mirror of
https://github.com/wiremod/advdupe2.git
synced 2025-03-04 03:03:05 -05:00
Update SavePositions to use physobject positions (#334)
* Update SavePositions to use physobject positions * Update sv_misc.lua * Update sv_misc.lua
This commit is contained in:
parent
6a510580b2
commit
91dd4c236d
@ -20,37 +20,57 @@ local function SavePositions( Constraint )
|
||||
if IsValid(Constraint) then
|
||||
|
||||
if Constraint.BuildDupeInfo then return end
|
||||
|
||||
if not Constraint.BuildDupeInfo then Constraint.BuildDupeInfo = {} end
|
||||
local BuildDupeInfo = {}
|
||||
Constraint.BuildDupeInfo = BuildDupeInfo
|
||||
|
||||
local Ent1
|
||||
local Ent2
|
||||
local Ent1, Ent2
|
||||
if IsValid(Constraint.Ent) then
|
||||
Constraint.BuildDupeInfo.Ent1Ang = Constraint.Ent:GetAngles()
|
||||
if Constraint.Ent:GetPhysicsObjectCount()>1 then
|
||||
BuildDupeInfo.Ent1Ang = Constraint.Ent:GetAngles()
|
||||
else
|
||||
BuildDupeInfo.Ent1Ang = Constraint.Ent:GetPhysicsObject():GetAngles()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(Constraint.Ent1) then
|
||||
Constraint.BuildDupeInfo.Ent1Ang = Constraint.Ent1:GetAngles()
|
||||
if(Constraint.Ent1:GetPhysicsObjectCount()>1)then
|
||||
Constraint.BuildDupeInfo.Bone1 = Constraint["Bone1"]
|
||||
Constraint.BuildDupeInfo.Bone1Pos = Constraint.Ent1:GetPhysicsObjectNum(Constraint["Bone1"]):GetPos() - Constraint.Ent1:GetPos()
|
||||
Constraint.BuildDupeInfo.Bone1Angle = Constraint.Ent1:GetPhysicsObjectNum(Constraint["Bone1"]):GetAngles()
|
||||
if Constraint.Ent1:GetPhysicsObjectCount()>1 then
|
||||
local Bone = Constraint.Ent1:GetPhysicsObjectNum(Constraint.Bone1)
|
||||
BuildDupeInfo.Ent1Ang = Constraint.Ent1:GetAngles()
|
||||
BuildDupeInfo.Ent1Pos = Constraint.Ent1:GetPos()
|
||||
BuildDupeInfo.Bone1 = Constraint.Bone1
|
||||
BuildDupeInfo.Bone1Pos = Bone:GetPos() - Constraint.Ent1:GetPos()
|
||||
BuildDupeInfo.Bone1Angle = Bone:GetAngles()
|
||||
else
|
||||
local Bone = Constraint.Ent1:GetPhysicsObject()
|
||||
BuildDupeInfo.Ent1Ang = Bone:GetAngles()
|
||||
BuildDupeInfo.Ent1Pos = Bone:GetPos()
|
||||
end
|
||||
|
||||
if IsValid(Constraint.Ent2) then
|
||||
Constraint.BuildDupeInfo.EntityPos = Constraint.Ent1:GetPos() - Constraint.Ent2:GetPos()
|
||||
Constraint.BuildDupeInfo.Ent2Ang = Constraint.Ent2:GetAngles()
|
||||
if(Constraint.Ent2:GetPhysicsObjectCount()>1)then
|
||||
Constraint.BuildDupeInfo.Bone2 = Constraint["Bone2"]
|
||||
Constraint.BuildDupeInfo.Bone2Pos = Constraint.Ent2:GetPhysicsObjectNum(Constraint["Bone2"]):GetPos() - Constraint.Ent2:GetPos()
|
||||
Constraint.BuildDupeInfo.Bone2Angle = Constraint.Ent2:GetPhysicsObjectNum(Constraint["Bone2"]):GetAngles()
|
||||
if Constraint.Ent2:GetPhysicsObjectCount()>1 then
|
||||
local Bone = Constraint.Ent2:GetPhysicsObjectNum(Constraint.Bone2)
|
||||
BuildDupeInfo.EntityPos = BuildDupeInfo.Ent1Pos - Constraint.Ent2:GetPos()
|
||||
BuildDupeInfo.Ent2Ang = Constraint.Ent2:GetAngles()
|
||||
BuildDupeInfo.Bone2 = Constraint.Bone2
|
||||
BuildDupeInfo.Bone2Pos = Bone:GetPos() - Constraint.Ent2:GetPos()
|
||||
BuildDupeInfo.Bone2Angle = Bone:GetAngles()
|
||||
else
|
||||
local Bone = Constraint.Ent2:GetPhysicsObject()
|
||||
BuildDupeInfo.EntityPos = BuildDupeInfo.Ent1Pos - Bone:GetPos()
|
||||
BuildDupeInfo.Ent2Ang = Bone:GetAngles()
|
||||
end
|
||||
elseif IsValid(Constraint.Ent4) then
|
||||
Constraint.BuildDupeInfo.EntityPos = Constraint.Ent1:GetPos() - Constraint.Ent4:GetPos()
|
||||
Constraint.BuildDupeInfo.Ent4Ang = Constraint.Ent4:GetAngles()
|
||||
if(Constraint.Ent4:GetPhysicsObjectCount()>1)then
|
||||
Constraint.BuildDupeInfo.Bone2 = Constraint["Bone4"]
|
||||
Constraint.BuildDupeInfo.Bone2Pos = Constraint.Ent4:GetPhysicsObjectNum(Constraint["Bone4"]):GetPos() - Constraint.Ent4:GetPos()
|
||||
Constraint.BuildDupeInfo.Bone2Angle = Constraint.Ent4:GetPhysicsObjectNum(Constraint["Bone4"]):GetAngles()
|
||||
if Constraint.Ent4:GetPhysicsObjectCount()>1 then
|
||||
local Bone = Constraint.Ent4:GetPhysicsObjectNum(Constraint.Bone4)
|
||||
BuildDupeInfo.Bone2 = Constraint.Bone4
|
||||
BuildDupeInfo.EntityPos = BuildDupeInfo.Ent1Pos - Constraint.Ent4:GetPos()
|
||||
BuildDupeInfo.Ent2Ang = Constraint.Ent4:GetAngles()
|
||||
BuildDupeInfo.Bone2Pos = Bone:GetPos() - Constraint.Ent4:GetPos()
|
||||
BuildDupeInfo.Bone2Angle = Bone:GetAngles()
|
||||
else
|
||||
local Bone = Constraint.Ent4:GetPhysicsObject()
|
||||
BuildDupeInfo.EntityPos = BuildDupeInfo.Ent1Pos - Bone:GetPos()
|
||||
BuildDupeInfo.Ent2Ang = Bone:GetAngles()
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user