chore: stuff to move around for 42.13
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
-- TODO Should be server side in 42.13
|
||||||
|
|
||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local CommonMethods = require("TOC/CommonMethods")
|
local CommonMethods = require("TOC/CommonMethods")
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ local CutLimbAction = ISBaseTimedAction:derive("CutLimbAction")
|
|||||||
---@param bandageItem InventoryItem?
|
---@param bandageItem InventoryItem?
|
||||||
---@return CutLimbAction
|
---@return CutLimbAction
|
||||||
function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, bandageItem)
|
function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, bandageItem)
|
||||||
local o = {}
|
local o = ISBaseTimedAction.new(self, surgeon)
|
||||||
setmetatable(o, self)
|
|
||||||
self.__index = self
|
|
||||||
|
|
||||||
-- We need to follow ISBaseTimedAction. self.character is gonna be the surgeon
|
-- We need to follow ISBaseTimedAction. self.character is gonna be the surgeon
|
||||||
o.character = surgeon
|
o.character = surgeon
|
||||||
@@ -43,12 +41,21 @@ function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, banda
|
|||||||
o.stopOnWalk = true
|
o.stopOnWalk = true
|
||||||
o.stopOnRun = true
|
o.stopOnRun = true
|
||||||
|
|
||||||
o.maxTime = 1000 - (surgeon:getPerkLevel(Perks.Doctor) * 50)
|
o.maxTime = o:getDuration()
|
||||||
if o.character:isTimedActionInstant() then o.maxTime = 1 end
|
|
||||||
|
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CutLimbAction:getDuration()
|
||||||
|
if self.character:isTimedActionInstant() then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
local baseTime = 1000
|
||||||
|
local perkLevel = self.character:getPerkLevel(Perks.Doctor)
|
||||||
|
return baseTime - (perkLevel * 50)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function CutLimbAction:isValid()
|
function CutLimbAction:isValid()
|
||||||
return not ISHealthPanel.DidPatientMove(self.character,self.patient, self.patientX, self.patientY)
|
return not ISHealthPanel.DidPatientMove(self.character,self.patient, self.patientX, self.patientY)
|
||||||
end
|
end
|
||||||
@@ -89,6 +96,16 @@ function CutLimbAction:start()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- function CutLimbAction:serverStart()
|
||||||
|
|
||||||
|
-- emulateAnimEvent(self.netAction, 200, "")
|
||||||
|
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- function CutLimbAction:animEvent(event, parameter)
|
||||||
|
|
||||||
|
-- end
|
||||||
|
|
||||||
function CutLimbAction:waitToStart()
|
function CutLimbAction:waitToStart()
|
||||||
if self.character == self.patient then
|
if self.character == self.patient then
|
||||||
return false
|
return false
|
||||||
@@ -117,22 +134,30 @@ function CutLimbAction:stop()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CutLimbAction:perform()
|
function CutLimbAction:perform()
|
||||||
-- Stop the sound
|
|
||||||
self:stopSound()
|
self:stopSound()
|
||||||
|
|
||||||
if self.patient == self.character then
|
|
||||||
TOC_DEBUG.print("patient and surgeon are the same, executing on the client")
|
|
||||||
local handler = AmputationHandler:new(self.limbName)
|
|
||||||
handler:execute(true)
|
|
||||||
else
|
|
||||||
TOC_DEBUG.print("patient and surgeon not the same, sending relay to server")
|
|
||||||
-- Other player
|
|
||||||
---@type relayExecuteAmputationActionParams
|
|
||||||
local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
|
||||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteAmputationAction, params )
|
|
||||||
end
|
|
||||||
|
|
||||||
ISBaseTimedAction.perform(self)
|
ISBaseTimedAction.perform(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CutLimbAction:complete()
|
||||||
|
-- TODO AmputationHandler runs client side, by doing this this would run on the server. AM I missing something?
|
||||||
|
local handler = AmputationHandler:new(self.limbName, self.character)
|
||||||
|
handler:execute(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- function CutLimbAction:perform()
|
||||||
|
-- -- Stop the sound
|
||||||
|
-- if self.patient == self.character then
|
||||||
|
-- TOC_DEBUG.print("patient and surgeon are the same, executing on the client")
|
||||||
|
-- local handler = AmputationHandler:new(self.limbName)
|
||||||
|
-- handler:execute(true)
|
||||||
|
-- else
|
||||||
|
-- TOC_DEBUG.print("patient and surgeon not the same, sending relay to server")
|
||||||
|
-- -- Other player
|
||||||
|
-- ---@type relayExecuteAmputationActionParams
|
||||||
|
-- local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
||||||
|
-- sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteAmputationAction, params )
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- end
|
||||||
|
|
||||||
return CutLimbAction
|
return CutLimbAction
|
||||||
@@ -6,6 +6,5 @@ icon=icon.png
|
|||||||
url=https://github.com/ZioPao/The-Only-Cure
|
url=https://github.com/ZioPao/The-Only-Cure
|
||||||
modversion=2.3
|
modversion=2.3
|
||||||
versionMin=42.13
|
versionMin=42.13
|
||||||
|
|
||||||
loadModAfter=\FancyHandwork,\BrutalHandwork,\TwoWeaponsOnBackRework
|
loadModAfter=\FancyHandwork,\BrutalHandwork,\TwoWeaponsOnBackRework
|
||||||
incompatible=\BB_FirstAidOverhaul
|
incompatible=\BB_FirstAidOverhaul
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
name=The Only Cure
|
|
||||||
poster=poster.png
|
|
||||||
description=You've been bitten. You have only two choices.
|
|
||||||
id=TheOnlyCure
|
|
||||||
icon=icon.png
|
|
||||||
url=https://github.com/ZioPao/The-Only-Cure
|
|
||||||
modversion=2.2.1
|
|
||||||
BIN
poster.png
BIN
poster.png
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 182 KiB |
BIN
poster_b41.png
BIN
poster_b41.png
Binary file not shown.
|
Before Width: | Height: | Size: 182 KiB |
Reference in New Issue
Block a user