Sha256: 975075b164fead12948d73efecf52f7f233336943cf74d45126812110e44fd80

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

require "gamefic/entity_ext/portal"

module Gamefic

	class Room < Entity
		def connect(destination, direction, type = Portal, two_way = true)
			portal = type.new self.plot, :name => direction, :parent => self, :destination => destination
			if two_way == true
				reverse = Portal.reverse(direction)
				if reverse == nil
					raise "\"#{direction.cap_first}\" does not have an opposite direction"
				end
				portal2 = type.new(self.plot, {
					:name => reverse,
					:parent => destination,
					:destination => self
				})
			end
			portal
		end
		def tell(message, refresh = false)
			children.each { |c|
				c.tell message, refresh
			}
		end
	end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gamefic-0.0.5 lib/gamefic/entity_ext/room.rb
gamefic-0.0.4 lib/gamefic/entity_ext/room.rb
gamefic-0.0.3 lib/gamefic/entity_ext/room.rb