From dad01605d06b4e2949f1a1960ad052be9e31fbe2 Mon Sep 17 00:00:00 2001 From: Pao Date: Fri, 10 Feb 2023 01:30:33 +0100 Subject: [PATCH] Cleaning MP handlers --- media/AnimSets/player/aim/aim_default.xml | 8 +- media/AnimSets/player/idle/Bob_NoLegsIdle.xml | 65 ----------- media/AnimSets/player/idle/NoLegs_Idle.xml | 24 ++++ .../AnimSets/player/idle/NoLegs_IdleSneak.xml | 21 ++++ .../player/movement/Bob_NoLegsMovement.xml | 109 ------------------ .../AnimSets/player/movement/NoLegs_Walk.xml | 24 ++++ .../player/movement/NoLegs_WalkSneak.xml | 34 ++++++ media/AnimSets/player/turning/NoLegs_Turn.xml | 61 ++++++++++ .../player/turning/NoLegs_TurnIdle.xml | 45 ++++++++ .../player/turning/NoLegs_TurnIdle180.xml | 28 +++++ .../player/turning/NoLegs_TurnIdle180L.xml | 15 +++ .../player/turning/NoLegs_TurnIdle180R.xml | 18 +++ media/lua/client/TOC_ClientCommands.lua | 56 ++++----- media/lua/client/TOC_Update.lua | 1 + media/lua/server/TOC_MP_server.lua | 52 ++++----- 15 files changed, 320 insertions(+), 241 deletions(-) delete mode 100644 media/AnimSets/player/idle/Bob_NoLegsIdle.xml create mode 100644 media/AnimSets/player/idle/NoLegs_Idle.xml create mode 100644 media/AnimSets/player/idle/NoLegs_IdleSneak.xml delete mode 100644 media/AnimSets/player/movement/Bob_NoLegsMovement.xml create mode 100644 media/AnimSets/player/movement/NoLegs_Walk.xml create mode 100644 media/AnimSets/player/movement/NoLegs_WalkSneak.xml create mode 100644 media/AnimSets/player/turning/NoLegs_Turn.xml create mode 100644 media/AnimSets/player/turning/NoLegs_TurnIdle.xml create mode 100644 media/AnimSets/player/turning/NoLegs_TurnIdle180.xml create mode 100644 media/AnimSets/player/turning/NoLegs_TurnIdle180L.xml create mode 100644 media/AnimSets/player/turning/NoLegs_TurnIdle180R.xml diff --git a/media/AnimSets/player/aim/aim_default.xml b/media/AnimSets/player/aim/aim_default.xml index a89da19..5806066 100644 --- a/media/AnimSets/player/aim/aim_default.xml +++ b/media/AnimSets/player/aim/aim_default.xml @@ -1,7 +1,7 @@  aim_default - Zombie_Idle_FloorOnFront + Bob_Sit_FishingIdle 4 Y false @@ -15,21 +15,21 @@ Idle - Zombie_Idle_FloorOnFront + Bob_Sit_FishingIdle 0.3 0.3 1.2 sneakIdle - Zombie_Idle_FloorOnFront + Bob_Sit_FishingIdle 0.3 0.3 1.2 sneakIdleLow - Zombie_Idle_FloorOnFront + Bob_Sit_FishingIdle 0.3 0.3 1.2 diff --git a/media/AnimSets/player/idle/Bob_NoLegsIdle.xml b/media/AnimSets/player/idle/Bob_NoLegsIdle.xml deleted file mode 100644 index dcb318e..0000000 --- a/media/AnimSets/player/idle/Bob_NoLegsIdle.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - Bob_NoLegsIdle - Zombie_Idle_FloorOnFront - Y - 0.48 - 0.20 - - IsCrawling - BOOL - true - - IdleSpeed - IdleSpeed - - Zombie_Idle_FloorOnFront - 0.00 - 0.00 - 0.80 - - - Zombie_Idle_FloorOnFront - 0.00 - 1.00 - 0.80 - - - Zombie_Idle_FloorOnFront - 0.00 - 0.04 - 0.80 - - - 1 - 2 - 3 - - - aim_default - Zombie_Idle_FloorOnFront - 0.5 - 1.5 - - - defaultWalk - 0.3 - 0.3 - - isTurningAround - BOOL - false - - - - defaultRun - Zombie_Idle_FloorOnFront - 0.1 - 0.1 - - isTurningAround - BOOL - false - - - \ No newline at end of file diff --git a/media/AnimSets/player/idle/NoLegs_Idle.xml b/media/AnimSets/player/idle/NoLegs_Idle.xml new file mode 100644 index 0000000..af32f14 --- /dev/null +++ b/media/AnimSets/player/idle/NoLegs_Idle.xml @@ -0,0 +1,24 @@ + + + NoLegs_Idle + Bob_Sit_FishingIdle + Translation_Data + Y + true + 0.8 + 0.20 + + IsCrawling + BOOL + true + + + NoLegs_IdleSneak + 0.1 + + + NoLegs_Idle + 0.35 + 0.35 + + diff --git a/media/AnimSets/player/idle/NoLegs_IdleSneak.xml b/media/AnimSets/player/idle/NoLegs_IdleSneak.xml new file mode 100644 index 0000000..9816218 --- /dev/null +++ b/media/AnimSets/player/idle/NoLegs_IdleSneak.xml @@ -0,0 +1,21 @@ + + + NoLegs_IdleSneak + Bob_ScrambleFloorIdle + true + Y + false + true + 0.8 + 0.20 + + IsCrawling + BOOL + true + + + sneaking + BOOL + true + + \ No newline at end of file diff --git a/media/AnimSets/player/movement/Bob_NoLegsMovement.xml b/media/AnimSets/player/movement/Bob_NoLegsMovement.xml deleted file mode 100644 index 3989830..0000000 --- a/media/AnimSets/player/movement/Bob_NoLegsMovement.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - defaultWalk - Zombie_Crawl - Translation_Data - Y - 1.04 - 0.20 - - IsCrawling - BOOL - true - - - WalkInjury - WalkSpeed - - Zombie_Crawl - 0.50 - 1.00 - 0.80 - - - Zombie_Crawl - -0.50 - 1.00 - 0.80 - - - Zombie_Crawl - 1.00 - 1.00 - 0.80 - - - Zombie_Crawl - -1.00 - 1.00 - 0.80 - - - Zombie_Crawl - 0.00 - 1.00 - 0.80 - - - Zombie_Crawl - 0.00 - 0.00 - 0.80 - - - 2 - 4 - 6 - - - 5 - 2 - 6 - - - 6 - 1 - 5 - - - 6 - 3 - 1 - - - Bob_NoLegsIdle - 0.3 - 1 - - - Bob_NoLegsIdle - Zombie_Crawl - 0.3 - 0.3 - - DeltaY - GTR - -0.5 - - - isMoving - BOOL - false - - - - Bob_NoLegsIdle - 0.1 - - - - Footstep - 0.15 - walk - - - Footstep - 0.6 - walk - - \ No newline at end of file diff --git a/media/AnimSets/player/movement/NoLegs_Walk.xml b/media/AnimSets/player/movement/NoLegs_Walk.xml new file mode 100644 index 0000000..d976510 --- /dev/null +++ b/media/AnimSets/player/movement/NoLegs_Walk.xml @@ -0,0 +1,24 @@ + + + NoLegs_Walk + Bob_Crawl + Y + true + 1.5 + 0.20 + + IsCrawling + BOOL + true + + + Footstep + 0.15 + walk + + + Footstep + 0.6 + walk + + diff --git a/media/AnimSets/player/movement/NoLegs_WalkSneak.xml b/media/AnimSets/player/movement/NoLegs_WalkSneak.xml new file mode 100644 index 0000000..f87d216 --- /dev/null +++ b/media/AnimSets/player/movement/NoLegs_WalkSneak.xml @@ -0,0 +1,34 @@ + + + NoLegs_WalkSneak + Zombie_CrawlUnder + Translation_Data + true + 1.5 + 0.20 + + IsCrawling + BOOL + true + + + sneaking + BOOL + true + + + inTrees + BOOL + false + + + Footstep + 0.15 + sneak_walk + + + Footstep + 0.6 + sneak_walk + + diff --git a/media/AnimSets/player/turning/NoLegs_Turn.xml b/media/AnimSets/player/turning/NoLegs_Turn.xml new file mode 100644 index 0000000..85c6024 --- /dev/null +++ b/media/AnimSets/player/turning/NoLegs_Turn.xml @@ -0,0 +1,61 @@ + + + NoLegs_Turn + Bip01 + Y + true + 0.80 + 0.10 + 0.20 + + IsCrawling + BOOL + true + + + + + isTurning + BOOL + true + + + Bip01_Pelvis + false + + + Bip01_Spine + false + + + Bip01_BackPack + + + Bip01_DressFront + + + Bip01_DressBack + + + Bip01_L_Thigh + + + Bip01_R_Thigh + + + Bip01 + false + + + Translation_Data + false + + + Bip01_Prop1 + 0.00 + + + Bip01_Prop2 + 0.00 + + \ No newline at end of file diff --git a/media/AnimSets/player/turning/NoLegs_TurnIdle.xml b/media/AnimSets/player/turning/NoLegs_TurnIdle.xml new file mode 100644 index 0000000..ebbe1ce --- /dev/null +++ b/media/AnimSets/player/turning/NoLegs_TurnIdle.xml @@ -0,0 +1,45 @@ + + + NoLegs_TurnIdle + false + true + 0.10 + + + IsCrawling + BOOL + true + + + + isMoving + BOOL + false + + + + + Aim + BOOL + false + + + Idle + 0.1 + + + + 0.25 + + + 0.20 + + + + + + + + + + \ No newline at end of file diff --git a/media/AnimSets/player/turning/NoLegs_TurnIdle180.xml b/media/AnimSets/player/turning/NoLegs_TurnIdle180.xml new file mode 100644 index 0000000..6515cb2 --- /dev/null +++ b/media/AnimSets/player/turning/NoLegs_TurnIdle180.xml @@ -0,0 +1,28 @@ + + + NoLegs_TurnIdle180 + + + + IsCrawling + BOOL + true + + + + isTurningAround + BOOL + true + + + + 0.00 + + + + + + + + + \ No newline at end of file diff --git a/media/AnimSets/player/turning/NoLegs_TurnIdle180L.xml b/media/AnimSets/player/turning/NoLegs_TurnIdle180L.xml new file mode 100644 index 0000000..6370623 --- /dev/null +++ b/media/AnimSets/player/turning/NoLegs_TurnIdle180L.xml @@ -0,0 +1,15 @@ + + + NoLegs_turnIdle180L + Bob_Crawl + + IsCrawling + BOOL + true + + + twist + LESS + 0 + + \ No newline at end of file diff --git a/media/AnimSets/player/turning/NoLegs_TurnIdle180R.xml b/media/AnimSets/player/turning/NoLegs_TurnIdle180R.xml new file mode 100644 index 0000000..d219ba7 --- /dev/null +++ b/media/AnimSets/player/turning/NoLegs_TurnIdle180R.xml @@ -0,0 +1,18 @@ + + + NoLegs_TurnIdle180R + Bob_EmoteWaveBye + + + + + IsCrawling + BOOL + true + + + twist + GTR + 0 + + \ No newline at end of file diff --git a/media/lua/client/TOC_ClientCommands.lua b/media/lua/client/TOC_ClientCommands.lua index cab9740..4332b63 100644 --- a/media/lua/client/TOC_ClientCommands.lua +++ b/media/lua/client/TOC_ClientCommands.lua @@ -5,7 +5,7 @@ local ServerCommands = {} -ServerCommands["ResponseCanAct"] = function(arg) +ServerCommands.ResponseCanAct = function(arg) print("TOC: ResponseCanAct") @@ -21,7 +21,7 @@ end -ServerCommands["CanCutLimb"] = function(arg) +ServerCommands.CanCutLimb = function(arg) local part_name = arg["toSend"] arg["To"] = arg["From"] @@ -31,21 +31,14 @@ ServerCommands["CanCutLimb"] = function(arg) sendClientCommand("TOC", "SendServer", arg) end -ServerCommands["CutLimb"] = function(arg) - local arg = arg["toSend"] - --local surgeon_id = arg[5] - - -- Disable the sound coming from the surgeon - --getPlayerByOnlineID(surgeon_id):getEmitter():stopSoundByName("Amputation_Sound") - - - - TocCutLimb(arg[1], arg[2], arg[3], arg[4]) +ServerCommands.CutLimb = function(arg) + local data = arg["toSend"] + TocCutLimb(data[1], data[2], data[3], data[4]) end -ServerCommands["CanOperateLimb"] = function(arg) +ServerCommands.CanOperateLimb = function(arg) local part_name = arg["toSend"] arg["To"] = arg["From"] @@ -54,13 +47,14 @@ ServerCommands["CanOperateLimb"] = function(arg) arg["toSend"] = { part_name, "Operate", CheckIfCanBeOperated(part_name) } sendClientCommand("TOC", "SendServer", arg) end -ServerCommands["OperateLimb"] = function(arg) - local arg = arg["toSend"] - TocOperateLimb(arg[1], arg[2], arg[3]) +ServerCommands.OperateLimb = function(arg) + + local data = arg["toSend"] + TocOperateLimb(data[1], data[2], data[3]) end -ServerCommands["CanEquipProsthesis"] = function(arg) +ServerCommands.CanEquipProsthesis = function(arg) local part_name = arg["toSend"] --local item = arg["toSend"][2] -- TODO Add item prosth here @@ -71,19 +65,18 @@ ServerCommands["CanEquipProsthesis"] = function(arg) sendClientCommand("TOC", "SendServer", arg) end -ServerCommands["EquipProsthesis"] = function(arg) +ServerCommands.EquipProsthesis = function(arg) -- part_name = arg[1] -- prosthesis = arg[2] - local arg = arg["toSend"] - - TocEquipProsthesis(arg[1], arg[2]) + local data = arg["toSend"] + TocEquipProsthesis(data[1], data[2]) end -ServerCommands["CanUnequipProsthesis"] = function(arg) +ServerCommands.CanUnequipProsthesis = function(arg) local part_name = arg["toSend"] arg["To"] = arg["From"] arg["From"] = getPlayer():getOnlineID() @@ -91,19 +84,18 @@ ServerCommands["CanUnequipProsthesis"] = function(arg) arg["toSend"] = { part_name, "Unequip", CheckIfProsthesisCanBeUnequipped(part_name)} sendClientCommand("TOC", "SendServer", arg) end -ServerCommands["UnequipProsthesis"] = function(arg) +ServerCommands.UnequipProsthesis = function(arg) -- part_name = arg[1] - local arg = arg["toSend"] - - TheOnlyCure.TocUnequipProsthesis(arg[1], arg[2]) + local data = arg["toSend"] + TheOnlyCure.TocUnequipProsthesis(data[1], data[2]) end -ServerCommands["CanResetEverything"] = function(arg) +ServerCommands.CanResetEverything = function(arg) local part_name = "RightHand" --useless arg["To"] = arg["From"] @@ -112,22 +104,20 @@ ServerCommands["CanResetEverything"] = function(arg) arg["toSend"] = { part_name, "Cut", true } sendClientCommand("TOC", "SendServer", arg) end -ServerCommands["ResetEverything"] = function(_) +ServerCommands.ResetEverything = function(_) TocResetEverything() end -- Used when amputating the limb of another player -ServerCommands["AcceptDamageOtherPlayer"] = function(arg) - - local patient_id = arg[1] +ServerCommands.AcceptDamageOtherPlayer = function(arg) local patient = getPlayerByOnlineID(arg[1]) local part_name = arg[2] TocDamagePlayerDuringAmputation(patient, part_name) end -- Used to propagate animation changes after amputating a foot -ServerCommands["SetCrawlAnimation"] = function(args) +ServerCommands.SetCrawlAnimation = function(args) local player = getPlayerByOnlineID(args.id) local check = args.check @@ -137,7 +127,7 @@ ServerCommands["SetCrawlAnimation"] = function(args) end -- Used to propagate the stop of the sound of amputation -ServerCommands["StopAmputationSound"] = function(args) +ServerCommands.StopAmputationSound = function(args) local player = getPlayerByOnlineID(args.surgeon_id) player:getEmitter():stopSoundByName("Amputation_Sound") diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index 6ae662f..8931761 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -249,6 +249,7 @@ local function TocUpdateEveryOneMinute() -- Sends only Limbs since the other stuff is mostly static if toc_data ~= nil then -- FIXME Send little packets instead of the whole thing? + -- TODO we shouldn't run this if we're in SP I guess? sendClientCommand(player, 'TOC', 'ChangePlayerState', { toc_data.Limbs } ) end diff --git a/media/lua/server/TOC_MP_server.lua b/media/lua/server/TOC_MP_server.lua index 0287916..fc2ddc4 100644 --- a/media/lua/server/TOC_MP_server.lua +++ b/media/lua/server/TOC_MP_server.lua @@ -1,21 +1,18 @@ ---- A rly big thx to Fenris_Wolf and Chuck to help me with that. Love you guy ----Server side -local TOC_Commands = {} +local ClientCommands = {} --- TODO rework this -TOC_Commands.SendServer = function(player, arg) +-- Main handler of base functions for TOC, not changed till now 'cause it works +ClientCommands.SendServer = function(player, arg) local otherPlayer = getPlayerByOnlineID(arg["To"]) sendServerCommand(otherPlayer, "TOC", arg["command"], arg) end - --- Cut Limb stuff -TOC_Commands["AskDamageOtherPlayer"] = function(_, arg) +-- Cutting Limbs +ClientCommands.AskDamageOtherPlayer = function(_, arg) local patient = getPlayerByOnlineID(arg[1]) local patient_id = arg[1] @@ -25,9 +22,16 @@ TOC_Commands["AskDamageOtherPlayer"] = function(_, arg) end +ClientCommands.AskStopAmputationSound = function(_, args) --------- ANIMATIONS -TOC_Commands["NotifyNewCrawlAnimation"] = function(player, args) + print("TOC: We're in AskStopAmputationSound") + sendServerCommand("TOC", "StopAmputationSound", {surgeon_id = args.surgeon_id}) + + +end + +-- Animations +ClientCommands.NotifyNewCrawlAnimation = function(player, args) sendServerCommand("TOC", "SetCrawlAnimation", {id = args.id, check = args.check}) @@ -36,22 +40,15 @@ end --- CHEATING STUFF -TOC_Commands["AskToResetEverything"] = function(_, arg) +-- Cheats +ClientCommands.AskToResetEverything = function(_, arg) local clicked_player = getPlayerByOnlineID(arg[1]) sendServerCommand(clicked_player, "TOC", "ResetEverything", {}) end -TOC_Commands.AskStopAmputationSound = function(_, args) - - print("TOC: We're in AskStopAmputationSound") - sendServerCommand("TOC", "StopAmputationSound", {surgeon_id = args.surgeon_id}) - - -end - -TOC_Commands.ChangePlayerState = function(playerObj, args) +-- Global Mod Data data handler +ClientCommands.ChangePlayerState = function(playerObj, args) ModData.get("TOC_PLAYER_DATA")[playerObj:getUsername()] = args ModData.transmit("TOC_PLAYER_DATA") end @@ -68,17 +65,12 @@ Events.OnInitGlobalModData.Add(TOC_OnInitGlobalModData) ------------------------------------------------------ - - -TOC_Commands.OnClientCommand = function(module, command, playerObj, args) - - print("TOC: Running ClientCommand " .. command) - if module == 'TOC' and TOC_Commands[command] then - TOC_Commands[command](playerObj, args) +local function OnClientCommand(module, command, playerObj, args) + if module == 'TOC' and ClientCommands[command] then + ClientCommands[command](playerObj, args) end end - -Events.OnClientCommand.Add(TOC_Commands.OnClientCommand) +Events.OnClientCommand.Add(OnClientCommand)