Sha256: 7b7d525dcae3e346da08827e0b1a4f891e8e21bfff191b6e83ab99e3d19b6071

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

require 'gamefic-standard/openable'
require 'gamefic-standard/lockable'

# An openable and lockable receptacle.
#
class Container < Receptacle
  include Openable
  include Lockable
end

Gamefic.script do
  respond :insert, Use.available, Use.available(Container) do |actor, _thing, container|
    if container.open?
      actor.proceed
    else
      actor.tell "#{The container} is closed."
    end
  end

  respond :leave, Use.parent(Container, :enterable?, :closed?) do |actor, container|
    actor.tell "#{The container} is closed."
  end

  respond :enter, Use.siblings(Container, :enterable?, :closed?) do |actor, container|
    actor.tell "#{The container} is closed."
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gamefic-standard-2.2.0 lib/gamefic-standard/container.rb
gamefic-standard-2.1.0 lib/gamefic-standard/container.rb