Sha256: 6dc1501797a25243ae447bb546bc412d160fa0523472ba4c01d2f3c1d8f9127e

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

require "gamefic/entity_ext/portal"

module Gamefic

	class Room < Entity
		def post_initialize
		
		end
		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

2 entries across 2 versions & 1 rubygems

Version Path
gamefic-0.0.2 lib/gamefic/entity_ext/room.rb
gamefic-0.0.1 lib/gamefic/entity_ext/room.rb