lib/demiurge/container.rb
def item_change_location(item, old_pos, new_pos)
      old_loc = old_pos.split("#")[0]
      old_loc_item = @engine.item_by_name(old_loc)
      old_loc_item.ensure_does_not_contain(item.name)
      new_loc = new_pos.split("#")[0]
      new_loc_item = @engine.item_by_name(new_loc)
      new_loc_item.ensure_contains(item.name)
      item.state["position"] = new_pos

      old_zone = old_loc_item.zone_name
      new_zone = new_loc_item.zone_name
      if new_zone != old_zone
        item.state["zone"] = new_zone
      end
      nil
    end
# This is a callback to indicate that an item has changed from one
# location to another. This will normally require removing the
# item from its first location and adding it to a new location.  A
# different callback is called when the item changes position
# within a single location.
#
# @see #item_change_position
# @param item [Demiurge::StateItem] The item changing position
# @param old_pos [String] The pre-movement position, which is current when this is called
# @param new_pos [String] The post-movement position, which should be current when this method completes
# @return [void]
# @since 0.0.1
This is a callback to indicate that an item has changed from one
location to another. This will normally require removing the
item from its first location and adding it to a new location.  A
different callback is called when the item changes position
within a single location.
This is a callback to indicate that an item has changed from one location to another . This will normally require removing the item from its first location and adding it to a new location . A different callback is called when the item changes position within a single location .
def item_change_location(item, old_pos, new_pos)
      old_loc = old_pos.split("#")[0]
      old_loc_item = @engine.item_by_name(old_loc)
      old_loc_item.ensure_does_not_contain(item.name)
      new_loc = new_pos.split("#")[0]
      new_loc_item = @engine.item_by_name(new_loc)
      new_loc_item.ensure_contains(item.name)
      item.state["position"] = new_pos
      old_zone = old_loc_item.zone_name
      new_zone = new_loc_item.zone_name
      if new_zone != old_zone
        item.state["zone"] = new_zone
      end
      nil
    end
def item_change_location ( item , old_pos , new_pos ) old_loc = old_pos . split ( "#" ) [ 0 ] old_loc_item = @engine . item_by_name ( old_loc ) old_loc_item . ensure_does_not_contain ( item . name ) new_loc = new_pos . split ( "#" ) [ 0 ] new_loc_item = @engine . item_by_name ( new_loc ) new_loc_item . ensure_contains ( item . name ) item . state [ "position" ] = new_pos old_zone = old_loc_item . zone_name new_zone = new_loc_item . zone_name if new_zone != old_zone item . state [ "zone" ] = new_zone end nil end
This is a callback to indicate that an item has changed from one
location to another.
This is a callback to indicate that an item has changed from one location to another .
None
void
item
The item changing position
The item changing position
old_pos
The pre-movement position, which is current when this is called
The pre - movement position which is current when this is called
new_pos
The post-movement position, which should be current when this method completes
The post - movement position which should be current when this method completes
see
None
since
None