Reworked GetAmputationTexturesIndex

This commit is contained in:
ZioPao
2023-11-21 02:10:09 +01:00
parent 8a3b0bb190
commit 0d3b82aee3
2 changed files with 3 additions and 14 deletions

View File

@@ -5,7 +5,6 @@ local PlayerHandler = require("TOC/Handlers/PlayerHandler")
local StaticData = require("TOC/StaticData") local StaticData = require("TOC/StaticData")
--------------------------- ---------------------------
-- TODO Add Bandages, Torniquet, etc.
--- Manages an amputation. Will be run on the patient client --- Manages an amputation. Will be run on the patient client
---@class AmputationHandler ---@class AmputationHandler
---@field patientPl IsoPlayer ---@field patientPl IsoPlayer

View File

@@ -19,26 +19,16 @@ ItemsHandler.Player = {}
---@private ---@private
function ItemsHandler.Player.GetAmputationTexturesIndex(playerObj, isCicatrized) function ItemsHandler.Player.GetAmputationTexturesIndex(playerObj, isCicatrized)
local textureString = playerObj:getHumanVisual():getSkinTexture() local textureString = playerObj:getHumanVisual():getSkinTexture()
local isHairy = string.find(textureString, "a$") local isHairy = textureString:sub(-1) == "a"
-- Hairy bodies
if isHairy then
textureString = textureString:sub(1, -2) -- Removes b at the end to make it compatible
end
local matchedIndex = string.match(textureString, "%d$") local matchedIndex = tonumber(textureString:match("%d$")) or 0
-- TODO Rework this
if isHairy then if isHairy then
matchedIndex = matchedIndex + 5 matchedIndex = matchedIndex + 5
end end
if isCicatrized then if isCicatrized then
if isHairy then matchedIndex = matchedIndex + (isHairy and 5 or 10) -- We add 5 is it's the texture texture, else 10
matchedIndex = matchedIndex + 5 -- to use the cicatrized texture on hairy bodies
else
matchedIndex = matchedIndex + 10 -- cicatrized texture only, no hairs
end
end end
return matchedIndex - 1 return matchedIndex - 1