-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Trying to cure a dead patient #2562
Comments
Thanks for this report. Is the error reproducable from the save provided or has it already happened? |
Did he get up from the bench then sit back down again do you know? |
Can be reproduced from save
Just got up and went to the office. This can be seen in the save |
Clicked on:
humanoid - class: Standard Male Patient
Warmth: 0.324 Happiness: 1.000 Fatigue: 0.000 Thirst: 0.493 Toilet_Need: 0.528 Health: 0.000 Service Quality: 0.000
Actions: [use_object - bench must_happen, queue - Bench distance: 0 Standing: false must_happen, walk - going to 93:68 must_happen, meander, die] Already dead in the save. @mugmuggy if you're around any ideas if this may have slipped past #2310 ? Edit: Potentially related to the issue in 0.66 where an action got interrupted and blocked dying. If you pick up the patient's bench, then kill them again via debug script they die properly. Imo while we need to indeed fix bugs like these, our crash handling function for the action queue isn't really robust enough. Specifically, we just ignore any CorsixTH/CorsixTH/Lua/entities/humanoid.lua Lines 595 to 601 in c600596
|
@lewri Can't be definitive, but I would say its 'interrupted' twice. The obvious issue for me is that the queue action in the action queue position is immediately outside the door and the walk is to in the room. The must happen and saved must happen are true on the walk action so they will enter and it can't be interrupted until after the first tile is walked. As there are those multiple bits of code that are interrupting actions that cause it to be written and processed makes it harder or uglier to resolve this specific case. |
Thanks muggy, When I was playing around I found that if you found a way to initiate some kind of queue update or kicked them off the bench the problematic must happen was unblocked. Should we still try and prevent a crash when it falls over though for now? It probably isn't always good enough to ignore an empty action queue if the going home flag is true. |
Replicated this, can confirm it's the bench position. Another interesting part is that if a patient sits at the problematic bench and the You can hack the queue to account for this but it probably isn't the right solution: function Patient:die()
-- It may happen that this patient was just cured and then the room blew up.
self.hospital:humanoidDeath(self)
self:setMood("dead", "activate")
-- Remove any messages and/or callbacks related to the patient.
self:unregisterCallbacks()
self.going_home = true
if self:getRoom() then
self:queueAction(MeanderAction():setCount(1))
else
+ for _, act in ipairs(self.action_queue) do
+ if act.name == "walk" and act.must_happen then act.must_happen = false end
+ end
self:setNextAction(MeanderAction():setCount(1))
end
self:queueAction(DieAction())
self:setDynamicInfoText(_S.dynamic_info.patient.actions.dying)
end |
Describe the issue
Surgeons will attempt to treat a dead patient. But they won't succeed.
There's a long line for the surgery room. I've built a second surgery room. The patient went to the second room and got in line.
By the time it was his turn, he should have been dead.
But he went in. He was operated on. They didn't take any money. He started to change his clothes to get out. And then the game freezes.
Steps to Reproduce
Expected Behaviour
The patient should not go into the office, but die in the hallway
Save Game
Autosave9.zip
CorsixTH Version
0.67
Operating System
Windows 11
Theme Hospital Version
Origin
Gamelog.txt
Additional Information
No response
The text was updated successfully, but these errors were encountered: