Expression 2 - Prop Repositioning

From GMod Wiki

Jump to: navigation, search
Deletion.pngThis page has been nominated for deletion. Deletion is due within approximately 30 days from nomination, unless the deletion has been disputed on the talk page. See more pages nominated for deletion here.
Reason for deletion: Not what Garry wants the wiki to be used for
Last Edit was made on 11/16/2011

Contents

E2 Prop Repositioning

Developed by: ZeikJT

Description

Adds the ability to move props.

If the prop is frozen V1.1 will repsect that freeze and preserve it.

It will only work on props that you own.

Related Examples

@name Entity Bringer
@inputs E:entity Bring
@outputs
@persist
if(Bring){
E:reposition(entity():pos()+vec(0,0,100))
}

Download Link

None yet

Commands

Function Returns Description
E:reposition(V) Moves the entity to the given world vector position


Code

/******************************************************************************\
  Prop Repositioning V1.1
\******************************************************************************/

    registerFunction("reposition", "e:v", "", function(self, args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
    local entity = checkEntity(rv1)
	if (!entity || !rv1:IsValid()) then return end
	if(!isOwner(self, rv1)) then return end
	if (!validPhysics(rv1)) then return end
    local phys = entity:GetPhysicsObject()
    phys:SetPos(Vector(rv2[1],rv2[2],rv2[3]))
    phys:Wake()
    if(!phys:IsMoveable())then
    phys:EnableMotion(true)
    phys:EnableMotion(false)
    end    
end)
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox