Prop core - wiremod/wire GitHub Wiki

Description

The prop core functionality is used generally for manipulating props using an E2 script within the Garry's mod environment. Manipulation type can be anything like creating, deleting, teleporting, angling, gravity, inertia, buoyancy and much more. The data types are general for the E2 chip and you can find them here!

What console variables can be used to setup it

sbox_E2_maxProps          : Controls the maximum amount of props spawned via E2 set this to `-1` to disable the limit.
sbox_E2_maxPropsPerSecond : Controls the maximum amount of props spawned for one second. Don't set this too high!  
sbox_E2_PropCore          : Controls enable/disable of the extension. Setup values are written below.
  0 : The extension is disabled.
  1 : Only admins can use the extension.
  2 : Players can affect their own props.

Expression 2 API

All the function descriptions are available in the table below:

         Instance creator           Out   Description 
propSpawn(image,image,image) image 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.
propSpawn(image,image) image Entity template, Frozen Spawns a prop with the model of the template entity. If frozen is 0, then it will spawn unfrozen.
propSpawn(image,image,image,image) image 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.
propSpawn(image,image,image) image 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.
propSpawn(image,image,image) image 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.
propSpawn(image,image) image 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.
propSpawn(image,image,image,image) image 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.
propSpawn(image,image,image) image 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.
seatSpawn(image,image) image Model path, Frozen Spawns a prop with the model denoted by the string filepath. If frozen is 0, then it will spawn unfrozen.
seatSpawn(image,image,image,image) image Model path, Frozen Spawns a prop with the model denoted by the string filepath. If frozen is 0, then it will spawn unfrozen.
               Prop core method                 Out   Description 
image:deparent() Unparents an entity, so it moves freely again.
image:parentTo() Parents one entity to another.
image:parentTo(image) Parents one entity to another.
image:propBreak() Breaks/Explodes breakable/explodable props (Useful for Mines).
image:propDelete() Deletes the specified prop.
image:propDrag(image) Passing 0 makes the entity not be affected by drag
image:propDraw(image) Passing 0 disables rendering for the entity (makes it really invisible)
image:propFreeze(image) Passing 0 unfreezes the entity, everything else freezes it.
image:propGetElasticity() image Gets prop's elasticity coefficient
image:propGetFriction() image Gets prop's friction coefficient
image:propGravity(image) Passing 0 makes the entity weightless, everything else makes it weighty.
image:propInertia(image) Sets the directional inertia
image:propMakePersistent(image) Setting to 1 will make the prop persistent.
image:propManipulate(image,image,image,image,image) Allows to do any single prop core function in one term (position, rotation, freeze, gravity, notsolid)
image:propNotSolid(image) Passing 0 makes the entity solid, everything else makes it non-solid.
image:propPhysicalMaterial() image Returns the surface material of a prop.
image:propPhysicalMaterial(image) Changes the surface material of a prop (eg. wood, metal, ... See Material_surface_properties ).
image:propSetBuoyancy(image) Sets the prop's buoyancy ratio from 0 to 1
image:propSetElasticity(image) Sets prop's elasticity coefficient (default is 1)
image:propSetFriction(image) Sets prop's friction coefficient (default is 1)
image:propSetVelocity(image) Sets the velocity of the prop for the next iteration
image:propSetVelocityInstant(image) Sets the initial velocity of the prop
image:propShadow(image) Passing 0 disables rendering for the entity's shadow
image:propStatic(image) Sets to 1 to make the entity static (disables movement, physgun, unfreeze, drive...) or 0 to cancel.
image:reposition(image) Deprecated. Kept for backwards-compatibility.
image:rerotate(image) Deprecated. Kept for backwards-compatibility.
image:setAng(image) Set the rotation of an entity.
image:setPos(image) Sets the position of an entity.
image:use() Simulates a player pressing their use key on the entity.
        General functions           Out   Description 
propCanCreate() image Returns 1 when propSpawn() will successfully spawn a prop until the limit is reached.
image:propDelete() image Deletes all the props in the given array, returns the amount of props deleted.
image:propDelete() image Deletes all the props in the given table, returns the amount of props deleted.
propDeleteAll() Removes all entities spawned by this E2
propSpawnEffect(image) Set to 1 to enable prop spawn effect, 0 to disable.
propSpawnUndo(image) Set to 0 to force prop removal on E2 shutdown, and suppress Undo entries for props.