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
Fire extinguishers don't impact explosion chance #994
Comments
Did the original game implement this? I don't recall the extinguisher having any effect on machine strength. |
FYI, I was hoping to use this as an intro to try contributing to this project so we'll see how it goes. I'm not entirely sure if/how the original game implemented it but the "logic" is littered all over the place. CorsixTH game guide https://github.com/CorsixTH/CorsixTH/wiki/Game-Guide
And in player documentation http://bullfrogproductions.wikia.com/wiki/Hospital_Items
Official Game Guide http://vignette2.wikia.nocookie.net/bullfrogproductions/images/2/20/Manual_Theme_Hospital.pdf/revision/latest?cb=20131210232242
What are your thoughts on this? |
I think it would be good to implement, though we should have a consensus on what the desired behavior should be before you spend time coding it. I don't think it's viable that a fire extinguisher make the base strength of the machine higher. If there's nothing in the original game to copy, then I like the idea of a small increase in the chance that the machine doesn't explode for each use past the critical threshold. |
I don't believe they increased the strength of a machine or reduced the chance of explosion through use. Once a machine reaches 0 in uses it explodes. |
What about if there's a fire extinguisher in the room, and if the machine strength <=0; we do a 50/50 chance of whether it will explode? If the chance is successful we reset the strength to 1 to give a chance for the handyman to repair it. |
TH builds in this buffer without the fire extinguishers with what I can tell. |
I think we're ok to vary from the implementation of the original here, as the intent (as specified in the manual) was that they would have some impact. |
Agree, just thought I would point out that there is an escalating chance of failure instead of the 50/50 and a defined must crash point. |
In Corsix I assume we currently just explode the room if the strength hits 0. To add to mugmuggy's point, I do remember that machines in the original would usually make that horrible warning sound when they were about to blow.... I don't remember this happening in Corsix currently (could be wrong). I think 50/50 is the best balance. It could be lower if you think that might be too forgiving. |
Earthquake damage is by game tick and handled through |
My concern is if the damage is by tick we could end up with a horrible loop: To be more efficient, it would be better to wait to roll until the earthquake ends. It would definitely be kinder on the player... but I think general thoughts are that our implementation of explosions are too harsh on the player anyway right now. Edit: Though machines can explode mid-earthquake too. So maybe instead roll on the first time it hits 0 during the earthquake, then hard set it to 1 if it succeeds until the earthquake ends. |
Why is it bad to check multiple times in the same quake? Just means your chance of being saved diminishes the more your machine wouldn't stand up to the magnitude of the quake. |
Point noted. As such, I think the code below will fit this suggestion. If it's a good start then I'll make it into a PR. + local roll_to_crash = nil
+ -- If a fire extinguisher in the room, make explosion chance 50%
+ for object, _ in pairs(room.objects) do
+ if object.object_type.id == "extinguisher" then
+ roll_to_crash = math.random(0,1)
+ break
+ end
+ end
+ -- Room is set to explode and fire extinguisher failed to save it
+ if threshold < 1 and (roll_to_crash == nil or roll_to_crash == 1) then
-- Clean up any task of handyman coming to repair the machine
self.hospital:removeHandymanTask(taskIndex, "repairing")
-- Blow up the room
room:crashRoom()
self:setCrashedAnimation()
-- No special cursor required when hovering over the crashed room
self.hover_cursor = nil
-- Clear dynamic info (tracks machine usage which is no longer required)
self:clearDynamicInfo()
-- Prevent the machine from smoking, it's now just a pile of rubble
setSmoke(self, false)
-- If we have the window for this machine open, close it
local window = self.world.ui:getWindow(UIMachine)
if window and window.machine == self then
window:close()
end
-- Clear the icon showing a handyman is coming to repair the machine
self:setRepairing(nil)
return true
+ -- Else if urgent repair needed or extinguisher saved the room
elseif threshold < 4 then
+ if threshold < 1 then
+ self.times_used = self.times_used - 1
+ end
-- If the job of repairing the machine isn't queued, queue it now (higher priority)
if taskIndex == -1 then
local call = self.world.dispatcher:callForRepair(self, true, false, true)
self.hospital:addHandymanTask(self, "repairing", 2, self.tile_x, self.tile_y, call)
else -- Otherwise the task is already queued. Increase the priority to above that of machines with at least 4 uses left
self.hospital:modifyHandymanTaskPriority(taskIndex, 2, "repairing")
end
-- Else if repair is needed, but not urgently
elseif threshold < 6 then
-- If the job of repairing the machine isn't queued, queue it now (low priority)
if taskIndex == -1 then
local call = self.world.dispatcher:callForRepair(self)
self.hospital:addHandymanTask(self, "repairing", 1, self.tile_x, self.tile_y, call)
end
end |
Or do you want some kind of max times a room can be saved? And should that be concurrently, or cumulatively? |
I don't think we want or need to decrement the |
To preserve times_used I found a new method of having a flag saved_by_earthquake attached to each object (really it should only attach to each machine, but no harm done here). Its default is always 0, except when we need to check its threshold has dropped below 1. In that case, it does a math.random to see if the extinguisher saved the machine. If it does, the value changes to 1 until the machine is used again (earthquakes count as use). When it is used again it will set back to 0... and roll again if our threshold is still <1. You can look at what I've wrote at machine.lua on my patch-2 branch. Tell me if that's more suitable. Also, as mentioned on IRC yesterday, machine_dialog doesn't seem to care when our times_used > strength for any graphical output. |
Describe the issue
Fire extinguishers currently impact happiness but don't impact equipment explosion chance.
From the game manual:
"✚ Fire Extinguishers are looked for by Very Important People - VIPs. VIPs like being safe. If
they don’t see a reassuring number of Fire Extinguishers when they visit, their reports to
the Ministry won’t be very favorable. Fire Extinguishers also increase safety levels around
Hospital equipment, and their presence makes Patients and Staff alike happier."
Expected Behavior
Fire extinguishers should lower the chance that a piece of equipment explodes either by increasing it's strength or implementing a % chance that when the threshold is hit the equipment doesn't explode.
System Information
CorsixTH Version: 0.50
Operating System: any
Theme Hospital Version: any
The text was updated successfully, but these errors were encountered: