From 1545c88a194e9ec2aa13699f0c0bffbb7e192a52 Mon Sep 17 00:00:00 2001 From: Pao Date: Mon, 6 Feb 2023 02:44:59 +0100 Subject: [PATCH] Bunch of cleaning on old todos --- .../ActionsMethods/TOC_LocalActions.lua | 4 +- .../lua/client/Interface/TOC_ContextMenus.lua | 10 +-- media/lua/client/Interface/TOC_UI.lua | 8 +-- media/lua/client/TOC_Checks.lua | 8 +-- media/lua/client/TOC_Compatibility.lua | 3 +- media/lua/client/TOC_ModCompatibility.lua | 8 --- media/lua/client/TOC_Update.lua | 11 +--- media/lua/client/TimedActions/ISCutLimb.lua | 6 +- .../lua/client/TimedActions/ISOperateLimb.lua | 3 +- media/lua/shared/NPCs/ExtraBodyLocations.lua | 63 +------------------ 10 files changed, 18 insertions(+), 106 deletions(-) diff --git a/media/lua/client/ActionsMethods/TOC_LocalActions.lua b/media/lua/client/ActionsMethods/TOC_LocalActions.lua index 8f54b2d..17026a3 100644 --- a/media/lua/client/ActionsMethods/TOC_LocalActions.lua +++ b/media/lua/client/ActionsMethods/TOC_LocalActions.lua @@ -14,12 +14,10 @@ function TocCutLocal(_, player, part_name) end function TocOperateLocal(_, player, part_name, use_oven) - --local player = getPlayer(); - -- todo add a check if the player has already been amputated or somethin if use_oven then ISTimedActionQueue.add(ISOperateLimb:new(player, player, _, part_name, use_oven)); else - local kit = TocGetKitInInventory(player) -- TODO Why is it here and only for local? + local kit = TocGetKitInInventory(player) if kit ~= nil then ISTimedActionQueue.add(ISOperateLimb:new(player, player, kit, part_name, false)) else diff --git a/media/lua/client/Interface/TOC_ContextMenus.lua b/media/lua/client/Interface/TOC_ContextMenus.lua index 3026e5c..f2bec76 100644 --- a/media/lua/client/Interface/TOC_ContextMenus.lua +++ b/media/lua/client/Interface/TOC_ContextMenus.lua @@ -67,19 +67,11 @@ end TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjects, test) local player_obj = getSpecificPlayer(player) - --local clickedPlayer - - - -- TODO Add a way to move the player towards the oven - + -- TODO Let the player move towards the oven local part_data = player_obj:getModData().TOC.Limbs - local is_main_menu_already_created = false - - --local props = v:getSprite() and v:getSprite():getProperties() or nil - for _, v_stove in pairs(worldObjects) do if instanceof(v_stove, "IsoStove") and (player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then diff --git a/media/lua/client/Interface/TOC_UI.lua b/media/lua/client/Interface/TOC_UI.lua index 11466ed..c18070a 100644 --- a/media/lua/client/Interface/TOC_UI.lua +++ b/media/lua/client/Interface/TOC_UI.lua @@ -53,7 +53,7 @@ local function GetImageName(part_name, limbs_data) elseif part_data.is_cut and not part_data.is_amputation_shown then -- Empty (like hand if forearm cut) name = "media/ui/TOC/Empty.png" elseif not part_data.is_cut and - -- TODO This doesn't work in MP on another player since we're trying to retrieve bodyDamage from another player + -- FIXME This doesn't work in MP on another player since we're trying to retrieve bodyDamage from another player getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartFromPartName(part_name)):bitten() then -- Not cut but bitten name = "media/ui/TOC/" .. part_name .. "/Bite.png" else -- Not cut @@ -383,9 +383,7 @@ local function OnClickTocConfirmUIMP(button, args) -- We can't check if the player has a prosthesis right now, we need to do it later -- TODO should check if player has a prosthesis equipped before doing it - -- TODO Player is surgeon, but we don't have a confirm_ui_mp.surgeon... awful awful awful - -- TODO Workaround for now, we'd need to send data from patient before doing it since we can't access his inventory from the surgeon if confirm_ui_mp.patient == player then ISTimedActionQueue.add(ISUninstallProsthesis:new(player, confirm_ui_mp.patient, confirm_ui_mp.partNameAct)) @@ -442,8 +440,8 @@ local function CreateTocMainUI() end +-- Create a temporary desc UI with fake data (for now) local function CreateTocDescUI() - -- TODO most of this stuff is just temporary. We can probably wipe this off the face of the earth desc_ui = NewUI() desc_ui:setTitle("The only cure description"); desc_ui:isSubUIOf(main_ui) @@ -476,7 +474,7 @@ local function CreateTocDescUI() desc_ui:addEmpty() desc_ui:nextLine() - desc_ui:addButton("b1", "Operate", OnClickTocDescUI) -- TODO this is just temporary + desc_ui:addButton("b1", "Operate", OnClickTocDescUI) desc_ui:saveLayout() end diff --git a/media/lua/client/TOC_Checks.lua b/media/lua/client/TOC_Checks.lua index 187bf37..4086d77 100644 --- a/media/lua/client/TOC_Checks.lua +++ b/media/lua/client/TOC_Checks.lua @@ -45,16 +45,16 @@ end ----------------------------------------- function CheckIfItemIsAmputatedLimb(item) - -- TODO Benchmark if this is faster local item_full_type = item:getFullType() - + local check if string.find(item_full_type, "TOC.Amputation_") then - return true + check = true else - return false + check = false end + return check end diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index 5edf504..ad22d43 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -22,9 +22,8 @@ local function TocReapplyAmputationClothingItem(mod_data) end - +-- Gets the old status and turns it into the new. function TocCheckCompatibilityWithOlderVersions(mod_data) - -- Gets the old status and turns it into the new. if mod_data.TOC.Limbs == nil then print("TOC: Limbs is nil, setting new mod_data") diff --git a/media/lua/client/TOC_ModCompatibility.lua b/media/lua/client/TOC_ModCompatibility.lua index 4010ad7..3262d42 100644 --- a/media/lua/client/TOC_ModCompatibility.lua +++ b/media/lua/client/TOC_ModCompatibility.lua @@ -26,15 +26,8 @@ local function SetCompatibilityFancyHandwork() local limbs_data = getPlayer():getModData().TOC.Limbs local can_be_held = {} - -- TODO not totally realiable TocPopulateCanBeHeldTable(can_be_held, limbs_data) - - -- for _, test in pairs(can_be_held) do - -- print(test) - -- end - --ISInventoryPaneContextMenu.transferIfNeeded(self.chr, item) - -- If we already have the item equipped if (primary and primary == item) or (secondary and secondary == item) then ISTimedActionQueue.add(ISUnequipAction:new(self.chr, item, 20)) @@ -83,7 +76,6 @@ local function SetCompatibilityFancyHandwork() local og_FHSwapHandsAction = FHSwapHandsAction.start - function FHSwapHandsAction:isValid() local limbs_data = getPlayer():getModData().TOC.Limbs local can_be_held = {} diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index 2b9cce7..cc8240e 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -49,9 +49,6 @@ local function TocManagePhantomPain(player, toc_data) end end - -- TODO Add phantom pain to depended parts - - end @@ -85,9 +82,9 @@ local function SetHealthStatusForBodyPart(part_data, part_name, player) -- Check for stitching - local is_stitched = false + local is_stitched = false -- TODO Implement this + - -- TODO Implement this if part_data[part_name].is_cut then --print("TOC: Check update for " .. part_name) @@ -162,8 +159,6 @@ end local function UpdatePlayerHealth(player, part_data) local body_damage = player:getBodyDamage() - - if player:HasTrait("Insensitive") then body_damage:setPainReduction(49) end for _, part_name in pairs(GetBodyParts()) do @@ -251,7 +246,7 @@ local function TocUpdateEveryOneMinute() -- Updates toc data in a global way, basically player:transmitModData but it works -- Sends only Limbs since the other stuff is mostly static if toc_data ~= nil then - -- TODO make it so that we dont send it constantly + -- FIXME Send little packets instead of the whole thing? sendClientCommand(player, 'TOC', 'ChangePlayerState', { toc_data.Limbs } ) end diff --git a/media/lua/client/TimedActions/ISCutLimb.lua b/media/lua/client/TimedActions/ISCutLimb.lua index d4e6d68..16f1064 100644 --- a/media/lua/client/TimedActions/ISCutLimb.lua +++ b/media/lua/client/TimedActions/ISCutLimb.lua @@ -2,7 +2,6 @@ require "TimedActions/ISBaseTimedAction" ISCutLimb = ISBaseTimedAction:derive("ISCutLimb") --- 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. function ISCutLimb:isValid() return self.patientX == self.patient:getX() and self.patientY == self.patient:getY() @@ -33,6 +32,7 @@ end function ISCutLimb: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 = TocGetSawInInventory(self.surgeon) @@ -119,7 +119,7 @@ function ISCutLimb:perform() TocCutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table) end - self.surgeon:getEmitter():stopSoundByName("Amputation_Sound") -- TODO This doesn't work reliably + self.surgeon:getEmitter():stopSoundByName("Amputation_Sound") self.surgeon:getXp():AddXP(Perks.Doctor, 400) ISBaseTimedAction.perform(self) @@ -131,7 +131,7 @@ function ISCutLimb:new(patient, surgeon, part_name) local o = {} - setmetatable(o, self) -- TODO what's this crap? + setmetatable(o, self) self.__index = self o.part_name = part_name o.character = surgeon -- For anim diff --git a/media/lua/client/TimedActions/ISOperateLimb.lua b/media/lua/client/TimedActions/ISOperateLimb.lua index 56d3f85..d03d4e2 100644 --- a/media/lua/client/TimedActions/ISOperateLimb.lua +++ b/media/lua/client/TimedActions/ISOperateLimb.lua @@ -23,7 +23,7 @@ end function ISOperateLimb:start() self:setActionAnim("MedicalCheck") if self.use_oven then - self.sound = self.patient:getEmitter():playSound("Burn_sound") -- TODO currently broken, but maybe that's good + self.sound = self.patient:getEmitter():playSound("Burn_sound") self:forceComplete() end end @@ -63,7 +63,6 @@ function ISOperateLimb:perform() end self.surgeon:getXp():AddXP(Perks.Doctor, 400) - -- FIXME Add a check for kit to prevent errors if self.kit and not use_oven then self.surgeon:getInventory():Remove(self.kit) end diff --git a/media/lua/shared/NPCs/ExtraBodyLocations.lua b/media/lua/shared/NPCs/ExtraBodyLocations.lua index 828e213..b35b4c3 100644 --- a/media/lua/shared/NPCs/ExtraBodyLocations.lua +++ b/media/lua/shared/NPCs/ExtraBodyLocations.lua @@ -1,23 +1,12 @@ local function addBodyLocationBefore(newLocation, movetoLocation) + -- FIXME This doesn't really move a body location, it just re-adds it to another index. Find a way to remove it entirely (maybe setExclusive?) - -- TODO this is still broken! local group = BodyLocations.getGroup("Human") - - - local list = getClassFieldVal(group, getClassField(group, 1)) - - - group:getOrCreateLocation(newLocation) - - local newItem = list:get(list:size()-1) print("TOC: Created new body location" .. newItem:getId()) - - - list:remove(list:size()-1) local i = group:indexOf(movetoLocation) list:add(i, newItem) @@ -25,57 +14,7 @@ end - -local function TocSetSleeves(check) - - -- FIXME This can't work, we need to fix masks before changing the order. There is nothing I can do for now with only this - - - - - - - -- -- Check if we already set stuff before - -- -- Readd them - -- print("TOC: Running TocSetSleeves") - - -- if group:getLocation("RightArm") or group:getLocation("LeftArm") then - -- BodyLocations:Reset() -- maybe it's too much - -- end - - -- if check then - -- print("TOC: Rolling up sleeves") - -- group:getOrCreateLocation("ArmRight_Prot") - -- group:getOrCreateLocation("ArmLeft_Prot") - -- group:getOrCreateLocation("ArmRight") - -- group:getOrCreateLocation("ArmLeft") - -- else - -- print("TOC: Won't roll up sleeve") - -- addBodyLocationBefore("ArmRight_Prot", "TorsoExtra") - -- addBodyLocationBefore("ArmLeft_Prot", "TorsoExtra") - -- addBodyLocationBefore("ArmRight", "Jacket") - -- addBodyLocationBefore("ArmLeft", "Jacket") - - -- end - - -end - --- FIXME this still breaks - -local group = BodyLocations.getGroup("Human") - - - - addBodyLocationBefore("TOC_ArmRight", "Shoes") addBodyLocationBefore("TOC_ArmLeft", "Shoes") addBodyLocationBefore("TOC_ArmRightProsthesis", "Shoes") addBodyLocationBefore("TOC_ArmLeftProsthesis", "Shoes") - - - --- group:getOrCreateLocation("TOC_ArmRight") --- group:getOrCreateLocation("ArmLeft") --- group:getOrCreateLocation("ArmRight_Prot") --- group:getOrCreateLocation("ArmLeft_Prot") \ No newline at end of file