Drag[en]gine Script Module DragonScript
1.23
|
Public Member Functions | |
void | addBehavior (GWBehavior behavior) |
Add behavior. More... | |
void | addElement (Element element) |
Add Element. More... | |
void | addEnterFrameOnce (Element element) |
Call Element.enterFrame() on element once at start of next frame update. More... | |
void | addOneShotSpeaker (Speaker speaker) |
void | addThinker (Element element) |
Add element requiring thinking on frame updates. More... | |
Array | collectBehaviors (Block ablock) |
Collect behaviors with block into Array. More... | |
Dictionary | debugStatistics () |
Collect debug statistics. More... | |
Dictionary | debugStatisticsSummary () |
Retrieves some summary statistics. More... | |
void | dispose () |
Dispose of game world. More... | |
GWBehavior | findBehavior (Block ablock) |
Find behavior with block. More... | |
Element | findElement (Block ablock) |
Find element with block with parameter Element. More... | |
void | forEachBehavior (Block ablock) |
Visit behaviors with block. \versoin 1.17. More... | |
void | forEachThinker (Block ablock) |
Visit thinkers with block with parameter Element. More... | |
AnchoredElementList | getAnchoredElementList () |
Anchored element list. More... | |
GWBehavior | getBehaviorAt (int index) |
Behavior at index. More... | |
CachedVegetation | getCachedVegetation () |
Cached vegetation. More... | |
ConversationActorList | getConvoActorList () |
Conversation actor list. More... | |
ConversationCoordSystemList | getConvoCoordSystemList () |
Conversation coordinate system list. More... | |
Element | getElementWithID (UniqueID id) |
Element with identifier or null if absent. More... | |
bool | getEnablePersistency () |
Enable persistency (backward compatibility). More... | |
bool | getEnableReadDynDataWithSize () |
Enable reading dynamic element data from persistency with size. More... | |
Vector | getGravity () |
Gravity. More... | |
LayerMask | getLayerMaskOneShotSpeaker () |
RailList | getRailList () |
Rail list. More... | |
SpawnPointList | getSpawnPoints () |
Spawn point list. More... | |
StubGameWorld | getStub () |
Stub used to create game world. More... | |
TemporaryDecalManager | getTemporaryDecalManager () |
Temporary decal manager. More... | |
void | init (StubGameWorld stub) |
Init game world from stub. More... | |
GameWorld | new () |
Create game world. More... | |
void | playSoundOnce (Sound sound, DVector position, float volume, float range) |
void | playSoundOnce (Sound sound, DVector position, Quaternion orientation, float volume, float range) |
void | playSoundOnce (Sound sound, Element element, float volume, float range) |
void | playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, float volume, float range) |
void | playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, Quaternion orientation, float volume, float range) |
void | playSynthesizerOnce (SynthesizerInstance synthesizer, Element element, float volume, float range) |
void | removeAllElements () |
Remove all elements calling safeDispose() on them. More... | |
void | removeAllOneShotSpeakers () |
void | removeElement (Element element) |
Remove Element without disposing it. More... | |
void | removeEnterFrameOnce (Element element) |
Stop call Element.enterFrame() on element once at start of next frame update. More... | |
void | removeFinishedOneShotSpeakers () |
void | removeThinker (Element element) |
Remove element requiring thinking on frame updates. More... | |
void | requiresThinkChanged () |
Requires thinking changed. More... | |
void | setCachedVegetation (CachedVegetation cachedVegetation) |
Set cached vegetation. More... | |
void | setEnablePersistency (bool enable) |
void | setGravity (Vector gravity) |
Set gravity. More... | |
void | setLayerMaskOneShotSpeaker (LayerMask layerMask) |
void | setStub (StubGameWorld stub) |
Set stub used to create game world. More... | |
void | setTemporaryDecalManager (TemporaryDecalManager manager) |
Set temporary decal manager. More... | |
void | setUniqueIDRemapper (UniqueIDRemapper remapper) |
Set Unique ID remapper. More... | |
void | think (float elapsed) |
Make elements think. More... | |
void | visitElements (ElementVisitor visitor) |
Visit elements. More... | |
Game world.
A single simulation unit in the game. Simple games require usually only one game world containing all elements of the currently loaded map or level. More complex games can use multiple game worlds for example to simulate development of the game world outside the currently visible section. Every game world wraps an engine world resource. Elements removed from the game world using removeElement are not disposed of. This allows to move elements between game worlds. Elements removed using removeAllElements though get disposed.
void Dragengine.Scenery.GameWorld.addBehavior | ( | GWBehavior | behavior | ) |
Add behavior.
This is called by constructors of class implementing GWBehavior. Usually you do not have to call this manually.
void Dragengine.Scenery.GameWorld.addEnterFrameOnce | ( | Element | element | ) |
Call Element.enterFrame() on element once at start of next frame update.
void Dragengine.Scenery.GameWorld.addOneShotSpeaker | ( | Speaker | speaker | ) |
void Dragengine.Scenery.GameWorld.addThinker | ( | Element | element | ) |
Add element requiring thinking on frame updates.
Array Dragengine.Scenery.GameWorld.collectBehaviors | ( | Block | ablock | ) |
Collect behaviors with block into Array.
Block is required to have one parameter GWBehavior or subclass thereof and returning true if the right behavior is found otherwise false. Block is called only for behaviors castable to block parameter type.
Dictionary Dragengine.Scenery.GameWorld.debugStatistics | ( | ) |
Collect debug statistics.
Returns a dictionary with these values:
Dictionary Dragengine.Scenery.GameWorld.debugStatisticsSummary | ( | ) |
Retrieves some summary statistics.
Returns a dictionary with these values.
void Dragengine.Scenery.GameWorld.dispose | ( | ) |
Dispose of game world.
GWBehavior Dragengine.Scenery.GameWorld.findBehavior | ( | Block | ablock | ) |
Find behavior with block.
Block is required to have one parameter GWBehavior or subclass thereof and returning true if the right behavior is found otherwise false. Block is called only for behaviors castable to block parameter type.
Element Dragengine.Scenery.GameWorld.findElement | ( | Block | ablock | ) |
Find element with block with parameter Element.
void Dragengine.Scenery.GameWorld.forEachBehavior | ( | Block | ablock | ) |
Visit behaviors with block. \versoin 1.17.
Block is required to have one parameter of type GWBehavior or subclass thereof. Block is called only for behaviors castable to block parameter type.
void Dragengine.Scenery.GameWorld.forEachThinker | ( | Block | ablock | ) |
Visit thinkers with block with parameter Element.
AnchoredElementList Dragengine.Scenery.GameWorld.getAnchoredElementList | ( | ) |
Anchored element list.
GWBehavior Dragengine.Scenery.GameWorld.getBehaviorAt | ( | int | index | ) |
Behavior at index.
CachedVegetation Dragengine.Scenery.GameWorld.getCachedVegetation | ( | ) |
Cached vegetation.
ConversationActorList Dragengine.Scenery.GameWorld.getConvoActorList | ( | ) |
Conversation actor list.
ConversationCoordSystemList Dragengine.Scenery.GameWorld.getConvoCoordSystemList | ( | ) |
Conversation coordinate system list.
Element with identifier or null if absent.
bool Dragengine.Scenery.GameWorld.getEnablePersistency | ( | ) |
Enable persistency (backward compatibility).
Since Drag[en]gine 1.17 GameWorld supports persistency to load and save game world behavior states. This is incompatible with old saves where GameWorld did not persist any data. To support loading and saving saves prior to 1.17 use this method.
Hence to support loading old saves and saving new saves load with false and save with true.
By default enable persistency is set to true if the required version of the game project is set to 1.17 or newer and false otherwise. Hence projects require an earlier version will always operate with enable persistency set to false keeping them compatible while projects requiring 1.17 or newer enable persistency.
bool Dragengine.Scenery.GameWorld.getEnableReadDynDataWithSize | ( | ) |
Enable reading dynamic element data from persistency with size.
Returns true if readElementStubsFromFile() encountered version 1 or higher.
Vector Dragengine.Scenery.GameWorld.getGravity | ( | ) |
Gravity.
LayerMask Dragengine.Scenery.GameWorld.getLayerMaskOneShotSpeaker | ( | ) |
SpawnPointList Dragengine.Scenery.GameWorld.getSpawnPoints | ( | ) |
Spawn point list.
StubGameWorld Dragengine.Scenery.GameWorld.getStub | ( | ) |
Stub used to create game world.
TemporaryDecalManager Dragengine.Scenery.GameWorld.getTemporaryDecalManager | ( | ) |
Temporary decal manager.
void Dragengine.Scenery.GameWorld.init | ( | StubGameWorld | stub | ) |
Init game world from stub.
Subclass is required to super-call init() to init behaviors properly.
GameWorld Dragengine.Scenery.GameWorld.new | ( | ) |
Create game world.
void Dragengine.Scenery.GameWorld.playSoundOnce | ( | Sound | sound, |
DVector | position, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.playSoundOnce | ( | Sound | sound, |
DVector | position, | ||
Quaternion | orientation, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.playSoundOnce | ( | Sound | sound, |
Element | element, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.playSynthesizerOnce | ( | SynthesizerInstance | synthesizer, |
DVector | position, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.playSynthesizerOnce | ( | SynthesizerInstance | synthesizer, |
DVector | position, | ||
Quaternion | orientation, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.playSynthesizerOnce | ( | SynthesizerInstance | synthesizer, |
Element | element, | ||
float | volume, | ||
float | range | ||
) |
void Dragengine.Scenery.GameWorld.removeAllElements | ( | ) |
Remove all elements calling safeDispose() on them.
void Dragengine.Scenery.GameWorld.removeAllOneShotSpeakers | ( | ) |
void Dragengine.Scenery.GameWorld.removeElement | ( | Element | element | ) |
Remove Element without disposing it.
void Dragengine.Scenery.GameWorld.removeEnterFrameOnce | ( | Element | element | ) |
Stop call Element.enterFrame() on element once at start of next frame update.
void Dragengine.Scenery.GameWorld.removeFinishedOneShotSpeakers | ( | ) |
void Dragengine.Scenery.GameWorld.removeThinker | ( | Element | element | ) |
Remove element requiring thinking on frame updates.
void Dragengine.Scenery.GameWorld.requiresThinkChanged | ( | ) |
Requires thinking changed.
Called by GWBehavior if their requirement for thinking changed. This means requiresThink() implementations return different values than last time they have been checked. Game world will check all behaviors for their thinking requirements changes. Using this method helps to reduce script processing load by not making calling update(), think() and postThink() on behaviors not requiring it.
void Dragengine.Scenery.GameWorld.setCachedVegetation | ( | CachedVegetation | cachedVegetation | ) |
Set cached vegetation.
void Dragengine.Scenery.GameWorld.setEnablePersistency | ( | bool | enable | ) |
void Dragengine.Scenery.GameWorld.setGravity | ( | Vector | gravity | ) |
Set gravity.
void Dragengine.Scenery.GameWorld.setLayerMaskOneShotSpeaker | ( | LayerMask | layerMask | ) |
void Dragengine.Scenery.GameWorld.setStub | ( | StubGameWorld | stub | ) |
Set stub used to create game world.
void Dragengine.Scenery.GameWorld.setTemporaryDecalManager | ( | TemporaryDecalManager | manager | ) |
Set temporary decal manager.
void Dragengine.Scenery.GameWorld.setUniqueIDRemapper | ( | UniqueIDRemapper | remapper | ) |
Set Unique ID remapper.
void Dragengine.Scenery.GameWorld.think | ( | float | elapsed | ) |
Make elements think.
void Dragengine.Scenery.GameWorld.visitElements | ( | ElementVisitor | visitor | ) |
Visit elements.
AnchoredElementList Dragengine.Scenery.GameWorld.pAnchoredElementList |
GWBehaviorOneShotSpeaker Dragengine.Scenery.GameWorld.pBehaviorOneShotSpeaker |
Array Dragengine.Scenery.GameWorld.pBehaviors |
bool Dragengine.Scenery.GameWorld.pBehaviorsInited |
CachedVegetation Dragengine.Scenery.GameWorld.pCachedVegetation |
ConversationActorList Dragengine.Scenery.GameWorld.pConvoActorList |
ConversationCoordSystemList Dragengine.Scenery.GameWorld.pConvoCoordSystemList |
Dictionary Dragengine.Scenery.GameWorld.pElementIDMap |
SafeArray Dragengine.Scenery.GameWorld.pElements |
bool Dragengine.Scenery.GameWorld.pEnablePersistency |
bool Dragengine.Scenery.GameWorld.pEnableReadDynDataWithSize |
Array Dragengine.Scenery.GameWorld.pEnterFrameOnce |
Vector Dragengine.Scenery.GameWorld.pGravity |
bool Dragengine.Scenery.GameWorld.pLockEnterFrameOnce |
UniqueID Dragengine.Scenery.GameWorld.pNextObjectID |
RailList Dragengine.Scenery.GameWorld.pRailList |
SpawnPointList Dragengine.Scenery.GameWorld.pSpawnPoints |
StubGameWorld Dragengine.Scenery.GameWorld.pStub |
TemporaryDecalManager Dragengine.Scenery.GameWorld.pTempDecalMgr |
SafeArray Dragengine.Scenery.GameWorld.pThinkers |
Array Dragengine.Scenery.GameWorld.pThinkingBehaviors |
UniqueIDRemapper Dragengine.Scenery.GameWorld.pUniqueIDRemapper |
World Dragengine.Scenery.GameWorld.pWorld |