diff --git a/.vscode/settings.json b/.vscode/settings.json index 1930a37..b9abe73 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -40,6 +40,7 @@ "BodyLocations", "ISUnequipAction", "ISInventoryPaneContextMenu", - "ISDropItemAction" + "ISDropItemAction", + "BloodBodyPartType" ] } \ No newline at end of file diff --git a/media/lua/client/TOC_OverridenFunctions.lua b/media/lua/client/TOC_OverridenFunctions.lua index 4dca05e..5f13103 100644 --- a/media/lua/client/TOC_OverridenFunctions.lua +++ b/media/lua/client/TOC_OverridenFunctions.lua @@ -5,6 +5,10 @@ require "ISUI/ISInventoryPaneContextMenu" local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime + +-- TODO On death hide the amputation so that other players cant pick it up + + -- FIXME something is seriously broken here, it stacks up function ISBaseTimedAction:adjustMaxTime(maxTime) diff --git a/media/lua/client/TOC_Visuals.lua b/media/lua/client/TOC_Visuals.lua index ca6ee01..38fa8e0 100644 --- a/media/lua/client/TOC_Visuals.lua +++ b/media/lua/client/TOC_Visuals.lua @@ -6,4 +6,27 @@ function TocSetCorrectTextureForAmputation(item, player) local matched_index = string.match(texture_string, "%d$") print("TOC: Setting texture " .. matched_index) item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- TODO why is it correct with -1? +end + +function TocSetBloodOnAmputation(player, body_part) + + + local body_part_type = body_part:getType() + local blood_body_part_type + if body_part_type == BodyPartType.Hand_R then + blood_body_part_type = BloodBodyPartType.ForeArm_R + elseif body_part_type == BodyPartType.Hand_L then + blood_body_part_type = BloodBodyPartType.ForeArm_L + elseif body_part_type == BodyPartType.Forearm_L or body_part_type == BodyPartType.UpperArm_L then + blood_body_part_type = BloodBodyPartType.UpperArm_L + elseif body_part_type == BodyPartType.Forearm_R or body_part_type == BodyPartType.UpperArm_R then + blood_body_part_type= BloodBodyPartType.UpperArm_R + end + + + print("TOC: Adding blood based on " .. tostring(body_part_type)) + + player:addBlood(blood_body_part_type, false, true, false) + player:addBlood(BloodBodyPartType.Torso_Lower, false, true, false) + end \ No newline at end of file diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index f9baf5e..f113900 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -217,21 +217,22 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille local player = getPlayer() local toc_data = player:getModData().TOC local part_data = toc_data.Limbs - local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)) + + local body_part = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)) local stats = player:getStats() -- Set damage, stress, and low endurance after amputation - body_part_type:AddDamage(100 - surgeon_factor) - body_part_type:setAdditionalPain(100 - surgeon_factor) - body_part_type:setBleeding(true) - body_part_type:setBleedingTime(100 - surgeon_factor) - body_part_type:setDeepWounded(true) - body_part_type:setDeepWoundTime(100 - surgeon_factor) + 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) stats:setEndurance(surgeon_factor) stats:setStress(100 - surgeon_factor) -- If bandages are available, use them - body_part_type:setBandaged(bandage_table.use_bandage, 10, bandage_table.is_bandage_sterilized, bandage_table.bandage_type) + body_part:setBandaged(bandage_table.use_bandage, 10, bandage_table.is_bandage_sterilized, bandage_table.bandage_type) @@ -251,7 +252,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille local body_damage = player:getBodyDamage() if part_data[part_name].is_infected and body_damage.getInfectionLevel() < 20 then part_data[part_name].is_infected = false - body_part_type:SetBitten(false) + body_part:SetBitten(false) -- Second check, let's see if there is any other infected limb. if CheckIfStillInfected(part_data) == false then @@ -280,6 +281,10 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille TocSetCorrectTextureForAmputation(amputation_clothing_item, player) player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) + + -- Set blood on the amputated limb + TocSetBloodOnAmputation(getPlayer(), body_part) + player:transmitModData() end