class RuneRb::Model::Entity

Constants

DEFAULT_LOCATION

Attributes

agressor[R]
animation[RW]
auto_retaliate[R]
cached_update[RW]
cool_downs[R]
damage[R]

Combat

dead[R]
facing[R]
flags[R]
forced_chat_msg[R]
graphic[RW]
id[R]

Info

in_combat[R]
index[RW]
interacting_entity[R]
last_location[RW]
local_npcs[R]
local_players[R]
location[R]
region[R]
region_change[RW]
sprites[RW]
standanim[RW]
teleport_location[RW]
teleporting[RW]
walkanim[RW]

Animations

walking_queue[R]

Public Class Methods

new() click to toggle source
# File app/model/entity.rb, line 43
def initialize
  @flags = RuneRb::Misc::Flags.new
  @agressor = false
  @cool_downs = RuneRb::Misc::Flags.new
  @local_players = []
  @local_npcs = []
  @sprites = Array.new(2, -1)
  
  @location = DEFAULT_LOCATION
  @last_location = @location
  @region_change = false
  @teleporting = false
  @walking_queue = RuneRb::World::Pathfinder.new self
  
  @forced_chat_msg = ""
  
  @standanim = 0x328
  @walkanim = 0x333
  
  @damage = Damage.new
  @dead = false
  @in_combat = false
  @auto_retaliate = true
end

Public Instance Methods

add_to_region(region) click to toggle source
# File app/model/entity.rb, line 115
def add_to_region(region)
  raise "add_to_region is abstract"
end
destroy() click to toggle source
# File app/model/entity.rb, line 123
def destroy
  remove_from_region @region
end
face(location) click to toggle source
# File app/model/entity.rb, line 68
def face(location)
  @facing = location
  @flags.flag :face_coord
end
force_chat(msg) click to toggle source
# File app/model/entity.rb, line 98
def force_chat(msg)
  @forced_chat_msg = msg
  @flags.flag :forced_chat
end
interacting_entity=(entity) click to toggle source
# File app/model/entity.rb, line 78
def interacting_entity=(entity)
  @interacting_entity = entity
  @flags.flag :face_entity
end
location=(location) click to toggle source
# File app/model/entity.rb, line 103
def location=(location)
  @location = location
  
  region = WORLD.region_manager.get_region_for_location location
  
  return if region == nil
  remove_from_region @region unless @region == nil
  
  @region = region
  add_to_region @region
end
play_animation(animation) click to toggle source
# File app/model/entity.rb, line 88
def play_animation(animation)
  @animation = animation
  @flags.flag :animation
end
play_graphic(graphic) click to toggle source
# File app/model/entity.rb, line 93
def play_graphic(graphic)
  @graphic = graphic
  @flags.flag :graphics
end
remove_from_region(region) click to toggle source
# File app/model/entity.rb, line 119
def remove_from_region(region)
  raise "remove_to_region is abstract"
end
reset() click to toggle source
# File app/model/entity.rb, line 127
def reset
  @animation = nil
  @graphic = nil
end
reset_face() click to toggle source
# File app/model/entity.rb, line 73
def reset_face
  @facing = nil
  @flags.set :face_coord, false
end
reset_interacting_entity() click to toggle source
# File app/model/entity.rb, line 83
def reset_interacting_entity
  @interacting_entity = nil
  @flags.flag :face_entity
end