mirror of
https://github.com/Winded/RagdollMover.git
synced 2025-03-04 03:13:36 -05:00
Merge pull request #65 from penolakushari/master
Additional gizmo enhancements (#13)
This commit is contained in:
commit
b4d912d59b
@ -16,6 +16,31 @@ local TYPE_BOOL = 5
|
||||
|
||||
RAGDOLLMOVER = {}
|
||||
|
||||
local shouldCallHook = false
|
||||
hook.Add("EntityKeyValue", "RGMAllowTool", function(ent, key, val)
|
||||
-- I couldn't find a clean, direct way to add ragdollmover to the m_tblToolsAllowed for both
|
||||
-- loading into a map or loading a save on the same map.
|
||||
if key == "gmod_allowtools" and not string.find(val, "ragdollmover") then
|
||||
shouldCallHook = true
|
||||
end
|
||||
|
||||
-- We can't call the hook at the same time the key is gmod_allowtools because ent.m_tblToolsAllowed
|
||||
-- must exist (which relies on the gmod_allowtools key), but it doesn't yet
|
||||
if shouldCallHook and key ~= "gmod_allowtools" then
|
||||
hook.Run("RGMAllowTool", ent)
|
||||
shouldCallHook = false
|
||||
end
|
||||
end)
|
||||
|
||||
-- Some brush entities only allow a select number of tools (see https://wiki.facepunch.com/gmod/Sandbox_Specific_Mapping)
|
||||
-- Without this, the gizmos would not be "selectable"
|
||||
hook.Add("RGMAllowTool", "RGMAllowTool", function(ent)
|
||||
-- If the table is not filled, we don't want to insert it, as it would make other tools not work
|
||||
if istable(ent.m_tblToolsAllowed) and #ent.m_tblToolsAllowed > 0 then
|
||||
table.insert(ent.m_tblToolsAllowed, "ragdollmover")
|
||||
end
|
||||
end)
|
||||
|
||||
if SERVER then
|
||||
|
||||
util.AddNetworkString("RAGDOLLMOVER_META")
|
||||
@ -43,6 +68,7 @@ hook.Add("PlayerDisconnected", "RGMCleanupGizmos", function(pl)
|
||||
RAGDOLLMOVER[pl] = nil
|
||||
end)
|
||||
|
||||
|
||||
local NumpadBindRot, NumpadBindScale = {}, {}
|
||||
local RotKey, ScaleKey = {}, {}
|
||||
local rgmMode = {}
|
||||
|
@ -10,6 +10,7 @@ function ENT:Initialize()
|
||||
|
||||
self:DrawShadow(false)
|
||||
self:SetCollisionBounds(-self.DefaultMinMax, self.DefaultMinMax)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetNotSolid(true)
|
||||
|
||||
|
@ -1851,7 +1851,7 @@ function TOOL:Deploy()
|
||||
end
|
||||
|
||||
local function EntityFilter(ent, tool)
|
||||
return (ent:GetClass() == "prop_ragdoll" or ent:GetClass() == "prop_physics" or ent:GetClass() == "prop_effect") or (tool:GetClientNumber("disablefilter") ~= 0 and not ent:IsWorld())
|
||||
return ent:GetBrushPlaneCount() == 0 and ((ent:GetClass() == "prop_ragdoll" or ent:GetClass() == "prop_physics" or ent:GetClass() == "prop_effect") or (tool:GetClientNumber("disablefilter") ~= 0 and not ent:IsWorld()))
|
||||
end
|
||||
|
||||
function TOOL:LeftClick()
|
||||
@ -2225,7 +2225,7 @@ function TOOL:Reload()
|
||||
end
|
||||
|
||||
|
||||
function TOOL:Think()
|
||||
function TOOL:Think()
|
||||
|
||||
if SERVER then
|
||||
|
||||
@ -2235,7 +2235,7 @@ if SERVER then
|
||||
if CurTime() < self.LastThink + (RAGDOLLMOVER[pl].updaterate or 0.01) then return end
|
||||
|
||||
local plTable = RAGDOLLMOVER[pl]
|
||||
|
||||
|
||||
local ent = plTable.Entity
|
||||
local axis = plTable.Axis
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user