Readded amputation sound

This commit is contained in:
ZioPao
2023-11-21 02:25:49 +01:00
parent 0d3b82aee3
commit 74508a9ed1
8 changed files with 43 additions and 19 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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()

View File

@@ -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)

View File

@@ -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,
}
}
}

BIN
media/sound/Cut_sound.ogg Normal file

Binary file not shown.