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);
The sectorId and broadcast parameters should not be modified and do not need to be passed.
Sectors cannot be deleted.
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.
This is called automatically once per frame if needed. Call this function to update instantly instead.
updateSectors();
broadcast has no effect from clients.
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 sector's 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 sector's damage amount to apply to ground objects (e.g. lava floor).
setSectorDamage(0, 10);
float getSectorLightLevel(int sectorID)
Get a sector's light level.
print(getSectorLightLevel(1));
void setSectorLightLevel(int sectorID, float lightLevel, bool broadcast=true)
Set a sector's light level.
setSectorLightLevel(1, -1.0);
setSectorLightLevel(1, 1.0);
setSectorLightLevel(1, 0.0);
lightLevel is a value between -1.0 and 1.0 where 0 is no change, -1.0 is darker and +1.0 is illuminated.
float getSectorFlowSpeed(int sectorID)
Get a sector's flow speed (aka conveyor speed).
print(getSectorFlowSpeed(1));
void setSectorFlowSpeed(int sectorID, float damage, bool broadcast=true)
Set a sector's flow speed (aka conveyor speed).
setSectorFlowSpeed(1, 2.0);
int getSectorTeleportID(int sectorID)
Get a sector's teleport ID.
print(getSectorTeleportID(1));
void setSectorTeleportID(int sectorID, int teleportID, bool broadcast=true)
Set a sector's flow speed (aka conveyor speed).
setSectorTeleportID(1, 10);
setSectorTeleportID(2, 10);
setSectorTeleportID(1, -1);
setSectorTeleportID(2, -1);
Set 2 sectors to the same teleport IDs to teleport between them.
Set a sector teleport ID to -1 to no longer make it a teleporter (default sector behaviour).
vector2 getSectorPos(int sectorID)
Get the centre position of the specified sector.
print(getSectorPos(1));
int getFirstFreeTeleportID()
Get the first (lowest) available free teleport ID on the map.
print(getFirstFreeTeleportID());
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