LuaDocs/PresetManager

From Data Realms Wiki

Jump to: navigation, search

Contents

Has no parent class

Generic Class. The singleton manager of all presets of Entity:s in the RTE. The presets serve as a respository of Entity instances with specific and unique and initial runtime data.

Go back to Class Index


Functions

GetDataModule

Gets a specific loaded DataModule

Arguments:

  • The ID of the module to get.

Return value:

The requested DataModule. Ownership is NOT transferred!


GetModuleID

Gets the ID of a loaded DataModule.

Arguments:

  • The name of the DataModule to get the ID from, including the ".rte"

Return value:

The requested ID. If no module of the name was found, -1 will be returned.


GetModuleIDFromPath

Gets the ID of a loaded DataModule, from a full data file path.

Arguments:

  • The full path to a data file inside the data module id you want to get.

Return value:

The requested ID. If no module of the name was found, -1 will be returned.


GetTotalModuleCount

Gets the total number of modules loaded so far, official or not.

Arguments:

  • None.

Return value:

The number of modules loaded so far, both official and non.


GetOfficialModuleCount

Gets the total number of OFFICIAL modules loaded so far.

Arguments:

  • None.

Return value:

The number of official modules loaded so far.


AddPreset

Adds an Entity instance's pointer and name associations to the internal list of already read in Entity:s. Ownership is NOT transferred! If there already is an instance defined, nothing happens. If there is not, a clone is made of the passed-in Entity and added to the library.

Arguments:

  • A pointer to the Entity derived instance to add. It should be created from a Reader. Ownership is NOT transferred!
  • Which module to add the entity to.
  • Whether to overwrite if an instance of the EXACT same TYPE and name was found. If one of the same name but not the exact type, false is returned regardless and nothing will have been added.
  • The file this instance was read from, or where it should be written.
  • If "Same" is passed as the file path read from, an overwritten instance will keep the old one's file location entry.

Return value:

Whether or not a copy of the passed-in instance was successfully inserted into the module. False will be returned if there already was an instance of that class and instance name inserted previously, unless overwritten.


GetRandomOfGroup

Returns a previously read in (defined) Entity which is randomly selected from a specific group.

Arguments:

  • The group to randomly select an Entity from. "All" will look in all.
  • The name of the least common denominator type of the Entitys you want.
  • "All" will look at all types.
  • Whether to only get those of one specific DataModule (0-n), or all (-1).

Return value:

The Entity preset that was randomly selected. Ownership is NOT transferred!


GetRandomOfGroupInModuleSpace

Returns a previously read in (defined) Entity which is associated with a specific group, randomly selected and only exist in a specific module space.

Arguments:

  • Ownership of the list or the Entitys placed in it are NOT transferred!
  • The group to randomly select from. "All" will look in all.
  • The name of the least common denominator type of the Entity:s you want.
  • "All" will look at all types.
  • Which module to get the instances for, in addition to all groups in official modules loaded earlier than the one specified here. -1 means get ALL groups ever reg'd.

Return value:

The randomly select preset, if any was found with thse search params. Ownership is NOT transferred!


GetEntityDataLocation

Gets the data file path of a previously read in (defined) Entity.

Arguments:

  • The type name of the derived Entity. Ownership is NOT transferred!
  • The preset name of the derived Entity preset.
  • Which module to try to get the entity from. If it's not found there, the official modules will be searched also.

Return value:

The file path of the data file that the specified Entity was read from. If no Entity of that description was found, "" is returned.


ReadReflectedPreset

Reads a preset of an Entity and tries to add it to the list of read-in instances. Regardless of whether there is a name collision, the read-in preset will be returned, ownership TRANSFERRED!

Arguments:

  • The Reader which is about to read in a preset.

Return value:

A pointer to the Entity preset read in. 0 if there was an error, or the instance name was 'None'. Ownership IS transferred!


ReloadAllScripts

Reloads all scripted Entity Presets witht he latest version of their respective script files.

Arguments:

  • None.

Return value:

None.


Go back to Class Index

Personal tools