forked from Nebual/NadmodPP
replace freezing code with physics code that doesnt mess with players props
This commit is contained in:
parent
5b3b4ca0c0
commit
0e7c721ce8
@ -205,7 +205,10 @@ function NADMOD.AdminPanel(Panel, runByNetReceive)
|
||||
Panel:Button("Cleanup All Ragdolls", "nadmod_cleanclass", "prop_ragdol*")
|
||||
Panel:Button("Cleanup Clientside Ragdolls", "nadmod_cleanclragdolls")
|
||||
Panel:Button("Cleanup World Ropes", "nadmod_cleanworldropes")
|
||||
Panel:Button("Freeze All Props", "nadmod_freezeworld")
|
||||
Panel:Help(""):SetAutoStretchVertical(false) -- Spacer
|
||||
Panel:Button("0% Physics", "nadmod_physics", "0.0")
|
||||
Panel:Button("50% Physics", "nadmod_physics", "0.50")
|
||||
Panel:Button("100% Physics", "nadmod_physics", "1.0")
|
||||
end
|
||||
|
||||
local metaply = FindMetaTable("Player")
|
||||
|
@ -413,25 +413,6 @@ function NADMOD.CleanupPlayerProps(steamid)
|
||||
return count
|
||||
end
|
||||
|
||||
function NADMOD.FreezePlayerProps(steamid)
|
||||
local count = 0
|
||||
for k,v in pairs(NADMOD.Props) do
|
||||
if(v.SteamID == steamid) then
|
||||
if IsValid(v.Ent) then
|
||||
if !v.Ent:GetPersistent() then
|
||||
local phys = v.Ent:GetPhysicsObject()
|
||||
if IsValid(phys) then
|
||||
phys:Sleep()
|
||||
phys:EnableMotion(false)
|
||||
end
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function NADMOD.CleanPlayer(ply, tar)
|
||||
if IsValid(tar) and tar:IsPlayer() then
|
||||
local count = NADMOD.CleanupPlayerProps(tar:SteamID())
|
||||
@ -546,14 +527,14 @@ function NADMOD.DebugTotals(ply,cmd,args)
|
||||
end
|
||||
concommand.Add("nadmod_totals", NADMOD.DebugTotals)
|
||||
|
||||
function NADMOD.FreezeWorld(ply,cmd,args)
|
||||
function NADMOD.Physics(ply,cmd,args)
|
||||
if ply:IsValid() and not NADMOD.IsPPAdmin(ply) then return end
|
||||
NADMOD.Notify("Froze all props on the server")
|
||||
for k,v in ipairs(player.GetAll()) do
|
||||
NADMOD.FreezePlayerProps(v:SteamID())
|
||||
local timescale = util.StringToType(args[1], "float")
|
||||
if timescale < 0.0 or timescale > 1.0 then return end
|
||||
NADMOD.Notify("Physics Speed Set To: " .. timescale)
|
||||
RunConsoleCommand("phys_timescale", timescale)
|
||||
end
|
||||
end
|
||||
concommand.Add("nadmod_freezeworld", NADMOD.FreezeWorld)
|
||||
concommand.Add("nadmod_physics", NADMOD.Physics)
|
||||
|
||||
--=========================================================--
|
||||
-- Clientside Callbacks for the Friends/Options panels --
|
||||
|
Loading…
Reference in New Issue
Block a user