summaryrefslogtreecommitdiff
path: root/app/models/built_hearth_amenity.rb
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-03 09:23:59 -0400
committerDavid Gay <david@davidgay.org>2021-06-03 09:23:59 -0400
commitb9091779d24bbbcad0c6514a5fc04af860100894 (patch)
tree0078fb704e17f83753e9348d0bc7f1c4952bdb87 /app/models/built_hearth_amenity.rb
parent5c79a9376feab23366859a3bbf44cf393d39ad91 (diff)
Display amount of time until amenity on cooldown is usable again
Diffstat (limited to 'app/models/built_hearth_amenity.rb')
-rw-r--r--app/models/built_hearth_amenity.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/built_hearth_amenity.rb b/app/models/built_hearth_amenity.rb
index a1e35e8..02e2cd3 100644
--- a/app/models/built_hearth_amenity.rb
+++ b/app/models/built_hearth_amenity.rb
@@ -29,6 +29,11 @@ class BuiltHearthAmenity < ApplicationRecord
[0, seconds_until_cooled_down].max
end
+ def cooled_down_at
+ return nil unless seconds_until_cooled_down
+ Time.now + seconds_until_cooled_down.seconds
+ end
+
def effects
self.hearth_amenity.whatnot[:effects]&.reject { |e| e[:level] > self.level }
end