Meteor 2 Scripting Functions
Sector
int createSector(array vertsArray, string textureName, int passableType, int sectorId=-1, bool broadcast=true)
Create a new sector (server only).

Example
// create land 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);

// create wall sector
array<vector2> wallVertsArray = {vector2(100,10), vector2(110,10), vector2(110,150), vector2(100,150)};
sectorID = createSector(wallVertsArray, "metal04", TPT_SOLID);
print(sectorID);

// create water sector
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);

// update sectors
updateSectors();

Comments
Call updateSectors() after creating new sectors.
The sectorId and broadcast parameters should not be modified and do not need to be passed.

See also
deleteSector updateSectors

void deleteSector(int sectorID, bool broadcast=true)
Delete a sector (server only)

Example
deleteSector(1);
updateSectors();

See also
createSector 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.

Example
updateSectors();

See also
createSector setSectorPassableType

string getDefaultSectorTexture()
Get the default sector texture name (no texture).

Example
print(getDefaultSectorTexture());

Comments
Use this texture name to when creating shadow sectors.

See also
getSectorIsShadow setSectorIsShadow

string getSectorTexture(int sectorID)
Get a sector's texture name.

Example
// print texture name for base sector
print(getSectorTexture(0));

See also
setSectorTexture

void setSectorTexture(int sectorID, string textureName, bool broadcast=true)
Set a sector's texture name.

Example
// change base sector texture
setSectorTexture(0, "concrete");

Comments
Texture path and file extension are not required.

See also
getSectorTexture

int getSectorPassableType(int sectorID)
Get a sector's passable type.
passableType value examples: TPT_LAND, TPT_WATER, TPT_SOLID, TPT_CLOSED, TPT_LOW_WALL

Example
int passableType = getSectorPassableType(0);
print(passableType);

See also
setSectorPassableType

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

Example
setSectorPassableType(0, TPT_WATER);
updateSectors();

See also
getSectorPassableType updateSectors

int getSectorBevelType(int sectorID)
Get a sector's bevel type.
bevelType value examples: BT_FLAT, BT_RAISED, BT_SUNK

Example
int bevelType = getSectorBevelType(0);
print(bevelType);

See also
getSectorBevelType

void setSectorBevelType(int sectorID, int bevelType, bool broadcast=true)
Set a sector's bevel type.
bevelType value examples: BT_FLAT, BT_RAISED, BT_SUNK

Example
setSectorBevelType(0, BT_RAISED);

Comments
updateSectors does not need to be called afterwards.

See also
getSectorBevelType

bool getSectorWaterEffect(int sectorID)
Get a sector's water effect flag.

Example
bool waterEffect = getSectorWaterEffect(0);
print(waterEffect);

See also
setSectorWaterEffect

void setSectorWaterEffect(int sectorID, bool waterEffect, bool broadcast=true)
Set a sector's visual water effect flag.

Example
setSectorWaterEffect(0, true);

Comments
Set waterEffect to true to make the sector render using the water shader.
Changes are visual only, passable type is not affected.

See also
getSectorWaterEffect

bool getSectorIsShadow(int sectorID)
Get a sector's shadow flag.

Example
print(getSectorIsShadow(1));

See also
setSectorIsShadow

bool setSectorIsShadow(int sectorID, bool broadcast=true)
Set a sector's shadow flag.

Example
setSectorIsShadow(1, true);

Comments
Call updateSectors() after using this function.

See also
getSectorIsShadow updateSectors

int getSectorShadowMode(int sectorID)
Get a sector's shadow mode.

Example
print(getSectorShadowMode(1));

See also
setSectorShadowMode

void setSectorShadowMode(int sectorID, int shadowMode, bool broadcast=true)
Set a sector's shadow mode.

Example
setSectorShadowMode(1, SSM_LIGHT_BEVEL);

Comments
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.

See also
getSectorShadowMode setSectorIsShadow

bool getSectorHidden(int sectorID)
Get a sector's hidden status.

Example
print(getSectorHidden(1));

See also
setSectorHidden

void setSectorHidden(int sectorID, bool hidden, bool broadcast=true)
Show or hide a sector.

Example
setSectorHidden(1, true);

Comments
Hidden sectors are invisible, have no collision and are not displayed on the minimap.

See also
getSectorHidden

bool getSectorTriggerEnabled(int sectorID)
Determine if a sector's script trigger is enabled.

Example
print(getSectorTriggerEnabled(1));

See also
setSectorTriggerEnabled

void setSectorTriggerEnabled(int sectorID, bool enabled, bool broadcast=true)
Enable or disable a sector's script trigger.

Example
setSectorTriggerEnabled(1, true);

Comments
Sector triggers are usually disabled automatically once they are activated. This function can override that behaviour.

See also
getSectorTriggerEnabled

int getSectorDamage(int sectorID)
Get a sectors damage amount to apply to ground objects (e.g. lava floor).

Example
print(getSectorDamage(1));

See also
setSectorDamage

void setSectorDamage(int sectorID, int damage, bool broadcast=true)
Set a sectors damage amount to apply to ground objects (e.g. lava floor).

Example
// make base sector damage ground objects
setSectorDamage(0, 10);

See also
getSectorDamage

void openDoor(int sectorID, bool broadcast=true)
Opens a door sector just as if the player had walked into it.

Example
openDoor(1);

Comments
Only supports door sectors.

See also
closeDoor

void closeDoor(int sectorID, bool broadcast=true)
Closes a door.

Example
closeDoor(1);

See also
openDoor

void openForcefield(int sectorID, bool broadcast=true)
Opens a forcefield (changes sector to passable and sets texture to forcefield opened texture).

Example
openForcefield(1);

See also
closeForcefield

void closeForcefield(int sectorID, string forcefieldTexture, bool broadcast=true)
Closes a forcefield (changes sector to solid and sets texture to specified texture).

Example
closeForcefield(1, "FF_Green_UpDown");

See also
openForcefield


Index

Generated on the 23 November 2024 at 08:20:43 (UK Time)