Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Category: entity (5)

Lua Command inentityzone

Categories

Parameters

  • x
  • y
  • type

Info

Checks if the tile position (x|y) is inside the area of a certain entity type and returns true if this is the case and false otherwise.
The "area" of an entity depends on the entity type and and in some cases on its properties.

The following entities have special area sizes:
  • Info_T / Info_CT: 5x5 tiles (entity in center)

  • Info_RescuePoint: 3x3 tiles (entity in center)

  • Info_BombSpot: 5x5 tiles (entity in center)

  • Info_NoBuildings: Depending on entity settings

  • Info_TeamGate: Depending on entity settings

  • Info_NoWeather: Depending on entity settings

  • Env_Hurt: Depending on entity settings

  • Env_Room: Depending on entity settings


All other entities have an area of 1x1 tiles at the entity position.
So for these inentityzone only returns true, if an entity of the specified type is at the exact same tile position.

Note: This command has been implemented for performance reasons. It's much faster to use inentityzone than checking all entities in a Lua script manually.

Note: CS2D internally uses a 2D cache array (built at map load time) for very fast checks if there is any entity area on a tile position.