Too much stuff to fix.

This commit is contained in:
ZioPao
2024-03-29 18:46:44 +01:00
parent 883a84412b
commit d73b1a3f43
13 changed files with 120 additions and 28 deletions

View File

@@ -208,7 +208,8 @@ end
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
local patientUsername = self:getPatient():getUsername()
if #types > 0 and StaticData.BODYLOCS_IND_BPT[self.limbName] and not DataController.GetInstance(patientUsername):getIsCut(self.limbName) then
TOC_DEBUG.print("addToMenu, types > 0")
for i=1, #types do
context:addOption(getText("ContextMenu_Amputate"), self, self.onMenuOptionSelected, types[i])
@@ -230,7 +231,8 @@ end
function CutLimbInteractionHandler:isValid()
--TOC_DEBUG.print("CutLimbInteractionHandler isValid")
self:checkItems()
return not DataController.GetInstance():getIsCut(self.limbName)
local patientUsername = self:getPatient():getUsername()
return not DataController.GetInstance(patientUsername):getIsCut(self.limbName)
end
function CutLimbInteractionHandler:perform(previousAction, itemType)

View File

@@ -126,10 +126,12 @@ function BaseHandler:toPlayerInventory(item, previousAction)
return previousAction
end
---@return IsoPlayer
function BaseHandler:getDoctor()
return self.panel.otherPlayer or self.panel.character
end
---@return IsoPlayer
function BaseHandler:getPatient()
return self.panel.character
end

View File

@@ -35,6 +35,7 @@ end
function WoundCleaningInteractionHandler:addToMenu(context)
--TOC_DEBUG.print("WoundCleaningInteraction addToMenu")
local types = self:getAllItemTypes(self.items.ITEMS)
if #types > 0 and self:isValid() then
TOC_DEBUG.print("WoundCleaningInteraction inside addToMenu")