lib/gamefic-standard/actions/lock.rb in gamefic-standard-2.4.0 vs lib/gamefic-standard/actions/lock.rb in gamefic-standard-3.0.0
- old
+ new
@@ -1,21 +1,25 @@
-Gamefic.script do
- respond :lock, Use.available do |actor, thing|
- actor.tell "You can't lock #{the thing}."
- end
+module Gamefic
+ module Standard
+ script do
+ respond :lock, available do |actor, thing|
+ actor.tell "You can't lock #{the thing}."
+ end
- respond :lock, Use.available(Lockable, :has_lock_key?), Use.children do |actor, thing, key|
- if thing.lock_key == key
- thing.locked = true
- actor.tell "You lock ##{the thing} with #{the key}."
- else
- actor.tell "You can't lock #{the thing} with #{the key}."
- end
- end
+ respond :lock, available(Lockable, proc(&:has_lock_key?)), children do |actor, thing, key|
+ if thing.lock_key == key
+ thing.locked = true
+ actor.tell "You lock ##{the thing} with #{the key}."
+ else
+ actor.tell "You can't lock #{the thing} with #{the key}."
+ end
+ end
- respond :lock, Use.available(Lockable, :has_lock_key?), Use.available do |actor, thing, key|
- actor.execute :take, key if key.parent != actor
- actor.proceed if key.parent == actor
- end
+ respond :lock, available(Lockable, proc(&:has_lock_key?)), available do |actor, thing, key|
+ actor.execute :take, key if key.parent != actor
+ actor.proceed if key.parent == actor
+ end
- interpret "lock :container with :key", "lock :container :key"
+ interpret "lock :container with :key", "lock :container :key"
+ end
+ end
end