Added wrist watches and stuff drop
This commit is contained in:
@@ -42,7 +42,6 @@ function LocalPlayerController.InitializePlayer(isForced)
|
||||
|
||||
-- Set a bool to use an overriding GetDamagedParts
|
||||
SetHealthPanelTOC()
|
||||
|
||||
end
|
||||
|
||||
---Handles the traits
|
||||
@@ -67,7 +66,6 @@ end
|
||||
---Used to heal an area that has been cut previously. There's an exception for bites, those are managed differently
|
||||
---@param bodyPart BodyPart
|
||||
function LocalPlayerController.HealArea(bodyPart)
|
||||
|
||||
bodyPart:setFractureTime(0)
|
||||
|
||||
bodyPart:setScratched(false, true)
|
||||
@@ -128,7 +126,6 @@ function LocalPlayerController.TryRandomBleed(character, limbName)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-------------------------
|
||||
--* Damage handling *--
|
||||
--- Locks OnPlayerGetDamage event, to prevent it from getting spammed constantly
|
||||
@@ -149,7 +146,6 @@ function LocalPlayerController.HandleDamage(character)
|
||||
local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
|
||||
local bodyPart = bd:getBodyPart(bptEnum)
|
||||
if dcInst:getIsCut(limbName) then
|
||||
|
||||
-- Generic injury, let's heal it since they already cut the limb off
|
||||
if bodyPart:HasInjury() then
|
||||
TOC_DEBUG.print("Healing area - " .. limbName)
|
||||
@@ -189,7 +185,6 @@ function LocalPlayerController.HandleDamage(character)
|
||||
|
||||
-- Disable the lock
|
||||
LocalPlayerController.hasBeenDamaged = false
|
||||
|
||||
end
|
||||
|
||||
---Setup HandleDamage, triggered by OnPlayerGetDamage
|
||||
@@ -197,7 +192,6 @@ end
|
||||
---@param damageType string
|
||||
---@param damageAmount number
|
||||
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
||||
|
||||
-- TODO Check if other players in the online triggers this
|
||||
|
||||
if LocalPlayerController.hasBeenDamaged == false then
|
||||
@@ -280,7 +274,6 @@ function LocalPlayerController.UpdateAmputations()
|
||||
Events.EveryHours.Remove(LocalPlayerController.UpdateAmputations) -- We can remove it safely, no cicatrization happening here boys
|
||||
end
|
||||
TOC_DEBUG.print("updating cicatrization and wound dirtyness!")
|
||||
|
||||
end
|
||||
|
||||
---Starts safely the loop to update cicatrzation
|
||||
@@ -325,7 +318,6 @@ function LocalPlayerController.HandleTourniquet()
|
||||
-- local wornItem = wornItems:get(j-1)
|
||||
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
||||
@@ -333,12 +325,43 @@ Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
||||
|
||||
--* Object drop handling when amputation occurs
|
||||
|
||||
--- Drop all items from the affected limb
|
||||
---@param limbName string
|
||||
function LocalPlayerController.DropItemsAfterAmputation(limbName)
|
||||
|
||||
-- TODO Check for watches and stuff like that
|
||||
|
||||
TOC_DEBUG.print("Triggered DropItemsAfterAmputation")
|
||||
local side = CommonMethods.GetSide(limbName)
|
||||
local sideStr
|
||||
|
||||
if side == 'R' then
|
||||
sideStr = "Right"
|
||||
else
|
||||
sideStr = 'Left'
|
||||
end
|
||||
|
||||
|
||||
local pl = getPlayer()
|
||||
|
||||
local wornItems = pl:getWornItems()
|
||||
|
||||
for i = 1, wornItems:size() do
|
||||
local it = wornItems:get(i - 1)
|
||||
if it then
|
||||
local wornItem = wornItems:get(i - 1):getItem()
|
||||
TOC_DEBUG.print(wornItem:getBodyLocation())
|
||||
|
||||
local bl = wornItem:getBodyLocation()
|
||||
if string.contains(limbName, "Hand_") and (bl == sideStr .. "_MiddleFinger" or bl == sideStr .. "_RingFinger") then
|
||||
pl:removeWornItem(wornItem)
|
||||
end
|
||||
|
||||
|
||||
if string.contains(limbName, "ForeArm_") and (bl == sideStr .. "Wrist") then
|
||||
pl:removeWornItem(wornItem)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Events.OnAmputatedLimb.Add(LocalPlayerController.DropItemsAfterAmputation)
|
||||
|
||||
Reference in New Issue
Block a user