Sha256: bb2a7571b6e7fa6ec2345f512127964cb7626071c4bf8bbda15cfa991d1e7c7f

Contents?: true

Size: 700 Bytes

Versions: 1

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.execute :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

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-2.4.0 lib/gamefic-standard/actions/lock.rb