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)
=
:model()
Gets the model of an entity (5 ops)
=
:owner()
Gets the owner of an entity (5 ops)
=
:keyvalues()
Returns the keyvalue table of an entity (20 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)
=
: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)
=
: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)
: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 (5 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material,
Color,
Alpha)
StartSize, EndSize, Length, Material, Color (RGB), Alpha. Adds a trail to E with the specified attributes (30 ops)
:setTrails(
Startsize,
Endsize,
Length,
Material,
Color,
Alpha,
Attachmentid,
Additive)
StartSize, EndSize, Length, Material, Color (RGB), Alpha, AttachmentID, Additive. Adds a trail to E with the specified attributes (30 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)