Permalink
Browse files

Merge pull request #1286 from mugmuggy/handymanlittertasks

[RDY] Remove handyman task upon sweep action start
  • Loading branch information...
TheCycoONE committed Nov 29, 2017
2 parents b9339ff + 0834c5f commit 7c8fdabf5afb059335970a8d8826edf292708414
View
@@ -28,7 +28,7 @@ local runDebugger = dofile "run_debugger"
-- Increment each time a savegame break would occur
-- and add compatibility code in afterLoad functions
local SAVEGAME_VERSION = 120
local SAVEGAME_VERSION = 121
class "App"
@@ -900,6 +900,15 @@ function Staff:afterLoad(old, new)
end
end
if old < 121 then
if self.humanoid_class == "Handyman" and self.user_of and self.user_of.object_type.class == "Litter" then
local litter = self.user_of
local hospital = self.world:getHospital(litter.tile_x, litter.tile_y)
local taskIndex = hospital:getIndexOfTask(litter.tile_x, litter.tile_y, "cleaning", litter)
hospital:removeHandymanTask(taskIndex, "cleaning")
end
end
Humanoid.afterLoad(self, old, new)
end
@@ -57,6 +57,11 @@ end)
local function action_sweep_floor_start(action, humanoid)
action.must_happen = true
humanoid.user_of = action.litter
-- remove handyman task as soon as action starts - we should be committed to completing this task
local litter = action.litter
local hospital = litter.world:getHospital(litter.tile_x, litter.tile_y)
local taskIndex = hospital:getIndexOfTask(litter.tile_x, litter.tile_y, "cleaning", litter)
hospital:removeHandymanTask(taskIndex, "cleaning")
local anim = animation_numbers[1]
humanoid:setAnimation(anim)
humanoid:setTimer(humanoid.world:getAnimLength(anim), sweep)
@@ -56,6 +56,7 @@ local Litter = _G["Litter"]
function Litter:Litter(world, object_type, x, y, direction, etc)
local th = TH.animation()
self:Entity(th)
self.ticks = object_type.ticks
self.object_type = object_type
self.world = world
self:setTile(x, y)
@@ -149,6 +150,10 @@ function Litter:afterLoad(old, new)
hospital:removeHandymanTask(taskIndex, "cleaning")
end
end
if old < 121 then
self.ticks = object.ticks
end
end
return object

0 comments on commit 7c8fdab

Please sign in to comment.