lib/gamefic-standard/actions/close.rb in gamefic-standard-3.2.4 vs lib/gamefic-standard/actions/close.rb in gamefic-standard-3.3.0

- old
+ new

@@ -1,17 +1,23 @@ +# frozen_string_literal: true + module Gamefic module Standard - script do - respond :close, available do |actor, thing| - actor.tell "You can't close #{the thing}." - end + module Actions + module Close + extend Gamefic::Scriptable - respond :close, available(Openable) do |actor, thing| - if thing.open? - actor.tell "You close #{the thing}." - thing.open = false - else - actor.tell "#{The thing} is already closed." + respond :close, available do |actor, thing| + actor.tell "You can't close #{the thing}." + end + + respond :close, available(Openable) do |actor, thing| + if thing.open? + actor.tell "You close #{the thing}." + thing.open = false + else + actor.tell "#{The thing} is already closed." + end end end end end end