diff options
author | David Gay <david@davidgay.org> | 2021-05-19 18:39:35 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-19 18:39:35 -0400 |
commit | 9fec79398a34d26be1042e35cae429b88f8b96d0 (patch) | |
tree | c51814b60f5fb3ae753f9fe7549b30af6930adcc /app/controllers | |
parent | 9ab7dfd99e7015513bfe1a092f257c1c7a7afb1b (diff) |
Revise and progress with hearth amenity construction
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/activities_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/game_controller.rb | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index a535f99..a32ffab 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -5,7 +5,11 @@ class ActivitiesController < ApplicationController def start @activity = Activity.find(params[:id]) - current_char.update(activity: @activity, activity_started_at: Time.now) - redirect_to action: :show + if current_char.can_do_activity?(@activity) + redirect_to action: :show + else + flash[:alert] = "You can't do that. Make sure you have the items and meet the requirements." + redirect_to character_path(current_char) + end end end diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index d69645f..147b692 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -2,6 +2,7 @@ class GameController < ApplicationController def finish_activity @results = [] return unless current_char.activity_time_remaining <= 0 + return unless current_char.can_do_activity?(current_char.activity) # TODO: Add error message current_char.update(activity_started_at: Time.now) current_char.activity.whatnot[:results].each do |result| |