more setup stuff for modular prosthetics

This commit is contained in:
Pao
2023-02-10 13:47:08 +01:00
parent 031af29b51
commit a610763131
6 changed files with 84 additions and 40 deletions

View File

@@ -3,6 +3,9 @@ require "TimedActions/ISBaseTimedAction"
ISInstallProsthesis = ISBaseTimedAction:derive("ISInstallProsthesis");
function ISInstallProsthesis:isValid()
-- TODO add here conditions if the action can be performed or not, so if thing is in inventory
-- TODO 'not sure about multiplayer, maybe an overriding check?
return true
end
@@ -49,17 +52,19 @@ function ISInstallProsthesis:perform()
return
end
self.surgeon:getInventory():Remove(prosthesis_base_name) -- Removes the base item and substitute it with the part one
if self.patient ~= self.surgeon and isClient() then
SendEquipProsthesis(self.patient, self.part_name, prosthesis_base_name)
SendEquipProsthesis(self.patient, self.part_name, self.item, prosthesis_base_name)
else
TocEquipProsthesis(self.part_name, prosthesis_base_name)
TocEquipProsthesis(self.part_name, self.item, prosthesis_base_name)
end
self.surgeon:getInventory():Remove(prosthesis_base_name) -- Removes the base item after we transferred everything
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self)
end