Changed Timed Actions names
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
require "TimedActions/ISBaseTimedAction"
|
||||
|
||||
JCIO_InstallProsthesisAction = ISBaseTimedAction:derive("JCIO_InstallProsthesisAction")
|
||||
|
||||
function JCIO_InstallProsthesisAction: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
|
||||
|
||||
function JCIO_InstallProsthesisAction:update()
|
||||
self.item:setJobDelta(self:getJobDelta())
|
||||
end
|
||||
|
||||
function JCIO_InstallProsthesisAction:start()
|
||||
self.item:setJobType("Install prosthesis")
|
||||
self.item:setJobDelta(0.0)
|
||||
|
||||
|
||||
|
||||
self:setActionAnim("WearClothing")
|
||||
self:setAnimVariable("WearClothingLocation", "Jacket")
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
function JCIO_InstallProsthesisAction:stop()
|
||||
ISBaseTimedAction.stop(self)
|
||||
self.item:setJobDelta(0.0)
|
||||
end
|
||||
|
||||
function JCIO_InstallProsthesisAction:perform()
|
||||
|
||||
|
||||
|
||||
local prosthesis_base_name = self.item:getType()
|
||||
|
||||
|
||||
|
||||
self.item:setJobDelta(0.0)
|
||||
-- local toc_data = self.character:getModData().TOC
|
||||
--local part_name = TocGetPartNameFromBodyPartType(self.bodyPart:getType())
|
||||
|
||||
local body_part_type = JCIO_Common.GetBodyPartFromPartName(self.part_name)
|
||||
|
||||
-- Check if can be performed. This shouldn't be necessary, but just to be sure
|
||||
if body_part_type == BodyPartType.UpperArm_L or body_part_type == BodyPartType.UpperArm_R then
|
||||
print("Can't equip prosthesis")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
|
||||
SendEquipProsthesis(self.patient, self.part_name, self.item, prosthesis_base_name)
|
||||
else
|
||||
JCIO.EquipProsthesis(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
|
||||
|
||||
function JCIO_InstallProsthesisAction:new(surgeon, patient, item, part_name)
|
||||
|
||||
local o = ISBaseTimedAction.new(self, patient)
|
||||
|
||||
o.character = surgeon -- For animation, since self.startAnim or whatever relies on this
|
||||
o.surgeon = surgeon
|
||||
o.patient = patient
|
||||
|
||||
o.item = item
|
||||
|
||||
o.part_name = part_name
|
||||
|
||||
--o.bodyPart = bodyPart
|
||||
o.maxTime = 100
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
o.cloth = nil
|
||||
o.ignoreHandsWounds = false
|
||||
o.fromHotbar = true -- just to disable hotbar:update() during the wearing
|
||||
if o.character:isTimedActionInstant() then o.maxTime = 1 end
|
||||
return o
|
||||
end
|
||||
Reference in New Issue
Block a user