diff --git a/lua/wire/stools/vthruster.lua b/lua/wire/stools/vthruster.lua index ef333760fb..dc3c089c8e 100644 --- a/lua/wire/stools/vthruster.lua +++ b/lua/wire/stools/vthruster.lua @@ -53,6 +53,13 @@ function TOOL:LeftClick( trace ) local ent = WireToolObj.LeftClick_Make(self, trace, ply ) if isbool(ent) then return ent end if IsValid(ent) then + undo.Create("WireVThruster") + undo.AddEntity( ent ) + undo.SetPlayer( ply ) + undo.Finish() + + ply:AddCleanup( "wire_vthrusters", ent ) + ent:GetPhysicsObject():EnableMotion( false ) self:ReleaseGhostEntity() @@ -67,19 +74,11 @@ function TOOL:LeftClick( trace ) local anchorbone = self:GetBone(1) local const = WireLib.Weld(wire_thruster, anchor, anchorbone, true, false) + if const then ply:AddCleanup( "wire_vthrusters", const ) end local Phys = wire_thruster:GetPhysicsObject() Phys:EnableMotion( true ) - undo.Create("WireVThruster") - undo.AddEntity( wire_thruster ) - undo.AddEntity( const ) - undo.SetPlayer( ply ) - undo.Finish() - - ply:AddCleanup( "wire_vthrusters", wire_thruster ) - ply:AddCleanup( "wire_vthrusters", const ) - self:ClearObjects() end