LuaDocs/PresetManager
From Data Realms Wiki
(PresetManager - Automatically generated by LuaBot) |
(PresetManager - Automatically generated by LuaBot) |
||
Line 79: | Line 79: | ||
* 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. | * 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. | * 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 | + | * If "Same" is passed as the file path read from, an overwritten instance will keep the old one's file location entry. |
'''Return value:''' | '''Return value:''' |
Revision as of 04:40, 5 August 2011
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.
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.
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.