Home Reference Source
import {GameRoot} from 'shapez.io/js/game/root.js'
public class | source

GameRoot

The game root is basically the whole game state at a given point, combining all important classes. We don't have globals, but this class is passed to almost all game classes.

Constructor Summary

Public Constructor
public

Constructs a new game root

Member Summary

Public Members
public

app: *

public
public
public

Whether a bulk operation is running

public
public

canvas: HTMLCanvasElement

public

context: CanvasRenderingContext2D

public

currentLayer: Layer

public
public
public
public
public
public

gameMode: GameMode

public
public
public
public
public
public

logic: GameLogic

public
public
public
public

queue: {"requireRedraw": *}

public
public
public
public

signals: {"entityManuallyPlaced": *, "entityAdded": *, "entityChanged": *, "entityGotNewComponent": *, "entityComponentRemoved": *, "entityQueuedForDestroy": *, "entityDestroyed": *, "resized": *, "readyToRender": *, "aboutToDestruct": *, "gameSaved": *, "gameRestored": *, "gameFrameStarted": *, "storyGoalCompleted": *, "upgradePurchased": *, "postLoadHook": *, "shapeDelivered": *, "itemProduced": *, "bulkOperationFinished": *, "editModeChanged": *, "prePlacementCheck": *, "freeEntityAreaBeforeBuild": *}

public
public
public

Method Summary

Public Methods
public

Destructs the game root

public

reset()

Resets the whole root and removes all properties

Public Constructors

public constructor(app: Application) source

Constructs a new game root

Params:

NameTypeAttributeDescription
app Application

Public Members

public app: * source

public automaticSave: AutomaticSave source

public buffers: BufferMaintainer source

public bulkOperationRunning: boolean source

Whether a bulk operation is running

public camera: Camera source

public canvas: HTMLCanvasElement source

public context: CanvasRenderingContext2D source

public currentLayer: Layer source

public dynamicTickrate: DynamicTickrate source

public entityMgr: EntityManager source

public gameHeight: number source

public gameInitialized: boolean source

public gameIsFresh: boolean source

public gameMode: GameMode source

public gameState: InGameState source

public gameWidth: number source

public hubGoals: HubGoals source

public hud: GameHUD source

public keyMapper: KeyActionMapper source

public logic: GameLogic source

public logicInitialized: boolean source

public map: MapView source

public productionAnalytics: ProductionAnalytics source

public queue: {"requireRedraw": *} source

public savegame: Savegame source

public shapeDefinitionMgr: ShapeDefinitionManager source

public signals: {"entityManuallyPlaced": *, "entityAdded": *, "entityChanged": *, "entityGotNewComponent": *, "entityComponentRemoved": *, "entityQueuedForDestroy": *, "entityDestroyed": *, "resized": *, "readyToRender": *, "aboutToDestruct": *, "gameSaved": *, "gameRestored": *, "gameFrameStarted": *, "storyGoalCompleted": *, "upgradePurchased": *, "postLoadHook": *, "shapeDelivered": *, "itemProduced": *, "bulkOperationFinished": *, "editModeChanged": *, "prePlacementCheck": *, "freeEntityAreaBeforeBuild": *} source

public soundProxy: SoundProxy source

public systemMgr: GameSystemManager source

public time: GameTime source

Public Methods

public destruct() source

Destructs the game root

public reset() source

Resets the whole root and removes all properties