diff --git a/42/media/lua/client/TOC/Controllers/ItemsController.lua b/42/media/lua/client/TOC/Controllers/ItemsController.lua index e76d2d3..015e633 100644 --- a/42/media/lua/client/TOC/Controllers/ItemsController.lua +++ b/42/media/lua/client/TOC/Controllers/ItemsController.lua @@ -1,3 +1,5 @@ +-- TODO Should be server side in 42.13 + local StaticData = require("TOC/StaticData") local CommonMethods = require("TOC/CommonMethods") --------------------------- diff --git a/42/media/lua/client/TOC/TimedActions/CutLimbAction.lua b/42/media/lua/client/TOC/TimedActions/CutLimbAction.lua index 4db7f04..cc7212f 100644 --- a/42/media/lua/client/TOC/TimedActions/CutLimbAction.lua +++ b/42/media/lua/client/TOC/TimedActions/CutLimbAction.lua @@ -24,9 +24,7 @@ local CutLimbAction = ISBaseTimedAction:derive("CutLimbAction") ---@param bandageItem InventoryItem? ---@return CutLimbAction function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, bandageItem) - local o = {} - setmetatable(o, self) - self.__index = self + local o = ISBaseTimedAction.new(self, surgeon) -- We need to follow ISBaseTimedAction. self.character is gonna be the surgeon o.character = surgeon @@ -43,12 +41,21 @@ function CutLimbAction:new(surgeon, patient, limbName, item, stitchesItem, banda o.stopOnWalk = true o.stopOnRun = true - o.maxTime = 1000 - (surgeon:getPerkLevel(Perks.Doctor) * 50) - if o.character:isTimedActionInstant() then o.maxTime = 1 end + o.maxTime = o:getDuration() return o 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() return not ISHealthPanel.DidPatientMove(self.character,self.patient, self.patientX, self.patientY) end @@ -89,6 +96,16 @@ function CutLimbAction:start() end +-- function CutLimbAction:serverStart() + +-- emulateAnimEvent(self.netAction, 200, "") + +-- end + +-- function CutLimbAction:animEvent(event, parameter) + +-- end + function CutLimbAction:waitToStart() if self.character == self.patient then return false @@ -117,22 +134,30 @@ function CutLimbAction:stop() end function CutLimbAction:perform() - -- Stop the sound 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) 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 \ No newline at end of file diff --git a/42/mod.info b/42/mod.info index 0d14aa6..cab3e74 100644 --- a/42/mod.info +++ b/42/mod.info @@ -6,6 +6,5 @@ icon=icon.png url=https://github.com/ZioPao/The-Only-Cure modversion=2.3 versionMin=42.13 - loadModAfter=\FancyHandwork,\BrutalHandwork,\TwoWeaponsOnBackRework incompatible=\BB_FirstAidOverhaul \ No newline at end of file diff --git a/42/media/lua/client/lua_timers.lua b/common/media/lua/client/lua_timers.lua similarity index 100% rename from 42/media/lua/client/lua_timers.lua rename to common/media/lua/client/lua_timers.lua diff --git a/mod_41.info b/mod_41.info deleted file mode 100644 index babeea2..0000000 --- a/mod_41.info +++ /dev/null @@ -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 \ No newline at end of file diff --git a/poster.png b/poster.png index 9aae2d2..86c8c7e 100644 Binary files a/poster.png and b/poster.png differ diff --git a/poster_b41.png b/poster_b41.png deleted file mode 100644 index 86c8c7e..0000000 Binary files a/poster_b41.png and /dev/null differ