From 65ca3d285ed968495c5963151fde5460744e568c Mon Sep 17 00:00:00 2001 From: Pao Date: Thu, 9 Feb 2023 22:13:51 +0100 Subject: [PATCH] working no foot animations in mp --- media/lua/client/TOC_Animations.lua | 20 +++++++------------- media/lua/client/TOC_ClientCommands.lua | 10 ++-------- media/lua/server/TOC_MP_server.lua | 6 ++---- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/media/lua/client/TOC_Animations.lua b/media/lua/client/TOC_Animations.lua index 4d2d787..766d32a 100644 --- a/media/lua/client/TOC_Animations.lua +++ b/media/lua/client/TOC_Animations.lua @@ -1,23 +1,17 @@ -- Thanks to Glytcher and Matías N. Salas for helping out with this - - - - function SetMissingFootAnimation(check) local player = getPlayer() - - if check then - player:setVariable("IsCrawling", "true") - else - player:setVariable("IsCrawling", "false") - end + player:setVariable("IsCrawling", tostring(check)) - -- if isClient() then - -- sendClientCommand("TOC", "SetCrawlAnimation", {}) - -- end + if not isServer() and not isClient() then + print("SP, so it's fine") + else + + sendClientCommand(player, "TOC", "NotifyNewCrawlAnimation", {id = player:getOnlineID(), check = check}) + end end diff --git a/media/lua/client/TOC_ClientCommands.lua b/media/lua/client/TOC_ClientCommands.lua index 9d2a70d..cab9740 100644 --- a/media/lua/client/TOC_ClientCommands.lua +++ b/media/lua/client/TOC_ClientCommands.lua @@ -129,16 +129,10 @@ end -- Used to propagate animation changes after amputating a foot ServerCommands["SetCrawlAnimation"] = function(args) - local source = getPlayer() local player = getPlayerByOnlineID(args.id) + local check = args.check - if source ~= player then - if args.hasInjury then - player:setVariable('SetCrawlAnimation', 'true'); - else - player:setVariable('SetCrawlAnimation', 'false'); - end - end + player:setVariable('IsCrawling', tostring(check)) end diff --git a/media/lua/server/TOC_MP_server.lua b/media/lua/server/TOC_MP_server.lua index 8d5568e..0287916 100644 --- a/media/lua/server/TOC_MP_server.lua +++ b/media/lua/server/TOC_MP_server.lua @@ -27,11 +27,9 @@ end -------- ANIMATIONS -TOC_Commands["SetCrawlAnimation"] = function(player, args) +TOC_Commands["NotifyNewCrawlAnimation"] = function(player, args) - local player_id = player:getOnlineID() - - sendServerCommand(player, "TOC", "SetCrawlAnimation", {}) + sendServerCommand("TOC", "SetCrawlAnimation", {id = args.id, check = args.check}) end