Bandage handling and bug fixes
This commit is contained in:
@@ -57,9 +57,6 @@ function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function AmputationHandler.HandleBandages(prevAction, limbName, surgeonPl, patientPl, bandageItem)
|
function AmputationHandler.HandleBandages(prevAction, limbName, surgeonPl, patientPl, bandageItem)
|
||||||
|
|
||||||
-- TODO Will it work? Can we get bodyDamage for another player from here?
|
|
||||||
|
|
||||||
local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
|
local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
|
||||||
local bd = patientPl:getBodyDamage()
|
local bd = patientPl:getBodyDamage()
|
||||||
local bodyPart = bd:getBodyPart(bptEnum)
|
local bodyPart = bd:getBodyPart(bptEnum)
|
||||||
|
|||||||
@@ -55,11 +55,15 @@ function CutLimbAction:start()
|
|||||||
|
|
||||||
|
|
||||||
-- TODO Check bandages, if there are init a bandage process
|
-- TODO Check bandages, if there are init a bandage process
|
||||||
local bandageItem = ""
|
|
||||||
|
--AmputationHandler.HandleBandages(self, self.limbName, self.character, self.patient, )
|
||||||
|
local bandageItem = InventoryItemFactory.CreateItem("Base.Bandage")
|
||||||
|
self.character:getInventory():addItem(bandageItem)
|
||||||
|
|
||||||
local bptEnum = StaticData.BODYLOCS_IND_BPT[self.limbName]
|
local bptEnum = StaticData.BODYLOCS_IND_BPT[self.limbName]
|
||||||
local bd = self.character:getBodyDamage()
|
local bd = self.character:getBodyDamage()
|
||||||
local bodyPart = bd:getBodyPart(bptEnum)
|
local bodyPart = bd:getBodyPart(bptEnum)
|
||||||
local bandageAction = ISApplyBandage:new(self.character, self.patient, bandageItem, bodyPart, true)
|
local bandageAction = ISApplyBandage:new(self.character, self.patient, bandageItem, bodyPart, 100)
|
||||||
ISTimedActionQueue.addAfter(self, bandageAction)
|
ISTimedActionQueue.addAfter(self, bandageAction)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
||||||
---Check if the item name corresponds to a compatible saw
|
|
||||||
---@param itemName string
|
|
||||||
local function CheckIfSaw(itemName)
|
---Check if the item type corresponds to a compatible saw
|
||||||
return itemName == "Saw" or itemName == "GardenSaw" or itemName == "Chainsaw"
|
---@param itemType string
|
||||||
|
local function CheckIfSaw(itemType)
|
||||||
|
return itemType:contains(StaticData.SAWS_TYPES_IND_STR.saw) or itemType:contains(StaticData.SAWS_TYPES_IND_STR.gardenSaw)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---Add the action to the queue
|
---Add the action to the queue
|
||||||
---@param limbName string
|
---@param limbName string
|
||||||
---@param surgeon IsoPlayer
|
---@param surgeon IsoPlayer
|
||||||
@@ -42,8 +45,19 @@ end
|
|||||||
---@param context ISContextMenu
|
---@param context ISContextMenu
|
||||||
---@param items table
|
---@param items table
|
||||||
local function AddInventoryAmputationMenu(player, context, items)
|
local function AddInventoryAmputationMenu(player, context, items)
|
||||||
local item = items[1] -- Selected item
|
local item
|
||||||
if CheckIfSaw(item.name) then
|
|
||||||
|
-- We can't access the item if we don't create the loop and start ipairs.
|
||||||
|
for _, v in ipairs(items) do
|
||||||
|
item = v
|
||||||
|
if not instanceof(v, "InventoryItem") then
|
||||||
|
item = v.items[1]
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
local itemType = item:getType()
|
||||||
|
if CheckIfSaw(itemType) then
|
||||||
AddInventoryAmputationOptions(player, context, item)
|
AddInventoryAmputationOptions(player, context, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -74,7 +88,9 @@ end
|
|||||||
---@param item InventoryItem
|
---@param item InventoryItem
|
||||||
function CutLimbHandler:checkItem(item)
|
function CutLimbHandler:checkItem(item)
|
||||||
local itemType = item:getType()
|
local itemType = item:getType()
|
||||||
if string.contains(itemType, "Saw") then
|
TOC_DEBUG.print("checkItem: " .. tostring(itemType))
|
||||||
|
|
||||||
|
if CheckIfSaw(itemType) then
|
||||||
self:addItem(self.items.ITEMS, item)
|
self:addItem(self.items.ITEMS, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -50,7 +50,24 @@ function TOC_DEBUG.TestBodyDamage(id)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TOC_DEBUG.TestBloodDrop()
|
||||||
|
local pl = getPlayer()
|
||||||
|
|
||||||
|
--IsoZombieGiblets.GibletType.A
|
||||||
|
--local giblets = IsoZombieGiblets.new(getCell())
|
||||||
|
|
||||||
|
local sq = pl:getSquare()
|
||||||
|
local t = IsoZombieGiblets.class.GibletType
|
||||||
|
|
||||||
|
print(t)
|
||||||
|
--IsoBall.new(getCell(), pl:getX(), pl:)
|
||||||
|
addBloodSplat(sq, 100)
|
||||||
|
|
||||||
|
|
||||||
|
--pl:getChunk():addBloodSplat(pl:getX(), pl:getY(), pl:getZ(), 100)
|
||||||
|
--IsoZombieGiblets.new(x, getCell(), pl:getX(), pl:getY(), pl:getZ(), 100, 1)
|
||||||
|
|
||||||
|
end
|
||||||
---------------------------------
|
---------------------------------
|
||||||
--* Debug server commands *--
|
--* Debug server commands *--
|
||||||
|
|
||||||
|
|||||||
@@ -159,4 +159,21 @@ StaticData.HEALTH_PANEL_TEXTURES = {
|
|||||||
StaticData.AMPUTATION_CLOTHING_ITEM_BASE = "TOC.Amputation_"
|
StaticData.AMPUTATION_CLOTHING_ITEM_BASE = "TOC.Amputation_"
|
||||||
|
|
||||||
|
|
||||||
|
------------------
|
||||||
|
--* Items check
|
||||||
|
|
||||||
|
local sawObj = InventoryItemFactory.CreateItem("Base.Saw")
|
||||||
|
local gardenSawObj = InventoryItemFactory.CreateItem("Base.GardenSaw")
|
||||||
|
|
||||||
|
StaticData.SAWS_NAMES_IND_STR = {
|
||||||
|
saw = sawObj:getName(),
|
||||||
|
gardenSaw = gardenSawObj:getName()
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticData.SAWS_TYPES_IND_STR = {
|
||||||
|
saw = sawObj:getType(),
|
||||||
|
gardenSaw = gardenSawObj:getType()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return StaticData
|
return StaticData
|
||||||
|
|||||||
Reference in New Issue
Block a user