cleaning up crap

This commit is contained in:
ZioPao
2024-04-30 18:00:34 +02:00
parent 074950ebf6
commit 7b07b7954a
3 changed files with 129 additions and 45 deletions

View File

@@ -3,7 +3,7 @@ local ItemsController = require("TOC/Controllers/ItemsController")
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
local LocalPlayerController = require("TOC/Controllers/LocalPlayerController")
local StaticData = require("TOC/StaticData")
local CommonMethods = require("TOC/CommonMethods")
local TourniquetController = require("TOC/Controllers/TourniquetController")
---------------------------
--- Manages an amputation. Will be run on the patient client
@@ -42,31 +42,6 @@ end
--* Static methods *--
---@param player IsoPlayer
---@param limbName string
---@return boolean
function AmputationHandler.CheckTourniquet(player, limbName)
local side = CommonMethods.GetSide(limbName)
local wornItems = player:getWornItems()
for j=1,wornItems:size() do
local wornItem = wornItems:get(j-1)
local fType = wornItem:getItem():getFullType()
if string.contains(fType, "Surg_Arm_Tourniquet_") then
-- Check side
if luautils.stringEnds(fType, side) then
TOC_DEBUG.print("Found acceptable tourniquet")
return true
end
end
end
return false
end
---@param player IsoPlayer
---@param limbName string
function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
@@ -159,7 +134,7 @@ function AmputationHandler:damageAfterAmputation(surgeonFactor)
-- Check if player has tourniquet equipped on the limb
-- TODO Suboptimal checks, but they should work for now.
local hasTourniquet = AmputationHandler.CheckTourniquet(self.patientPl, self.limbName)
local hasTourniquet = TourniquetController.CheckTourniquetOnLimb(self.patientPl, self.limbName)
if hasTourniquet then
TOC_DEBUG.print("Do something different for the damage calculation because tourniquet is applied")
baseDamage = baseDamage * 0.5 -- 50% less damage due to tourniquet