Constructor
new World()
Constructs a new world. All the other components require an existing "world" to function. A world is a container for the whole system.
Methods
addAutomator(automator)
Registers a new automator to the world.
Parameters:
| Name | Type | Description |
|---|---|---|
automator |
to register |
addCurrency()
Registers a new currency in the world, making the currency usable.
addGenerator(generator)
Adds a new generator to this world
Parameters:
| Name | Type | Description |
|---|---|---|
generator |
Generator to add |
addModifier(modifier)
Registers a new modifier
Parameters:
| Name | Type | Description |
|---|---|---|
modifier |
to register |
disableAutomators()
Disables all automators
enableAutomators()
Enables all automators
getAutomators()
Retrieves all the automators registered in the world
Returns:
list of automators
getCurrencies()
Retrieves a list of all the currencies currently registered in the world.
Returns:
list of currencies
getCurrency(index)
Retrieves a currency at the given index. The index is based on the order in which the currencies were added to the world.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
of the currency |
Returns:
the currency at the given index, or null if not found
getGeneratorCount()
Returns the number of generators in this world
Returns:
The number of generators in this world
getModifiers()
Retrieves all the modifiers registered in the world
Returns:
list of modifiers
getSpeedMultiplier()
Retrieves the global speed multiplier
Returns:
the speed multiplier
isAutomationEnabled()
Queries whether or not the automators are enabled.
Returns:
True if automation is enabled, false otherwise.
removeAllCurrencies()
Removes all currencies registered in the world.
removeAllGenerators()
Removes all the generators from this world
removeAutomator(automator)
Removes an automator from the world
Parameters:
| Name | Type | Description |
|---|---|---|
automator |
to remove |
removeCurrency()
Removes a currency from the world.
removeGenerator(generator)
Removes a generator
Parameters:
| Name | Type | Description |
|---|---|---|
generator |
Generator to remove |
removeModifier(modifier)
Removes a modifier from the world
Parameters:
| Name | Type | Description |
|---|---|---|
modifier |
to remove |
setSpeedMultiplier(multiplier)
Sets the global speed multiplier
Parameters:
| Name | Type | Description |
|---|---|---|
multiplier |
of the world update speed |
update(seconds)
Advances the world state by the given amount of seconds. Useful when calculating away-from-keyboard income etc.
Parameters:
| Name | Type | Description |
|---|---|---|
seconds |
Seconds to advance |