summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-19 19:24:20 -0400
committerDavid Gay <david@davidgay.org>2021-05-19 19:24:20 -0400
commit38fff0e2d09f2954d747baf65ab555427ba653be (patch)
treed1e9c488a910015d907e539febe8cf683af3dc88 /app/controllers
parent045867220ea68b912f74b74a1476ac08bd19dbfd (diff)
Hearth amenity building working!
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/activities_controller.rb1
-rw-r--r--app/controllers/game_controller.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index a32ffab..f72bc3a 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -6,6 +6,7 @@ class ActivitiesController < ApplicationController
def start
@activity = Activity.find(params[:id])
if current_char.can_do_activity?(@activity)
+ current_char.start_activity(@activity)
redirect_to action: :show
else
flash[:alert] = "You can't do that. Make sure you have the items and meet the requirements."
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb
index 1b88cb8..d3d3ce2 100644
--- a/app/controllers/game_controller.rb
+++ b/app/controllers/game_controller.rb
@@ -44,7 +44,8 @@ class GameController < ApplicationController
end
end
when "hearth_amenity"
- bhi = BuiltHearthAmenity.find_or_initialize_by(hearth_amenity: HearthAmenity.find_by_gid(result[:gid]))
+ bhi = current_char.hearth.built_hearth_amenities
+ .find_or_initialize_by(hearth_amenity: HearthAmenity.find_by_gid(result[:gid]))
bhi.update(level: result[:level])
@results.push({ type: type, hearth_amenity: bhi.hearth_amenity })
else