From 4b707a3ed485e0ad53ab4ec7fca189aeeac9030f Mon Sep 17 00:00:00 2001 From: Brandon Sturgeon Date: Sun, 7 Aug 2022 01:58:06 -0700 Subject: [PATCH] Expose ragdoll functions --- lua/ulx/modules/sh/fun.lua | 15 +++++++-------- lua/ulx/sh_defines.lua | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lua/ulx/modules/sh/fun.lua b/lua/ulx/modules/sh/fun.lua index 4613579..01943f7 100644 --- a/lua/ulx/modules/sh/fun.lua +++ b/lua/ulx/modules/sh/fun.lua @@ -639,9 +639,8 @@ end hook.Add( "PhysgunDrop", "ulxPlayerDropJailCheck", playerDrop ) ------------------------------ Ragdoll ------------------------------ -local function ragdollPlayer( v ) +function ulx.ragdollPlayer( v ) if v:InVehicle() then - local vehicle = v:GetParent() v:ExitVehicle() end @@ -673,7 +672,7 @@ local function ragdollPlayer( v ) v:SpectateEntity( ragdoll ) v:StripWeapons() -- Otherwise they can still use the weapons. - ragdoll:DisallowDeleting( true, function( old, new ) + ragdoll:DisallowDeleting( true, function( _, new ) if v:IsValid() then v.ragdoll = new end end ) v:DisallowSpawning( true ) @@ -682,7 +681,7 @@ local function ragdollPlayer( v ) ulx.setExclusive( v, "ragdolled" ) end -local function unragdollPlayer( v ) +function ulx.unragdollPlayer( v ) v:DisallowSpawning( false ) v:SetParent() @@ -721,11 +720,11 @@ function ulx.ragdoll( calling_ply, target_plys, should_unragdoll ) elseif not v:Alive() then ULib.tsayError( calling_ply, v:Nick() .. " is dead and cannot be ragdolled!", true ) else - ragdollPlayer( v ) + ulx.ragdollPlayer( v ) table.insert( affected_plys, v ) end elseif v.ragdoll then -- Only if they're ragdolled... - unragdollPlayer( v ) + ulx.unragdollPlayer( v ) table.insert( affected_plys, v ) end end @@ -769,7 +768,7 @@ local function removeRagdollOnCleanup() local ply = players[i] if ply.ragdoll then ply.ragdollAfterCleanup = true - unragdollPlayer( ply ) + ulx.unragdollPlayer( ply ) end end end @@ -782,7 +781,7 @@ local function createRagdollAfterCleanup() if ply.ragdollAfterCleanup then ply.ragdollAfterCleanup = nil timer.Simple( 0.1, function() -- Doesn't like us re-creating the ragdoll immediately - ragdollPlayer( ply ) + ulx.ragdollPlayer( ply ) end) end end diff --git a/lua/ulx/sh_defines.lua b/lua/ulx/sh_defines.lua index 7bf30e1..d4f96c2 100644 --- a/lua/ulx/sh_defines.lua +++ b/lua/ulx/sh_defines.lua @@ -1,6 +1,6 @@ ulx.LOW_ARGS = "You did not specify enough arguments for this command. Type 'ulx help' in console for help." -ulx.version = 3.81 -- Current release version. Don't access directly, use ULib.pluginVersionStr( "ULX" ) instead. +ulx.version = 3.82 -- Current release version. Don't access directly, use ULib.pluginVersionStr( "ULX" ) instead. ulx.release = false -- Is this the release? ulx.ID_ORIGINAL = 1