e2 docs entity - wiremod/wire GitHub Wiki
Entity
= entity(
Id)
Gets the entity associated with the id (5 ops)
=
:id()
Gets the numeric id of an entity (5 ops)
=
:creationID()
(5 ops)
=
:creationTime()
Returns the time the entity was created on, relative to curtime. (5 ops)
= noentity()
Returns an invalid entity (5 ops)
= world()
Returns the world entity (5 ops)
=
:name()
Gets the name of a player (5 ops)
=
:type()
Gets the class of an entity (5 ops)
=
:getClass()
(5 ops)
=
:model()
Gets the model of an entity (5 ops)
=
:owner()
Gets the owner of an entity (5 ops)
= entities()
Returns an array containing all entities on the map (100 ops)
=
:keyvalues()
Returns the keyvalue table of an entity (20 ops)
=
:setEditProperty(
Key,
Value)
Sets an editable property to the string-encoded value. Returns 1 if it succeeded (20 ops)
=
:getEditProperty(
Key)
Returns a string encoding of the editable property (20 ops)
=
:getEditData()
Returns a look-up table of editable values on an editable entity (30 ops)
=
:isEditable()
Returns 1 if the entity has editable properties (1 ops)
=
:pos()
Gets the position of the entity (5 ops)
=
:forward()
Gets the forward direction of the entity 2) (5 ops)
=
:right()
Gets the right direction of the entity (5 ops)
=
:up()
Gets the up direction of the entity (5 ops)
=
:vel()
Gets the velocity of the entity (5 ops)
=
:velL()
Gets the local velocity of the entity (5 ops)
=
:velAtPoint(
Worldposition)
Gets the world velocity of a point in world coordinates attached to the entity (5 ops)
=
:angVel()
Gets the angular velocity of the entity (5 ops)
=
:angVelVector()
Returns rotation axis, velocity and direction given as the vector's direction, magnitude and sense (5 ops)
= sunDirection()
Returns the vector direction that points towards the sun (5 ops)
=
:toWorld(
Localposition)
Transforms from a vector local to E to a world vector (15 ops)
=
:toLocal(
Worldposition)
Transforms from a world vector to a vector local to E (15 ops)
=
:toWorldAxis(
Localaxis)
Transforms an axis local to E to a global axis (15 ops)
=
:toLocalAxis(
Worldaxis)
Transforms a world axis to an axis local to E (15 ops)
=
:toWorld(
Localangle)
Transforms from an angle local to E to a world angle (15 ops)
=
:toLocal(
Worldangle)
Transforms from a world angle to an angle local to E (15 ops)
=
:health()
Gets the health of the entity (5 ops)
=
:maxHealth()
Gets the max health of the entity (5 ops)
=
:radius()
Gets the size of the object (not precisely, but useful) (5 ops)
=
:bearing(
Pos)
Gets the bearing from the entity to the vector (15 ops)
=
:elevation(
Pos)
Gets the elevation from the entity to the vector (15 ops)
=
:heading(
Pos)
Gets the elevation and bearing from the entity to the vector (15 ops)
=
:mass()
Gets the mass of the entity (10 ops)
=
:massCenter()
Gets the Center of Mass of the entity (10 ops)
=
:massCenterL()
Gets the center of mass as a local vector (10 ops)
Mass)
setMass(Sets the mass of the E2 chip (between 0.001 and 50,000) (10 ops)
:setMass(
Mass)
Sets the mass of the entity (between 0.001 and 50,000) (10 ops)
=
:volume()
Gets the volume of the entity (10 ops)
=
:surfaceArea()
Gets the surface area of the entity (10 ops)
=
:stress()
Gets the stress of the entity (10 ops)
=
:frictionSnapshot()
Returns current friction events of the entity as a table of tables [https://wiki.facepunch.com/gmod/PhysObj:GetFrictionSnapshot] (10 ops)
=
:isPlayer()
Is the entity a player? (10 ops)
=
:isNPC()
Is the entity a NPC? (10 ops)
=
:isNextBot()
Is the entity a NextBot? (10 ops)
=
:isRagdoll()
Is the entity a ragdoll? (10 ops)
=
:isVehicle()
Is the entity a vehicle? (10 ops)
=
:isWorld()
Is the entity the world? (10 ops)
=
:isOnGround()
Is the player/NPC resting on something? (10 ops)
=
:isUnderWater()
Is the entity under water? (10 ops)
=
:isValid()
Returns 1 if the entity is valid, 0 otherwise (10 ops)
=
:isValidPhysics()
Returns 1 if the entity has valid physics (players don't) (10 ops)
=
:angles()
Gets the pitch, yaw and roll of the entity (10 ops)
=
:getMaterial()
Returns the material of an entity (10 ops)
=
:getSubMaterial(
Index)
(10 ops)
=
:getMaterials()
(20 ops)
:setMaterial(
Material)
Sets the material of an entity (10 ops)
:setSubMaterial(
Index,
Material)
(10 ops)
=
:getSkin()
Gets Es current skin number (10 ops)
:setSkin(
Skinindex)
Sets the skin of an entity (10 ops)
=
:getSkinCount()
Gets Es number of skins (10 ops)
:setBodygroup(
Bgrp_id,
Bgrp_subid)
Group ID, Group SubID Sets the bodygroups of the given entity (10 ops)
=
:getBodygroup(
Bgrp_id)
(10 ops)
=
:getBodygroups(
Bgrp_id)
Group ID Returns the number of bodygroups in the Group ID of the given entity (10 ops)
=
:isPlayerHolding()
Is the entity being held by a player? (10 ops)
=
:isOnFire()
Is the entity on fire? (10 ops)
=
:isWeapon()
Is the entity a weapon? (10 ops)
=
:isFrozen()
Is the entity frozen? (10 ops)
=
:isAsleep()
Is the entity asleep? (10 ops)
=
:isGravityEnabled()
Is gravity enabled for the entity? (10 ops)
=
:isPenetrating()
Is the entity penetrating another entity? (10 ops)
:applyForce(
Force)
Applies force to the entity according to the given vector's direction and magnitude (30 ops)
:applyOffsetForce(
Force,
Position)
Applies force to the entity according to the first vector from the location of the second (30 ops)
:applyAngForce(
Angforce)
Applies torque to the entity according to the given angle (30 ops)
:applyTorque(
Torque)
Applies torque to the entity according to the given vector, representing the torque axis, magnitude and direction (30 ops)
=
:inertia()
Gets the principal components of the entity's inertia tensor in the form ( Ixx, Iyy, Izz ) (30 ops)
:lockPod(
Lock)
1 locks and 0 unlocks the vehicle (10 ops)
:killPod()
Kills player in vehicle (10 ops)
:ejectPod()
Ejects player in vehicle (10 ops)
:podStripWeapons()
Strips player in vehicle (10 ops)
=
:boxSize()
Gets the dimensions of the entity's bounding box as a vector (length, width, height) (10 ops)
=
:boxCenter()
Gets the center of the entity's bounding box, as a local position vector (10 ops)
=
:boxCenterW()
Same as using E:toWorld(E:boxCenter()), but since Lua is faster, this is more efficient (also shorter to write) (10 ops)
=
:boxMax()
Gets the maximum local XYZ of the entity's bounding box (the "highest" corner), as a local position vector (10 ops)
=
:boxMin()
Gets the minimum local XYZ of the entity's bounding box (the "lowest" corner), as a local position vector (10 ops)
=
:aabbMin()
Returns the entity's (min) axis-aligned bounding box (10 ops)
=
:aabbMax()
Returns the entity's (max) axis-aligned bounding box (10 ops)
=
:aabbSize()
Returns the entity's axis-aligned bounding box size (10 ops)
=
:aabbWorldMin()
Returns the rotated entity's min world-axis-aligned bounding box corner (10 ops)
=
:aabbWorldMax()
Returns the rotated entity's max world-axis-aligned bounding box corner (10 ops)
=
:aabbWorldSize()
Returns the rotated entity's world-axis-aligned bounding box size (10 ops)
=
:driver()
Returns the driver of the vehicle if there is one, nil otherwise (5 ops)
=
:passenger()
Returns the passenger of the vehicle if there is one, in single seat pods this will return the driver (5 ops)
=
:toString()
Converts entity to string (5 ops)
= toString(
Ent)
Converts entity to string (5 ops)
:removeTrails()
Removes the trail from E (50 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material,
Color,
Alpha)
StartSize, EndSize, Length, Material, Color (RGB), Alpha. Sets entity's trails with the specified attributes (75 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material,
Color)
StartSize, EndSize, Length, Material, Color (RGBA). Sets entity's trails with the specified attributes (75 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material)
StartSize, EndSize, Length, Material. Sets entity's trails with the specified attributes (75 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material,
Color,
Alpha,
Attachmentid,
Additive)
StartSize, EndSize, Length, Material, Color (RGB), Alpha, AttachmentID, Additive. Sets entity's trails with the specified attributes (75 ops)
= trailsLeft()
Returns how many more entities can have trails (2 ops)
= trailsCount()
Returns how many entities currently have trails (2 ops)
= trailsMax()
Returns the maximum amount of entities that can have trails at the same time (Beware, the limit is shared between different chips!) (1 ops)
=
:lookupAttachment(
Attachmentname)
Returns Es attachment ID associated with attachmentName (15 ops)
=
:attachmentPos(
Attachmentid)
Returns Es attachment position associated with attachmentID (15 ops)
=
:attachmentAng(
Attachmentid)
Returns Es attachment angle associated with attachmentID (15 ops)
=
:attachmentPos(
Attachmentname)
Same as E:attachmentPos(E:lookupAttachment(attachmentName)) (15 ops)
=
:attachmentAng(
Attachmentname)
Same as E:attachmentAng(E:lookupAttachment(attachmentName)) (15 ops)
=
:attachments()
Returns array of attachment names of the entity (20 ops)
=
:nearestPoint(
Point)
Returns the closest point on the edge of the entity's bounding box to the given vector (15 ops)
:ignite()
Ignites an entity for 360 seconds (same as C menu). Requires wire_expression2_entity_ignite_enabled (15 ops)
:ignite(
Length)
Ignites an entity for the given length in seconds. Requires wire_expression2_entity_ignite_enabled (15 ops)
:ignite(
Length,
Radius)
Creates a fire at an entity with given radius and length in seconds. Requires wire_expression2_entity_ignite_enabled (15 ops)
:extinguish()
Extinguishes an entity granted you have permission. Does not work inside of entityDamage event if the attacker is the fire itself (15 ops)
=
:getCollisionGroup()
Returns the collision group of the entity (15 ops)
:setCollisionGroup(
Group)
Sets the collision group of the entity. Does not work on players. Use one of the _COLLISION_GROUP constants (15 ops)
:noCollideAll(
State)
(15 ops)
=
:getFlexBounds(
Flex)
(5 ops)
=
:getFlexCount()
Gets the number of flexes on the entity (5 ops)
=
:getFlexID(
Flex)
Gets the flex ID of the given name or -1 if it doesn't exist (5 ops)
=
:getFlexScale()
Gets the flex scale of the entity (5 ops)
=
:getFlexName(
Id)
Gets the name of the flex (5 ops)
=
:getFlexWeight(
Flex)
(5 ops)
=
:hasFlexes()
Returns 1 if the entity has flexes (5 ops)
=
:getFlexBounds(
Flex)
(15 ops)
=
:getFlexWeight(
Flex)
(15 ops)
=
:getFlexes()
Gets a 0-indexed array of all flexes and their names (50 ops)
=
:getModelBoneCount()
Gets the number of bones on the entity's model. Note these are different from E2 bones (5 ops)
=
:getModelBoneIndex(
Bone_name)
Gets the bone index of the given name or -1 if it doesn't exist (5 ops)
=
:getModelBoneName(
Bone_index)
Gets the name of the bone (5 ops)
=
:getModelBones()
Gets a 0-indexed array of all bones and their names. Note these are different from E2 bones (50 ops)