Bunch of cleaning on old todos

This commit is contained in:
Pao
2023-02-06 02:44:59 +01:00
parent 83077a115d
commit 1545c88a19
10 changed files with 18 additions and 106 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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 = {}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")