Sha256: 0ae0a2bee7ad5d434ab1c46313c8d6a3341140054bfdafb331857cc3c66713bb

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

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

  respond :search, available(Receptacle) do |actor, thing|
    if thing.accessible?
      itemized = thing.children.that_are_not(proc(&:attached?)).that_are(proc(&: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, available(Container, proc(&:closed?)) do |actor, container|
    actor.execute :open, container
    actor.proceed if container.open?
  end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gamefic-standard-3.2.4 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.2.3 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.2.2 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.2.1 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.2.0 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.1.0 lib/gamefic-standard/actions/search.rb
gamefic-standard-3.0.0 lib/gamefic-standard/actions/search.rb