Loading

Paste #pvwjalgqd

  1. diff --git a/CorsixTH/Lua/world.lua b/CorsixTH/Lua/world.lua
  2. index 99c6df1..e789060 100644
  3. --- a/CorsixTH/Lua/world.lua
  4. +++ b/CorsixTH/Lua/world.lua
  5. @@ -2109,11 +2109,14 @@ function World:objectPlaced(entity, id)
  6.    self.entities[#self.entities + 1] = entity
  7.    -- If it is a bench we're placing, notify queueing patients in the vicinity
  8.    if id == "bench" and entity.tile_x and entity.tile_y then
  9. -    for _, patient in ipairs(self.entities) do
  10. -      if class.is(patient, Patient) then
  11. -        if math.abs(patient.tile_x - entity.tile_x) < 7 and
  12. -          math.abs(patient.tile_y - entity.tile_y) < 7 then
  13. -          patient:notifyNewObject(id)
  14. +    local w, h = self.map.th:size()
  15. +    local tx, ty
  16. +    for tx = math.max(1, entity.tile_x - 6), math.min(w, entity.tile_x + 6) do
  17. +      for ty = math.max(1, entity.tile_y - 6), math.min(h, entity.tile_y + 6) do
  18. +        for _, patient in ipairs(self.entity_map:getHumanoidsAtCoordinate(tx, ty)) do
  19. +          if class.is(patient, Patient) then
  20. +            patient:notifyNewObject(id)
  21. +          end
  22.          end
  23.        end
  24.      end

Comments