Function
| Static Public Summary | ||
| public |
accessNestedPropertyReverse(obj: any, keys: Array<string>): * Access an object in a very annoying way, used for obsfuscation. |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
applyGameTheme(id: *) |
|
| public |
applyLanguage(languageCode: *): boolean |
|
| public |
arrayDelete(array: Array<any>, index: number) Deletes from an array at the given index |
|
| public |
arrayDeleteValue(array: Array<any>, value: any): * Deletes the given value from an array |
|
| public |
Tries to auto-detect a language |
|
| public |
Generates a cachebuster string. |
|
| public |
Clamps a value between [min, max] |
|
| public |
compressObject(obj: object): {"keys": *, "values": *, "data": *} |
|
| public |
compressU8(uncompressed: *): * |
|
| public |
compressU8WHeader(uncompressed: string, header: number): * |
|
| public |
compressX64(input: *): * |
|
| public |
computeCrc(str: string): * Computes the crc for a given string |
|
| public |
createLogger(context: *): * |
|
| public |
createSimpleShape(layers: *): Array<import("./shape_definition").ShapeLayer> Converts the given parameters to a valid shape definition |
|
| public |
decompressObject(obj: object): * |
|
| public |
decompressU8WHeader(compressed: Uint8Array): * |
|
| public |
decompressX64(input: *): * |
|
| public |
deserializeSchema(obj: object, schema: Schema, data: object, baseclassErrorResult: string | void | null=, root: import("../game/root").GameRoot=): string | void Deserializes data into an object |
|
| public |
drawRotatedSprite(param0: object) |
|
| public |
drawSpriteClipped(param0: object) Draws a sprite with clipping |
|
| public |
epsilonCompare(a: number, b: number): boolean Compare two floats for epsilon equality |
|
| public |
extendSchema(base: Schema, newOne: Schema): Schema Extends a schema by adding the properties from the new schema to the existing base schema |
|
| public |
fastArrayDelete(array: Array<any>, index: number) Deletes from an array by swapping with the last element |
|
| public |
fastArrayDeleteValue(array: Array<any>, value: any): * Deletes from an array by swapping with the last element. |
|
| public |
fastArrayDeleteValueIfContained(array: Array<any>, value: any): * |
|
| public |
fillInLinkIntoTranslation(translation: string, link: string): * Fills in a <link> tag |
|
| public |
findNiceIntegerValue(num: number): * Finds a nice integer value |
|
| public |
findNiceValue(num: number): * Finds a value which is nice to display, e.g. |
|
| public |
formatBigNumber(num: number, separator: string=): string Formats a big number |
|
| public |
formatBigNumberFull(num: number, divider: string=): string Formats a big number, but does not add any suffix and instead uses its full representation |
|
| public |
formatItemsPerSecond(speed: number, double: boolean=, separator: string=): * Formats a number like 2.51 to "2.51 items / s" |
|
| public |
formatSeconds(secs: number): string Formats seconds into a readable string like "5h 23m" |
|
| public |
formatSecondsToTimeAgo(secs: number): string Formats an amount of seconds into something like "5s ago" |
|
| public |
generateFileDownload(filename: string, text: string) Generates a file download |
|
| public |
generateLevelDefinitions(limitedVersion: boolean): * Generates the level definitions |
|
| public |
Generates rotated variants of the matrix |
|
| public |
getApplicationSettingById(id: *): * |
|
| public |
|
|
| public |
getCodeFromBuildingData(metaBuilding: MetaBuilding, variant: string, rotationVariant: number): String Finds the code for a given variant |
|
| public |
Returns the current dpi |
|
| public |
getIPCRenderer(): * |
|
| public |
getNameOfProvider(): * |
|
| public |
getPlatformName(): "android" | "browser" | "ios" | "standalone" | "unknown" Returns a platform name |
|
| public |
getRandomHint(): * Finds a new hint to show about the game which the user hasn't seen within this session |
|
| public |
getRomanNumber(number: number): string |
|
| public |
getSavegameInterface(savegame: any): BaseSavegameInterface | null Returns if the given savegame has any supported interface |
|
| public |
getStringForKeyCode(code: number): string Returns a keycode -> string |
|
| public |
globalDebug(context: *, args: ...*) |
|
| public |
globalError(context: *, args: ...*) |
|
| public |
globalLog(context: *, args: ...*) |
|
| public |
globalWarn(context: *, args: ...*) |
|
| public |
Once all sprites are loaded, propagates the cache |
|
| public |
initBuildingsByCategory(buildings: Object<string, Array<Class<import("../game/meta_building").MetaBuilding>>>) |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
Returns if this platform is android |
|
| public |
Returns if this platform is iOs |
|
| public |
Returns if the game supports this browser |
|
| public |
isTrueItem(item: BaseItem): boolean Returns whether the item is Boolean and TRUE |
|
| public |
isTruthyItem(item: BaseItem): boolean Returns whether the item is truthy |
|
| public |
itemResolverSingleton(root: import("./root").GameRoot, data: {$: string, data: any}): * Resolves items so we share instances |
|
| public |
Interpolates two numbers |
|
| public |
logSection(name: *, color: *) |
|
| public |
make2DUndefinedArray(w: number, h: number): Array<Array<any>> Makes a new 2D array with undefined contents |
|
| public |
makeButton(parent: Element, classes: Array<string>=, innerHTML: string=): * Helper method to create a new button |
|
| public |
makeButtonElement(classes: Array<string>=, innerHTML: string=): * Helper method to create a new button element |
|
| public |
makeDiv(parent: Element, id: string=, classes: Array<string>=, innerHTML: string=): * Helper method to create a new div |
|
| public |
matchOverwriteRecursive(dest: *, src: *) |
|
| public |
matchOverwriteRecursiveSettings(dest: *, src: *) |
|
| public |
Interpolates two vectors, for a = 0, returns v1 and for a = 1 return v2, otherwise interpolate |
|
| public |
newEmptyMap(): * Creates a new map (an empty object without any props) |
|
| public |
prepareHighDPIContext(context: CanvasRenderingContext2D) Prepares a context for hihg dpi rendering |
|
| public |
randomChoice(arr: T[]): T Chooses a random entry of an array |
|
| public |
Returns a random integer in the range [start,end] |
|
| public |
registerBuildingVariant(meta: typeof MetaBuilding, variant: string, rotationVariant: number) Registers a new variant |
|
| public |
removeAllChildren(elem: Element) Removes all children of the given element |
|
| public |
resizeCanvas(canvas: HTMLCanvasElement, w: number, h: number) Resizes a canvas |
|
| public |
resizeCanvasAndClear(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, w: number, h: number) Resizes a canvas and makes sure its cleared |
|
| public |
resizeHighDPICanvas(canvas: HTMLCanvasElement, w: number, h: number) Resizes a high dpi canvas |
|
| public |
Rotates a directional object |
|
| public |
rotateFlatMatrix3x3(flatMatrix: Array<number>): undefined[] Rotates a flat 3x3 matrix clockwise Entries: 0 lo 1 mo 2 ro 3 lm 4 mm 5 rm 6 lu 7 mu 8 ru |
|
| public |
round1Digit(n: number): number Rounds 1 digit |
|
| public |
round1DigitLocalized(speed: number, separator: string=): * Formats a number like 2.51 to "2.5" |
|
| public |
round2Digits(n: number): number Rounds 2 digits |
|
| public |
round3Digits(n: number): number Rounds 3 digits |
|
| public |
round4Digits(n: number): number Rounds 4 digits |
|
| public |
safeModulo(n: number, m: number): * Modulo which works for negative numbers |
|
| public |
schemaToJsonSchema(schema: import("./serialization").Schema): * |
|
| public |
serializeError(err: Error | ErrorEvent): * Serializes an error |
|
| public |
serializeSchema(obj: object, schema: Schema, mergeWith: object=): object Serializes an object using the given schema, mergin with the given properties |
|
| public |
setGlobalApp(app: Application) |
|
| public |
sha1(str: *): * |
|
| public |
smoothPulse(time: number): number Returns a smooth pulse between 0 and 1 |
|
| public |
smoothenDpi(dpi: number): number |
|
| public |
startFileChoose(acceptedType: string): * Starts a file chooser |
|
| public |
stringifyObjectContainingErrors(payload: any): * Stringifies an object containing circular references and errors |
|
| public |
updateApplicationLanguage(id: *) |
|
| public |
verifySchema(schema: Schema, data: object): string | void Verifies stored data using the given schema |
|
| public |
waitNextFrame(): Promise<void> Waits two frames so the ui is updated |
|
Static Public
public accessNestedPropertyReverse(obj: any, keys: Array<string>): * source
import {accessNestedPropertyReverse} from 'shapez.io/js/core/utils.js'Access an object in a very annoying way, used for obsfuscation.
Return:
| * |
public addVanillaBuildingsToAPI() source
import {addVanillaBuildingsToAPI} from 'shapez.io/js/game/meta_building_registry.js'public addVanillaComponentsToAPI() source
import {addVanillaComponentsToAPI} from 'shapez.io/js/game/component_registry.js'public addVanillaGameModesToAPI() source
import {addVanillaGameModesToAPI} from 'shapez.io/js/game/game_mode_registry.js'public addVanillaGameSpeedToAPI() source
import {addVanillaGameSpeedToAPI} from 'shapez.io/js/game/game_speed_registry.js'public addVanillaItemsToAPI() source
import {addVanillaItemsToAPI} from 'shapez.io/js/game/item_registry.js'public addVanillaSystemsToAPI() source
import {addVanillaSystemsToAPI} from 'shapez.io/js/game/game_system_manager.js'public allApplicationSettings(): * source
import {allApplicationSettings} from 'shapez.io/js/profile/application_settings.js'Return:
| * |
public applyGameTheme(id: *) source
import {applyGameTheme} from 'shapez.io/js/game/theme.js'Params:
| Name | Type | Attribute | Description |
| id | * |
public applyLanguage(languageCode: *): boolean source
import {applyLanguage} from 'shapez.io/js/translations.js'Params:
| Name | Type | Attribute | Description |
| languageCode | * |
public arrayDelete(array: Array<any>, index: number) source
import {arrayDelete} from 'shapez.io/js/core/utils.js'Deletes from an array at the given index
public arrayDeleteValue(array: Array<any>, value: any): * source
import {arrayDeleteValue} from 'shapez.io/js/core/utils.js'Deletes the given value from an array
Params:
| Name | Type | Attribute | Description |
| array | Array<any> | ||
| value | any |
Return:
| * |
public autoDetectLanguageId(): string source
import {autoDetectLanguageId} from 'shapez.io/js/translations.js'Tries to auto-detect a language
public cachebust(path: string): * source
import {cachebust} from 'shapez.io/js/core/cachebust.js'Generates a cachebuster string. This only modifies the path in the browser version
Params:
| Name | Type | Attribute | Description |
| path | string |
Return:
| * |
public clamp(v: number, minimum: number=, maximum: number=): * source
import {clamp} from 'shapez.io/js/core/utils.js'Clamps a value between [min, max]
Params:
| Name | Type | Attribute | Description |
| v | number | ||
| minimum | number= | Default 0 |
|
| maximum | number= | Default 1 |
Return:
| * |
public compressObject(obj: object): {"keys": *, "values": *, "data": *} source
import {compressObject} from 'shapez.io/js/savegame/savegame_compressor.js'Params:
| Name | Type | Attribute | Description |
| obj | object |
Return:
| {"keys": *, "values": *, "data": *} |
public compressU8(uncompressed: *): * source
import {compressU8} from 'shapez.io/js/core/lzstring.js'Params:
| Name | Type | Attribute | Description |
| uncompressed | * |
Return:
| * |
public compressU8WHeader(uncompressed: string, header: number): * source
import {compressU8WHeader} from 'shapez.io/js/core/lzstring.js'Return:
| * |
public compressX64(input: *): * source
import {compressX64} from 'shapez.io/js/core/lzstring.js'Params:
| Name | Type | Attribute | Description |
| input | * |
Return:
| * |
public computeCrc(str: string): * source
import {computeCrc} from 'shapez.io/js/core/sensitive_utils.encrypt.js'Computes the crc for a given string
Params:
| Name | Type | Attribute | Description |
| str | string |
Return:
| * |
public createLogger(context: *): * source
import {createLogger} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| context | * |
Return:
| * |
public createSimpleShape(layers: *): Array<import("./shape_definition").ShapeLayer> source
import {createSimpleShape} from 'shapez.io/js/game/shape_definition.js'Converts the given parameters to a valid shape definition
Params:
| Name | Type | Attribute | Description |
| layers | * |
public decompressObject(obj: object): * source
import {decompressObject} from 'shapez.io/js/savegame/savegame_compressor.js'Params:
| Name | Type | Attribute | Description |
| obj | object |
Return:
| * |
public decompressU8WHeader(compressed: Uint8Array): * source
import {decompressU8WHeader} from 'shapez.io/js/core/lzstring.js'Params:
| Name | Type | Attribute | Description |
| compressed | Uint8Array |
Return:
| * |
public decompressX64(input: *): * source
import {decompressX64} from 'shapez.io/js/core/lzstring.js'Params:
| Name | Type | Attribute | Description |
| input | * |
Return:
| * |
public deserializeSchema(obj: object, schema: Schema, data: object, baseclassErrorResult: string | void | null=, root: import("../game/root").GameRoot=): string | void source
import {deserializeSchema} from 'shapez.io/js/savegame/serialization.js'Deserializes data into an object
Params:
| Name | Type | Attribute | Description |
| obj | object | The object to store the deserialized data into |
|
| schema | Schema | The schema to use |
|
| data | object | The serialized data |
|
| baseclassErrorResult | string | void | null= | Convenience, if this is a string error code, do nothing and return it |
|
| root | import("../game/root").GameRoot= | Optional game root reference |
public drawRotatedSprite(param0: object) source
import {drawRotatedSprite} from 'shapez.io/js/core/draw_utils.js'public drawSpriteClipped(param0: object) source
import {drawSpriteClipped} from 'shapez.io/js/core/draw_utils.js'Draws a sprite with clipping
public epsilonCompare(a: number, b: number): boolean source
import {epsilonCompare} from 'shapez.io/js/core/utils.js'Compare two floats for epsilon equality
public extendSchema(base: Schema, newOne: Schema): Schema source
import {extendSchema} from 'shapez.io/js/savegame/serialization.js'Extends a schema by adding the properties from the new schema to the existing base schema
public fastArrayDelete(array: Array<any>, index: number) source
import {fastArrayDelete} from 'shapez.io/js/core/utils.js'Deletes from an array by swapping with the last element
public fastArrayDeleteValue(array: Array<any>, value: any): * source
import {fastArrayDeleteValue} from 'shapez.io/js/core/utils.js'Deletes from an array by swapping with the last element. Searches for the value in the array first
Params:
| Name | Type | Attribute | Description |
| array | Array<any> | ||
| value | any |
Return:
| * |
public fastArrayDeleteValueIfContained(array: Array<any>, value: any): * source
import {fastArrayDeleteValueIfContained} from 'shapez.io/js/core/utils.js'Params:
| Name | Type | Attribute | Description |
| array | Array<any> | ||
| value | any |
Return:
| * |
public fillInLinkIntoTranslation(translation: string, link: string): * source
import {fillInLinkIntoTranslation} from 'shapez.io/js/core/utils.js'Fills in a <link> tag
Return:
| * |
public findNiceIntegerValue(num: number): * source
import {findNiceIntegerValue} from 'shapez.io/js/core/utils.js'Finds a nice integer value
Params:
| Name | Type | Attribute | Description |
| num | number |
Return:
| * |
See:
public findNiceValue(num: number): * source
import {findNiceValue} from 'shapez.io/js/core/utils.js'Finds a value which is nice to display, e.g. 15669 -> 15000. Also handles fractional stuff
Params:
| Name | Type | Attribute | Description |
| num | number |
Return:
| * |
public formatBigNumber(num: number, separator: string=): string source
import {formatBigNumber} from 'shapez.io/js/core/utils.js'Formats a big number
Params:
| Name | Type | Attribute | Description |
| num | number | ||
| separator | string= | The decimal separator for numbers like 50.1 (separator='.') |
public formatBigNumberFull(num: number, divider: string=): string source
import {formatBigNumberFull} from 'shapez.io/js/core/utils.js'Formats a big number, but does not add any suffix and instead uses its full representation
Params:
| Name | Type | Attribute | Description |
| num | number | ||
| divider | string= | The divider for numbers like 50,000 (divider=',') |
public formatItemsPerSecond(speed: number, double: boolean=, separator: string=): * source
import {formatItemsPerSecond} from 'shapez.io/js/core/utils.js'Formats a number like 2.51 to "2.51 items / s"
Params:
| Name | Type | Attribute | Description |
| speed | number | ||
| double | boolean= | ||
| separator | string= | The decimal separator for numbers like 50.1 (separator='.') |
Return:
| * |
public formatSeconds(secs: number): string source
import {formatSeconds} from 'shapez.io/js/core/utils.js'Formats seconds into a readable string like "5h 23m"
Params:
| Name | Type | Attribute | Description |
| secs | number | Seconds |
public formatSecondsToTimeAgo(secs: number): string source
import {formatSecondsToTimeAgo} from 'shapez.io/js/core/utils.js'Formats an amount of seconds into something like "5s ago"
Params:
| Name | Type | Attribute | Description |
| secs | number | Seconds |
public generateFileDownload(filename: string, text: string) source
import {generateFileDownload} from 'shapez.io/js/core/utils.js'Generates a file download
public generateLevelDefinitions(limitedVersion: boolean): * source
import {generateLevelDefinitions} from 'shapez.io/js/game/modes/regular.js'Generates the level definitions
Params:
| Name | Type | Attribute | Description |
| limitedVersion | boolean |
Return:
| * |
public generateMatrixRotations(originalMatrix: Array<number>): Object<number, Array<number>> source
import {generateMatrixRotations} from 'shapez.io/js/core/utils.js'Generates rotated variants of the matrix
public getApplicationSettingById(id: *): * source
import {getApplicationSettingById} from 'shapez.io/js/profile/application_settings.js'Params:
| Name | Type | Attribute | Description |
| id | * |
Return:
| * |
public getBuildingDataFromCode(code: String): BuildingVariantIdentifier source
import {getBuildingDataFromCode} from 'shapez.io/js/game/building_codes.js'Params:
| Name | Type | Attribute | Description |
| code | String |
public getCodeFromBuildingData(metaBuilding: MetaBuilding, variant: string, rotationVariant: number): String source
import {getCodeFromBuildingData} from 'shapez.io/js/game/building_codes.js'Finds the code for a given variant
Params:
| Name | Type | Attribute | Description |
| metaBuilding | MetaBuilding | ||
| variant | string | ||
| rotationVariant | number |
public getDeviceDPI(): number source
import {getDeviceDPI} from 'shapez.io/js/core/dpi_manager.js'Returns the current dpi
public getIPCRenderer(): * source
import {getIPCRenderer} from 'shapez.io/js/core/utils.js'Return:
| * |
public getNameOfProvider(): * source
import {getNameOfProvider} from 'shapez.io/js/core/sensitive_utils.encrypt.js'Return:
| * |
public getPlatformName(): "android" | "browser" | "ios" | "standalone" | "unknown" source
import {getPlatformName} from 'shapez.io/js/core/utils.js'Returns a platform name
Return:
| "android" | "browser" | "ios" | "standalone" | "unknown" |
public getRandomHint(): * source
import {getRandomHint} from 'shapez.io/js/game/hints.js'Finds a new hint to show about the game which the user hasn't seen within this session
Return:
| * |
public getRomanNumber(number: number): string source
import {getRomanNumber} from 'shapez.io/js/core/utils.js'Params:
| Name | Type | Attribute | Description |
| number | number |
public getSavegameInterface(savegame: any): BaseSavegameInterface | null source
import {getSavegameInterface} from 'shapez.io/js/savegame/savegame_interface_registry.js'Returns if the given savegame has any supported interface
Params:
| Name | Type | Attribute | Description |
| savegame | any |
public getStringForKeyCode(code: number): string source
import {getStringForKeyCode} from 'shapez.io/js/game/key_action_mapper.js'Returns a keycode -> string
Params:
| Name | Type | Attribute | Description |
| code | number |
public globalDebug(context: *, args: ...*) source
import {globalDebug} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| context | * | ||
| args | ...* |
public globalError(context: *, args: ...*) source
import {globalError} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| context | * | ||
| args | ...* |
public globalLog(context: *, args: ...*) source
import {globalLog} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| context | * | ||
| args | ...* |
public globalWarn(context: *, args: ...*) source
import {globalWarn} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| context | * | ||
| args | ...* |
public initBuildingCodesAfterResourcesLoaded() source
import {initBuildingCodesAfterResourcesLoaded} from 'shapez.io/js/game/meta_building_registry.js'Once all sprites are loaded, propagates the cache
public initBuildingsByCategory(buildings: Object<string, Array<Class<import("../game/meta_building").MetaBuilding>>>) source
import {initBuildingsByCategory} from 'shapez.io/js/core/global_registries.js'public initComponentRegistry() source
import {initComponentRegistry} from 'shapez.io/js/game/component_registry.js'public initGameModeRegistry() source
import {initGameModeRegistry} from 'shapez.io/js/game/game_mode_registry.js'public initGameSpeedRegistry() source
import {initGameSpeedRegistry} from 'shapez.io/js/game/game_speed_registry.js'public initItemRegistry() source
import {initItemRegistry} from 'shapez.io/js/game/item_registry.js'public initMetaBuildingRegistry() source
import {initMetaBuildingRegistry} from 'shapez.io/js/game/meta_building_registry.js'public isAndroid(): boolean source
import {isAndroid} from 'shapez.io/js/core/utils.js'Returns if this platform is android
public isIos(): boolean source
import {isIos} from 'shapez.io/js/core/utils.js'Returns if this platform is iOs
public isSupportedBrowser(): boolean source
import {isSupportedBrowser} from 'shapez.io/js/core/utils.js'Returns if the game supports this browser
public isTrueItem(item: BaseItem): boolean source
import {isTrueItem} from 'shapez.io/js/game/items/boolean_item.js'Returns whether the item is Boolean and TRUE
Params:
| Name | Type | Attribute | Description |
| item | BaseItem |
public isTruthyItem(item: BaseItem): boolean source
import {isTruthyItem} from 'shapez.io/js/game/items/boolean_item.js'Returns whether the item is truthy
Params:
| Name | Type | Attribute | Description |
| item | BaseItem |
public itemResolverSingleton(root: import("./root").GameRoot, data: {$: string, data: any}): * source
import {itemResolverSingleton} from 'shapez.io/js/game/item_resolver.js'Resolves items so we share instances
Params:
| Name | Type | Attribute | Description |
| root | import("./root").GameRoot | ||
| data | {$: string, data: any} |
Return:
| * |
public lerp(a: number, b: number, x: number): * source
import {lerp} from 'shapez.io/js/core/utils.js'Interpolates two numbers
Return:
| * |
public logSection(name: *, color: *) source
import {logSection} from 'shapez.io/js/core/logging.js'Params:
| Name | Type | Attribute | Description |
| name | * | ||
| color | * |
public make2DUndefinedArray(w: number, h: number): Array<Array<any>> source
import {make2DUndefinedArray} from 'shapez.io/js/core/utils.js'Makes a new 2D array with undefined contents
public makeButton(parent: Element, classes: Array<string>=, innerHTML: string=): * source
import {makeButton} from 'shapez.io/js/core/utils.js'Helper method to create a new button
Params:
| Name | Type | Attribute | Description |
| parent | Element | ||
| classes | Array<string>= | ||
| innerHTML | string= |
Return:
| * |
public makeButtonElement(classes: Array<string>=, innerHTML: string=): * source
import {makeButtonElement} from 'shapez.io/js/core/utils.js'Helper method to create a new button element
Params:
| Name | Type | Attribute | Description |
| classes | Array<string>= | ||
| innerHTML | string= |
Return:
| * |
public makeDiv(parent: Element, id: string=, classes: Array<string>=, innerHTML: string=): * source
import {makeDiv} from 'shapez.io/js/core/utils.js'Helper method to create a new div
Params:
| Name | Type | Attribute | Description |
| parent | Element | ||
| id | string= | ||
| classes | Array<string>= | ||
| innerHTML | string= |
Return:
| * |
public matchOverwriteRecursive(dest: *, src: *) source
import {matchOverwriteRecursive} from 'shapez.io/js/translations.js'Params:
| Name | Type | Attribute | Description |
| dest | * | ||
| src | * |
public matchOverwriteRecursiveSettings(dest: *, src: *) source
import {matchOverwriteRecursiveSettings} from 'shapez.io/js/modloader/overwrite.js'Params:
| Name | Type | Attribute | Description |
| dest | * | ||
| src | * |
public mixVector(v1: Vector, v2: Vector, a: number): * source
import {mixVector} from 'shapez.io/js/core/vector.js'Interpolates two vectors, for a = 0, returns v1 and for a = 1 return v2, otherwise interpolate
Return:
| * |
public newEmptyMap(): * source
import {newEmptyMap} from 'shapez.io/js/core/utils.js'Creates a new map (an empty object without any props)
Return:
| * |
public prepareHighDPIContext(context: CanvasRenderingContext2D) source
import {prepareHighDPIContext} from 'shapez.io/js/core/dpi_manager.js'Prepares a context for hihg dpi rendering
Params:
| Name | Type | Attribute | Description |
| context | CanvasRenderingContext2D |
public randomChoice(arr: T[]): T source
import {randomChoice} from 'shapez.io/js/core/utils.js'Chooses a random entry of an array
Params:
| Name | Type | Attribute | Description |
| arr | T[] |
public randomInt(start: number, end: number): * source
import {randomInt} from 'shapez.io/js/core/utils.js'Returns a random integer in the range [start,end]
Return:
| * |
public registerBuildingVariant(meta: typeof MetaBuilding, variant: string, rotationVariant: number) source
import {registerBuildingVariant} from 'shapez.io/js/game/building_codes.js'Registers a new variant
public removeAllChildren(elem: Element) source
import {removeAllChildren} from 'shapez.io/js/core/utils.js'Removes all children of the given element
Params:
| Name | Type | Attribute | Description |
| elem | Element |
public resizeCanvas(canvas: HTMLCanvasElement, w: number, h: number) source
import {resizeCanvas} from 'shapez.io/js/core/dpi_manager.js'Resizes a canvas
public resizeCanvasAndClear(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, w: number, h: number) source
import {resizeCanvasAndClear} from 'shapez.io/js/core/dpi_manager.js'Resizes a canvas and makes sure its cleared
public resizeHighDPICanvas(canvas: HTMLCanvasElement, w: number, h: number) source
import {resizeHighDPICanvas} from 'shapez.io/js/core/dpi_manager.js'Resizes a high dpi canvas
public rotateDirectionalObject(obj: DirectionalObject): DirectionalObject source
import {rotateDirectionalObject} from 'shapez.io/js/core/utils.js'Rotates a directional object
Params:
| Name | Type | Attribute | Description |
| obj | DirectionalObject |
public rotateFlatMatrix3x3(flatMatrix: Array<number>): undefined[] source
import {rotateFlatMatrix3x3} from 'shapez.io/js/core/utils.js'Rotates a flat 3x3 matrix clockwise Entries: 0 lo 1 mo 2 ro 3 lm 4 mm 5 rm 6 lu 7 mu 8 ru
public round1Digit(n: number): number source
import {round1Digit} from 'shapez.io/js/core/utils.js'Rounds 1 digit
Params:
| Name | Type | Attribute | Description |
| n | number |
public round1DigitLocalized(speed: number, separator: string=): * source
import {round1DigitLocalized} from 'shapez.io/js/core/utils.js'Formats a number like 2.51 to "2.5"
Params:
| Name | Type | Attribute | Description |
| speed | number | ||
| separator | string= | The decimal separator for numbers like 50.1 (separator='.') |
Return:
| * |
public round2Digits(n: number): number source
import {round2Digits} from 'shapez.io/js/core/utils.js'Rounds 2 digits
Params:
| Name | Type | Attribute | Description |
| n | number |
public round3Digits(n: number): number source
import {round3Digits} from 'shapez.io/js/core/utils.js'Rounds 3 digits
Params:
| Name | Type | Attribute | Description |
| n | number |
public round4Digits(n: number): number source
import {round4Digits} from 'shapez.io/js/core/utils.js'Rounds 4 digits
Params:
| Name | Type | Attribute | Description |
| n | number |
public safeModulo(n: number, m: number): * source
import {safeModulo} from 'shapez.io/js/core/utils.js'Modulo which works for negative numbers
Return:
| * |
public schemaToJsonSchema(schema: import("./serialization").Schema): * source
import {schemaToJsonSchema} from 'shapez.io/js/savegame/serialization_data_types.js'Params:
| Name | Type | Attribute | Description |
| schema | import("./serialization").Schema |
Return:
| * |
public serializeError(err: Error | ErrorEvent): * source
import {serializeError} from 'shapez.io/js/core/logging.js'Serializes an error
Params:
| Name | Type | Attribute | Description |
| err | Error | ErrorEvent |
Return:
| * |
public serializeSchema(obj: object, schema: Schema, mergeWith: object=): object source
import {serializeSchema} from 'shapez.io/js/savegame/serialization.js'Serializes an object using the given schema, mergin with the given properties
public setGlobalApp(app: Application) source
import {setGlobalApp} from 'shapez.io/js/core/globals.js'Params:
| Name | Type | Attribute | Description |
| app | Application |
public sha1(str: *): * source
import {sha1} from 'shapez.io/js/core/sensitive_utils.encrypt.js'Params:
| Name | Type | Attribute | Description |
| str | * |
Return:
| * |
public smoothPulse(time: number): number source
import {smoothPulse} from 'shapez.io/js/core/utils.js'Returns a smooth pulse between 0 and 1
Params:
| Name | Type | Attribute | Description |
| time | number | time in seconds |
public smoothenDpi(dpi: number): number source
import {smoothenDpi} from 'shapez.io/js/core/dpi_manager.js'Params:
| Name | Type | Attribute | Description |
| dpi | number |
public startFileChoose(acceptedType: string): * source
import {startFileChoose} from 'shapez.io/js/core/utils.js'Starts a file chooser
Params:
| Name | Type | Attribute | Description |
| acceptedType | string |
Return:
| * |
public stringifyObjectContainingErrors(payload: any): * source
import {stringifyObjectContainingErrors} from 'shapez.io/js/core/logging.js'Stringifies an object containing circular references and errors
Params:
| Name | Type | Attribute | Description |
| payload | any |
Return:
| * |
public updateApplicationLanguage(id: *) source
import {updateApplicationLanguage} from 'shapez.io/js/translations.js'Params:
| Name | Type | Attribute | Description |
| id | * |
public verifySchema(schema: Schema, data: object): string | void source
import {verifySchema} from 'shapez.io/js/savegame/serialization.js'Verifies stored data using the given schema
public waitNextFrame(): Promise<void> source
import {waitNextFrame} from 'shapez.io/js/core/utils.js'Waits two frames so the ui is updated
