Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/doc/lua/entity.md
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
commit6352e8e3196f78388b6c771073f9e03eaa612673 (patch)
treee23772f79a7fbc41bc9108951e9e136857484bf4 /doc/lua/entity.md
parent6741a057e5639280d85d0f88ba26f000baa58f61 (diff)
everything everywhere
all at once
Diffstat (limited to 'doc/lua/entity.md')
-rw-r--r--doc/lua/entity.md69
1 files changed, 69 insertions, 0 deletions
diff --git a/doc/lua/entity.md b/doc/lua/entity.md
new file mode 100644
index 0000000..dc3ebd7
--- /dev/null
+++ b/doc/lua/entity.md
@@ -0,0 +1,69 @@
+# entity
+
+The *entity* table contains functions that are common among all entities. Every function refers to the entity the script context is running on.
+
+Accessible in:
+
+* companion system scripts
+* quests
+* tech
+* primary status script
+* status effects
+* monsters
+* npcs
+* objects
+* active items
+
+---
+
+#### `EntityId` entity.id()
+
+Returns the id number of the entity.
+
+---
+
+#### `LuaTable` entity.damageTeam()
+
+Returns a table of the entity's damage team type and team number. Ex: {type = "enemy", team = 0}
+
+---
+
+#### `bool` entity.isValidTarget(`EntityId` entityId)
+
+Returns whether the provided entity is a valid target of the current entity. An entity is a valid target if they can be damaged, and in the case of monsters and NPCs if they are aggressive.
+
+---
+
+#### `Vec2F` entity.distanceToEntity(`EntityId` entityId)
+
+Returns the vector distance from the current entity to the provided entity.
+
+---
+
+#### `bool` entity.entityInSight(`EntityId` entityId)
+
+Returns whether the provided entity is in line of sight of the current entity.
+
+---
+
+#### `Vec2F` entity.position()
+
+Returns the position of the current entity.
+
+---
+
+#### `String` entity.entityType()
+
+Returns the type of the current entity.
+
+---
+
+#### `String` entity.uniqueId()
+
+Returns the unique ID of the entity. Returns nil if there is no unique ID.
+
+---
+
+#### `bool` entity.persistent()
+
+Returns `true` if the entity is persistent (will be saved to disk on sector unload) or `false` otherwise.