Bump to mod version and changed folder for specific game version

This commit is contained in:
ZioPao
2025-03-31 02:17:40 +02:00
parent b6b61b872f
commit e919c8c01b
64 changed files with 2 additions and 10 deletions

View File

@@ -1,58 +0,0 @@
require("TOC/Debug")
require("NPCs/BodyLocations")
local BodyLocationsAPI = {}
local function customGetVal(obj, int) return getClassFieldVal(obj, getClassField(obj, int)) end
local group = BodyLocations.getGroup("Human")
---@type ArrayList
local list = customGetVal(group, 1)
---@param toRelocateOrCreate string
---@param locationElement string
---@param afterBoolean boolean
---@return BodyLocation
function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, locationElement, afterBoolean)
-- Check type of arg 2 == string - if not error out.
if type(locationElement) ~= "string" then error("Argument 2 is not of type string. Please re-check!", 2) end
local itemToMoveTo = group:getLocation(locationElement) -- get location to move to
if itemToMoveTo ~= nil then
-- Check type of arg 1 == string - if not, error out.
if type(toRelocateOrCreate) ~= "string" then error("Argument 1 is not of type string. Please re-check!", 2) end
local curItem = group:getOrCreateLocation(toRelocateOrCreate) -- get current item - or create
list:remove(curItem) -- remove from the list
local index = group:indexOf(locationElement) -- get current index after removal of the location to move to
if afterBoolean then index = index + 1 end -- if we want it after it, we increase the index to move to by one
list:add(index, curItem) -- we add the item again
return curItem
else -- we did not find the location to move to, so we throw an error.
error("Could not find the BodyLocation [".. tostring(locationElement) .."] - please check the passed arguments!", 2)
end
end
function TestBodyLocations()
local group = BodyLocations.getGroup("Human")
local x = group:getAllLocations()
for i=0, x:size() -1 do
---@type BodyLocation
local bl = x:get(i)
print(bl:getId())
end
end
-- MultiItem causes a ton of issues... fucking hell
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
group:setMultiItem("TOC_Arm", true)
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
group:setMultiItem("TOC_ArmProst", true)
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmAccessory", "TOC_ArmProst", true)
group:setMultiItem("TOC_ArmAccessory", true)

View File

@@ -1,57 +0,0 @@
local StaticData = require("TOC/StaticData")
------------------------
local CommandsData = {}
CommandsData.modules = {
TOC_DEBUG = "TOC_DEBUG",
TOC_RELAY = "TOC_RELAY"
}
CommandsData.client = {
Relay = {
ReceiveDamageDuringAmputation = "ReceiveDamageDuringAmputation", ---@alias receiveDamageDuringAmputationParams { limbName : string}
ReceiveExecuteAmputationAction = "ReceiveExecuteAmputationAction", ---@alias receiveExecuteAmputationActionParams {surgeonNum : number, limbName : string, damagePlayer : boolean}
--* APPLY *--
ReceiveApplyFromServer = "ReceiveApplyFromServer",
--* ADMIN ONLY --*
ReceiveExecuteInitialization = "ReceiveExecuteInitialization",
ReceiveForcedCicatrization = "ReceiveForcedCicatrization" ---@alias receiveForcedCicatrizationParams {limbName : string}
}
}
CommandsData.server = {
Debug = {
PrintTocData = "PrintTocData", ---@alias printTocDataParams {username : string}
PrintAllTocData = "PrintAllTocData"
},
Relay = {
RelayDamageDuringAmputation = "RelayDamageDuringAmputation", ---@alias relayDamageDuringAmputationParams {patientNum : number, limbName : string}
RelayExecuteAmputationAction = "RelayExecuteAmputationAction", ---@alias relayExecuteAmputationActionParams {patientNum : number, limbName : string}
--* ADMIN ONLY *--
RelayExecuteInitialization = "RelayExecuteInitialization", ---@alias relayExecuteInitializationParams {patientNum : number}
RelayForcedAmputation = "RelayForcedAmputation" ---@alias relayForcedAmputationParams {patientNum : number, limbName : string}
}
}
---Get the correct key for that particular player to be used in the global mod data table
---@param username string
---@return string
function CommandsData.GetKey(username)
return StaticData.MOD_NAME .. "_" .. username
end
function CommandsData.GetUsername(key)
return string.sub(key, #StaticData.MOD_NAME + 2, #key) -- Not sure why +2... Something with kahlua, it should be +1
end
function CommandsData.GetZombieKey()
return StaticData.MOD_NAME .. "_ZOMBIES"
end
return CommandsData

View File

@@ -1,110 +0,0 @@
TOC_DEBUG = {}
TOC_DEBUG.disablePaneMod = false
TOC_DEBUG.enableHealthPanelDebug = false
function TOC_DEBUG.TogglePaneMod()
TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod
end
function TOC_DEBUG.ToggleHealthPanelDebug()
TOC_DEBUG.enableHealthPanelDebug = not TOC_DEBUG.enableHealthPanelDebug
end
---Print debug
---@param string string
function TOC_DEBUG.print(string)
--if isDebugEnabled() then
local runningFile = TOC_DEBUG.getRunningFile()
print("[TOC]" .. "[" .. runningFile .. "] " .. tostring(string))
--end
end
---Horrendous but I don't really care about performance for this
---@return string
function TOC_DEBUG.getRunningFile()
local coroutine = getCurrentCoroutine()
local o = getCoroutineObjStack(coroutine, 0)
if o then
local s = KahluaUtil.rawTostring2(o)
local match = string.match(s, "file: (%w+)%.lua")
if match then return match end
end
return ""
end
function TOC_DEBUG.printTable(table, indent)
if not table then return end
indent = indent or ""
for key, value in pairs(table) do
if type(value) == "table" then
print(indent .. key .. " (table):")
TOC_DEBUG.printTable(value, indent .. " ")
else
print(indent .. key .. ":", value)
end
end
end
---------------------------------
--* Random debug commands *--
function TOC_DEBUG.TestBodyDamage(id)
local StaticData = require("TOC/StaticData")
local pl = getPlayerByOnlineID(id)
local bd = pl:getBodyDamage()
TOC_DEBUG.print(tostring(bd))
if bd then
TOC_DEBUG.print("bd for " .. pl:getUsername() .. " exists")
local bptEnum = StaticData.LIMBS_TO_BODYLOCS_IND_BPT["Hand_L"]
local bodyPart = bd:getBodyPart(bptEnum)
bodyPart:setBleeding(true)
bodyPart:setCut(true)
TOC_DEBUG.print(tostring(bodyPart))
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 *--
local CommandsData = require("TOC/CommandsData")
function TOC_DEBUG.printPlayerServerModData(username)
sendClientCommand(CommandsData.modules.TOC_DEBUG, CommandsData.server.Debug.PrintTocData, {username = username})
end
function TOC_DEBUG.printAllServerModData()
sendClientCommand(CommandsData.modules.TOC_DEBUG, CommandsData.server.Debug.PrintAllTocData, {})
end
function TOC_DEBUG.testRelayDamage()
---@type relayDamageDuringAmputationParams
local params = {limbName = "Hand_R", patientNum = getPlayer():getOnlineID()}
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayDamageDuringAmputation, params)
end

View File

@@ -1,293 +0,0 @@
---@alias partDataType { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, woundDirtyness : number, cicatrizationTime : number }
---@alias limbsTable {Hand_L : partDataType, ForeArm_L : partDataType, UpperArm_L : partDataType, Hand_R : partDataType, ForeArm_R : partDataType, UpperArm_R : partDataType }
---@alias prosthesisData {isProstEquipped : boolean, prostFactor : number }
---@alias prosthesesTable {Top_L : prosthesisData, Top_R : prosthesisData } -- TODO add Bottom_L and Bottom_R
---@alias tocModDataType { limbs : limbsTable, prostheses : prosthesesTable, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean, isUpdateFromServer : boolean, isInitializing : boolean}
---------------------------
-- _STR = Only strings, no index
-- _IND_STR = indexed Strings
-- _IND_BPT = Indexed BodyPartType
-- PART = Single part, could be hand, forearm, etc
-- LIMB = Part + side
-- BODYLOCS = Body Locations
local StaticData = {}
---Mod name, used to setup Global Mod Data and various stuff
StaticData.MOD_NAME = "TOC"
-------------------------
--* Base
-- TODO Add references inside tables instead of making multiple tables
StaticData.SIDES_IND_STR = {
R = "R",
L = "L"
}
StaticData.SIDES_STR = {
"R", "L"
}
StaticData.PARTS_IND_STR = {
Hand = "Hand",
ForeArm = "ForeArm",
UpperArm = "UpperArm"
}
StaticData.PARTS_STR = {
"Hand",
"ForeArm",
"UpperArm"
}
StaticData.MOD_BODYLOCS_BASE_IND_STR = {
TOC_ArmProst = "TOC_ArmProst",
TOC_LegProst = "TOC_LegProst",
TOC_Arm = "TOC_Arm",
}
-- No "MAX" here.
StaticData.IGNORED_BODYLOCS_BPT = {
BodyPartType.Foot_L, BodyPartType.Foot_R, BodyPartType.Groin, BodyPartType.Head,
BodyPartType.LowerLeg_L, BodyPartType.LowerLeg_R, BodyPartType.Neck, BodyPartType.Torso_Lower,
BodyPartType.Torso_Upper, BodyPartType.UpperLeg_L, BodyPartType.UpperLeg_R
}
-- Assembled BodyParts string
StaticData.LIMBS_STR = {}
StaticData.LIMBS_IND_STR = {}
StaticData.LIMBS_DEPENDENCIES_IND_STR = {}
StaticData.LIMBS_ADJACENT_IND_STR = {}
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM = {}
StaticData.LIMBS_BASE_DAMAGE_IND_NUM = {}
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM = {}
StaticData.LIMBS_TO_BODYLOCS_IND_BPT = {} -- {limbName = bodyLoc}
StaticData.BODYLOCS_TO_LIMBS_IND_STR = {} -- {bodyLoc = limbName}
-- FIXME You weren't considering surgeonFactor, which decreases that base time. Fuck mod 60
-- CicatrizationBaseTime should be mod 60 since we're using EveryHours to update the cicatrizationTime
---@param assembledName string
---@param side string
local function AssembleHandData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 60
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 120
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 2
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = {}
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.ForeArm .. "_" .. side
end
---@param assembledName string
---@param side string
local function AssembleForearmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 80
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 144
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 3
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side }
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.UpperArm .. "_" .. side
end
---@param assembledName string
---@param side string
local function AssembleUpperarmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 100
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 192
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 4
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side,
StaticData.PARTS_IND_STR.ForeArm .. "_" .. side }
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = "Torso_Upper"
end
for side, _ in pairs(StaticData.SIDES_IND_STR) do
for part, _ in pairs(StaticData.PARTS_IND_STR) do
local assembledName = part .. "_" .. side
-- Assembled strings
table.insert(StaticData.LIMBS_STR, assembledName) -- We need a table like this to cycle through it easily
StaticData.LIMBS_IND_STR[assembledName] = assembledName
-- BodyParts stuff
---@type BodyPartType
local bptType = BodyPartType[assembledName]
local bptString = BodyPartType.ToString(bptType)
StaticData.LIMBS_TO_BODYLOCS_IND_BPT[assembledName] = bptType
StaticData.BODYLOCS_TO_LIMBS_IND_STR[bptString] = assembledName
-- Dependencies and cicatrization time
if part == StaticData.PARTS_IND_STR.Hand then
AssembleHandData(assembledName, side)
elseif part == StaticData.PARTS_IND_STR.ForeArm then
AssembleForearmData(assembledName, side)
elseif part == StaticData.PARTS_IND_STR.UpperArm then
AssembleUpperarmData(assembledName, side)
end
end
end
-----------------
--* Amputation Groups
StaticData.AMP_GROUPS_BASE_IND_STR = {
Top = "Top",
Bottom = "Bottom"
}
StaticData.AMP_GROUPS_IND_STR = {}
StaticData.AMP_GROUPS_STR = {}
for side, _ in pairs(StaticData.SIDES_IND_STR) do
for group, _ in pairs(StaticData.AMP_GROUPS_BASE_IND_STR) do
local sidedGroup = group .. "_" .. side
StaticData.AMP_GROUPS_IND_STR[sidedGroup] = sidedGroup
table.insert(StaticData.AMP_GROUPS_STR, sidedGroup)
end
end
-- TODO We can do this in one pass if we do it before
StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR = {} -- This is probably unnecessary
StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR = {}
for side, _ in pairs(StaticData.SIDES_IND_STR) do
for part, _ in pairs(StaticData.PARTS_IND_STR) do
local limbName = part .. "_" .. side
local group
if part == StaticData.PARTS_IND_STR.Hand or part == StaticData.PARTS_IND_STR.ForeArm or part == StaticData.PARTS_IND_STR.UpperArm then
group = StaticData.AMP_GROUPS_BASE_IND_STR.Top
else
group = StaticData.AMP_GROUPS_BASE_IND_STR.Bottom
end
local sidedGroup = group .. "_" .. side
if StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup] == nil then
StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup] = {}
end
table.insert(StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup], limbName)
StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR[limbName] = sidedGroup
end
end
StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR = {
["HandsLeft"] = StaticData.AMP_GROUPS_IND_STR.Top_L,
["HandsRight"] = StaticData.AMP_GROUPS_IND_STR.Top_R
}
StaticData.AFFECTED_BODYLOCS_TO_LIMBS_IND_STR = {}
local handsBodyLocs = {"Hands%s", "%s_MiddleFinger", "%s_RingFinger"}
local foreArmBodyLocs = {"%sWrist"}
for side, _ in pairs(StaticData.SIDES_IND_STR) do
for part, _ in pairs(StaticData.PARTS_IND_STR) do
local limbName = part .. "_" .. side
local sideFull
if side == 'R' then sideFull = "Right" else sideFull = "Left" end
if part == "Hand" then
for i=1, #handsBodyLocs do
local bl = string.format(handsBodyLocs[i], sideFull)
StaticData.AFFECTED_BODYLOCS_TO_LIMBS_IND_STR[bl] = limbName
end
elseif part == "ForeArm" then
-- -- UGLY very ugly
-- for i=1, #handsBodyLocs do
-- local bl = string.format(handsBodyLocs[i], sideFull)
-- StaticData.AFFECTED_BODYLOCS_TO_LIMBS_IND_STR[bl] = limbName
-- end
for i=1, #foreArmBodyLocs do
local bl = string.format(foreArmBodyLocs[i], sideFull)
StaticData.AFFECTED_BODYLOCS_TO_LIMBS_IND_STR[bl] = limbName
end
end
end
end
-----------------
--* Traits
-- Link a trait to a specific body part
StaticData.TRAITS_BP = {
Amputee_Hand = "Hand_L",
Amputee_ForeArm = "ForeArm_L",
Amputee_UpperArm = "UpperArm_L"
}
-----------------
--* Visuals and clothing
--- Textures
StaticData.HEALTH_PANEL_TEXTURES = {
Female = {
Hand_L = getTexture("media/ui/Female/Hand_L.png"),
ForeArm_L = getTexture("media/ui/Female/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/Female/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Female/Hand_R.png"),
ForeArm_R = getTexture("media/ui/Female/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/Female/UpperArm_R.png")
},
Male = {
Hand_L = getTexture("media/ui/Male/Hand_L.png"),
ForeArm_L = getTexture("media/ui/Male/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/Male/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Male/Hand_R.png"),
ForeArm_R = getTexture("media/ui/Male/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/Male/UpperArm_R.png")
},
ProstArm = {
L = getTexture("media/ui/ProstArm_L.png"),
R = getTexture("media/ui/ProstArm_R.png")
}
}
StaticData.AMPUTATION_CLOTHING_ITEM_BASE = "TOC.Amputation_"
------------------
--* Items check
local sawObj = instanceItem("Base.Saw")
local gardenSawObj = instanceItem("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

View File

@@ -1,49 +0,0 @@
---Setups the custom TOC traits
local TRAITS = {
Amputee_Hand = "Amputee_Hand",
Amputee_ForeArm = "Amputee_ForeArm",
Amputee_UpperArm = "Amputee_UpperArm",
--Insensitive = "Insensitive" -- TODO Disabled for now, until we reintroduce it
}
local function GetTraitText(trait)
return getText("UI_trait_" .. trait)
end
local function GetTraitDesc(trait)
return getText("UI_trait_" .. trait .. "_desc")
end
local function SetupTraits()
-- Perks.Left_Hand is defined in perks.txt
local traitsTable = {
[1] = TraitFactory.addTrait(TRAITS.Amputee_Hand, GetTraitText(TRAITS.Amputee_Hand), -8, GetTraitDesc(TRAITS.Amputee_Hand), false, false),
[2] = TraitFactory.addTrait(TRAITS.Amputee_ForeArm, GetTraitText(TRAITS.Amputee_ForeArm), -10, GetTraitDesc(TRAITS.Amputee_ForeArm), false, false),
[3] = TraitFactory.addTrait(TRAITS.Amputee_UpperArm, GetTraitText(TRAITS.Amputee_UpperArm), -20, GetTraitDesc(TRAITS.Amputee_UpperArm), false, false)
}
for i=1, #traitsTable do
---@type Trait
local t = traitsTable[i]
---@diagnostic disable-next-line: undefined-field
t:addXPBoost(Perks.Left_Hand, 4)
t:addXPBoost(Perks.Fitness, -1)
t:addXPBoost(Perks.Strength, -1)
end
--TraitFactory.addTrait(TRAITS.Insensitive, GetTraitText(TRAITS.Insensitive), 6, GetTraitDesc(TRAITS.Insensitive), false, false)
TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_ForeArm)
TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_UpperArm)
TraitFactory.setMutualExclusive(TRAITS.Amputee_ForeArm, TRAITS.Amputee_UpperArm)
end
Events.OnGameBoot.Add(SetupTraits)