Sha256: 22a90ebbfc44fb27a9fcf4967b62f750fe756354a788b3ea4b592c238c24e586

Contents?: true

Size: 1.7 KB

Versions: 7

Compression:

Stored size: 1.7 KB

Contents

module Gamefic
  module Standard
    script do
      respond :go, siblings(Portal) do |actor, portal|
        if portal.destination.nil?
          actor.tell "That portal leads nowhere."
        else
          actor.parent = portal.destination
          if !portal.direction.nil?
            actor.tell "You go #{portal.direction}."
          end
          actor.execute :look
        end
      end

      respond :go, plaintext do |actor, text|
        if actor.parent == actor.room
          actor.tell "I don't see any way to go \"#{text}\" from here."
        else
          actor.execute :leave
          if actor.parent == actor.room
            actor.perform "go #{text}"
          else
            actor.proceed
          end
        end
      end

      respond :go, available(Door) do |actor, door|
        actor.execute :open, door unless door.open?
        actor.proceed if door.open?
      end

      interpret "north", "go north"
      interpret "south", "go south"
      interpret "west", "go west"
      interpret "east", "go east"
      interpret "up", "go up"
      interpret "down", "go down"
      interpret "northwest", "go northwest"
      interpret "northeast", "go northeast"
      interpret "southwest", "go southwest"
      interpret "southeast", "go southeast"

      interpret "n", "go north"
      interpret "s", "go south"
      interpret "w", "go west"
      interpret "e", "go east"
      interpret "u", "go up"
      interpret "d", "go down"
      interpret "nw", "go northwest"
      interpret "ne", "go northeast"
      interpret "sw", "go southwest"
      interpret "se", "go southeast"

      interpret "go to :place", "go :place"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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