e2 docs custom prop - wiremod/wire GitHub Wiki

Jump to table of contents

Custom/prop

Entity = propSpawn(String Model, Number Frozen)

Use the model string or a template entity to spawn a prop. You can set the position and/or the rotation as well. The last number indicates frozen/unfrozen. (40 ops)

Entity = propSpawn(Entity Template, Number Frozen)

Entity template, Frozen Spawns a prop with the model of the template entity. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(String Model, Vector Pos, Number Frozen)

Model path, Position, Frozen Spawns a prop with the model denoted by the string filepath at the position denoted by the vector. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(Entity Template, Vector Pos, Number Frozen)

Entity template, Position, Frozen Spawns a prop with the model of the template entity at the position denoted by the vector. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(String Model, Angle Rot, Number Frozen)

Model path, Rotation, Frozen Spawns a prop with the model denoted by the string filepath and rotated to the angle given. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(Entity Template, Angle Rot, Number Frozen)

Rotation, Frozen Spawns a prop with the model of the template entity and rotated to the angle given. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(String Model, Vector Pos, Angle Rot, Number Frozen)

Model path, Position, Rotation, Frozen Spawns a prop with the model denoted by the string file path, at the position denoted by the vector, and rotated to the angle given. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = propSpawn(Entity Template, Vector Pos, Angle Rot, Number Frozen)

Position, Rotation, Frozen Spawns a prop with the model of the template entity, at the position denoted by the vector, and rotated to the angle given. If frozen is 0, then it will spawn unfrozen. (40 ops)

Entity = sentSpawn(String Class)

Sent class - Spawns a SENT with no parameters. (Attempts to default the required values). (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Vector Pos)

Sent class, Position - Spawns a SENT with no parameters. (Attempts to default the required values). (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Table Data)

Sent class, Sent data - Spawns a SENT with provided data as parameters. (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Vector Pos, Table Data)

(150 ops)

Entity = sentSpawn(String Class, Vector Pos, Angle Rot)

Sent class, Position, Rotation - Spawns a SENT with no parameters. (Attempts to default the required values). (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Vector Pos, Angle Rot, Table Data)

Sent class, Position, Rotation, Sent data - Spawns a SENT with provided data as parameters. (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Vector Pos, Angle Rot, Number Frozen)

Sent class, Position, Rotation, Frozen - Spawns a SENT with no parameters. (Attempts to default the required values). (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Entity = sentSpawn(String Class, Vector Pos, Angle Rot, Number Frozen, Table Data)

Sent class, Position, Rotation, Frozen, Sent data - Spawns a SENT with provided data as parameters. (Requires wire_expression2_propcore_sents_whitelist 0 to spawn sents from entity tab!) (150 ops)

Array = sentGetWhitelisted()

Returns an array of classes, which is registered to the whitelist (can be spawned regardless of wire_expression2_propcore_sents_whitelist). (Can be used to make a lookup table) (25 ops)

Table = sentGetData(String Class)

Returns a table, where keys are parameter names (key sensitive!) and values as a table, where 'type' is a value type, 'default_value' is the default value that will be used, if none provided, and 'description' is a description of the parameter. (30 ops)

Table = sentGetData(String Class, String Key)

Returns a table, where 'type' is a value type, 'default_value' is the default value that will be used, if none provided, and 'description' is a description of the parameter. (10 ops)

Table = sentGetDataTypes(String Class)

Returns a table, where keys are parameter names (key sensitive!) and values is (lua-)types. (25 ops)

String = sentGetDataType(String Class, String Key)

Returns parameters's (lua-)type of the parameter. (5 ops)

Table = sentGetDataDefaultValues(String Class)

Returns a table, where keys are parameter names (key sensitive!) and values is default values, which will be applied if none would be provided. (25 ops)

String = sentGetDataDefaultValue(String Class, String Key)

(5 ops)

Table = sentGetDataDescriptions(String Class)

Returns a table, where keys are parameter names (key sensitive!) and values is descriptions of the parameter. (25 ops)

String = sentGetDataDescription(String Class, String Key)

(5 ops)

Number = sentCanCreate()

Returns 1 if you can spawn a SENT, 0 otherwise. (Complete alias of propCanCreate()) (5 ops)

Number = sentCanCreate(String Class)

Returns 1 if you can spawn a provided class(type) SENT, 0 otherwise. (Accounts both for antispam and whitelist) (5 ops)

Number = sentIsWhitelist()

Returns 1 if the whitelist is enabled, 0 otherwise. (1 ops)

Number = sentIsEnabled()

Returns 1 if server allows spawning sents, 0 otherwise. (1 ops)

Entity = seatSpawn(String Model, Number Frozen)

Model path, Frozen Spawns a prop with the model denoted by the string filepath. If frozen is 0, then it will spawn unfrozen. (50 ops)

Entity = seatSpawn(String Model, Vector Pos, Angle Rot, Number Frozen)

Model path, Frozen Spawns a prop with the model denoted by the string filepath. If frozen is 0, then it will spawn unfrozen. (50 ops)

Entity = seatSpawn(String Model, Vector Pos, Angle Rot, Number Frozen, String Vehicletype)

Model path, Frozen Spawns a prop with the model denoted by the string filepath. If frozen is 0, then it will spawn unfrozen. String seatType, determines what animations the seat will have. For example phx_seat2 and phx_seat3 will have Jeep and Airboat animations. (50 ops)

Entity:propDelete()

Deletes the specified prop. (10 ops)

Entity:propBreak()

Breaks/Explodes breakable/explodable props (Useful for Mines). (10 ops)

Entity:propDissolve()

Dissolves the specified entity. (10 ops)

Entity:propDissolve(Number Dissolvetype)

Dissolves the specified entity using the given dissolve type (_ENTITY_DISSOLVE). (10 ops)

Entity:propDissolve(Number Dissolvetype, Number Magnitude)

Dissolves the specified entity with the given dissolve type (_ENTITY_DISSOLVE) and magnitude. (10 ops)

Entity:use()

Simulates a player pressing their use key on the entity. (10 ops)

Number = Table:propDelete()

Deletes all the props in the given table, returns the amount of props deleted. (30 ops)

Number = Array:propDelete()

Deletes all the props in the given array, returns the amount of props deleted. (30 ops)

propDeleteAll()

Removes all entities spawned by this E2 (30 ops)

Number = Entity:propIsDupeable()

(1 ops)

Number = Entity:propCanSetDupeable()

(1 ops)

Entity:propNoDupe(Number Nodupe)

(2 ops)

Entity:propManipulate(Vector Pos, Angle Rot, Number Freeze, Number Gravity, Number Notsolid)

Allows to do any single prop core function in one term (position, rotation, freeze, gravity, notsolid) (10 ops)

Entity:propFreeze(Number Freeze)

Passing 0 unfreezes the entity, everything else freezes it. (10 ops)

Entity:propNotSolid(Number Notsolid)

Passing 0 makes the entity solid, everything else makes it non-solid. (10 ops)

Entity:propDraw(Number Drawenable)

Passing 0 disables rendering for the entity (makes it really invisible) (10 ops)

Entity:propShadow(Number Shadowenable)

Passing 0 disables rendering for the entity's shadow (10 ops)

Entity:propSleep(Number Sleep)

Puts an entity to 'sleep', causing it to stop moving until any physical interaction occurs. (10 ops)

Entity:propGravity(Number Gravity)

Passing 0 makes the entity weightless, everything else makes it weighty. (10 ops)

Entity:propDrag(Number Drag)

Passing 0 makes the entity not be affected by drag (10 ops)

Entity:propInertia(Vector Inertia)

Sets the directional inertia (10 ops)

Entity:propSetBuoyancy(Number Buoyancy)

Sets the prop's buoyancy ratio from 0 to 1 (10 ops)

Entity:propSetFriction(Number Friction)

Sets prop's friction coefficient (default is 1) (10 ops)

Number = Entity:propGetFriction()

Gets prop's friction coefficient (10 ops)

Entity:propSetElasticity(Number Elasticity)

Sets prop's elasticity coefficient (default is 1) (10 ops)

Number = Entity:propGetElasticity()

Gets prop's elasticity coefficient (10 ops)

Entity:propMakePersistent(Number Persistent)

Setting to 1 will make the prop persistent. (10 ops)

Entity:propPhysicalMaterial(String Physprop)

Changes the surface material of a prop (eg. wood, metal, ... See Material_surface_properties ). (10 ops)

String = Entity:propPhysicalMaterial()

Returns the surface material of a prop. (10 ops)

Entity:propSetVelocity(Vector Velocity)

Sets the velocity of the prop for the next iteration (10 ops)

Entity:propSetVelocityInstant(Vector Velocity)

Sets the initial velocity of the prop (10 ops)

Entity:propSetAngVelocity(Vector Velocity)

Sets the angular velocity of the prop for the next iteration (10 ops)

Entity:propSetAngVelocityInstant(Vector Velocity)

Sets the initial angular velocity of the prop (10 ops)

Entity:propStatic(Number Static)

Sets to 1 to make the entity static (disables movement, physgun, unfreeze, drive...) or 0 to cancel. (10 ops)

Bone:boneManipulate(Vector Pos, Angle Rot, Number Isfrozen, Number Gravity, Number Collision)

Allows to do any single bone function in one term (position, rotation, freeze, gravity, collision) (10 ops)

Bone:boneFreeze(Number Isfrozen)

Passing 0 unfreezes that specific bone, everything else freezes it. (10 ops)

Bone:setCollisions(Number Enable)

Passing 0 will disable collisions with the everything but players (30 ops)

Bone:setDrag(Number Drag)

Passing 0 makes the bone not be affected by drag (30 ops)

Bone:setInertia(Vector Inertia)

Sets the directional inertia (30 ops)

Bone:setBuoyancy(Number Buoyancy)

(30 ops)

Bone:setPhysicalMaterial(String Material)

Sets the surface material of the bone. (eg. wood, metal, ... See Material_surface_properties ) (30 ops)

Bone:setVelocity(Vector Velocity)

Sets the velocity of the bone for the next iteration (30 ops)

Bone:setVelocityInstant(Vector Velocity)

Sets the initial velocity of the bone (30 ops)

Bone:setAngVelocity(Vector Velocity)

Sets the angular velocity of the bone for the next iteration (30 ops)

Bone:setAngVelocityInstant(Vector Velocity)

Sets the initial angular velocity of the bone (30 ops)

Entity:makeStatue(Number Enable)

Applies the 'statue' effect on a ragdoll. Remove it by passing 0. (5000 ops)

Entity:setPos(Vector Pos)

Sets the position of an entity. (20 ops)

Entity:reposition(Vector Pos)

Deprecated. Kept for backwards-compatibility. (20 ops)

Entity:setLocalPos(Vector Pos)

Sets the position of an entity local to its parent. (20 ops)

Entity:rerotate(Angle Rot)

Deprecated. Kept for backwards-compatibility. (20 ops)

Entity:setAng(Angle Rot)

Set the rotation of an entity. (20 ops)

Entity:setLocalAng(Angle Rot)

Set the rotation of an entity local to its parent. (20 ops)

Bone:setPos(Vector Pos)

Sets the position of a bone. (20 ops)

Bone:setAng(Angle Rot)

Set the rotation of a bone. (20 ops)

Entity:ragdollFreeze(Number Isfrozen)

Passing 0 unfreezes the entire ragdoll. (60 ops)

Angle = Entity:ragdollGetAng()

(5 ops)

Entity:ragdollSetPos(Vector Pos)

Sets the position of a ragdoll while preserving pose. (150 ops)

Entity:ragdollSetAng(Angle Rot)

Set the rotation of a ragdoll while preserving pose. (150 ops)

Table = Entity:ragdollGetPose()

Gets a specially built table containing the pose of the ragdoll. See ragdollSetPose. (150 ops)

Entity:ragdollSetPose(Table Pose, Number Rotate)

Sets the pose of a ragdoll while preserving position. Setting rotate to 0 makes the ragdoll use the pose's original angle. See ragdollGetPose. (150 ops)

Entity:ragdollSetPose(Table Pose)

Sets the pose of a ragdoll while preserving position and angle. See ragdollGetPose. (150 ops)

Entity:parentTo(Entity Target)

Parents one entity to another. (20 ops)

Entity:parentToAttachment(Entity Target, String Attachmentname)

Parents one entity to anothers attachment. (20 ops)

Entity:deparent()

Unparents an entity, so it moves freely again. (5 ops)

Entity:parentTo()

Parents one entity to another. (5 ops)

propSpawnEffect(Number On)

Set to 1 to enable prop spawn effect, 0 to disable. (1 ops)

propSpawnUndo(Number On)

Set to 0 to force prop removal on E2 shutdown, and suppress Undo entries for props. (1 ops)

Number = propCanCreate()

Returns 1 when propSpawn() will successfully spawn a prop until the limit is reached. (1 ops)

Entity:setEyeTarget(Vector Pos)

For NPCs, sets the eye target to the world position. For ragdolls, sets the eye target to the local eye position (10 ops)

Entity:setFlexWeight(Number Flex, Number Weight)

(10 ops)

Entity:setEyeTargetLocal(Vector Pos)

Sets the eye target to the local eye position (30 ops)

Entity:setEyeTargetWorld(Vector Pos)

Sets the eye target to the world position (30 ops)

Entity:setFlexWeight(String Flex, Number Weight)

(20 ops)

Entity:setFlexScale(Number Scale)

Sets the flex scale of the entity (20 ops)

Table = Collision:toTable()

(20 ops)

Vector = Collision:hitPos()

Returns a vector of where the collision ocurred (5 ops)

Vector = Collision:pos()

Returns a vector of where the collision ocurred Alias of hitPos(xcd:) (5 ops)

Vector = Collision:position()

Returns a vector of where the collision ocurred Alias of hitPos(xcd:) (5 ops)

Vector = Collision:ourOldVelocity()

Returns a vector of the velocity of the tracked entity before the collision occurred. (5 ops)

Vector = Collision:entityOldVelocity()

Returns a vector of the velocity of the tracked entity before the collision occurred. Alias of ourOldVelocity(xcd:) (5 ops)

Vector = Collision:theirOldVelocity()

Returns a vector of the velocity of the hit entity before the collision occurred (5 ops)

Vector = Collision:hitEntityOldVelocity()

Returns a vector of the velocity of the hit entity before the collision occurred Alias of theirOldVelocity(xcd:) (5 ops)

Vector = Collision:hitNormal()

Returns the hitnormal(vector) of the surface on the tracked entity that hit the other entity (5 ops)

Vector = Collision:hitSpeed()

Returns a vector of the speed the impact occurred with (5 ops)

Vector = Collision:ourNewVelocity()

Returns a vector of the velocity of the tracked entity after the collision occurred. (5 ops)

Vector = Collision:entityNewVelocity()

Returns a vector of the velocity of the tracked entity after the collision occurred. Alias of ourNewVelocity(xcd:) (5 ops)

Vector = Collision:theirNewVelocity()

Returns a vector of the velocity of the hit entity after the collision occurred. (5 ops)

Vector = Collision:hitEntityNewVelocity()

Returns a vector of the velocity of the hit entity after the collision occurred. Alias of theirNewVelocity(xcd:) (5 ops)

Vector = Collision:ourOldAngularVelocity()

Returns a vector of the angular velocity of the tracked entity before the collision occurred. (5 ops)

Vector = Collision:entityOldAngularVelocity()

Returns a vector of the angular velocity of the tracked entity before the collision occurred. Alias of ourOldAngularVelocity(xcd:) (5 ops)

Vector = Collision:theirOldAngularVelocity()

Returns a vector of the angular velocity of the hit entity before the collision occurred. (5 ops)

Vector = Collision:hitEntityOldAngularVelocity()

Returns a vector of the angular velocity of the hit entity before the collision occurred. Alias of ourOldAngularVelocity(xcd:) (5 ops)

Number = Collision:speed()

Returns a number representing the speed at which the collision occurred. (2 ops)

Number = Collision:ourSurfaceProps()

Returns a number representing the surface properties of the tracked entity (2 ops)

Number = Collision:entitySurfaceProps()

Returns a number representing the surface properties of the tracked entity Alias of ourSurfaceProps(xcd:) (2 ops)

Number = Collision:theirSurfaceProps()

Returns a number representing the surface properties of the hit entity (2 ops)

Number = Collision:hitEntitySurfaceProps()

Returns a number representing the surface properties of the hit entity Alias of theirSurfaceProps(xcd:) (2 ops)

Number = Collision:deltaTime()

Returns a number representing how long ago the last collision between the tracked entity and the hit entity was, in seconds. Capped at 1 second. (2 ops)

Entity = Collision:hitEntity()

Returns the entity that was hit for this collision. (2 ops)

Number = trackCollision(Entity Ent)

Starts tracking collisions for the entity, will fire event entityCollision when they occur. Does not track when players or vehicles hit world, only other entities. Needs event entityCollision(entity, entity, collision) in order to run. Returns 1 on success or 0 on error in non-strict (20 ops)

Number = trackCollision(Entity Ent, Function Cb)

Starts tracking collisions for the entity, will call the provided function, then fire event entityCollision when they occur. May track without event entityCollision. Passed callback function needs argument signature of (eexcd), aka (entity, entity, collision) For more info see trackCollision(e) (20 ops)

Number = isTrackingCollision(Entity Ent)

Returns 1 if the entity's collisions are already being tracked, 0 if not. Errors on an invalid ent (5 ops)

stopTrackingCollision(Entity Ent)

Stops tracking collisions for the entity. Error in strict if entity is invalid or entity isn't being tracked (5 ops)