Class: RuneRb::Game::Entity::Mob

Inherits:
Object
  • Object
show all
Includes:
Helpers::Flags, Helpers::Movement, System::Log
Defined in:
app/game/entity/mob.rb

Overview

Models a mobile model.

Since:

  • 0.9.3

Direct Known Subclasses

Context

Instance Attribute Summary collapse

Attributes included from Helpers::Flags

#flags

Attributes included from Helpers::Movement

#locals, #movement, #position

Instance Method Summary collapse

Methods included from Helpers::Flags

#load_flags, #reset_flags, #update

Methods included from Helpers::Movement

#clear_waypoints, #load_movement, #parse_movement, #push_path, #reset_movement, #teleport, #toggle_run, #waypoint_size

Methods included from System::Log

#class_name, #err, #err!, #log, #log!, #symbolize_file

Constructor Details

#initialize(definition) ⇒ Mob

Constructs a new Mob object with the passed definition.

Parameters:

  • definition (Object)

    the Definition for the mob.

Since:

  • 0.9.3


28
29
30
31
32
# File 'app/game/entity/mob.rb', line 28

def initialize(definition)
  register(definition)
  load_flags
  load_movement
end

Instance Attribute Details

#animationRuneRb::Game::Entity::Animation (readonly)

Returns the current Animation of the Mob.

Returns:

Since:

  • 0.9.3


12
13
14
# File 'app/game/entity/mob.rb', line 12

def animation
  @animation
end

#definitionObject (readonly)

Returns a definition object contains details about the Mobs properties. TODO: impl mob definitions.

Returns:

  • (Object)

    a definition object contains details about the Mobs properties. TODO: impl mob definitions.

Since:

  • 0.9.3


9
10
11
# File 'app/game/entity/mob.rb', line 9

def definition
  @definition
end

#graphicRuneRb::Game::Entity::Graphic (readonly)

Returns the current Graphic of the Mob.

Returns:

Since:

  • 0.9.3


15
16
17
# File 'app/game/entity/mob.rb', line 15

def graphic
  @graphic
end

#indexInteger

Returns the index of the Mob within it's world Instance's mob list.

Returns:

  • (Integer)

    the index of the Mob within it's world Instance's mob list.

Since:

  • 0.9.3


24
25
26
# File 'app/game/entity/mob.rb', line 24

def index
  @index
end

#messageRuneRb::Game::Entity::Message (readonly)

Returns the current Message of the Mob.

Returns:

  • (RuneRb::Game::Entity::Message)

    the current Message of the Mob

Since:

  • 0.9.3


18
19
20
# File 'app/game/entity/mob.rb', line 18

def message
  @message
end

#regionalRuneRb::Game::Map::Regional (readonly)

Returns the regional position for the mob.

Returns:

Since:

  • 0.9.3


21
22
23
# File 'app/game/entity/mob.rb', line 21

def regional
  @regional
end

Instance Method Details

#post_syncObject

Called after a SynchronizationMessage is dispatched.

Since:

  • 0.9.3


42
43
44
45
# File 'app/game/entity/mob.rb', line 42

def post_sync
  reset_movement
  reset_flags
end

#pre_syncObject

Called before a SynchronizationMessage is constructed and dispatched.

Since:

  • 0.9.3


35
36
37
# File 'app/game/entity/mob.rb', line 35

def pre_sync
  #move
end

#register(definition) ⇒ Object

Registers a definition to the Mob.

Since:

  • 0.9.3


48
49
50
# File 'app/game/entity/mob.rb', line 48

def register(definition)
  load_definition(definition)
end

#syncObject

Since:

  • 0.9.3


39
# File 'app/game/entity/mob.rb', line 39

def sync; end