Fixes
This commit is contained in:
@@ -24,7 +24,11 @@ function AmputationHandler:new(limbName, surgeonPl)
|
||||
|
||||
o.patientPl = getPlayer()
|
||||
o.limbName = limbName
|
||||
o.bodyPartType = BodyPartType[self.limbName]
|
||||
o.bodyPartType = BodyPartType[limbName]
|
||||
|
||||
-- TOC_DEBUG.print("limbName = " .. o.limbName)
|
||||
-- TOC_DEBUG.print("bodyPartType = " .. tostring(o.bodyPartType))
|
||||
|
||||
if surgeonPl then
|
||||
o.surgeonPl = surgeonPl
|
||||
else
|
||||
@@ -38,26 +42,10 @@ end
|
||||
|
||||
--* Main methods *--
|
||||
|
||||
---Starts bleeding from the point where the saw is being used. Static since this could be used for online
|
||||
---comment
|
||||
---@param patientPl IsoPlayer
|
||||
---@param bodyPartType BodyPartType
|
||||
function AmputationHandler.DamageDuringAmputation(patientPl, bodyPartType)
|
||||
TOC_DEBUG.print("damage patient")
|
||||
local bodyDamage = patientPl:getBodyDamage()
|
||||
local bodyDamagePart = bodyDamage:getBodyPart(bodyPartType)
|
||||
|
||||
bodyDamagePart:setBleeding(true)
|
||||
bodyDamagePart:setCut(true)
|
||||
bodyDamagePart:setBleedingTime(ZombRand(10, 20))
|
||||
|
||||
|
||||
|
||||
end
|
||||
function AmputationHandler:damageDuringAmputation()
|
||||
TOC_DEBUG.print("damage patient")
|
||||
local bodyDamage = self.patientPl:getBodyDamage()
|
||||
local bodyDamagePart = bodyDamage:getBodyPart(self.bodyPartType)
|
||||
TOC_DEBUG.print("damage patient - " .. tostring(self.bodyPartType))
|
||||
|
||||
bodyDamagePart:setBleeding(true)
|
||||
bodyDamagePart:setCut(true)
|
||||
|
||||
@@ -76,19 +76,15 @@ end
|
||||
|
||||
---@param context ISContextMenu
|
||||
function CutLimbHandler:addToMenu(context)
|
||||
--local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
--if #types > 0 then
|
||||
local option = context:addOption(getText("ContextMenu_Amputate"), nil)
|
||||
local subMenu = context:getNew(context)
|
||||
context:addSubMenu(option, subMenu)
|
||||
for i = 1, #StaticData.LIMBS_STRINGS do
|
||||
local limbName = StaticData.LIMBS_STRINGS[i]
|
||||
|
||||
--TOC_DEBUG.print("addToMenu running")
|
||||
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
||||
--TOC_DEBUG.print(limbName)
|
||||
if StaticData.BODYPARTSTYPES_ENUM[limbName] then
|
||||
if not ModDataHandler.GetInstance():getIsCut(limbName) then
|
||||
local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName)
|
||||
subMenu:addOption(limbTranslatedName, self.onMenuOptionSelected, nil)
|
||||
context:addOption(getText("ContextMenu_Amputate"), self, self.onMenuOptionSelected)
|
||||
end
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
function CutLimbHandler:dropItems(items)
|
||||
@@ -101,17 +97,17 @@ function CutLimbHandler:dropItems(items)
|
||||
end
|
||||
|
||||
function CutLimbHandler:isValid(itemType)
|
||||
return self:getItemOfType(self.items.ITEMS, itemType)
|
||||
return true -- TODO Workaround for now
|
||||
end
|
||||
|
||||
function CutLimbHandler:perform(previousAction, itemType)
|
||||
TOC_DEBUG.print("perform CutLimbHandler")
|
||||
local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
previousAction = self:toPlayerInventory(item, previousAction)
|
||||
--local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
--previousAction = self:toPlayerInventory(item, previousAction)
|
||||
|
||||
local limbName = BodyPartType.getDisplayName(self.bodyPart:getType()) -- TODO Test this
|
||||
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
||||
TOC_DEBUG.print("perform CutLimbHandler on " .. limbName)
|
||||
local action = CutLimbAction:new(self:getPatient(), self:getDoctor(), limbName)
|
||||
ISTimedActionQueue.addAfter(previousAction, action)
|
||||
ISTimedActionQueue.add(action)
|
||||
end
|
||||
|
||||
return CutLimbHandler
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||
---------------
|
||||
|
||||
@@ -27,7 +27,7 @@ local function AddOvenContextMenu(playerNum, context, worldObjects, test)
|
||||
local pl = getSpecificPlayer(playerNum)
|
||||
|
||||
if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end
|
||||
local amputatedLimbs = PlayerHandler.GetAmputatedLimbs()
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||
|
||||
local stoveObj = nil
|
||||
for _, obj in pairs(worldObjects) do
|
||||
|
||||
Reference in New Issue
Block a user