Meteor 2 Scripting Functions
Sector
int createSector(array vertsArray, string textureName, int passableType, int sectorId=-1, bool broadcast=true)
Create a new sector.
array<vector2> landVertsArray = {vector2(10,10), vector2(100,10), vector2(100,100), vector2(10,100)};
int sectorID = createSector(landVertsArray, "dirt-dry-reg.png", TPT_LAND);
print(sectorID);
array<vector2> wallVertsArray = {vector2(100,10), vector2(110,10), vector2(110,150), vector2(100,150)};
sectorID = createSector(wallVertsArray, "metal04", TPT_SOLID);
print(sectorID);
array<vector2> waterVertsArray = {vector2(110,10), vector2(210,10), vector2(210,100), vector2(110,100)};
sectorID = createSector(waterVertsArray, "water02.png", TPT_WATER);
setSectorWaterEffect(sectorID, true);
print(sectorID);
updateSectors();
Call updateSectors() after creating new sectors.
The sectorId and broadcast parameters should not be modified and do not need to be passed.
void deleteSector(int sectorID, bool broadcast=true)
Delete a sector
deleteSector(1);
updateSectors();
void updateSectors(bool broadcast=true)
Update map sectors, physics and minimap etc after creating new sectors using createSector or changing sectors passable type using setSectorPassableType.
If creating multiple sectors call updateSectors once afterwards.
updateSectors();
string getDefaultSectorTexture()
Get the default sector texture name (no texture).
print(getDefaultSectorTexture());
Use this texture name to when creating shadow sectors.
string getSectorTexture(int sectorID)
Get a sector's texture name.
print(getSectorTexture(0));
void setSectorTexture(int sectorID, string textureName, bool broadcast=true)
Set a sector's texture name.
setSectorTexture(0, "concrete");
Texture path and file extension are not required.
int getSectorPassableType(int sectorID)
Get a sector's passable type.
passableType value examples: TPT_LAND, TPT_WATER, TPT_SOLID, TPT_CLOSED, TPT_LOW_WALL
int passableType = getSectorPassableType(0);
print(passableType);
void setSectorPassableType(int sectorID, int passableType, bool broadcast=true)
Set a sector's passable type.
passableType value examples: TPT_LAND, TPT_WATER, TPT_SOLID, TPT_CLOSED
setSectorPassableType(0, TPT_WATER);
updateSectors();
int getSectorBevelType(int sectorID)
Get a sector's bevel type.
bevelType value examples: BT_FLAT, BT_RAISED, BT_SUNK
int bevelType = getSectorBevelType(0);
print(bevelType);
void setSectorBevelType(int sectorID, int bevelType, bool broadcast=true)
Set a sector's bevel type.
bevelType value examples: BT_FLAT, BT_RAISED, BT_SUNK
setSectorBevelType(0, BT_RAISED);
updateSectors does not need to be called afterwards.
bool getSectorWaterEffect(int sectorID)
Get a sector's water effect flag.
bool waterEffect = getSectorWaterEffect(0);
print(waterEffect);
void setSectorWaterEffect(int sectorID, bool waterEffect, bool broadcast=true)
Set a sector's visual water effect flag.
setSectorWaterEffect(0, true);
Set waterEffect to true to make the sector render using the water shader.
Changes are visual only, passable type is not affected.
bool getSectorIsShadow(int sectorID)
Get a sector's shadow flag.
print(getSectorIsShadow(1));
bool setSectorIsShadow(int sectorID, bool broadcast=true)
Set a sector's shadow flag.
setSectorIsShadow(1, true);
Call updateSectors() after using this function.
int getSectorShadowMode(int sectorID)
Get a sector's shadow mode.
print(getSectorShadowMode(1));
void setSectorShadowMode(int sectorID, int shadowMode, bool broadcast=true)
Set a sector's shadow mode.
setSectorShadowMode(1, SSM_LIGHT_BEVEL);
Shadow mode can be either SSM_SHADOW, SSM_LIGHT_BEVEL or SSM_DARK_BEVEL.
This function does not make the sector a shadow, call setSectorIsShadow separately to enable shadow.
bool getSectorHidden(int sectorID)
Get a sector's hidden status.
print(getSectorHidden(1));
void setSectorHidden(int sectorID, bool hidden, bool broadcast=true)
Show or hide a sector.
setSectorHidden(1, true);
Hidden sectors are invisible, have no collision and are not displayed on the minimap.
bool getSectorTriggerEnabled(int sectorID)
Determine if a sector's script trigger is enabled.
print(getSectorTriggerEnabled(1));
void setSectorTriggerEnabled(int sectorID, bool enabled, bool broadcast=true)
Enable or disable a sector's script trigger.
setSectorTriggerEnabled(1, true);
Sector triggers are usually disabled automatically once they are activated. This function can override that behaviour.
int getSectorDamage(int sectorID)
Get a sectors damage amount to apply to ground objects (e.g. lava floor).
print(getSectorDamage(1));
void setSectorDamage(int sectorID, int damage, bool broadcast=true)
Set a sectors damage amount to apply to ground objects (e.g. lava floor).
setSectorDamage(0, 10);
void openDoor(int sectorID, bool broadcast=true)
Opens a door sector just as if the player had walked into it.
openDoor(1);
Only supports door sectors.
void closeDoor(int sectorID, bool broadcast=true)
Closes a door.
closeDoor(1);
void openForcefield(int sectorID, bool broadcast=true)
Opens a forcefield (changes sector to passable and sets texture to forcefield opened texture).
openForcefield(1);
void closeForcefield(int sectorID, string forcefieldTexture, bool broadcast=true)
Closes a forcefield (changes sector to solid and sets texture to specified texture).
closeForcefield(1, "FF_Green_UpDown");
Index