Drag[en]gine Script Module DragonScript Script API  1.0
StubGameWorld Class Reference

Stub for constructing game world. More...

Inheritance diagram for StubGameWorld:

Public Member Functions

void addElement (StubElement element)
 Add element stub. More...
void addNavigationSpace (NavigationSpace navspace)
 Add navigation space. More...
void addWorldDecal (StubWorldDecal worldDecal)
 Add world decal stub. More...
void beginPreloading ()
 Begin preloading resources. More...
void createAndAddElements (Console console)
 Create and add all elements. More...
void createAndAddNonPersistableElements (Console console)
 Create and add non-persistable elements. More...
void createAndAddPersistableElements (Console console, UniqueIDRemapper.RemapEntry range)
 Create and add persistable elements with IDs inside range. More...
void createWorldDecals (DecalBuilder builder, Console console)
 Create world decals from stubs. More...
void forEachElement (Block ablock)
 Visit element stubs using block with StubElement as parameter. More...
void forEachWorldDecal (Block ablock)
 Visit world decal stubs using block with StubWorldDecal as parameter. More...
StubElement getElementAt (int index)
 Element stub at index. More...
int getElementCount ()
 Number of element stubs. More...
GameWorld getGameWorld ()
 Game world. More...
NavigationSpace getNavigationSpaceAt (int index)
 Navigation space at index. More...
int getNavigationSpaceCount ()
 Number of navigation spaces. More...
UniqueID getNextObjectID ()
 Next object ID. More...
StubWorldDecal getWorldDecalAt (int index)
 World decal stub at index. More...
int getWorldDecalCount ()
 Number of world decal stubs. More...
bool hasLoadingFinished ()
 Loading has finished. More...
void loadAndAddPersistableElements (Console console, PersistencyEnvironment env, FileReader reader)
 Load and add persistable elements. More...
void loadElementResources ()
 Load element resources. More...
void loadResources ()
 Loading resources. More...
void loadWorldDecalResources ()
 Load world decal resources. More...
StubGameWorld new (GameWorld gameWorld, PreloadCounter parentCounter)
 Create stub. More...
StubGameWorld new (StubGameWorld stub)
 Create copy of stub. More...
void preloadElementResources ()
 Preload element resources. More...
void readElementStubsFromFile (PersistencyEnvironment env, FileReader reader, ElementClassList ElementClassList)
 Read element stubs from file. More...
void remapObjectIDs (UniqueIDRemapper remapper)
 Remap object IDs. More...
void removeAllElements ()
 Remove all elements. More...
void removeAllNavigationSpaces ()
 Remove all navigation spaces. More...
void setNextObjectID (UniqueID nextObjectID)
 Set next object ID. More...
bool updatePreloading ()
 Update preloading. More...
bool verifyPreloading (Console console)
 Verify if resources failed preloading printing problems to console. More...
void worldAddNavigationSpaces ()
 Add navigation spaces to world. More...
- Public Member Functions inherited from StubWithProperties
bool getPropertyBoolFor (String key, bool default)
 Boolean property value or default value if absent. More...
int getPropertyCount ()
 Number of properties. More...
float getPropertyFloatFor (String key, float default)
 Floating point property value or default value if absent. More...
int getPropertyIntFor (String key, int default)
 Integer property value or default value if absent. More...
Array getPropertyKeys ()
 Property keys (String array). More...
String getPropertyValueFor (String key, String default)
 Value of property or default value if absent. More...
bool hasPropertyWithKey (String key)
 Property key is present. More...
StubWithProperties new ()
 Create stub with properties. More...
StubWithProperties new (StubWithProperties stub)
 Create copy of stub with properties. More...
void readPropertiesFromFile (FileReader reader)
 Read properties from file. More...
void removeAllProperties ()
 Remove all properties. More...
void removePropertyWithKey (String key)
 Remove property if present. More...
void setFrom (StubWithProperties properties)
 Set properties from another StubWithProperties. More...
void setPropertyValueFor (String key, String value)
 Set property. More...
void writePropertiesToFile (FileWriter writer)
 Write properties to file. More...

Detailed Description

Stub for constructing game world.

Supports preloading resources in the background as well as game world creation.

Member Function Documentation

◆ addElement()

void addElement ( StubElement  element)

Add element stub.

◆ addNavigationSpace()

void addNavigationSpace ( NavigationSpace  navspace)

Add navigation space.

◆ addWorldDecal()

void addWorldDecal ( StubWorldDecal  worldDecal)

Add world decal stub.

◆ beginPreloading()

void beginPreloading ( )

Begin preloading resources.

◆ createAndAddElements()

void createAndAddElements ( Console  console)

Create and add all elements.

Call for newly create game worlds. For loading game worlds use:

◆ createAndAddNonPersistableElements()

void createAndAddNonPersistableElements ( Console  console)

Create and add non-persistable elements.

Call for loading game worlds from file readers (save stated for example). For creating new game worlds from world files use createAndAddElements().

◆ createAndAddPersistableElements()

void createAndAddPersistableElements ( Console  console,
UniqueIDRemapper.RemapEntry  range 

Create and add persistable elements with IDs inside range.

Call for loading game worlds from file readers (save stated for example). For creating new game worlds from world files use createAndAddElements().

This call allows to load dynamic (persistable) content from world files added after save states have been created. This is the case for patching and improving world files after release where users have already created save states. For this to work you have to stored in save states the getNextObjectID() of the stub at the time of saving. Upon loading if the loaded world stub getNextObjectID() is greater than the persisted ID the world has changed and new content has been added.

Calling createAndAddNonPersistableElements() creates all non-persistable elements which works for upgraded world files. New persistable objects would not be loaded only those found in the save state. Using this call and the persisted next object ID the new persistable objects can be created.

Call this method with an entry from a UniqueIDRemapper. This is required since this method can not be called until all remappings have been established and object IDs have been remapped. This in turn is required since reading persistable element stubs would potentially clash with IDs of new elements so they have to be moved out of the way. The most simple solution is to save the UniqueIDRemapper entry for the newly added range of elements aside at the time you have to add the range.

◆ createWorldDecals()

void createWorldDecals ( DecalBuilder  builder,
Console  console 

Create world decals from stubs.

◆ forEachElement()

void forEachElement ( Block  ablock)

Visit element stubs using block with StubElement as parameter.

◆ forEachWorldDecal()

void forEachWorldDecal ( Block  ablock)

Visit world decal stubs using block with StubWorldDecal as parameter.

◆ getElementAt()

StubElement getElementAt ( int  index)

Element stub at index.

◆ getElementCount()

int getElementCount ( )

Number of element stubs.

◆ getGameWorld()

GameWorld getGameWorld ( )

Game world.

◆ getNavigationSpaceAt()

NavigationSpace getNavigationSpaceAt ( int  index)

Navigation space at index.

◆ getNavigationSpaceCount()

int getNavigationSpaceCount ( )

Number of navigation spaces.

◆ getNextObjectID()

UniqueID getNextObjectID ( )

Next object ID.

◆ getWorldDecalAt()

StubWorldDecal getWorldDecalAt ( int  index)

World decal stub at index.

◆ getWorldDecalCount()

int getWorldDecalCount ( )

Number of world decal stubs.

◆ hasLoadingFinished()

bool hasLoadingFinished ( )

Loading has finished.

◆ loadAndAddPersistableElements()

void loadAndAddPersistableElements ( Console  console,
PersistencyEnvironment  env,
FileReader  reader 

Load and add persistable elements.

Call for loading game worlds from file readers (save stated for example).

◆ loadElementResources()

void loadElementResources ( )

Load element resources.

◆ loadResources()

void loadResources ( )

Loading resources.

◆ loadWorldDecalResources()

void loadWorldDecalResources ( )

Load world decal resources.

◆ new() [1/2]

StubGameWorld new ( GameWorld  gameWorld,
PreloadCounter  parentCounter 

Create stub.

◆ new() [2/2]

Create copy of stub.

◆ preloadElementResources()

void preloadElementResources ( )

Preload element resources.

◆ readElementStubsFromFile()

void readElementStubsFromFile ( PersistencyEnvironment  env,
FileReader  reader,
ElementClassList  ElementClassList 

Read element stubs from file.

Use together with GameWorld.readDynamicElementDataFromFile() to restore elements from file readers. Call first readElementStubsFromFile() to load the stubs from the file reader. This loads stub of element classes without parent and marked persistable. These stubs together with those loaded from world file are then preloading their resources. Once finished call GameWorld.readDynamicElementDataFromFile() to create the elements.

◆ remapObjectIDs()

void remapObjectIDs ( UniqueIDRemapper  remapper)

Remap object IDs.

◆ removeAllElements()

void removeAllElements ( )

Remove all elements.

◆ removeAllNavigationSpaces()

void removeAllNavigationSpaces ( )

Remove all navigation spaces.

◆ setNextObjectID()

void setNextObjectID ( UniqueID  nextObjectID)

Set next object ID.

◆ updatePreloading()

bool updatePreloading ( )

Update preloading.

Returns false if the preloading has not yet finished. If all resources are loaded the game world and the individual elements are updated and the required engine objects created. Once all this has been done true is returned.

◆ verifyPreloading()

bool verifyPreloading ( Console  console)

Verify if resources failed preloading printing problems to console.

true if all resources loaded successfully or false otherwise.

◆ worldAddNavigationSpaces()

void worldAddNavigationSpaces ( )

Add navigation spaces to world.

The documentation for this class was generated from the following file: