More cleaning, fixing up interactions
This commit is contained in:
@@ -7,7 +7,6 @@ local CommonMethods = require("TOC/CommonMethods")
|
||||
local ItemsController = {}
|
||||
|
||||
|
||||
|
||||
--* Player Methods *--
|
||||
---@class ItemsController.Player
|
||||
ItemsController.Player = {}
|
||||
|
||||
@@ -215,7 +215,6 @@ function LocalPlayerController.UpdateAmputations()
|
||||
end
|
||||
|
||||
local pl = LocalPlayerController.playerObj
|
||||
local bd = pl:getBodyDamage()
|
||||
local visual = pl:getHumanVisual()
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||
local needsUpdate = false
|
||||
@@ -227,26 +226,16 @@ function LocalPlayerController.UpdateAmputations()
|
||||
if not isCicatrized then
|
||||
needsUpdate = true
|
||||
local cicTime = dcInst:getCicatrizationTime(limbName)
|
||||
TOC_DEBUG.print("updating cicatrization for " .. tostring(limbName))
|
||||
TOC_DEBUG.print("Updating cicatrization for " .. tostring(limbName))
|
||||
|
||||
-- TODO Check if bandaged, sutured, whatever
|
||||
-- TODO Clean
|
||||
-- TODO Check dirtyness of zone and add to it
|
||||
--* Dirtyness of the wound
|
||||
|
||||
--local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
|
||||
|
||||
-- TODO Workaround
|
||||
-- We need to get the BloodBodyPartType to find out how dirty the zone is
|
||||
local bbptEnum = BloodBodyPartType[limbName]
|
||||
--local bodyPart = bd:getBodyPart(bptEnum)
|
||||
|
||||
local modifier = 0.01 * SandboxVars.TOC.WoundDirtynessMultiplier
|
||||
|
||||
--------------
|
||||
-- TEST SECTION
|
||||
|
||||
|
||||
local dirtynessVis = visual:getDirt(bbptEnum) + visual:getBlood(bbptEnum)
|
||||
local dirtynessWound = dcInst:getWoundDirtyness(limbName) + modifier
|
||||
--------------
|
||||
|
||||
local dirtyness = dirtynessVis + dirtynessWound
|
||||
|
||||
@@ -255,12 +244,17 @@ function LocalPlayerController.UpdateAmputations()
|
||||
end
|
||||
|
||||
dcInst:setWoundDirtyness(limbName, dirtyness)
|
||||
TOC_DEBUG.print("Dirtyness for this zone: " .. tostring(dirtyness))
|
||||
|
||||
--* Cicatrization
|
||||
|
||||
local cicDec = SandboxVars.TOC.CicatrizationSpeed - dirtyness
|
||||
if cicDec <= 0 then cicDec = 0.1 end
|
||||
cicTime = cicTime - cicDec
|
||||
|
||||
TOC_DEBUG.print("dirtyness for this zone: " .. tostring(dirtyness))
|
||||
|
||||
cicTime = cicTime - SandboxVars.TOC.CicatrizationSpeed
|
||||
dcInst:setCicatrizationTime(limbName, cicTime)
|
||||
TOC_DEBUG.print("new cicatrization time: " .. tostring(cicTime))
|
||||
TOC_DEBUG.print("New cicatrization time: " .. tostring(cicTime))
|
||||
if cicTime <= 0 then
|
||||
TOC_DEBUG.print(tostring(limbName) .. " is cicatrized")
|
||||
dcInst:setIsCicatrized(limbName, true)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local StaticData = require("TOC/StaticData")
|
||||
local DataController = require("TOC/Controllers/DataController")
|
||||
|
||||
local StaticData = require("TOC/StaticData")
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
---------------------------
|
||||
|
||||
@@ -23,7 +24,6 @@ function CachedDataHandler.CalculateAmputatedLimbs(username)
|
||||
CachedDataHandler.amputatedLimbs[username] = {}
|
||||
local dcInst = DataController.GetInstance(username)
|
||||
|
||||
-- TODO If the data hasn't arrived, this won't work
|
||||
for i=1, #StaticData.LIMBS_STR do
|
||||
local limbName = StaticData.LIMBS_STR[i]
|
||||
if dcInst:getIsCut(limbName) then
|
||||
|
||||
@@ -22,17 +22,9 @@ end
|
||||
---@param item InventoryItem
|
||||
---@return string
|
||||
function ProsthesisHandler.GetGroup(item)
|
||||
|
||||
local bodyLocation = item:getBodyLocation()
|
||||
local side = CommonMethods.GetSide(bodyLocation)
|
||||
local index
|
||||
|
||||
if bodyLocation:contains(bodyLocArmProst) then
|
||||
index = "Top_" .. side
|
||||
else
|
||||
index = "Bottom_" .. side
|
||||
end
|
||||
|
||||
local index = bodyLocation:contains(bodyLocArmProst) and "Top_" .. side or "Bottom_" .. side
|
||||
local group = StaticData.PROSTHESES_GROUPS_IND_STR[index]
|
||||
return group
|
||||
end
|
||||
@@ -41,15 +33,15 @@ end
|
||||
---@param bodyLocation string
|
||||
---@return boolean
|
||||
function ProsthesisHandler.CheckIfEquippable(bodyLocation)
|
||||
TOC_DEBUG.print("current item is a prosthesis")
|
||||
TOC_DEBUG.print("Current item is a prosthesis")
|
||||
local side = CommonMethods.GetSide(bodyLocation)
|
||||
TOC_DEBUG.print("checking side: " .. tostring(side))
|
||||
TOC_DEBUG.print("Checking side: " .. tostring(side))
|
||||
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(getPlayer():getUsername())
|
||||
for k, _ in pairs(amputatedLimbs) do
|
||||
local limbName = k
|
||||
if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then
|
||||
TOC_DEBUG.print("found acceptable limb to use prosthesis")
|
||||
TOC_DEBUG.print("Found acceptable limb to use prosthesis")
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -66,20 +58,12 @@ function ProsthesisHandler.SearchAndSetupProsthesis(item, isEquipping)
|
||||
if not ProsthesisHandler.CheckIfProst(item) then return end
|
||||
|
||||
local group = ProsthesisHandler.GetGroup(item)
|
||||
TOC_DEBUG.print("applying prosthesis stuff for " .. group)
|
||||
TOC_DEBUG.print("Applying prosthesis stuff for " .. group)
|
||||
local dcInst = DataController.GetInstance()
|
||||
dcInst:setIsProstEquipped(group, isEquipping)
|
||||
dcInst:apply()
|
||||
|
||||
end
|
||||
|
||||
|
||||
-------------------------
|
||||
--* Events *--
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------
|
||||
--* Overrides *--
|
||||
|
||||
@@ -136,7 +120,6 @@ function ISClothingExtraAction:isValid()
|
||||
return isEquippable
|
||||
end
|
||||
|
||||
|
||||
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
|
||||
function ISClothingExtraAction:perform()
|
||||
og_ISClothingExtraAction_perform(self)
|
||||
@@ -150,5 +133,4 @@ function ISUnequipAction:perform()
|
||||
end
|
||||
|
||||
|
||||
|
||||
return ProsthesisHandler
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
local DataController = require("TOC/Controllers/DataController")
|
||||
|
||||
---@class SurgeryHandler
|
||||
---@field type string
|
||||
---@field limbName string
|
||||
local SurgeryHandler = {}
|
||||
|
||||
function SurgeryHandler:new(type, limbName)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
|
||||
-- TODO use getjob for this
|
||||
o.type = type
|
||||
o.limbName = limbName
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
|
||||
-- TODO Should we consider stitching as "operating?"
|
||||
|
||||
function SurgeryHandler:execute()
|
||||
if self.type == "needle" then
|
||||
-- TODO
|
||||
end
|
||||
|
||||
|
||||
if self.type == "oven" then
|
||||
DataController.GetInstance():setIsCauterized(self.limbName, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Cauterize
|
||||
|
||||
|
||||
-- Needle and stitching (scrap surgery kits and crap like that)
|
||||
|
||||
|
||||
|
||||
|
||||
return SurgeryHandler
|
||||
@@ -1,10 +1,41 @@
|
||||
local DataController = require("TOC/Controllers/DataController")
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
----
|
||||
--------------------
|
||||
|
||||
---@class CleanWoundAction : ISBaseTimedAction
|
||||
---@field doctor IsoPlayer
|
||||
---@field otherPlayer IsoPlayer
|
||||
---@field bandage InventoryItem
|
||||
---@field bodyPart any
|
||||
local CleanWoundAction = ISBaseTimedAction:derive("CleanWoundAction")
|
||||
|
||||
---@param doctor IsoPlayer
|
||||
---@param otherPlayer IsoPlayer
|
||||
---@param bandage InventoryItem
|
||||
---@param bodyPart any
|
||||
---@return CleanWoundAction
|
||||
function CleanWoundAction:new(doctor, otherPlayer, bandage, bodyPart)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.character = doctor
|
||||
o.otherPlayer = otherPlayer
|
||||
o.doctorLevel = doctor:getPerkLevel(Perks.Doctor)
|
||||
o.bodyPart = bodyPart
|
||||
o.bandage = bandage
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
o.bandagedPlayerX = otherPlayer:getX()
|
||||
o.bandagedPlayerY = otherPlayer:getY()
|
||||
o.maxTime = 250 - (o.doctorLevel * 6)
|
||||
if doctor:isTimedActionInstant() then
|
||||
o.maxTime = 1
|
||||
end
|
||||
if doctor:getAccessLevel() ~= "None" then
|
||||
o.doctorLevel = 10
|
||||
end
|
||||
return o
|
||||
end
|
||||
function CleanWoundAction:isValid()
|
||||
if ISHealthPanel.DidPatientMove(self.character, self.otherPlayer, self.bandagedPlayerX, self.bandagedPlayerY) then
|
||||
return false
|
||||
@@ -52,26 +83,24 @@ function CleanWoundAction:perform()
|
||||
ISBaseTimedAction.perform(self)
|
||||
|
||||
if self.character:HasTrait("Hemophobic") then
|
||||
self.character:getStats():setPanic(self.character:getStats():getPanic() + 50)
|
||||
self.character:getStats():setPanic(self.character:getStats():getPanic() + 15)
|
||||
end
|
||||
|
||||
self.character:getXp():AddXP(Perks.Doctor, 10)
|
||||
local addPain = (60 - (self.doctorLevel * 1))
|
||||
self.bodyPart:setAdditionalPain(self.bodyPart:getAdditionalPain() + addPain)
|
||||
--self.bodyPart:setNeedBurnWash(false)
|
||||
self.bandage:Use()
|
||||
|
||||
-- TODO Use Water too
|
||||
|
||||
if isClient() then
|
||||
--sendCleanBurn(self.character, self.otherPlayer, self.bodyPart, self.bandage)
|
||||
end
|
||||
|
||||
local limbName = CommonMethods.GetLimbNameFromBodyPart(self.bodyPart)
|
||||
|
||||
-- TODO CHeck if correct in MP
|
||||
local dcInst = DataController.GetInstance(self.otherPlayer:getUsername())
|
||||
dcInst:setWoundDirtyness(limbName, 0)
|
||||
|
||||
local currentWoundDirtyness = dcInst:getWoundDirtyness(limbName)
|
||||
local newWoundDirtyness = currentWoundDirtyness - (self.bandage:getBandagePower() * 10)
|
||||
if newWoundDirtyness < 0 then newWoundDirtyness = 0 end
|
||||
|
||||
dcInst:setWoundDirtyness(limbName, newWoundDirtyness)
|
||||
|
||||
|
||||
-- Clean visual
|
||||
@@ -85,29 +114,4 @@ function CleanWoundAction:perform()
|
||||
ISHealthPanel.setBodyPartActionForPlayer(self.otherPlayer, self.bodyPart, nil, nil, nil)
|
||||
end
|
||||
|
||||
---@return CleanWoundAction
|
||||
function CleanWoundAction:new(doctor, otherPlayer, bandage, bodyPart)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.character = doctor
|
||||
o.otherPlayer = otherPlayer
|
||||
o.doctorLevel = doctor:getPerkLevel(Perks.Doctor)
|
||||
o.bodyPart = bodyPart
|
||||
o.bandage = bandage
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
o.bandagedPlayerX = otherPlayer:getX()
|
||||
o.bandagedPlayerY = otherPlayer:getY()
|
||||
o.maxTime = 250 - (o.doctorLevel * 6)
|
||||
if doctor:isTimedActionInstant() then
|
||||
o.maxTime = 1
|
||||
end
|
||||
if doctor:getAccessLevel() ~= "None" then
|
||||
o.doctorLevel = 10
|
||||
end
|
||||
return o
|
||||
end
|
||||
|
||||
|
||||
return CleanWoundAction
|
||||
@@ -2,8 +2,8 @@ local StaticData = require("TOC/StaticData")
|
||||
local DataController = require("TOC/Controllers/DataController")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
|
||||
local CutLimbHandler = require("TOC/UI/Interactions/CutLimbHandler")
|
||||
local WoundCleaningHandler = require("TOC/UI/Interactions/WoundCleaningHandler")
|
||||
local CutLimbInteractionHandler = require("TOC/UI/Interactions/CutLimbInteractionHandler")
|
||||
local WoundCleaningInteractionHandler = require("TOC/UI/Interactions/WoundCleaningInteractionHandler")
|
||||
------------------------
|
||||
|
||||
|
||||
@@ -30,11 +30,14 @@ function ISHealthPanel:dropItemsOnBodyPart(bodyPart, items)
|
||||
og_ISHealthPanel_dropItemsOnBodyPart(self, bodyPart, items)
|
||||
|
||||
TOC_DEBUG.print("override to dropItemsOnBodyPart running")
|
||||
local cutLimbHandler = CutLimbHandler:new(self, bodyPart)
|
||||
local cutLimbInteraction = CutLimbInteractionHandler:new(self, bodyPart)
|
||||
local woundCleaningInteraction = WoundCleaningInteractionHandler:new(self, bodyPart, self.character:getUsername())
|
||||
|
||||
for _,item in ipairs(items) do
|
||||
cutLimbHandler:checkItem(item)
|
||||
cutLimbInteraction:checkItem(item)
|
||||
woundCleaningInteraction:checkItem(item)
|
||||
end
|
||||
if cutLimbHandler:dropItems(items) then
|
||||
if cutLimbInteraction:dropItems(items) or woundCleaningInteraction:dropItems(items) then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -48,13 +51,13 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
|
||||
-- To not recreate it but reuse the one that has been created in the original method
|
||||
local context = getPlayerContextMenu(playerNum)
|
||||
|
||||
local cutLimbHandler = CutLimbHandler:new(self, bodyPart)
|
||||
self:checkItems({cutLimbHandler})
|
||||
cutLimbHandler:addToMenu(context)
|
||||
local cutLimbInteraction = CutLimbInteractionHandler:new(self, bodyPart)
|
||||
self:checkItems({cutLimbInteraction})
|
||||
cutLimbInteraction:addToMenu(context)
|
||||
|
||||
local woundCleaningHandler = WoundCleaningHandler:new(self, bodyPart, self.character:getUsername())
|
||||
self:checkItems({woundCleaningHandler})
|
||||
woundCleaningHandler:addToMenu(context)
|
||||
local woundCleaningInteraction = WoundCleaningInteractionHandler:new(self, bodyPart, self.character:getUsername())
|
||||
self:checkItems({woundCleaningInteraction})
|
||||
woundCleaningInteraction:addToMenu(context)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -142,31 +142,30 @@ Events.OnFillInventoryObjectContextMenu.Add(AddInventoryAmputationMenu)
|
||||
|
||||
-------------------------------------
|
||||
|
||||
---@class CutLimbHandler : BaseHandler
|
||||
---@class CutLimbInteractionHandler : BaseHandler
|
||||
---@field items table
|
||||
---@field limbName string
|
||||
---@field itemType string temporary
|
||||
local CutLimbHandler = BaseHandler:derive("CutLimbHandler")
|
||||
local CutLimbInteractionHandler = BaseHandler:derive("CutLimbInteractionHandler")
|
||||
|
||||
|
||||
---Creates new CutLimbHandler
|
||||
---Creates new CutLimbInteractionHandler
|
||||
---@param panel ISUIElement
|
||||
---@param bodyPart BodyPart
|
||||
---@return CutLimbHandler
|
||||
function CutLimbHandler:new(panel, bodyPart)
|
||||
---@return CutLimbInteractionHandler
|
||||
function CutLimbInteractionHandler:new(panel, bodyPart)
|
||||
local o = BaseHandler.new(self, panel, bodyPart)
|
||||
o.items.ITEMS = {}
|
||||
o.limbName = BodyPartType.ToString(bodyPart:getType())
|
||||
o.itemType = "Saw"
|
||||
TOC_DEBUG.print("init CutLimbHandler")
|
||||
--TOC_DEBUG.print("init CutLimbInteractionHandler")
|
||||
return o
|
||||
end
|
||||
|
||||
---@param item InventoryItem
|
||||
function CutLimbHandler:checkItem(item)
|
||||
TOC_DEBUG.print("CutLimbHandler checkItem")
|
||||
function CutLimbInteractionHandler:checkItem(item)
|
||||
--TOC_DEBUG.print("CutLimbInteractionHandler checkItem")
|
||||
local itemType = item:getType()
|
||||
--TOC_DEBUG.print("checkItem: " .. tostring(itemType))
|
||||
|
||||
if CheckIfSaw(itemType) then
|
||||
TOC_DEBUG.print("added to list -> " .. itemType)
|
||||
@@ -175,8 +174,8 @@ function CutLimbHandler:checkItem(item)
|
||||
end
|
||||
|
||||
---@param context ISContextMenu
|
||||
function CutLimbHandler:addToMenu(context)
|
||||
TOC_DEBUG.print("CutLimbHandler addToMenu")
|
||||
function CutLimbInteractionHandler:addToMenu(context)
|
||||
--TOC_DEBUG.print("CutLimbInteractionHandler addToMenu")
|
||||
local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
if #types > 0 and StaticData.BODYLOCS_IND_BPT[self.limbName] and not DataController.GetInstance():getIsCut(self.limbName) then
|
||||
TOC_DEBUG.print("addToMenu, types > 0")
|
||||
@@ -186,7 +185,7 @@ function CutLimbHandler:addToMenu(context)
|
||||
end
|
||||
end
|
||||
|
||||
function CutLimbHandler:dropItems(items)
|
||||
function CutLimbInteractionHandler:dropItems(items)
|
||||
local types = self:getAllItemTypes(items)
|
||||
if #self.items.ITEMS > 0 and #types == 1 and StaticData.BODYLOCS_IND_BPT[self.limbName] then
|
||||
self:onMenuOptionSelected(types[1])
|
||||
@@ -195,20 +194,20 @@ function CutLimbHandler:dropItems(items)
|
||||
return false
|
||||
end
|
||||
|
||||
---Check if CutLimbHandler is valid, the limb must not be cut to be valid
|
||||
---Check if CutLimbInteractionHandler is valid, the limb must not be cut to be valid
|
||||
---@return boolean
|
||||
function CutLimbHandler:isValid()
|
||||
TOC_DEBUG.print("CutLimbHandler isValid")
|
||||
function CutLimbInteractionHandler:isValid()
|
||||
--TOC_DEBUG.print("CutLimbInteractionHandler isValid")
|
||||
self:checkItems()
|
||||
return not DataController.GetInstance():getIsCut(self.limbName)
|
||||
end
|
||||
|
||||
function CutLimbHandler:perform(previousAction, itemType)
|
||||
function CutLimbInteractionHandler:perform(previousAction, itemType)
|
||||
local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
previousAction = self:toPlayerInventory(item, previousAction)
|
||||
TOC_DEBUG.print("perform CutLimbHandler on " .. self.limbName)
|
||||
TOC_DEBUG.print("Perform CutLimbInteractionHandler on " .. self.limbName)
|
||||
local action = CutLimbAction:new(self:getDoctor(),self:getPatient(), self.limbName, item)
|
||||
ISTimedActionQueue.addAfter(previousAction, action)
|
||||
end
|
||||
|
||||
return CutLimbHandler
|
||||
return CutLimbInteractionHandler
|
||||
@@ -5,17 +5,16 @@ local DataController = require("TOC/Controllers/DataController")
|
||||
|
||||
local CleanWoundAction = require("TOC/TimedActions/CleanWoundAction")
|
||||
-------------------------
|
||||
---@class WoundCleaningHandler : BaseHandler
|
||||
---@class WoundCleaningInteractionHandler : BaseHandler
|
||||
---@field username string
|
||||
---@field limbName string
|
||||
local WoundCleaningHandler = BaseHandler:derive("WoundCleaningHandler")
|
||||
local WoundCleaningInteractionHandler = BaseHandler:derive("WoundCleaningInteractionHandler")
|
||||
|
||||
---comment
|
||||
---@param panel any
|
||||
---@param bodyPart any
|
||||
---@param username string
|
||||
---@return table
|
||||
function WoundCleaningHandler:new(panel, bodyPart, username)
|
||||
function WoundCleaningInteractionHandler:new(panel, bodyPart, username)
|
||||
local o = BaseHandler.new(self, panel, bodyPart)
|
||||
o.items.ITEMS = {}
|
||||
o.username = username
|
||||
@@ -25,26 +24,32 @@ function WoundCleaningHandler:new(panel, bodyPart, username)
|
||||
return o
|
||||
end
|
||||
|
||||
function WoundCleaningHandler:checkItem(item)
|
||||
if item:getBandagePower() >= 2 then
|
||||
function WoundCleaningInteractionHandler:checkItem(item)
|
||||
-- Disinfected rag or bandage
|
||||
--TOC_DEBUG.print("WoundCleaningInteractionHandler checkItem")
|
||||
if item:getBandagePower() >=2 and item:isAlcoholic() then
|
||||
--TOC_DEBUG.print("Adding " .. item:getName())
|
||||
self:addItem(self.items.ITEMS, item)
|
||||
end
|
||||
end
|
||||
|
||||
function WoundCleaningHandler:addToMenu(context)
|
||||
function WoundCleaningInteractionHandler:addToMenu(context)
|
||||
--TOC_DEBUG.print("WoundCleaningInteraction addToMenu")
|
||||
local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
if #types > 0 and self:isValid() then
|
||||
local option = context:addOption("Clean Wound", nil)
|
||||
--TOC_DEBUG.print("WoundCleaningInteraction inside addToMenu")
|
||||
local option = context:addOption(getText("ContextMenu_CleanWound"), nil)
|
||||
local subMenu = context:getNew(context)
|
||||
context:addSubMenu(option, subMenu)
|
||||
for i=1,#types do
|
||||
for i=1, #types do
|
||||
local item = self:getItemOfType(self.items.ITEMS, types[i])
|
||||
--TOC_DEBUG.print(item:getName())
|
||||
subMenu:addOption(item:getName(), self, self.onMenuOptionSelected, item:getFullType())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function WoundCleaningHandler:dropItems(items)
|
||||
function WoundCleaningInteractionHandler:dropItems(items)
|
||||
local types = self:getAllItemTypes(items)
|
||||
if #self.items.ITEMS > 0 and #types == 1 and self:isInjured() and self.bodyPart:isNeedBurnWash() then
|
||||
-- FIXME: A bandage can be used to clean a burn or bandage it
|
||||
@@ -54,7 +59,7 @@ function WoundCleaningHandler:dropItems(items)
|
||||
return false
|
||||
end
|
||||
|
||||
function WoundCleaningHandler:isValid()
|
||||
function WoundCleaningInteractionHandler:isValid()
|
||||
-- TODO Check if cut and not cicatrized and dirty
|
||||
|
||||
-- todo get username
|
||||
@@ -63,12 +68,13 @@ function WoundCleaningHandler:isValid()
|
||||
local dcInst = DataController.GetInstance(self.username)
|
||||
|
||||
--and dcInst:getWoundDirtyness(self.limbName) > 0.1
|
||||
|
||||
return dcInst:getIsCut(self.limbName) and not dcInst:getIsCicatrized(self.limbName)
|
||||
local check = dcInst:getIsCut(self.limbName) and not dcInst:getIsCicatrized(self.limbName) and dcInst:getWoundDirtyness(self.limbName) > 0
|
||||
--TOC_DEBUG.print("WoundCleaningInteraction isValid: " .. tostring(check))
|
||||
return check
|
||||
--return self:getItemOfType(self.items.ITEMS, itemType)
|
||||
end
|
||||
|
||||
function WoundCleaningHandler:perform(previousAction, itemType)
|
||||
function WoundCleaningInteractionHandler:perform(previousAction, itemType)
|
||||
local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
previousAction = self:toPlayerInventory(item, previousAction)
|
||||
local action = CleanWoundAction:new(self:getDoctor(), self:getPatient(), item, self.bodyPart)
|
||||
@@ -76,4 +82,4 @@ function WoundCleaningHandler:perform(previousAction, itemType)
|
||||
end
|
||||
|
||||
|
||||
return WoundCleaningHandler
|
||||
return WoundCleaningInteractionHandler
|
||||
Reference in New Issue
Block a user