more cleaning

This commit is contained in:
Pao
2023-01-23 01:15:11 +01:00
parent b7effc0d62
commit 5770b8a488
9 changed files with 10 additions and 45 deletions

View File

@@ -42,6 +42,7 @@
"ISInventoryPaneContextMenu", "ISInventoryPaneContextMenu",
"ISDropItemAction", "ISDropItemAction",
"BloodBodyPartType", "BloodBodyPartType",
"ISInventoryPane" "ISInventoryPane",
"ModData"
] ]
} }

View File

@@ -102,7 +102,4 @@ function TocMapOldDataToNew(mod_data)
end end
getPlayer():transmitModData()
end end

View File

@@ -115,10 +115,7 @@ end
TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu) TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu)
local local_part_data = local_player:getModData().TOC.Limbs
for _, v in ipairs(GetBodyParts()) do for _, v in ipairs(GetBodyParts()) do
if local_player == clicked_player then -- Local player if local_player == clicked_player then -- Local player
if CheckIfCanBeCut(v) and TocGetSawInInventory(local_player) ~= nil then if CheckIfCanBeCut(v) and TocGetSawInInventory(local_player) ~= nil then
@@ -149,8 +146,6 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player,
end end
TocContextMenus.CreateCheatMenu = function(context, root_menu, local_player, clicked_player) TocContextMenus.CreateCheatMenu = function(context, root_menu, local_player, clicked_player)
if local_player:getAccessLevel() == "Admin" then if local_player:getAccessLevel() == "Admin" then

View File

@@ -17,7 +17,4 @@ function TocResetEverything()
cloth = nil -- reset it cloth = nil -- reset it
end end
player:transmitModData()
end end

View File

@@ -1,5 +1,4 @@
-- CutLimb -- CutLimb
-- TODO if TheONlyCure. triggers an errors
function TocCheckIfStillInfected(limbs_data) function TocCheckIfStillInfected(limbs_data)
if limbs_data == nil then if limbs_data == nil then
return return

View File

@@ -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 for _, depended_v in pairs(limbs_data[part_name].depends_on) do
limbs_data[depended_v].is_cut = true limbs_data[depended_v].is_cut = true
limbs_data[depended_v].is_amputation_shown = false 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 end
-- Check for older amputation models and deletes them from player's inventory -- Check for older amputation models and deletes them from player's inventory
local side = string.match(part_name, '(%w+)_') local side = string.match(part_name, '(%w+)_')
TocDeleteOtherAmputatedLimbs(side) 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 if use_oven then limbs_data[part_name].is_cauterized = true end
for _, depended_v in pairs(limbs_data[part_name].depends_on) do for _, depended_v in pairs(limbs_data[part_name].depends_on) do
limbs_data[depended_v].is_operated = true 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? if use_oven then limbs_data[depended_v].is_cauterized = true end -- TODO does this make sense?
end end
@@ -335,7 +335,6 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven)
end end
SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven) SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven)
player:transmitModData()
end end
function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name) 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) local prosthesis_name = string.match(equipped_prosthesis_full_type, prost_v)
if prosthesis_name then if prosthesis_name then
player:getInventory():AddItem("TOC." .. prosthesis_name) player:getInventory():AddItem("TOC." .. prosthesis_name)
player:setWornItem(equipped_prosthesis:getBodyLocation(), nil) player:setWornItem(equipped_prosthesis:getBodyLocation(), nil)
player:getInventory():Remove(equipped_prosthesis) player:getInventory():Remove(equipped_prosthesis)
player:transmitModData()
end end
end end
@@ -408,20 +404,17 @@ function TryTocAction(_, part_name, action, surgeon, patient)
TocUnequipProsthesisLocal(_, surgeon, part_name) TocUnequipProsthesisLocal(_, surgeon, part_name)
end end
else else
local ui = GetConfirmUIMP() local ui = GetConfirmUIMP()
if not ui then if not ui then
CreateTocConfirmUIMP() CreateTocConfirmUIMP()
ui = GetConfirmUIMP() ui = GetConfirmUIMP()
end end
if patient == nil then if patient == nil then
patient = surgeon patient = surgeon
end end
if action == "Cut" then if action == "Cut" then
AskCanCutLimb(patient, part_name) AskCanCutLimb(patient, part_name)
elseif action == "Operate" then elseif action == "Operate" then
@@ -431,11 +424,11 @@ function TryTocAction(_, part_name, action, surgeon, patient)
elseif action == "Unequip" then elseif action == "Unequip" then
AskCanUnequipProsthesis(patient, part_name) AskCanUnequipProsthesis(patient, part_name)
end end
ui.actionAct = action ui.actionAct = action
ui.partNameAct = part_name ui.partNameAct = part_name
ui.patient = patient ui.patient = patient
SendCommandToConfirmUIMP("Wait server") SendCommandToConfirmUIMP("Wait server")
end end

View File

@@ -58,7 +58,6 @@ function ISInstallProsthesis:perform()
TheOnlyCure.EquipProsthesis(self.part_name, prosthesis_base_name) TheOnlyCure.EquipProsthesis(self.part_name, prosthesis_base_name)
end end
self.character:transmitModData()
-- needed to remove from queue / start next. -- needed to remove from queue / start next.
ISBaseTimedAction.perform(self) ISBaseTimedAction.perform(self)

View File

@@ -57,7 +57,6 @@ function ISUninstallProsthesis:perform()
else else
TheOnlyCure.UnequipProsthesis(self.part_name, self.item) TheOnlyCure.UnequipProsthesis(self.part_name, self.item)
end end
self.character:transmitModData()
ISBaseTimedAction.perform(self) ISBaseTimedAction.perform(self)

View File

@@ -1,5 +1,5 @@
--- A rly big thx to Fenris_Wolf and Chuck to help me with that. Love you guy --- A rly big thx to Fenris_Wolf and Chuck to help me with that. Love you guy
--if isClient() then return end
---Server side ---Server side
local TOC_Commands = {} local TOC_Commands = {}
@@ -40,22 +40,7 @@ TOC_Commands["AskToResetEverything"] = function(_, arg)
end end
-- local function OnTocClientCommand(module, command, player, args) ------ Global Mod Data -----------
-- 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 ------------------------
function TOC_OnInitGlobalModData() function TOC_OnInitGlobalModData()
ModData.getOrCreate("TOC_PLAYER_DATA") ModData.getOrCreate("TOC_PLAYER_DATA")