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

HubGoals

Extends:

BasicSerializableObject → HubGoals

Static Method Summary

Static Public Methods
public static
public static

getSchema(): {"level": *, "storedShapes": *, "upgradeLevels": *}

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

currentGoal: {"definition": *, "required": *, "reward": *, "throughputOnly": *}

public

Which story rewards we already gained

public

level: *

public

root: *

public

Mapping from shape hash -> amount

public

Stores the improvements for all upgrades

public

Stores the levels for all upgrades

Method Summary

Public Methods
public

Returns whether a given upgrade can be unlocked

public

Creates a (seeded) random shape

public

Creates the next goal

public

deserialize(data: *, root: GameRoot): *

public

Picks random colors which are close to each other

public

Returns the number of available upgrades

public

Belt speed

public

Returns how much of the current goal was already delivered

public

Miner speed

public

Processor speed

public

Returns how much of the current shape is stored

public

Returns how much of the current shape is stored

public

Underground belt speed

public

getUpgradeLevel(upgradeId: string): *

Returns the current level of a given upgrade

public

Handles the given definition, by either accounting it towards the goal or otherwise granting some points

public

Returns whether the end of the demo is reached

public

isFreePlay(): *

Returns whether we are playing in free-play

public

Returns whether the given reward is already unlocked

public

Called when the level was completed

public

takeShapeByKey(key: string, amount: number)

public

Tries to unlock the given upgrade

Inherited Summary

From class BasicSerializableObject
public static
public static

getId()

public static

Should return the serialization schema

public static

verify(data: *): string | void

public

deserialize(data: any, root: import("./savegame_serializer").GameRoot): string | void

public

Static Public Methods

public static getId(): string source

Override:

BasicSerializableObject#getId

Return:

string

public static getSchema(): {"level": *, "storedShapes": *, "upgradeLevels": *} source

Should return the serialization schema

Override:

BasicSerializableObject#getSchema

Return:

{"level": *, "storedShapes": *, "upgradeLevels": *}

Public Constructors

public constructor(root: GameRoot) source

Fixes typeof DerivedComponent is not assignable to typeof Component, compiled out in non-dev builds

Override:

BasicSerializableObject#constructor

Params:

NameTypeAttributeDescription
root GameRoot

Public Members

public currentGoal: {"definition": *, "required": *, "reward": *, "throughputOnly": *} source

public gainedRewards: Object<string, number> source

Which story rewards we already gained

public level: * source

public root: * source

public storedShapes: Object<string, number> source

Mapping from shape hash -> amount

public upgradeImprovements: Object<string, number> source

Stores the improvements for all upgrades

public upgradeLevels: Object<string, number> source

Stores the levels for all upgrades

Public Methods

public canUnlockUpgrade(upgradeId: string): boolean source

Returns whether a given upgrade can be unlocked

Params:

NameTypeAttributeDescription
upgradeId string

Return:

boolean

public computeFreeplayShape(level: number): ShapeDefinition source

Creates a (seeded) random shape

Params:

NameTypeAttributeDescription
level number

Return:

ShapeDefinition

public computeNextGoal() source

Creates the next goal

public deserialize(data: *, root: GameRoot): * source

Override:

BasicSerializableObject#deserialize

Params:

NameTypeAttributeDescription
data *
root GameRoot

Return:

*

public generateRandomColorSet(rng: RandomNumberGenerator): * source

Picks random colors which are close to each other

Params:

NameTypeAttributeDescription
rng RandomNumberGenerator

Return:

*

public getAvailableUpgradeCount(): number source

Returns the number of available upgrades

Return:

number

public getBeltBaseSpeed(): number source

Belt speed

Return:

number

items / sec

public getCurrentGoalDelivered(): * source

Returns how much of the current goal was already delivered

Return:

*

public getMinerBaseSpeed(): number source

Miner speed

Return:

number

items / sec

public getProcessorBaseSpeed(processorType: enumItemProcessorTypes): number source

Processor speed

Params:

NameTypeAttributeDescription
processorType enumItemProcessorTypes

Return:

number

items / sec

public getShapesStored(definition: ShapeDefinition): number source

Returns how much of the current shape is stored

Params:

NameTypeAttributeDescription
definition ShapeDefinition

Return:

number

public getShapesStoredByKey(key: string): number source

Returns how much of the current shape is stored

Params:

NameTypeAttributeDescription
key string

Return:

number

public getUndergroundBeltBaseSpeed(): number source

Underground belt speed

Return:

number

items / sec

public getUpgradeLevel(upgradeId: string): * source

Returns the current level of a given upgrade

Params:

NameTypeAttributeDescription
upgradeId string

Return:

*

public handleDefinitionDelivered(definition: ShapeDefinition) source

Handles the given definition, by either accounting it towards the goal or otherwise granting some points

Params:

NameTypeAttributeDescription
definition ShapeDefinition

public isEndOfDemoReached(): boolean source

Returns whether the end of the demo is reached

Return:

boolean

public isFreePlay(): * source

Returns whether we are playing in free-play

Return:

*

public isRewardUnlocked(reward: enumHubGoalRewards): * source

Returns whether the given reward is already unlocked

Params:

NameTypeAttributeDescription
reward enumHubGoalRewards

Return:

*

public onGoalCompleted() source

Called when the level was completed

public takeShapeByKey(key: string, amount: number) source

Params:

NameTypeAttributeDescription
key string
amount number

public tryUnlockUpgrade(upgradeId: string): boolean source

Tries to unlock the given upgrade

Params:

NameTypeAttributeDescription
upgradeId string

Return:

boolean