Meteor 2 Scripting Functions
Prefab
bool loadPrefab(string filename, vector2 pos, float angle, bool broadcast=true)
Additive load a map into the current map.
loadPrefab("prefabs\\Sample_OneRoom.map", getPos(PLAYER_OBJECT), 0);
updateSectors();
Filename is relative to base\maps (or modfolder\maps).
The prefab map's settings and base sector are ignored.
The prefab map's start points and message triggers are ignored.
The prefab map will be positioned with the centre of it's geometry at the specified pos.
Matching IDs (e.g. sector IDs) are not guaranteed in multiplayer.
Call updateSectors() after loading prefabs to apply changes. If loading multiple prefabs call updateSectors() once after loading.
int getPrefabTypesCount()
Get the number of available prefab types (maps marked as "Prefab").
print(getPrefabTypesCount());
Returns the number of map files in the base\maps folder (inlcuding sub-folders) that have Is Prefab set to true in the Map Properties.
string getPrefabTypeFilename(int prefabTypeIndex)
Get a prefab type filename by index.
print(getPrefabTypeFilename(1));
All prefab maps are indexed when the game data is loaded and stored in the list of prefab types.
Prefab type 0 is always empty (default prefab).
string getPrefabTypeDescription(int prefabTypeIndex)
Get a prefab type description by index.
print(getPrefabTypeDescription(1));
All prefab maps are indexed when the game data is loaded and stored in the list of prefab types.
Prefab type 0 is always empty (default prefab).
vector2 getPrefabTypeSize(int prefabTypeIndex)
Get a the dimension in pixels of a prefab type by index.
print(getPrefabTypeSize(1));
All prefab maps are indexed when the game data is loaded and stored in the list of prefab types.
Prefab type 0 is always empty (default prefab).
Size is in pixels (not metres) and does not include the base sector or placed objects.
Index