mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 05:13:02 +05:00
handle missing physics gracefully (#114)
This commit is contained in:
parent
a3bbbbff84
commit
547146dbf1
1 changed files with 15 additions and 8 deletions
|
@ -619,8 +619,10 @@ if SERVER then
|
||||||
a:Spawn()
|
a:Spawn()
|
||||||
|
|
||||||
local phys = a:GetPhysicsObject()
|
local phys = a:GetPhysicsObject()
|
||||||
phys:EnableMotion(false)
|
if IsValid(phys) then
|
||||||
phys:Sleep()
|
phys:EnableMotion(false)
|
||||||
|
phys:Sleep()
|
||||||
|
end
|
||||||
|
|
||||||
a:PhysicsDestroy()
|
a:PhysicsDestroy()
|
||||||
a:SetHealth(inf)
|
a:SetHealth(inf)
|
||||||
|
@ -1404,14 +1406,19 @@ if CLIENT then
|
||||||
if bind ~= "buildmode" and not camcontrol then return true end
|
if bind ~= "buildmode" and not camcontrol then return true end
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("OnEntityCreated", "BuildModeProps", function(ent)
|
hook.Add("InitPostEntity", "buildmode_create_hook", function()
|
||||||
if not ent:GetNW2Bool("BRProtected") and ent:GetClass() == "prop_physics" or buildmode_ents[ent:GetClass()] then
|
timer.Simple(2, function()
|
||||||
if not BuildMode then ent.buildmode_placed_manually = true end
|
hook.Add("OnEntityCreated", "BuildModeProps", function(ent)
|
||||||
|
if not ent:GetNW2Bool("BRProtected") and ent:GetClass() == "prop_physics" or buildmode_ents[ent:GetClass()] then
|
||||||
|
if not BuildMode then ent.buildmode_placed_manually = true end
|
||||||
|
|
||||||
table.insert(buildmode_placed, ent)
|
table.insert(buildmode_placed, ent)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
local dragorigin = nil
|
local dragorigin = nil
|
||||||
|
|
||||||
function BuildModeDrag()
|
function BuildModeDrag()
|
||||||
|
|
Loading…
Reference in a new issue