4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -9,4 +9,8 @@
|
|||||||
"zombie",
|
"zombie",
|
||||||
"_"
|
"_"
|
||||||
],
|
],
|
||||||
|
"Lua.format.defaultConfig": {
|
||||||
|
"indent_style": "space",
|
||||||
|
"indent_size": "2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,21 @@ local function AddAdminTocOptions(playerNum, context, worldobjects)
|
|||||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteInitialization,
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteInitialization,
|
||||||
{ patientNum = clickedPlayerNum })
|
{ patientNum = clickedPlayerNum })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Force amputation
|
||||||
|
local forceAmpOption = subMenu:addOption(getText("ContextMenu_Admin_ForceAmputation"), nil, nil)
|
||||||
|
local forceAmpSubMenu = ISContextMenu:getNew(subMenu)
|
||||||
|
context:addSubMenu(forceAmpOption, forceAmpSubMenu)
|
||||||
|
|
||||||
|
for i = 1, #StaticData.LIMBS_STR do
|
||||||
|
local limbName = StaticData.LIMBS_STR[i]
|
||||||
|
local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName)
|
||||||
|
|
||||||
|
forceAmpSubMenu:addOption(limbTranslatedName, nil, function()
|
||||||
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayForcedAmputation,
|
||||||
|
{ patientNum = clickedPlayerNum, limbName = limbName })
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Events.OnFillWorldObjectContextMenu.Add(AddAdminTocOptions)
|
Events.OnFillWorldObjectContextMenu.Add(AddAdminTocOptions)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local CommandsData = require("TOC/CommandsData")
|
local CommandsData = require("TOC/CommandsData")
|
||||||
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
|
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
|
||||||
|
local DataController = require("TOC/Controllers/DataController")
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
local ClientRelayCommands = {}
|
local ClientRelayCommands = {}
|
||||||
@@ -25,8 +26,14 @@ end
|
|||||||
---Creates a new handler and execute the amputation function on this client
|
---Creates a new handler and execute the amputation function on this client
|
||||||
---@param args receiveExecuteAmputationActionParams
|
---@param args receiveExecuteAmputationActionParams
|
||||||
function ClientRelayCommands.ReceiveExecuteAmputationAction(args)
|
function ClientRelayCommands.ReceiveExecuteAmputationAction(args)
|
||||||
|
|
||||||
|
-- Check if player already doesn't have that limb or it's a dependant limb.
|
||||||
|
-- Mostly a check for admin forced amputations more than anything else, since this case is handled in the GUI already.
|
||||||
|
local dcInst = DataController.GetInstance()
|
||||||
|
if dcInst:getIsCut(args.limbName) then return end
|
||||||
|
|
||||||
local handler = InitAmputationHandler(args.limbName, args.surgeonNum)
|
local handler = InitAmputationHandler(args.limbName, args.surgeonNum)
|
||||||
handler:execute(true)
|
handler:execute(args.damagePlayer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +53,15 @@ function ClientRelayCommands.ReceiveExecuteInitialization()
|
|||||||
LocalPlayerController.InitializePlayer(true)
|
LocalPlayerController.InitializePlayer(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Creates a new handler and execute the amputation function on this client
|
||||||
|
---@param args receiveForcedCicatrizationParams
|
||||||
|
function ClientRelayCommands.ReceiveForcedCicatrization(args)
|
||||||
|
local dcInst = DataController.GetInstance()
|
||||||
|
--dcInst:setCicatrizationTime(args.limbName, 1)
|
||||||
|
dcInst:setIsCicatrized(args.limbName, true)
|
||||||
|
dcInst:apply()
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function OnServerRelayCommand(module, command, args)
|
local function OnServerRelayCommand(module, command, args)
|
||||||
|
|||||||
@@ -156,7 +156,9 @@ function AmputationHandler:damageAfterAmputation(surgeonFactor)
|
|||||||
patientStats:setStress(baseDamage - surgeonFactor)
|
patientStats:setStress(baseDamage - surgeonFactor)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Execute the amputation
|
---Execute the amputation. This method doesn't check if the upper limb has been amputated or not, so if
|
||||||
|
--- somehow the method gets triggered and we're trying to cut off a part that doesn't really exist anymore,
|
||||||
|
--- it will still be executed. This is by design, additional checks must be made BEFORE running the AmputationHandler
|
||||||
---@param damagePlayer boolean
|
---@param damagePlayer boolean
|
||||||
function AmputationHandler:execute(damagePlayer)
|
function AmputationHandler:execute(damagePlayer)
|
||||||
local surgeonFactor = self.surgeonPl:getPerkLevel(Perks.Doctor) * SandboxVars.TOC.SurgeonAbilityImportance
|
local surgeonFactor = self.surgeonPl:getPerkLevel(Perks.Doctor) * SandboxVars.TOC.SurgeonAbilityImportance
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require("TOC/Events")
|
|||||||
|
|
||||||
---@class Main
|
---@class Main
|
||||||
local Main = {
|
local Main = {
|
||||||
_version = "2.1.1"
|
_version = "2.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Main.Start()
|
function Main.Start()
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ end
|
|||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local bloodAmount = 10
|
local bloodAmount = 10
|
||||||
|
|
||||||
|
|
||||||
@@ -84,13 +82,22 @@ local function HandleZombiesAmputations(player, zombie, handWeapon, damage)
|
|||||||
if (damage > SandboxVars.TOC.ZombieAmputationDamageThreshold and randomChance) or isCrit then
|
if (damage > SandboxVars.TOC.ZombieAmputationDamageThreshold and randomChance) or isCrit then
|
||||||
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage))
|
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage))
|
||||||
local zombieInv = zombie:getInventory()
|
local zombieInv = zombie:getInventory()
|
||||||
|
|
||||||
-- Check left or right
|
-- Check left or right
|
||||||
if not zombieInv:containsEval(PredicateAmputationItemLeft) then
|
local randSide = ZombRand(2) -- Random side
|
||||||
SpawnAmputation(zombie, "L")
|
local preferredSide = randSide == 0 and "L" or "R"
|
||||||
elseif not zombieInv:containsEval(PredicateAmputationItemRight) then
|
local alternateSide = preferredSide == "L" and "R" or "L"
|
||||||
SpawnAmputation(zombie, "R")
|
|
||||||
|
local predicatePreferred = preferredSide == "L" and PredicateAmputationItemLeft or PredicateAmputationItemRight
|
||||||
|
local predicateAlternate = alternateSide == "L" and PredicateAmputationItemLeft or PredicateAmputationItemRight
|
||||||
|
|
||||||
|
if not zombieInv:containsEval(predicatePreferred) then
|
||||||
|
SpawnAmputation(zombie, preferredSide)
|
||||||
|
elseif not zombieInv:containsEval(predicateAlternate) then
|
||||||
|
SpawnAmputation(zombie, alternateSide)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage) .. ", preferred limb side: " .. preferredSide)
|
||||||
|
|
||||||
-- add blood splat every couple of seconds for a while
|
-- add blood splat every couple of seconds for a while
|
||||||
addBloodSplat(getCell():getGridSquare(zombie:getX(), zombie:getY(), zombie:getZ()), bloodAmount)
|
addBloodSplat(getCell():getGridSquare(zombie:getX(), zombie:getY(), zombie:getZ()), bloodAmount)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function ServerRelayCommands.RelayExecuteAmputationAction(surgeonPl, args)
|
|||||||
local surgeonNum = surgeonPl:getOnlineID()
|
local surgeonNum = surgeonPl:getOnlineID()
|
||||||
|
|
||||||
---@type receiveDamageDuringAmputationParams
|
---@type receiveDamageDuringAmputationParams
|
||||||
local params = {surgeonNum = surgeonNum, limbName = args.limbName}
|
local params = {surgeonNum = surgeonNum, limbName = args.limbName, damagePlayer = true}
|
||||||
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveExecuteAmputationAction, params)
|
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveExecuteAmputationAction, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,6 +38,21 @@ function ServerRelayCommands.RelayExecuteInitialization(adminObj, args)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Relay a forced amputation to another client.
|
||||||
|
---@param adminObj IsoPlayer
|
||||||
|
---@param args relayForcedAmputationParams
|
||||||
|
function ServerRelayCommands.RelayForcedAmputation(adminObj, args)
|
||||||
|
local patientPl = getPlayerByOnlineID(args.patientNum)
|
||||||
|
local adminNum = adminObj:getOnlineID()
|
||||||
|
|
||||||
|
---@type receiveDamageDuringAmputationParams
|
||||||
|
local ampParams = {surgeonNum = adminNum, limbName = args.limbName, damagePlayer = false} -- the only difference between relayExecuteAmputationAction and this is the damage
|
||||||
|
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveExecuteAmputationAction, ampParams)
|
||||||
|
|
||||||
|
-- Automatic cicatrization
|
||||||
|
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveForcedCicatrization, {limbName = args.limbName})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ CommandsData.modules = {
|
|||||||
CommandsData.client = {
|
CommandsData.client = {
|
||||||
Relay = {
|
Relay = {
|
||||||
ReceiveDamageDuringAmputation = "ReceiveDamageDuringAmputation", ---@alias receiveDamageDuringAmputationParams { limbName : string}
|
ReceiveDamageDuringAmputation = "ReceiveDamageDuringAmputation", ---@alias receiveDamageDuringAmputationParams { limbName : string}
|
||||||
ReceiveExecuteAmputationAction = "ReceiveExecuteAmputationAction", ---@alias receiveExecuteAmputationActionParams {surgeonNum : number, limbName : string}
|
ReceiveExecuteAmputationAction = "ReceiveExecuteAmputationAction", ---@alias receiveExecuteAmputationActionParams {surgeonNum : number, limbName : string, damagePlayer : boolean}
|
||||||
|
|
||||||
--* APPLY *--
|
--* APPLY *--
|
||||||
ReceiveApplyFromServer = "ReceiveApplyFromServer",
|
ReceiveApplyFromServer = "ReceiveApplyFromServer",
|
||||||
|
|
||||||
--* ADMIN ONLY --*
|
--* ADMIN ONLY --*
|
||||||
ReceiveExecuteInitialization = "ReceiveExecuteInitialization"
|
ReceiveExecuteInitialization = "ReceiveExecuteInitialization",
|
||||||
|
ReceiveForcedCicatrization = "ReceiveForcedCicatrization" ---@alias receiveForcedCicatrizationParams {limbName : string}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,8 +31,10 @@ CommandsData.server = {
|
|||||||
Relay = {
|
Relay = {
|
||||||
RelayDamageDuringAmputation = "RelayDamageDuringAmputation", ---@alias relayDamageDuringAmputationParams {patientNum : number, limbName : string}
|
RelayDamageDuringAmputation = "RelayDamageDuringAmputation", ---@alias relayDamageDuringAmputationParams {patientNum : number, limbName : string}
|
||||||
RelayExecuteAmputationAction = "RelayExecuteAmputationAction", ---@alias relayExecuteAmputationActionParams {patientNum : number, limbName : string}
|
RelayExecuteAmputationAction = "RelayExecuteAmputationAction", ---@alias relayExecuteAmputationActionParams {patientNum : number, limbName : string}
|
||||||
|
|
||||||
--* ADMIN ONLY *--
|
--* ADMIN ONLY *--
|
||||||
RelayExecuteInitialization = "RelayExecuteInitialization" ---@alias relayExecuteInitializationParams {patientNum : number}
|
RelayExecuteInitialization = "RelayExecuteInitialization", ---@alias relayExecuteInitializationParams {patientNum : number}
|
||||||
|
RelayForcedAmputation = "RelayForcedAmputation" ---@alias relayForcedAmputationParams {patientNum : number, limbName : string}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
mod.info
2
mod.info
@@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices.
|
|||||||
id=TheOnlyCure
|
id=TheOnlyCure
|
||||||
icon=icon.png
|
icon=icon.png
|
||||||
url=https://github.com/ZioPao/The-Only-Cure
|
url=https://github.com/ZioPao/The-Only-Cure
|
||||||
modversion=2.1.1
|
modversion=2.1.2
|
||||||
pzversion=41.65
|
pzversion=41.65
|
||||||
|
|||||||
Reference in New Issue
Block a user