module Gamefic::World
@todo Monkey patching might not be the best way to handle this. It's only
necessary because of specs that make Plot#connect calls. Consider changing the specs instead.
Public Instance Methods
connect(origin, destination, direction = nil, type: Portal, two_way: true)
click to toggle source
Create portals between rooms.
@return [Portal]
# File lib/gamefic-standard/entities/room.rb, line 38 def connect origin, destination, direction = nil, type: Portal, two_way: true if direction.nil? portal = make type, :parent => origin, :destination => destination if two_way == true portal2 = make type, :parent => destination, :destination => origin end else if direction.kind_of?(String) direction = Direction.find(direction) end portal = make type, :direction => direction, :parent => origin, :destination => destination portal.proper_named = true if type == Portal if two_way == true reverse = direction.reverse if reverse == nil raise "#{direction.name.cap_first} does not have an opposite direction" end portal2 = make type, :direction => reverse, :parent => destination, :destination => origin portal2.proper_named = true if type == Portal end end portal end