diff --git a/media/lua/client/TOC/Handlers/ItemsHandler.lua b/media/lua/client/TOC/Handlers/ItemsHandler.lua index b866716..3ad7f3c 100644 --- a/media/lua/client/TOC/Handlers/ItemsHandler.lua +++ b/media/lua/client/TOC/Handlers/ItemsHandler.lua @@ -101,7 +101,7 @@ end ---@class ItemsHandler.Zombie ItemsHandler.Zombie = {} ----comment +---Set an amputation to a zombie ---@param zombie IsoZombie function ItemsHandler.Zombie.SpawnAmputationItem(zombie) -- TODO Set texture ID @@ -124,7 +124,7 @@ function ItemsHandler.Zombie.SpawnAmputationItem(zombie) end - -- TODO COnsider highest amputation + -- TODO Consider highest amputation local usableClothingAmputations = {} for i=1, #StaticData.LIMBS_STR do diff --git a/media/lua/client/TOC/Handlers/ModDataHandler.lua b/media/lua/client/TOC/Handlers/ModDataHandler.lua index a732295..9eb8e31 100644 --- a/media/lua/client/TOC/Handlers/ModDataHandler.lua +++ b/media/lua/client/TOC/Handlers/ModDataHandler.lua @@ -26,8 +26,8 @@ function ModDataHandler:new(username, isResetForced) ModData.request(key) end - o.tocData = ModData.get(key) -- TODO This is working like a placeholder at the moment, it's gonna get replaced later in reapplyTocData - + -- FIXME This is working like a placeholder at the moment, it's gonna get replaced later in reapplyTocData + o.tocData = ModData.get(key) if isResetForced or o.tocData == nil or o.tocData.limbs == nil or o.tocData.limbs.Hand_L == nil or o.tocData.limbs.Hand_L.isCut == nil then TOC_DEBUG.print("tocData in ModDataHandler for " .. username .. " is nil, creating it now") o:setup(key) @@ -290,7 +290,8 @@ function ModDataHandler.ReceiveData(key, table) end TOC_DEBUG.print("receiving data from server") - if key == "TOC_Bob" then return end -- TODO Fix this + -- During startup the game can return Bob as the player username, adding a useless ModData table + if key == "TOC_Bob" then return end TOC_DEBUG.print("receive data for " .. key) if table == {} or table == nil then @@ -300,7 +301,7 @@ function ModDataHandler.ReceiveData(key, table) -- Create ModDataHandler instance if there was none for that user and reapply the correct ModData table as a reference local username = key:sub(5) - ModDataHandler.GetInstance(username):reapplyTocData(key, table) --tocData = table -- TODO Ugly, use a setter + ModDataHandler.GetInstance(username):reapplyTocData(key, table) end Events.OnReceiveGlobalModData.Add(ModDataHandler.ReceiveData) diff --git a/media/lua/client/TOC/Handlers/PlayerHandler.lua b/media/lua/client/TOC/Handlers/PlayerHandler.lua index 14a6a60..46c9382 100644 --- a/media/lua/client/TOC/Handlers/PlayerHandler.lua +++ b/media/lua/client/TOC/Handlers/PlayerHandler.lua @@ -329,9 +329,6 @@ function ISEquipWeaponAction:isValid() local isValid = og_ISEquipWeaponAction_isValid(self) local modDataHandler = ModDataHandler.GetInstance(self.character:getUsername()) if isValid and modDataHandler:getIsAnyLimbCut() then - - -- TODO We need to consider amputating legs, this won't be correct anymore - -- TODO Cache this! local isPrimaryHandValid = not modDataHandler:getIsCut(primaryHand) or modDataHandler:getIsProstEquipped(prostTopR) local isSecondaryHandValid = not modDataHandler:getIsCut(secondaryHand) or modDataHandler:getIsProstEquipped(prostTopL) diff --git a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua index 501fad1..d8c954a 100644 --- a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -37,11 +37,6 @@ function ProsthesisHandler.GetGroup(item) return group end ----Cache the correct texture for the Health Panel for the currently equipped prosthesis -function ProsthesisHandler.SetHealthPanelTexture() - -- TODO do it -end - ---Check if a prosthesis is equippable. It depends whether the player has a cut limb or not on that specific side. There's an exception for Upper arm, obviously ---@param bodyLocation string ---@return boolean diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 040045d..30a95de 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -51,10 +51,6 @@ function Main.SetupEvents() end function Main.Initialize() - - - -- TODO In SP we should clean Global Mod Data when a player dies! - ---Looop until we've successfully initialized the mod local function TryToInitialize() local pl = getPlayer() diff --git a/media/lua/client/TOC/TimedActions/CutLimbAction.lua b/media/lua/client/TOC/TimedActions/CutLimbAction.lua index 0cc8a79..0d87126 100644 --- a/media/lua/client/TOC/TimedActions/CutLimbAction.lua +++ b/media/lua/client/TOC/TimedActions/CutLimbAction.lua @@ -39,7 +39,7 @@ function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, banda o.stopOnWalk = true o.stopOnRun = true - o.maxTime = 100 + o.maxTime = 1000 - (surgeon:getPerkLevel(Perks.Doctor) * 50) if o.character:isTimedActionInstant() then o.maxTime = 1 end return o @@ -79,6 +79,11 @@ function CutLimbAction:start() self:setActionAnim("SawLog") self:setOverrideHandModels(self.item:getStaticModel()) + -- Setup audio + self.sound = self.character:getEmitter():playSound("Amputation_Sound") + local radius = 5 + addSound(self.character, self.character:getX(), self.character:getY(), self.character:getZ(), radius, radius) + end function CutLimbAction:waitToStart() @@ -93,13 +98,30 @@ function CutLimbAction:update() self.character:setMetabolicTarget(Metabolics.HeavyWork) -- TODO Apply it too on the patient! check if it works online + -- TODO Add sound if self.character ~= self.patient then self.patient:setMetabolicTarget(Metabolics.HeavyWork) end end +function CutLimbAction:stopSound() + if self.sound then + self.character:getEmitter():stopSound(self.sound) + self.sound = nil + end +end + +function CutLimbAction:stop() + self:stopSound() + ISBaseTimedAction.stop(self) +end + function CutLimbAction:perform() + + -- Stop the sound + self:stopSound() + if self.patient == self.character then TOC_DEBUG.print("patient and surgeon are the same, executing on the client") local handler = AmputationHandler:new(self.limbName) diff --git a/media/scripts/TOC_sounds.txt b/media/scripts/TOC_sounds.txt new file mode 100644 index 0000000..48da882 --- /dev/null +++ b/media/scripts/TOC_sounds.txt @@ -0,0 +1,13 @@ +module base { + + sound Amputation_Sound { + category = Player, + loop = true, + is3D = true, + clip { + file = media/sound/Cut_sound.ogg, + distanceMax = 3, + volume = 1.0, + } + } +} \ No newline at end of file diff --git a/media/sound/Cut_sound.ogg b/media/sound/Cut_sound.ogg new file mode 100644 index 0000000..59ce2ff Binary files /dev/null and b/media/sound/Cut_sound.ogg differ