Various stuff
- Changed how we apply damage to limbs after cutting one - Added some new textures for hooks - Fixed UVs - Some corrections like bandages not applying after cutting a limb
This commit is contained in:
@@ -12,7 +12,7 @@ Commands["ResponseCanAct"] = function(arg)
|
||||
ui.responsePartName = arg["toSend"][1]
|
||||
ui.responseCan = arg["toSend"][3]
|
||||
ui.responseUserName = getPlayerByOnlineID(arg["From"]):getUsername()
|
||||
ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(ui
|
||||
ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TocGetBodyPartFromPartName(ui
|
||||
.responsePartName)):bitten()
|
||||
end
|
||||
|
||||
|
||||
@@ -84,7 +84,9 @@ function TocGetPartNameFromBodyPartType(body_part)
|
||||
|
||||
end
|
||||
|
||||
function TocGetBodyPartTypeFromPartName(part_name)
|
||||
|
||||
-- 1:1 map of part_name to BodyPartType
|
||||
function TocGetBodyPartFromPartName(part_name)
|
||||
if part_name == "Right_Hand" then return BodyPartType.Hand_R end
|
||||
if part_name == "Right_LowerArm" then return BodyPartType.ForeArm_R end
|
||||
if part_name == "Right_UpperArm" then return BodyPartType.UpperArm_R end
|
||||
@@ -93,6 +95,17 @@ function TocGetBodyPartTypeFromPartName(part_name)
|
||||
if part_name == "Left_UpperArm" then return BodyPartType.UpperArm_L end
|
||||
end
|
||||
|
||||
-- Custom mapping to make more sense when cutting a limb
|
||||
function TocGetAdiacentBodyPartFromPartName(part_name)
|
||||
|
||||
if part_name == "Right_Hand" then return BodyPartType.ForeArm_R end
|
||||
if part_name == "Right_LowerArm" then return BodyPartType.UpperArm_R end
|
||||
if part_name == "Right_UpperArm" then return BodyPartType.Torso_Upper end
|
||||
if part_name == "Left_Hand" then return BodyPartType.ForeArm_L end
|
||||
if part_name == "Left_LowerArm" then return BodyPartType.UpperArm_R end
|
||||
if part_name == "Left_UpperArm" then return BodyPartType.Torso_Upper end
|
||||
end
|
||||
|
||||
function TocFindCorrectClothingProsthesis(item_name, part_name)
|
||||
|
||||
local correct_name = "TOC.Prost_" .. part_name .. "_" .. item_name
|
||||
|
||||
@@ -22,7 +22,7 @@ end
|
||||
|
||||
function TocCureInfection(body_damage, part_name)
|
||||
|
||||
local body_part_type = body_damage:getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
|
||||
local body_part_type = body_damage:getBodyPart(TocGetBodyPartFromPartName(part_name))
|
||||
|
||||
body_damage:setInfected(false)
|
||||
body_part_type:SetInfected(false)
|
||||
@@ -79,7 +79,10 @@ function TocGetSawInInventory(surgeon)
|
||||
end
|
||||
|
||||
function TocDamagePlayerDuringAmputation(patient, part_name)
|
||||
local body_part_type = TocGetBodyPartTypeFromPartName(part_name)
|
||||
|
||||
-- Since we're cutting that specific part, it only makes sense that the bleeding starts from there.
|
||||
-- Then, we just delete the bleeding somewhere else before applying the other damage to to upper part of the limb
|
||||
local body_part_type = TocGetBodyPartFromPartName(part_name)
|
||||
local body_damage = patient:getBodyDamage()
|
||||
local body_damage_part = body_damage:getBodyPart(body_part_type)
|
||||
|
||||
@@ -110,11 +113,11 @@ function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_ove
|
||||
--for _, v in ipairs(GetBodyParts()) do
|
||||
|
||||
|
||||
local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
|
||||
local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name))
|
||||
FixSingleBodyPartType(body_part_type, use_oven)
|
||||
|
||||
for _, v in ipairs(limbs_data[part_name].depends_on) do
|
||||
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(v))
|
||||
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(v))
|
||||
FixSingleBodyPartType(depended_body_part_type, use_oven)
|
||||
|
||||
end
|
||||
|
||||
@@ -53,7 +53,7 @@ local function GetImageName(part_name, limbs_data)
|
||||
elseif part_data.is_cut and not part_data.is_amputation_shown then -- Empty (like hand if forearm cut)
|
||||
name = "media/ui/TOC/Empty.png"
|
||||
elseif not part_data.is_cut and
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten() then -- Not cut but bitten
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartFromPartName(part_name)):bitten() then -- Not cut but bitten
|
||||
name = "media/ui/TOC/" .. part_name .. "/Bite.png"
|
||||
else -- Not cut
|
||||
name = "media/ui/TOC/" .. part_name .. "/Base.png"
|
||||
@@ -93,7 +93,7 @@ end
|
||||
|
||||
local function IsPartBitten(part_data, part_name)
|
||||
return not part_data.is_cut and
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten()
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartFromPartName(part_name)):bitten()
|
||||
end
|
||||
|
||||
local function FindMinMax(lv)
|
||||
|
||||
@@ -12,12 +12,7 @@ local function CheckIfPlayerIsInfected(player, toc_data)
|
||||
if body_part:bitten() and part_data ~= nil then
|
||||
if part_data.is_cut == false then
|
||||
part_data.is_infected = true
|
||||
else
|
||||
-- if the player gets bit to a cut area we have to reset it here since it doesn't make any sense
|
||||
body_part:SetBitten(false)
|
||||
body_part:setBiteTime(0)
|
||||
|
||||
part_data.is_infected = false
|
||||
end
|
||||
|
||||
end
|
||||
@@ -38,11 +33,14 @@ end
|
||||
--Helper function for UpdatePlayerHealth
|
||||
local function SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
|
||||
-- TODO this can be moved away from updates
|
||||
|
||||
-- In case the player gets bit in a cut area, we have to heal him...
|
||||
|
||||
|
||||
|
||||
local body_damage = player:getBodyDamage()
|
||||
local body_part_type = body_damage:getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
|
||||
if not body_part_type then
|
||||
local body_part = body_damage:getBodyPart(TocGetBodyPartFromPartName(part_name))
|
||||
if not body_part then
|
||||
print("TOC ERROR : Can't update health of " .. part_name);
|
||||
return false
|
||||
end
|
||||
@@ -53,18 +51,18 @@ local function SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
local bandage_type = ""
|
||||
|
||||
-- TODO Bandages should have some disadvantage when not operated... Like getting drenched or something
|
||||
if body_part_type:bandaged() then
|
||||
if body_part:bandaged() then
|
||||
is_bandaged = true -- this is useless
|
||||
bandage_life = body_part_type:getBandageLife()
|
||||
bandage_type = body_part_type:getBandageType()
|
||||
bandage_life = body_part:getBandageLife()
|
||||
bandage_type = body_part:getBandageType()
|
||||
|
||||
end
|
||||
|
||||
-- Set max health for body part
|
||||
if part_data[part_name].is_cicatrized and body_part_type:getHealth() > 80 then
|
||||
body_part_type:SetHealth(80)
|
||||
elseif body_part_type:getHealth() > 40 then
|
||||
body_part_type:SetHealth(40)
|
||||
if part_data[part_name].is_cicatrized and body_part:getHealth() > 80 then
|
||||
body_part:SetHealth(80)
|
||||
elseif body_part:getHealth() > 40 then
|
||||
body_part:SetHealth(40)
|
||||
end
|
||||
|
||||
-- Cicatrization check
|
||||
@@ -83,10 +81,16 @@ local function SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
player:getTraits():add("Insensitive")
|
||||
end
|
||||
|
||||
body_part_type:setBleeding(false);
|
||||
body_part_type:setDeepWounded(false)
|
||||
body_part_type:setBleedingTime(0)
|
||||
body_part_type:setDeepWoundTime(0)
|
||||
-- if the player gets attacked and damaged in a cut area we have to reset it here since it doesn't make any sense
|
||||
body_part:setBleeding(false);
|
||||
body_part:setDeepWounded(false)
|
||||
body_part:setBleedingTime(0)
|
||||
body_part:setDeepWoundTime(0)
|
||||
body_part:SetBitten(false)
|
||||
body_part:setBiteTime(0)
|
||||
part_data.is_infected = false
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,7 +98,7 @@ local function SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
if part_data[part_name].is_amputation_shown and ZombRand(1, 100) < 10 then
|
||||
local added_pain
|
||||
if part_data[part_name].is_cauterized then added_pain = 60 else added_pain = 30 end
|
||||
body_part_type:setAdditionalPain(ZombRand(1, added_pain))
|
||||
body_part:setAdditionalPain(ZombRand(1, added_pain))
|
||||
end
|
||||
|
||||
-- Reapplies bandages after the whole ordeal
|
||||
|
||||
@@ -87,6 +87,7 @@ function TocSetInitData(mod_data, player)
|
||||
|
||||
|
||||
|
||||
|
||||
for _, side in ipairs(TOC_sides) do
|
||||
for _, limb in ipairs(TOC_limbs) do
|
||||
|
||||
@@ -230,16 +231,40 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
local toc_data = player:getModData().TOC
|
||||
local limbs_data = toc_data.Limbs
|
||||
|
||||
local body_part = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
|
||||
|
||||
|
||||
-- TODO Stop for a bit,
|
||||
|
||||
-- Cut Hand -> Damage in forearm
|
||||
-- Cut Forearm -> Damage in Upperarm
|
||||
-- Cut UpperArm -> Damage to torso
|
||||
|
||||
local body_damage = player:getBodyDamage()
|
||||
local body_part = body_damage:getBodyPart(TocGetBodyPartFromPartName(part_name))
|
||||
local adiacent_body_part = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name))
|
||||
|
||||
local stats = player:getStats()
|
||||
|
||||
|
||||
|
||||
-- Reset the status of the first body part, since we just cut it off it shouldn't be bleeding anymore
|
||||
-- The bit will be checked later since we're not sure if the player is not infected from another wound
|
||||
body_part:setBleeding(false)
|
||||
body_part:setBleedingTime(0)
|
||||
body_part:setDeepWounded(false)
|
||||
body_part:setDeepWoundTime(0)
|
||||
body_part:setScratched(false, false) -- why the fuck are there 2 booleans TIS?
|
||||
body_part:setScratchTime(0)
|
||||
body_part:setCut(false)
|
||||
body_part:setCutTime(0)
|
||||
|
||||
-- Set damage, stress, and low endurance after amputation
|
||||
body_part:AddDamage(100 - surgeon_factor)
|
||||
body_part:setAdditionalPain(100 - surgeon_factor)
|
||||
body_part:setBleeding(true)
|
||||
body_part:setBleedingTime(100 - surgeon_factor)
|
||||
body_part:setDeepWounded(true)
|
||||
body_part:setDeepWoundTime(100 - surgeon_factor)
|
||||
adiacent_body_part:AddDamage(100 - surgeon_factor)
|
||||
adiacent_body_part:setAdditionalPain(100 - surgeon_factor)
|
||||
adiacent_body_part:setBleeding(true)
|
||||
adiacent_body_part:setBleedingTime(100 - surgeon_factor)
|
||||
adiacent_body_part:setDeepWounded(true)
|
||||
adiacent_body_part:setDeepWoundTime(100 - surgeon_factor)
|
||||
stats:setEndurance(surgeon_factor)
|
||||
stats:setStress(100 - surgeon_factor)
|
||||
|
||||
@@ -251,7 +276,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
|
||||
|
||||
-- If bandages are available, use them
|
||||
body_part:setBandaged(bandage_table.use_bandage, 10, bandage_table.is_bandage_sterilized, bandage_table.bandage_type)
|
||||
adiacent_body_part:setBandaged(bandage_table.use_bandage, 10, bandage_table.is_bandage_sterilized, bandage_table.bandage_type)
|
||||
|
||||
|
||||
|
||||
@@ -270,6 +295,8 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
local body_damage = player:getBodyDamage()
|
||||
if limbs_data[part_name].is_infected and body_damage:getInfectionLevel() < 20 then
|
||||
limbs_data[part_name].is_infected = false
|
||||
|
||||
-- NOT THE ADIACENT ONE!!!
|
||||
body_part:SetBitten(false)
|
||||
body_part:setBiteTime(0)
|
||||
|
||||
@@ -301,7 +328,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
|
||||
|
||||
-- Set blood on the amputated limb
|
||||
TocSetBloodOnAmputation(getPlayer(), body_part)
|
||||
TocSetBloodOnAmputation(getPlayer(), adiacent_body_part)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ function ISCutLimb:findArgs()
|
||||
|
||||
local bandage = self.surgeon:getInventory():FindAndReturn('Bandage')
|
||||
local sterilized_bandage = self.surgeon:getInventory():FindAndReturn('AlcoholBandage')
|
||||
--local ripped_sheets = self.surgeon:getInventory():FindAndReturn("...")
|
||||
|
||||
if sterilized_bandage then
|
||||
bandage_table.bandage_type = sterilized_bandage:getType()
|
||||
@@ -79,6 +80,7 @@ function ISCutLimb:findArgs()
|
||||
elseif bandage then
|
||||
bandage_table.bandage_type = bandage:getType()
|
||||
bandage_table.is_bandage_sterilized = false
|
||||
bandage_table.use_bandage = true
|
||||
self.surgeon:getInventory():Remove(bandage)
|
||||
surgeon_factor = surgeon_factor + 2
|
||||
else
|
||||
@@ -107,16 +109,9 @@ function ISCutLimb:perform()
|
||||
TheOnlyCure.CutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
end
|
||||
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
SendCutLimb(self.patient, self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
else
|
||||
TheOnlyCure.CutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
end
|
||||
|
||||
|
||||
self.surgeon:getXp():AddXP(Perks.Doctor, 400);
|
||||
|
||||
ISBaseTimedAction.perform(self);
|
||||
self.surgeon:getXp():AddXP(Perks.Doctor, 400)
|
||||
ISBaseTimedAction.perform(self)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ function ISInstallProsthesis:perform()
|
||||
-- local toc_data = self.character:getModData().TOC
|
||||
--local part_name = TocGetPartNameFromBodyPartType(self.bodyPart:getType())
|
||||
|
||||
local body_part_type = TocGetBodyPartTypeFromPartName(self.part_name)
|
||||
local body_part_type = TocGetBodyPartFromPartName(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
|
||||
|
||||
Reference in New Issue
Block a user