Sha256: 67b329432608e2424e3e73eca0318c07e9e38d8df1cdf236ccee09fc27d95f96

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

Gamefic.script do
  respond :lock, Use.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, Use.available(Lockable, :has_lock_key?), Use.available do |actor, thing, key|
    actor.perform :take, key if key.parent != actor
    actor.proceed if key.parent == actor
  end

  interpret "lock :container with :key", "lock :container :key"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gamefic-standard-2.3.1 lib/gamefic-standard/actions/lock.rb
gamefic-standard-2.3.0 lib/gamefic-standard/actions/lock.rb