diff --git a/.vscode/settings.json b/.vscode/settings.json index c7c22da..1000496 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -56,6 +56,7 @@ "getClassField", "ISWearClothing", "SyncXp", - "ISClothingExtraAction" + "ISClothingExtraAction", + "SwapItConfig" ] } \ No newline at end of file diff --git a/media/lua/client/JCIO_Init.lua b/media/lua/client/JCIO_Init.lua index d84ad55..2e60382 100644 --- a/media/lua/client/JCIO_Init.lua +++ b/media/lua/client/JCIO_Init.lua @@ -239,5 +239,11 @@ local function InitializeJustCutItOff() Events.EveryOneMinute.Add(JCIO.UpdateEveryOneMinute) + -- Mod Checker + CheckMyModTable = CheckMyModTable or {} + CheckMyModTable["JCIO"] = 2915572347 + + + end Events.OnGameBoot.Add(InitializeJustCutItOff) \ No newline at end of file diff --git a/media/lua/client/JCIO_OverridenFunctions.lua b/media/lua/client/JCIO_OverridenFunctions.lua index f73d8d6..ea70e55 100644 --- a/media/lua/client/JCIO_OverridenFunctions.lua +++ b/media/lua/client/JCIO_OverridenFunctions.lua @@ -211,8 +211,8 @@ function ISWearClothing:isValid() end +-- This is to manage the watches, we don't want them equipped over an amputated limb of course local og_ISWearClothingExtraAction = ISClothingExtraAction.isValid - function ISClothingExtraAction:isValid() local baseCheck = og_ISWearClothingExtraAction(self) diff --git a/media/lua/client/TimedActions/JCIO_CutLimbAction.lua b/media/lua/client/TimedActions/JCIO_CutLimbAction.lua index ca34537..6214ac9 100644 --- a/media/lua/client/TimedActions/JCIO_CutLimbAction.lua +++ b/media/lua/client/TimedActions/JCIO_CutLimbAction.lua @@ -23,13 +23,43 @@ function JCIO_CutLimbAction:update() if self.patient ~= self.surgeon then self.surgeon:faceThisObject(self.patient) end + + + local worldSoundRadius = 3 + + local soundDelay = 6 + + -- Sound handling + if self.soundTime + soundDelay < getTimestamp() then + + self.soundTime = getTimestamp() + + if not self.chatacter:getEmitter():isPlaying(self.sawSound) then + self.sawSound = self.character:getEmitter():playSound("Amputation_Sound") + + end + + + + end + + -- TODO This is to handle MP I guess? + if worldSoundRadius > 0 then + self.worldSoundTime = getTimestamp() + addSound(self.surgeon, self.surgeon:getX(), self.surgeon:getY(), self.surgeon:getZ(), worldSoundRadius, worldSoundRadius) + end end function JCIO_CutLimbAction:stop() print("Stopping ISCutLimb") - self.surgeon:getEmitter():stopSoundByName("Amputation_Sound") - sendClientCommand(self.surgeon, "JCIO", "AskStopAmputationSound", {surgeon_id = self.surgeon:getOnlineID()}) + + -- Handles sound + + if self.sawSound and self.sawSound ~= 0 and self.surgeon:getEmitter():isPlaying(self.sawSound) then + self.surgeon:getEmitter():stopSound(self.sawSound) + end + -- TODO test this with more than 2 players -- TODO this gets bugged when player dies while amputating @@ -44,8 +74,11 @@ function JCIO_CutLimbAction:start() -- TODO Add a check so you can't cut your arm if you don't have hands or if you only have one arm and want to cut that same arm. self:setActionAnim("SawLog") - local saw_item = JCIO_Common.GetSawInInventory(self.surgeon) - self.surgeon:getEmitter():playSound("Amputation_Sound") + local sawItem = JCIO_Common.GetSawInInventory(self.surgeon) + + self.soundTime = 0 + self.worldSoundTime = 0 + self.sawSound = self.surgeon:getEmitter():playSound("Amputation_Sound") -- Return whatever object we've got in the inventory if self.surgeon:getPrimaryHandItem() then @@ -55,8 +88,8 @@ function JCIO_CutLimbAction:start() ISTimedActionQueue.add(ISUnequipAction:new(self.surgeon, self.surgeon:getSecondaryHandItem(), 2)); end - if saw_item then - self:setOverrideHandModels(saw_item:getStaticModel(), nil) + if sawItem then + self:setOverrideHandModels(sawItem:getStaticModel(), nil) end @@ -124,7 +157,7 @@ function JCIO_CutLimbAction:perform() if self.patient ~= self.surgeon and isClient() then SendCutLimb(self.patient, self.partName, surgeon_factor, bandage_table, painkiller_table) - sendClientCommand(self.surgeon, "JCIO", "AskStopAmputationSound", {surgeon_id = self.surgeon:getOnlineID()}) + sendClientCommand(self.surgeon, "JCIO", "AskStopAmputationSound", {surgeonID = self.surgeon:getOnlineID()}) else JCIO.CutLimb(self.partName, surgeon_factor, bandage_table, painkiller_table) end diff --git a/media/lua/server/JCIO_ClientCommands.lua b/media/lua/server/JCIO_ClientCommands.lua index e5abf0b..6e9c8e7 100644 --- a/media/lua/server/JCIO_ClientCommands.lua +++ b/media/lua/server/JCIO_ClientCommands.lua @@ -28,7 +28,7 @@ end ClientCommands.AskStopAmputationSound = function(_, args) print("JCIO: We're in AskStopAmputationSound") - sendServerCommand("JCIO", "StopAmputationSound", {surgeon_id = args.surgeon_id}) + sendServerCommand("JCIO", "StopAmputationSound", {surgeon_id = args.surgeonID}) end diff --git a/media/scripts/JCIO_sounds.txt b/media/scripts/JCIO_sounds.txt index e5beaad..119a0ca 100644 --- a/media/scripts/JCIO_sounds.txt +++ b/media/scripts/JCIO_sounds.txt @@ -2,8 +2,8 @@ module base { sound Amputation_Sound { category = Player, - loop = true, - is3D = true, + loop = false, + is3D = true, clip { file = media/sound/Cut_sound.ogg, distanceMax = 3, diff --git a/workshop.txt b/workshop.txt index 8b69cfb..5421a24 100644 --- a/workshop.txt +++ b/workshop.txt @@ -1,6 +1,6 @@ version=1 -id=2916771109 -title=JUST CUT IT OFF DEV -description=Just for testing and shit +id=2915572347 +title=Just Cut It Off +description=TODO tags= -visibility=public +visibility=public \ No newline at end of file