World functions#

Those functions are used to manipulate the environment. They are registered when scripting::Scripting is created.

Layout functions#

Those functions are used to describe the layout of the level. While they may be called from within scripts, they main intent is to be used in the map.lua files to describe the initial layout of the level, and they do not validate if the identifiers are in fact unique, which may cause a crash when engine attempts to render an invalid geometry.

The calls are automatically generated when a level is saved in the level editor.

sector_create(sectorId, floor, floorTexture, ceiling, ceilingTexture)#

Creates an empty sector in the currently loaded level.

Parameters:
  • sectorId (number) – ID of the sector to be created. Has to be unique.

  • floor (number) – Z-coordinate of the sector floor.

  • floorTexture (str) – Texture of the sector floor.

  • ceiling (number) – Z-coordinate of the sector ceiling.

  • ceilingTexture (str) – Texture of the sector ceiling.

sector_wall(sectorId, texture, x1, y1, x2, y2)#

Adds a wall to the sector. The walls should be added in clockwise vertex direction so that the engine renders them properly.

Parameters:
  • sectorId (number) – ID of the sector.

  • texture (str) – Texture of the wall.

  • x1 (number) – X-coordinate of the wall start vertex.

  • y1 (number) – Y-coordinate of the wall start vertex.

  • x2 (number) – X-coordinate of the wall end vertex.

  • y2 (number) – Y-coordinate of the wall end vertex.

sector_portal(sectorId, texture, x1, y1, x2, y2, target)#

Adds a wall in the sector with a portal to the target sector. Behaves exactly as sector_wall() with the addition of:

Parameters:

target (number) – ID of the portal target sector.

sector_transform(sectorId, texture, x1, y1, x2, y2, target, transformX, transformY, transformZ, transformAngle)#

Adds a wall in the sector with a portal, which transforms the coordinates and viewing angle, to the target sector. Behaves exactly as sector_portal() with the addition of:

Parameters:
  • transformX (number) – X-coordinate transformation when passing the portal.

  • transformY (number) – Y-coordinate transformation when passing the portal.

  • transformZ (number) – Z-coordinate transformation when passing the portal.

  • transformAngle – Angle transformation when passing the portal.

sprite_create(sectorId, spriteId, texture, x, y, z, offset, shadows, lightCenter, blocking)#

Adds a sprite to the sector.

Parameters:
  • sectorId (number) – ID of the sector.

  • spriteId (number) – Sprite ID to be added. Has to be unique.

  • texture (str) – Texture of the sprite.

  • x (number) – X-coordinate of the sprite.

  • y (number) – Y-coordinate of the sprite.

  • z (number) – Z-coordinate of the sprite.

  • offset (number) – Movement of rendered sprite texture along the Z-axis.

  • shadows (boolean) – Whether the sprite casts shadows.

  • lightCenter (number) – Point along the Z-axis used to calculate sprite lighting.

  • blocking (boolean) – Whether the sprite prevents player from entering a sector.

sprite_texture(sectorId, spriteId, angle, texture)#

Adds a texture to the sprite.

The textures are displayed based on the viewing angle of player. When the player position angle reaches the angle value of the sprite texture, but is smaller than the angle value of the next sprite texture, this texture is used for the sprite.

Parameters:
  • sectorId (number) – ID of the sector.

  • spriteId (number) – ID of the sprite.

  • angle (number) – Player position angle value needed for the texture to activate.

  • texture (str) – The texture file.

light_create(sectorId, x, y, z, r, g, b)#

Adds a light source to the sector.

Parameters:
  • sectorId (number) – ID of the sector.

  • x (number) – X-coordinate of the light.

  • y (number) – Y-coordinate of the light.

  • z (number) – Z-coordinate of the light.

  • r (number) – Intensity of the red light.

  • g (number) – Intensity of the green light.

  • b (number) – Intensity of the blue light.

Interaction functions#

Those functions are meant to be used in the scripts.

load_texture(texture)#

Causes the texture to be loaded when the engine is initialized for the current level. Has no effect when the level is already loaded.

This function is intended to be used in the main level script file to mark the need to pre-load a texture which is dynamically added to the level during some later script execution (for example: a sprite texture will be changed). While any non-loaded texture loads automatically when needed, pre-loading all textures can reduce delays related to I/O operations.

Parameters:

texture (str) – The texture file.

change_texture(sectorId, spriteId, texture)#

Changes the base texture of a sprite.

Parameters:
  • sectorId (number) – ID of the sector.

  • spriteId (number) – ID of the sprite.

  • texture (str) – The texture file.

interactive_point(sectorId, x, y, script)#

Marks a point as interactive.

When facing an interactive point, player will be prompted to interact. When player chooses to interact, a script will be launched.

The interaction prompt is not dependent on the Z-coordinate of the player. As long as player is in the sector and is facing the proper X/Y-coordinates, the prompt will be displayed.

Parameters:
  • sectorId (number) – ID of the sector.

  • x (number) – X-coordinate of the interactive point.

  • y (number) – Y-coordinate of the interactive point.

  • script (str) – The script filename to be launched on interaction.