Added debug print func

This commit is contained in:
ZioPao
2023-11-12 05:58:45 +01:00
parent 3d963a2ad6
commit 52a4798377
7 changed files with 16 additions and 8 deletions

View File

@@ -5,3 +5,11 @@ TOC_DEBUG.disablePaneMod = false
function TOC_DEBUG.togglePaneMod() function TOC_DEBUG.togglePaneMod()
TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod
end end
---comment
---@param string string
function TOC_DEBUG.print(string)
if isDebugEnabled() then
print("TOC: " .. string)
end
end

View File

@@ -40,7 +40,7 @@ end
---Starts bleeding from the point where the saw is being used ---Starts bleeding from the point where the saw is being used
function AmputationHandler:damageDuringAmputation() function AmputationHandler:damageDuringAmputation()
print("TOC: Damage patient") TOC_DEBUG.print("damage patient")
local bodyDamage = self.patient:getBodyDamage() local bodyDamage = self.patient:getBodyDamage()
local bodyDamagePart = bodyDamage:getBodyPart(self.bodyPartType) local bodyDamagePart = bodyDamage:getBodyPart(self.bodyPartType)

View File

@@ -47,7 +47,7 @@ function ItemsHandler.RemoveClothingItem(playerObj, clothingItem)
playerObj:removeWornItem(clothingItem) playerObj:removeWornItem(clothingItem)
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
print("TOC: found and deleted " .. tostring(clothingItem)) TOC_DEBUG.print("found and deleted" .. tostring(clothingItem))
return true return true
end end
return false return false
@@ -87,7 +87,7 @@ end
---Spawns and equips the correct amputation item to the player. ---Spawns and equips the correct amputation item to the player.
function ItemsHandler.SpawnAmputationItem(playerObj, limbName) function ItemsHandler.SpawnAmputationItem(playerObj, limbName)
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 clothingItem = playerObj:getInventory():AddItem(StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName)
local texId = ItemsHandler.GetAmputationTexturesIndex(playerObj, false) local texId = ItemsHandler.GetAmputationTexturesIndex(playerObj, false)
@@ -108,7 +108,7 @@ function ISInventoryPane:refreshContainer()
for i=1, #self.itemslist do for i=1, #self.itemslist do
local cItem = self.itemslist[i] local cItem = self.itemslist[i]
if cItem and cItem.cat == "Amputation" then if cItem and cItem.cat == "Amputation" then
--print("TOC: current item is an amputation, removing it from the list") TOC_DEBUG.print("current item is an amputation, removing it from the list")
table.remove(self.itemslist, i) table.remove(self.itemslist, i)
end end
end end

View File

@@ -88,7 +88,7 @@ end
---Cache the currently amputated limbs ---Cache the currently amputated limbs
---@param limbName string ---@param limbName string
function PlayerHandler.AddLocalAmputatedLimb(limbName) function PlayerHandler.AddLocalAmputatedLimb(limbName)
print("TOC: added " .. limbName .. " to known amputated limbs") TOC_DEBUG.print("added " .. limbName .. " to known amputated limbs")
table.insert(PlayerHandler.amputatedLimbs, limbName) -- TODO This should be player specific, not generic table.insert(PlayerHandler.amputatedLimbs, limbName) -- TODO This should be player specific, not generic
end end

View File

@@ -16,7 +16,7 @@ end
---@param bodyLocation string ---@param bodyLocation string
---@return boolean ---@return boolean
function ProsthesisHandler.CheckIfEquippable(bodyLocation) function ProsthesisHandler.CheckIfEquippable(bodyLocation)
print("Current item is a prosthesis") TOC_DEBUG.print("current item is a prosthesis")
local side = CommonMethods.GetSide(bodyLocation) local side = CommonMethods.GetSide(bodyLocation)
for i=1, #PlayerHandler.amputatedLimbs do for i=1, #PlayerHandler.amputatedLimbs do

View File

@@ -106,7 +106,7 @@ function CutLimbHandler:isValid(itemType)
end end
function CutLimbHandler:perform(previousAction, itemType) function CutLimbHandler:perform(previousAction, itemType)
print("perform cutlimbhandler") TOC_DEBUG.print("perform CutLimbHandler")
local item = self:getItemOfType(self.items.ITEMS, itemType) local item = self:getItemOfType(self.items.ITEMS, itemType)
previousAction = self:toPlayerInventory(item, previousAction) previousAction = self:toPlayerInventory(item, previousAction)

View File

@@ -5,7 +5,7 @@ local function AddBodyLocationBefore(newLocation, moveToLocation)
local list = getClassFieldVal(group, getClassField(group, 1)) local list = getClassFieldVal(group, getClassField(group, 1))
group:getOrCreateLocation(newLocation) group:getOrCreateLocation(newLocation)
local newItem = list:get(list:size()-1) local newItem = list:get(list:size()-1)
print("TOC: Created new body location" .. newItem:getId()) TOC_DEBUG.print("created new body location" .. newItem:getId())
list:remove(newItem) -- We can't use the Index, it works if we pass the item though! list:remove(newItem) -- We can't use the Index, it works if we pass the item though!
local i = group:indexOf(moveToLocation) local i = group:indexOf(moveToLocation)
list:add(i, newItem) list:add(i, newItem)