Sha256: 007b7bc01eda37231b111a17b9eaa96e5009a80d1eeefbd763bb694c5c25c1a4
Contents?: true
Size: 875 Bytes
Versions: 7
Compression:
Stored size: 875 Bytes
Contents
Gamefic::Standard.script do respond :unlock, available(Lockable) do |actor, thing| if thing.has_lock_key? && actor.children.include?(thing.lock_key) actor.execute :unlock, thing, thing.lock_key else actor.tell "You can't unlock #{the thing}." end end respond :unlock, available(Lockable, proc(&:has_lock_key?)), children do |actor, thing, key| if thing.lock_key == key thing.locked = false actor.tell "You unlock #{the thing} with #{the key}." else actor.tell "You can't unlock #{the thing} with #{the key}." end end respond :unlock, 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 "unlock :container with :key", "unlock :container :key" end
Version data entries
7 entries across 7 versions & 1 rubygems