mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 02:31:51 +00:00
Minor adjustments
This commit is contained in:
parent
ebb2f3a1c6
commit
7e2501ea6e
@ -35,7 +35,7 @@ export class DemoMod extends Mod {
|
|||||||
weightComputation: distanceToOriginInChunks =>
|
weightComputation: distanceToOriginInChunks =>
|
||||||
Math.round(20 + Math.max(Math.min(distanceToOriginInChunks, 30), 0)),
|
Math.round(20 + Math.max(Math.min(distanceToOriginInChunks, 30), 0)),
|
||||||
|
|
||||||
shapeDrawer: ({ context, quadrantSize, layerScale }) => {
|
draw: ({ context, quadrantSize, layerScale }) => {
|
||||||
const quadrantHalfSize = quadrantSize / 2;
|
const quadrantHalfSize = quadrantSize / 2;
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.moveTo(-quadrantHalfSize, quadrantHalfSize);
|
context.moveTo(-quadrantHalfSize, quadrantHalfSize);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { ModLoader } from "./modloader";
|
|||||||
|
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { AtlasSprite, SpriteAtlasLink } from "../core/sprites";
|
import { AtlasSprite, SpriteAtlasLink } from "../core/sprites";
|
||||||
import { Mod } from "./mod";
|
|
||||||
import { enumShortcodeToSubShape, enumSubShape, enumSubShapeToShortcode } from "../game/shape_definition";
|
import { enumShortcodeToSubShape, enumSubShape, enumSubShapeToShortcode } from "../game/shape_definition";
|
||||||
import { Loader } from "../core/loader";
|
import { Loader } from "../core/loader";
|
||||||
import { LANGUAGES } from "../languages";
|
import { LANGUAGES } from "../languages";
|
||||||
@ -89,9 +88,9 @@ export class ModInterface {
|
|||||||
* @param {string} param0.id
|
* @param {string} param0.id
|
||||||
* @param {string} param0.shortCode
|
* @param {string} param0.shortCode
|
||||||
* @param {(distanceToOriginInChunks: number) => number} param0.weightComputation
|
* @param {(distanceToOriginInChunks: number) => number} param0.weightComputation
|
||||||
* @param {(options: SubShapeDrawOptions) => void} param0.shapeDrawer
|
* @param {(options: SubShapeDrawOptions) => void} param0.draw
|
||||||
*/
|
*/
|
||||||
registerSubShapeType({ id, shortCode, weightComputation, shapeDrawer }) {
|
registerSubShapeType({ id, shortCode, weightComputation, draw }) {
|
||||||
if (shortCode.length !== 1) {
|
if (shortCode.length !== 1) {
|
||||||
throw new Error("Bad short code: " + shortCode);
|
throw new Error("Bad short code: " + shortCode);
|
||||||
}
|
}
|
||||||
@ -100,7 +99,7 @@ export class ModInterface {
|
|||||||
enumShortcodeToSubShape[shortCode] = id;
|
enumShortcodeToSubShape[shortCode] = id;
|
||||||
|
|
||||||
MODS_ADDITIONAL_SHAPE_MAP_WEIGHTS[id] = weightComputation;
|
MODS_ADDITIONAL_SHAPE_MAP_WEIGHTS[id] = weightComputation;
|
||||||
MODS_ADDITIONAL_SUB_SHAPE_DRAWERS[id] = shapeDrawer;
|
MODS_ADDITIONAL_SUB_SHAPE_DRAWERS[id] = draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerTranslations(language, translations) {
|
registerTranslations(language, translations) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user