Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[RDY] Remove handyman task upon sweep action start #1286
Litter not 'tickable' as in to interrupt Handyman tasks when Litter:remove on build over.
I didn't update Litter:remove() to enforce the ticks = false, just left that to new litter only.
Removing the task in the action_sweep_floor_start is similar to Plant:restoreToFullHealth called from the end of action_use_object_start.
I looked into the history of
index 94be3f83..c0bf692e 100644 --- a/CorsixTH/Lua/hospital.lua +++ b/CorsixTH/Lua/hospital.lua @@ -1513,7 +1513,7 @@ function Hospital:removeHandymanTask(taskIndex, taskType) local task = subTable[taskIndex] table.remove(subTable, taskIndex) if task.assignedHandyman then - if taskType ~= "cleaning" and task.object.ticks ~= true then + if task.object.ticks ~= true then task.assignedHandyman:intreruptHandymanTask() end end
Which effectively is the same thing that you are doing by disabling ticks on litter. There was no indication in the commit as to why they removed that test.
I don't like that the purpose of
Otherwise, I was concerned about the action getting disrupted, and litter being abandoned, but it seems that the
I'm still concerned about the state deviation between old saves and new litter tasks. I means a code cleanup in the future could easily lead to broken state with little clue as to why. Should be able to fix that with an afterLoad on
For the ticks thing, I should have set it correctly as
A quick dive into the history and the context I believe is the 'soot' in a crash room was invoking an addHandymanTask call in the litter constructor. The afterLoad version < 54 check was added to remove the existing tasks for soot in crashed rooms, calling removeHandymanTask and in doing so, to interrupt handyman assigned to clean soot in rooms, the
For cleaning up tasks already assigned, the minimum required is, but not necessarily providing coverage to potentially all edge cases litter afterLoad.