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