Sha256: ca8a35f563bb24dcf23505cc0f24089b7229c25901a965a3f3a7c55bda5aed2b

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

Gamefic.script do
  respond :search, Use.available(Thing) do |actor, thing|
    actor.perform :look, thing
  end

  respond :search, Use.available(Receptacle) do |actor, thing|
    if thing.accessible?
      itemized = thing.children.that_are_not(:attached?).that_are(:itemized?)
      if itemized.empty?
        actor.tell "There's nothing inside #{the thing}."
      else
        actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
      end
    else
      actor.tell "You can't see inside #{the thing}."
    end
  end

  respond :search, Use.available(Container, :closed?) do |actor, container|
    actor.perform :open, container
    actor.proceed if container.open?
  end

  interpret 'look inside :thing', 'search :thing'
  interpret 'look in :thing', 'search :thing'
end

Version data entries

2 entries across 2 versions & 1 rubygems

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