Permalink
Browse files

Merge pull request #1451 from mugmuggy/noactiondespawn

[RDY] Crashed room despawn
  • Loading branch information...
TheCycoONE committed Sep 24, 2018
2 parents 338ea32 + d519308 commit 309460a939630c1adde9fc24f754cea1a1d8f71d
Showing with 4 additions and 4 deletions.
  1. +2 −4 CorsixTH/Lua/entities/staff.lua
  2. +2 −0 CorsixTH/Lua/room.lua
@@ -152,7 +152,7 @@ end
function Staff:tick()
Entity.tick(self)
-- don't do anything if they're fired or picked up or have no hospital
if self.fired or self.pickup or not self.hospital then
if self.fired or self.pickup or not self.hospital or self.dead then
return
end

@@ -394,7 +394,6 @@ function Staff:fire()
end

function Staff:die()
self:despawn()
if self.task then
-- If the staff member had a task outstanding, unassigning them from that task.
-- Tasks with no handyman assigned will be eligible for reassignment by the hospital.
@@ -406,8 +405,7 @@ function Staff:die()
if window then
window:updateStaffList(self)
end
-- It may be that the staff member was fired just before dying (then self.hospital = nil)
self.world.ui.hospital:humanoidDeath(self)
self.dead = true
end

-- Despawns the staff member and removes them from the hospital
@@ -779,13 +779,15 @@ function Room:crashRoom()
table.remove(self.world:getLocalPlayerHospital().emergency_patients, humanoid.is_emergency)
end
humanoid:die()
humanoid:despawn()
self.world:destroyEntity(humanoid)
end

-- Remove all humanoids in the room
for humanoid, _ in pairs(self.humanoids) do
remove_humanoid(humanoid)
end
self.humanoids = {}
-- There might also be someone using the door, even if that person is just about to exit
-- he/she is killed too.
local walker = self.door.user

0 comments on commit 309460a

Please sign in to comment.