class RuneRb::GroundItems::GroundItem

Attributes

available[R]
global[R]
item[R]
life[R]
location[R]
on_table[R]
player[R]
region[R]

Public Class Methods

new(player, item, on_table = false) click to toggle source
# File app/services/ground_items.rb, line 12
def initialize(player, item, on_table = false)
  @item = item
  @player = player
  @region = @player.region
  @location = @player.location
  @available = true
  @global = false
  @life = RuneRb::GroundItems::GroundItemEvent.new self
  @on_table = on_table
  
  @region.ground_items << self
end

Public Instance Methods

make_global() click to toggle source
# File app/services/ground_items.rb, line 25
def make_global
  @global = true
  WORLD.region_manager.get_local_players(@location).each {|player|
    player.io.send_grounditem_creation(self) unless player.eql?(@player)
  }
end
remove() click to toggle source
# File app/services/ground_items.rb, line 32
def remove
  return unless @available
  
  @available = false
  @life.stop
  @region.ground_items.delete self
  
  if @global
    WORLD.region_manager.get_local_players(@location).each {|p| p.io.send_grounditem_removal self }
  else
    @player.io.send_grounditem_removal self
  end
end