diff --git a/.vscode/settings.json b/.vscode/settings.json index 847574b..c17952a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,6 +42,7 @@ "ISInventoryPaneContextMenu", "ISDropItemAction", "BloodBodyPartType", - "ISInventoryPane" + "ISInventoryPane", + "ModData" ] } \ No newline at end of file diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index ab3d9d8..8a4f0f4 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -102,7 +102,4 @@ function TocMapOldDataToNew(mod_data) end - getPlayer():transmitModData() - - end diff --git a/media/lua/client/TOC_ContextMenus.lua b/media/lua/client/TOC_ContextMenus.lua index e98463a..9a9e462 100644 --- a/media/lua/client/TOC_ContextMenus.lua +++ b/media/lua/client/TOC_ContextMenus.lua @@ -115,10 +115,7 @@ end -TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu) - - local local_part_data = local_player:getModData().TOC.Limbs - +TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu) for _, v in ipairs(GetBodyParts()) do if local_player == clicked_player then -- Local player if CheckIfCanBeCut(v) and TocGetSawInInventory(local_player) ~= nil then @@ -149,8 +146,6 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, end - - TocContextMenus.CreateCheatMenu = function(context, root_menu, local_player, clicked_player) if local_player:getAccessLevel() == "Admin" then diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index 45255b3..a57990e 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -17,7 +17,4 @@ function TocResetEverything() cloth = nil -- reset it end - - player:transmitModData() - end diff --git a/media/lua/client/TOC_HelperFunctions.lua b/media/lua/client/TOC_HelperFunctions.lua index 630ee3f..9d793b5 100644 --- a/media/lua/client/TOC_HelperFunctions.lua +++ b/media/lua/client/TOC_HelperFunctions.lua @@ -1,5 +1,4 @@ -- CutLimb --- TODO if TheONlyCure. triggers an errors function TocCheckIfStillInfected(limbs_data) if limbs_data == nil then return diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index 753e409..7c0b6de 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -286,11 +286,10 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille for _, depended_v in pairs(limbs_data[part_name].depends_on) do limbs_data[depended_v].is_cut = true limbs_data[depended_v].is_amputation_shown = false - limbs_data[depended_v].cicatrization_time = limbs_data[part_name].cicatrization_base_time - surgeon_factor * 50 + limbs_data[depended_v].cicatrization_time = limbs_data[part_name].cicatrization_base_time - + surgeon_factor * 50 end - - -- Check for older amputation models and deletes them from player's inventory local side = string.match(part_name, '(%w+)_') TocDeleteOtherAmputatedLimbs(side) @@ -327,7 +326,8 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven) if use_oven then limbs_data[part_name].is_cauterized = true end for _, depended_v in pairs(limbs_data[part_name].depends_on) do limbs_data[depended_v].is_operated = true - limbs_data[depended_v].cicatrization_time = limbs_data[depended_v].cicatrization_time - (surgeon_factor * 200) + limbs_data[depended_v].cicatrization_time = limbs_data[depended_v].cicatrization_time - + (surgeon_factor * 200) if use_oven then limbs_data[depended_v].is_cauterized = true end -- TODO does this make sense? end @@ -335,7 +335,6 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven) end SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven) - player:transmitModData() end function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name) @@ -379,11 +378,8 @@ function TheOnlyCure.UnequipProsthesis(part_name, equipped_prosthesis) local prosthesis_name = string.match(equipped_prosthesis_full_type, prost_v) if prosthesis_name then player:getInventory():AddItem("TOC." .. prosthesis_name) - player:setWornItem(equipped_prosthesis:getBodyLocation(), nil) player:getInventory():Remove(equipped_prosthesis) - player:transmitModData() - end end @@ -408,20 +404,17 @@ function TryTocAction(_, part_name, action, surgeon, patient) TocUnequipProsthesisLocal(_, surgeon, part_name) end else - local ui = GetConfirmUIMP() if not ui then CreateTocConfirmUIMP() ui = GetConfirmUIMP() end - if patient == nil then patient = surgeon end - if action == "Cut" then AskCanCutLimb(patient, part_name) elseif action == "Operate" then @@ -431,11 +424,11 @@ function TryTocAction(_, part_name, action, surgeon, patient) elseif action == "Unequip" then AskCanUnequipProsthesis(patient, part_name) end + ui.actionAct = action ui.partNameAct = part_name ui.patient = patient - SendCommandToConfirmUIMP("Wait server") end diff --git a/media/lua/client/TimedActions/ISInstallProsthesis.lua b/media/lua/client/TimedActions/ISInstallProsthesis.lua index 868dc1b..7d6647a 100644 --- a/media/lua/client/TimedActions/ISInstallProsthesis.lua +++ b/media/lua/client/TimedActions/ISInstallProsthesis.lua @@ -58,7 +58,6 @@ function ISInstallProsthesis:perform() TheOnlyCure.EquipProsthesis(self.part_name, prosthesis_base_name) end - self.character:transmitModData() -- needed to remove from queue / start next. ISBaseTimedAction.perform(self) diff --git a/media/lua/client/TimedActions/ISUninstallProsthesis.lua b/media/lua/client/TimedActions/ISUninstallProsthesis.lua index c6046b5..9265e9d 100644 --- a/media/lua/client/TimedActions/ISUninstallProsthesis.lua +++ b/media/lua/client/TimedActions/ISUninstallProsthesis.lua @@ -57,7 +57,6 @@ function ISUninstallProsthesis:perform() else TheOnlyCure.UnequipProsthesis(self.part_name, self.item) end - self.character:transmitModData() ISBaseTimedAction.perform(self) diff --git a/media/lua/server/TOC_MP_server.lua b/media/lua/server/TOC_MP_server.lua index 1d13df7..d333c0d 100644 --- a/media/lua/server/TOC_MP_server.lua +++ b/media/lua/server/TOC_MP_server.lua @@ -1,5 +1,5 @@ --- A rly big thx to Fenris_Wolf and Chuck to help me with that. Love you guy ---if isClient() then return end + ---Server side local TOC_Commands = {} @@ -40,22 +40,7 @@ TOC_Commands["AskToResetEverything"] = function(_, arg) end --- local function OnTocClientCommand(module, command, player, args) --- if module == 'TOC' then --- print("OnTocClientCommand " .. command) --- if Commands[command] then --- args = args or {} --- Commands[command](_, args) --- end --- end - --- end - ---Events.OnClientCommand.Add(OnTocClientCommand) - --------------------------------- TEST ------------------------ - - +------ Global Mod Data ----------- function TOC_OnInitGlobalModData() ModData.getOrCreate("TOC_PLAYER_DATA")