fix: wearing amputation in MP 42.13

This commit is contained in:
ZioPao
2026-01-27 23:01:56 +01:00
parent df9f559078
commit e129b325e4
4 changed files with 17 additions and 8 deletions

View File

@@ -46,6 +46,17 @@ function ClientRelayCommands.ReceiveApplyFromServer()
end end
--* RELOAD MODEL *--
function ClientRelayCommands.ReceiveReloadModel(args)
local texId = args.texId
local itemName = args.itemName
TOC_DEBUG.print("Resetting visuals locally for item " .. itemName .. " with texId " .. tostring(texId))
local clothingItem = getPlayer():getInventory():FindAndReturn(itemName)
getPlayer():setWornItem(clothingItem:getBodyLocation(), clothingItem)
end
--* TRIGGERED BY ADMINS *-- --* TRIGGERED BY ADMINS *--
function ClientRelayCommands.ReceiveExecuteInitialization() function ClientRelayCommands.ReceiveExecuteInitialization()

View File

@@ -184,8 +184,6 @@ function AmputationHandler:execute(damagePlayer)
sendClientCommand(CommandsData.modules.TOC_ITEMS, "SpawnAmputationItem", sendClientCommand(CommandsData.modules.TOC_ITEMS, "SpawnAmputationItem",
{playerNum = self.patientPl:getOnlineID(), limbName = self.limbName}) {playerNum = self.patientPl:getOnlineID(), limbName = self.limbName})
--ItemsController.Player.DeleteOldAmputationItem(self.patientPl, self.limbName)
--ItemsController.Player.SpawnAmputationItem(self.patientPl, self.limbName)
-- Add it to the list of cut limbs on this local client -- Add it to the list of cut limbs on this local client
local username = self.patientPl:getUsername() local username = self.patientPl:getUsername()

View File

@@ -2,6 +2,8 @@
local StaticData = require("TOC/StaticData") local StaticData = require("TOC/StaticData")
local CommonMethods = require("TOC/CommonMethods") local CommonMethods = require("TOC/CommonMethods")
local CommandsData = require("TOC/CommandsData")
--------------------------- ---------------------------
--- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand). LOCAL ONLY! --- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand). LOCAL ONLY!
@@ -97,11 +99,7 @@ function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
---@cast clothItem InventoryItem ---@cast clothItem InventoryItem
ItemsController.Player.RemoveClothingItem(playerObj, clothItem) ItemsController.Player.RemoveClothingItem(playerObj, clothItem)
end end
-- Reset model just in case
playerObj:resetModel()
-- group:setMultiItem("TOC_Arm", true)
-- group:setMultiItem("TOC_ArmProst", true)
end end
---Spawns and equips the correct amputation item to the player. ---Spawns and equips the correct amputation item to the player.
@@ -109,14 +107,15 @@ end
---@param limbName string ---@param limbName string
function ItemsController.Player.SpawnAmputationItem(playerObj, limbName) function ItemsController.Player.SpawnAmputationItem(playerObj, limbName)
TOC_DEBUG.print("clothing name " .. StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName) TOC_DEBUG.print("clothing name " .. StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName)
local clothingItem = playerObj:getInventory():AddItem(StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName) local itemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
local clothingItem = playerObj:getInventory():AddItem(itemName)
local texId = ItemsController.Player.GetAmputationTexturesIndex(playerObj, false) local texId = ItemsController.Player.GetAmputationTexturesIndex(playerObj, false)
---@cast clothingItem InventoryItem ---@cast clothingItem InventoryItem
clothingItem:getVisual():setTextureChoice(texId) -- it counts from 0, so we have to subtract 1 clothingItem:getVisual():setTextureChoice(texId) -- it counts from 0, so we have to subtract 1
playerObj:setWornItem(clothingItem:getBodyLocation(), clothingItem)
sendAddItemToContainer(playerObj:getInventory(), clothingItem) sendAddItemToContainer(playerObj:getInventory(), clothingItem)
sendServerCommand(CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveWearAmputation, {itemName = itemName, texId = texId})
end end
---Search through worn items and modifies a specific amputation item ---Search through worn items and modifies a specific amputation item

View File

@@ -16,6 +16,7 @@ CommandsData.client = {
--* APPLY *-- --* APPLY *--
ReceiveApplyFromServer = "ReceiveApplyFromServer", ReceiveApplyFromServer = "ReceiveApplyFromServer",
ReceiveWearAmputation = "ReceiveWearAmputation",
--* ADMIN ONLY --* --* ADMIN ONLY --*
ReceiveExecuteInitialization = "ReceiveExecuteInitialization", ReceiveExecuteInitialization = "ReceiveExecuteInitialization",