Merge pull request #128 from thegrb93/gmodanchorfix

Fixes gmod anchor weirdness
This commit is contained in:
thegrb93 2018-11-19 23:26:47 -05:00 committed by GitHub
commit 5fc5bc1148
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -982,6 +982,7 @@ function AdvDupe2.duplicator.Paste( Player, EntityList, ConstraintList, Position
if(Ent.OnDuplicated)then Ent:OnDuplicated(v) end
ApplyEntityModifiers( Player, Ent )
ApplyBoneModifiers( Player, Ent )
Ent.SolidMod = not Ent:IsSolid()
Ent:SetNotSolid(true)
elseif(Ent==false)then
Ent = nil
@ -1021,7 +1022,7 @@ function AdvDupe2.duplicator.Paste( Player, EntityList, ConstraintList, Position
if(EntityList[_].BuildDupeInfo.DupeParentID and Parenting)then
v:SetParent(CreatedEntities[EntityList[_].BuildDupeInfo.DupeParentID])
end
v:SetNotSolid(false)
v:SetNotSolid( v.SolidMod )
undo.AddEntity( v )
end
undo.SetPlayer( Player )
@ -1044,7 +1045,7 @@ function AdvDupe2.duplicator.Paste( Player, EntityList, ConstraintList, Position
v:SetParent(CreatedEntities[EntityList[_].BuildDupeInfo.DupeParentID])
end
v:SetNotSolid(false)
v:SetNotSolid( v.SolidMod )
end
end
DisablePropCreateEffect = nil
@ -1131,6 +1132,7 @@ local function AdvDupe2_Spawn()
Ent.BoneMods = table.Copy( v.BoneMods )
Ent.EntityMods = table.Copy( v.EntityMods )
Ent.PhysicsObjects = table.Copy( v.PhysicsObjects )
Ent.SolidMod = not Ent:IsSolid()
local Phys = Ent:GetPhysicsObject()
if(IsValid(Phys))then Phys:EnableMotion(false) end
@ -1280,7 +1282,7 @@ local function AdvDupe2_Spawn()
end
if(not edit or not Queue.DisableParents)then
v:SetNotSolid(false)
v:SetNotSolid(v.SolidMod)
end
undo.AddEntity( v )

View File

@ -26,13 +26,17 @@ if(SERVER)then
return array
end
local areacopy_classblacklist = {
gmod_anchor = true
}
local function PlayerCanDupeCPPI(ply, ent)
if ent.DoNotDuplicate or not IsValid(ent:GetPhysicsObject()) or not duplicator.IsAllowed(ent:GetClass()) then return false end
if ent.DoNotDuplicate or areacopy_classblacklist[ent:GetClass()] or not IsValid(ent:GetPhysicsObject()) or not duplicator.IsAllowed(ent:GetClass()) then return false end
return ent:CPPIGetOwner()==ply
end
local function PlayerCanDupeTool(ply, ent)
if ent.DoNotDuplicate or not IsValid(ent:GetPhysicsObject()) or not duplicator.IsAllowed(ent:GetClass()) then return false end
if ent.DoNotDuplicate or areacopy_classblacklist[ent:GetClass()] or not IsValid(ent:GetPhysicsObject()) or not duplicator.IsAllowed(ent:GetClass()) then return false end
local trace = WireLib and WireLib.dummytrace(ent) or { Entity = ent }
return hook.Run( "CanTool", ply, trace, "advdupe2" ) ~= false
end