lib/demiurge/location.rb
def item_change_position(item, old_pos, new_pos)
      exit = @state["exits"].detect { |e| e["from"] == new_pos }
      return super unless exit  # No exit? Do what you were going to.

      # Going to hit an exit? Cancel this motion and enqueue an
      # intention to do so? Or just send them through? If the former,
      # it's very hard to unblockably pass through an exit, even if
      # that's what's wanted. If the latter, it's very hard to make
      # going through an exit blockable.

      # Eh, just send them through for now. We'll figure out how to
      # make detecting and blocking exit intentions easy later.

      item_change_location(item, old_pos, exit["to"])
    end
# When an item changes position in a TiledLocation, check if the
# new position leads out an exit. If so, send them where the exit
# leads instead.
#
# @param item [String] The item changing position
# @param old_pos [String] The position string the item is moving *from*
# @param new_pos [String] The position string the item is moving *to*
# @return [void]
# @since 0.2.0
When an item changes position in a TiledLocation, check if the
new position leads out an exit. If so, send them where the exit
leads instead.
When an item changes position in a TiledLocation check if the new position leads out an exit . If so send them where the exit leads instead .
def item_change_position(item, old_pos, new_pos)
      exit = @state["exits"].detect { |e| e["from"] == new_pos }
      return super unless exit  
      item_change_location(item, old_pos, exit["to"])
    end
def item_change_position ( item , old_pos , new_pos ) exit = @state [ "exits" ] . detect { | e | e [ "from" ] == new_pos } return super unless exit item_change_location ( item , old_pos , exit [ "to" ] ) end
When an item changes position in a TiledLocation, check if the
new position leads out an exit.
When an item changes position in a TiledLocation check if the new position leads out an exit .
# No exit? Do what you were going to. # Going to hit an exit? Cancel this motion and enqueue an # intention to do so? Or just send them through? If the former, # it's very hard to unblockably pass through an exit, even if # that's what's wanted. If the latter, it's very hard to make # going through an exit blockable. # Eh, just send them through for now. We'll figure out how to # make detecting and blocking exit intentions easy later.
None
void
item
The item changing position
The item changing position
old_pos
The position string the item is moving *from
The position string the item is moving * from
new_pos
The position string the item is moving *to
The position string the item is moving * to
since
None