Modified timed actions
This commit is contained in:
@@ -57,9 +57,9 @@ function JCIO_CutLimbAction:start()
|
||||
end
|
||||
|
||||
if self.patient == self.surgeon then
|
||||
TocDamagePlayerDuringAmputation(self.patient, self.part_name)
|
||||
TocDamagePlayerDuringAmputation(self.patient, self.partName)
|
||||
else
|
||||
sendClientCommand(self.surgeon, "TOC", "AskDamageOtherPlayer", {self.patient:getOnlineID(), self.part_name})
|
||||
sendClientCommand(self.surgeon, "TOC", "AskDamageOtherPlayer", {self.patient:getOnlineID(), self.partName})
|
||||
end
|
||||
|
||||
|
||||
@@ -119,10 +119,10 @@ function JCIO_CutLimbAction:perform()
|
||||
local surgeon_factor, bandage_table, painkiller_table = self:findArgs()
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
SendCutLimb(self.patient, self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
SendCutLimb(self.patient, self.partName, surgeon_factor, bandage_table, painkiller_table)
|
||||
sendClientCommand(self.surgeon, "TOC", "AskStopAmputationSound", {surgeon_id = self.surgeon:getOnlineID()})
|
||||
else
|
||||
JCIO.CutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
JCIO.CutLimb(self.partName, surgeon_factor, bandage_table, painkiller_table)
|
||||
end
|
||||
|
||||
self.surgeon:getEmitter():stopSoundByName("Amputation_Sound")
|
||||
@@ -131,7 +131,7 @@ function JCIO_CutLimbAction:perform()
|
||||
|
||||
end
|
||||
|
||||
function JCIO_CutLimbAction:new(patient, surgeon, part_name)
|
||||
function JCIO_CutLimbAction:new(patient, surgeon, partName)
|
||||
|
||||
-- TODO align surgeon, patient not patient, surgeon
|
||||
|
||||
@@ -139,7 +139,7 @@ function JCIO_CutLimbAction:new(patient, surgeon, part_name)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.part_name = part_name
|
||||
o.partName = partName
|
||||
o.character = surgeon -- For anim
|
||||
|
||||
o.surgeon = surgeon; -- Surgeon or player that make the operation
|
||||
|
||||
@@ -17,14 +17,9 @@ 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()
|
||||
@@ -34,20 +29,16 @@ end
|
||||
|
||||
function JCIO_InstallProsthesisAction:perform()
|
||||
|
||||
|
||||
|
||||
local prosthesis_base_name = self.item:getType()
|
||||
|
||||
|
||||
local prosthesisBaseName = self.item:getType()
|
||||
|
||||
self.item:setJobDelta(0.0)
|
||||
-- local toc_data = self.character:getModData().TOC
|
||||
--local part_name = TocGetPartNameFromBodyPartType(self.bodyPart:getType())
|
||||
--local partName = TocGetPartNameFromBodyPartType(self.bodyPart:getType())
|
||||
|
||||
local body_part_type = JCIO_Common.GetBodyPartFromPartName(self.part_name)
|
||||
local bodyPartType = JCIO_Common.GetBodyPartFromPartName(self.partName)
|
||||
|
||||
-- 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
|
||||
if bodyPartType == BodyPartType.UpperArm_L or bodyPartType == BodyPartType.UpperArm_R then
|
||||
print("Can't equip prosthesis")
|
||||
return
|
||||
end
|
||||
@@ -56,20 +47,20 @@ function JCIO_InstallProsthesisAction:perform()
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
|
||||
SendEquipProsthesis(self.patient, self.part_name, self.item, prosthesis_base_name)
|
||||
SendEquipProsthesis(self.patient, self.partName, self.item, prosthesisBaseName)
|
||||
else
|
||||
JCIO.EquipProsthesis(self.part_name, self.item, prosthesis_base_name)
|
||||
JCIO.EquipProsthesis(self.partName, self.item, prosthesisBaseName)
|
||||
|
||||
end
|
||||
|
||||
|
||||
self.surgeon:getInventory():Remove(prosthesis_base_name) -- Removes the base item after we transferred everything
|
||||
self.surgeon:getInventory():Remove(prosthesisBaseName) -- 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)
|
||||
function JCIO_InstallProsthesisAction:new(surgeon, patient, item, partName)
|
||||
|
||||
local o = ISBaseTimedAction.new(self, patient)
|
||||
|
||||
@@ -79,7 +70,7 @@ function JCIO_InstallProsthesisAction:new(surgeon, patient, item, part_name)
|
||||
|
||||
o.item = item
|
||||
|
||||
o.part_name = part_name
|
||||
o.partName = partName
|
||||
|
||||
--o.bodyPart = bodyPart
|
||||
o.maxTime = 100
|
||||
|
||||
@@ -22,57 +22,57 @@ end
|
||||
|
||||
function JCIO_OperateLimbAction:start()
|
||||
self:setActionAnim("MedicalCheck")
|
||||
if self.use_oven then
|
||||
if self.useOven then
|
||||
self.sound = self.patient:getEmitter():playSound("Burn_sound")
|
||||
self:forceComplete()
|
||||
end
|
||||
end
|
||||
|
||||
function JCIO_OperateLimbAction:findArgs()
|
||||
local surgeon_factor = self.surgeon:getPerkLevel(Perks.Doctor)
|
||||
local surgeonFactor = self.surgeon:getPerkLevel(Perks.Doctor)
|
||||
|
||||
if self.use_oven then
|
||||
surgeon_factor = surgeon_factor + 100
|
||||
if self.useOven then
|
||||
surgeonFactor = surgeonFactor + 100
|
||||
else
|
||||
if self.kit then
|
||||
local weight = math.floor(self.kit:getWeight() * 10 + 0.5)
|
||||
if weight == 1 then
|
||||
surgeon_factor = surgeon_factor + 2
|
||||
elseif weight == surgeon_factor then
|
||||
surgeon_factor = surgeon_factor + 4
|
||||
surgeonFactor = surgeonFactor + 2
|
||||
elseif weight == surgeonFactor then
|
||||
surgeonFactor = surgeonFactor + 4
|
||||
elseif weight == 3 then
|
||||
surgeon_factor = surgeon_factor + 6
|
||||
surgeonFactor = surgeonFactor + 6
|
||||
end
|
||||
end
|
||||
|
||||
if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeon_factor = surgeon_factor + 10 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "doctor" then surgeon_factor = surgeon_factor + 5 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "nurse" then surgeon_factor = surgeon_factor + 2 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeonFactor = surgeonFactor + 10 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "doctor" then surgeonFactor = surgeonFactor + 5 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "nurse" then surgeonFactor = surgeonFactor + 2 end
|
||||
end
|
||||
|
||||
return surgeon_factor, self.use_oven;
|
||||
return surgeonFactor, self.useOven;
|
||||
end
|
||||
|
||||
function JCIO_OperateLimbAction:perform()
|
||||
local surgeon_factor, use_oven = self:findArgs()
|
||||
local surgeonFactor, useOven = self:findArgs()
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
SendOperateLimb(self.patient, self.part_name, surgeon_factor, use_oven)
|
||||
SendOperateLimb(self.patient, self.partName, surgeonFactor, useOven)
|
||||
else
|
||||
JCIO.OperateLimb(self.part_name, surgeon_factor, use_oven)
|
||||
JCIO.OperateLimb(self.partName, surgeonFactor, useOven)
|
||||
end
|
||||
self.surgeon:getXp():AddXP(Perks.Doctor, 400)
|
||||
|
||||
if self.kit and not use_oven then
|
||||
if self.kit and not useOven then
|
||||
self.surgeon:getInventory():Remove(self.kit)
|
||||
end
|
||||
|
||||
ISBaseTimedAction.perform(self)
|
||||
end
|
||||
|
||||
function JCIO_OperateLimbAction:new(patient, surgeon, kit, part_name, use_oven)
|
||||
function JCIO_OperateLimbAction:new(patient, surgeon, kit, partName, useOven)
|
||||
local o = ISBaseTimedAction.new(self, patient)
|
||||
o.part_name = part_name
|
||||
o.partName = partName
|
||||
o.patient = patient
|
||||
o.character = surgeon -- For anim
|
||||
o.patientX = patient:getX()
|
||||
@@ -80,11 +80,11 @@ function JCIO_OperateLimbAction:new(patient, surgeon, kit, part_name, use_oven)
|
||||
o.surgeon = surgeon
|
||||
o.kit = kit
|
||||
|
||||
o.use_oven = use_oven
|
||||
o.useOven = useOven
|
||||
|
||||
|
||||
--o.use_oven = use_oven;
|
||||
if use_oven then
|
||||
--o.useOven = useOven;
|
||||
if useOven then
|
||||
o.maxTime = 30
|
||||
else
|
||||
o.maxTime = 200 - (surgeon:getPerkLevel(Perks.Doctor) * 10)
|
||||
|
||||
@@ -4,15 +4,11 @@ JCIO_UninstallProsthesisAction = ISBaseTimedAction:derive("JCIO_UninstallProsthe
|
||||
|
||||
function JCIO_UninstallProsthesisAction:isValid()
|
||||
|
||||
if self.item ~= nil and self.is_prosthesis_equipped then
|
||||
if self.item ~= nil and self.isProsthesisEquipped then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
function JCIO_UninstallProsthesisAction:update()
|
||||
@@ -56,36 +52,36 @@ function JCIO_UninstallProsthesisAction:perform()
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
|
||||
SendUnequipProsthesis(self.patient, self.part_name, self.item)
|
||||
SendUnequipProsthesis(self.patient, self.partName, self.item)
|
||||
else
|
||||
TheOnlyCure.TocUnequipProsthesis(self.patient, self.part_name, self.item)
|
||||
TheOnlyCure.TocUnequipProsthesis(self.patient, self.partName, self.item)
|
||||
end
|
||||
|
||||
ISBaseTimedAction.perform(self)
|
||||
end
|
||||
|
||||
function JCIO_UninstallProsthesisAction:new(surgeon, patient, part_name)
|
||||
function JCIO_UninstallProsthesisAction:new(surgeon, patient, partName)
|
||||
local o = ISBaseTimedAction.new(self, surgeon)
|
||||
|
||||
local toc_limbs_data = patient:getModData().TOC.Limbs
|
||||
local limbsData = patient:getModData().JCIO.limbs
|
||||
|
||||
o.item = TocFindItemInProstBodyLocation(part_name, patient)
|
||||
o.item = TocFindItemInProstBodyLocation(partName, patient)
|
||||
o.character = surgeon -- For animation purposes
|
||||
|
||||
o.patient = patient
|
||||
o.surgeon = surgeon
|
||||
|
||||
o.part_name = part_name
|
||||
o.partName = partName
|
||||
|
||||
|
||||
o.is_prosthesis_equipped = toc_limbs_data[part_name].is_prosthesis_equipped
|
||||
o.isProsthesisEquipped = limbsData[partName].isProsthesisEquipped
|
||||
|
||||
|
||||
o.maxTime = 100;
|
||||
o.stopOnWalk = true;
|
||||
o.stopOnRun = true;
|
||||
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;
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
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