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")
---------------------------
-- TODO Add Bandages, Torniquet, etc.
--- Manages an amputation. Will be run on the patient client
---@class AmputationHandler
---@field patientPl IsoPlayer

View File

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