Class: NetObj::Character

Inherits:
SnapItemBase show all
Defined in:
lib/snapshot/items/character.rb

Instance Attribute Summary collapse

Attributes inherited from SnapItemBase

#id, #name, #notes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SnapItemBase

#init_hash, #init_raw, #init_unpacker, #to_a, #to_h, #to_s, #validate

Constructor Details

#initialize(hash_or_raw) ⇒ Character

Returns a new instance of Character.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/snapshot/items/character.rb', line 11

def initialize(hash_or_raw)
  @field_names = i[
    tick
    x
    y
    vel_x
    vel_y
    angle
    direction
    jumped
    hooked_player
    hook_state
    hook_tick
    hook_x
    hook_y
    hook_dx
    hook_dy
    health
    armor
    ammo_count
    weapon
    emote
    attack_tick
    triggered_events
  ]
  super
end

Instance Attribute Details

#ammo_countObject

Returns the value of attribute ammo_count.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def ammo_count
  @ammo_count
end

#angleObject

Returns the value of attribute angle.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def angle
  @angle
end

#armorObject

Returns the value of attribute armor.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def armor
  @armor
end

#attack_tickObject

Returns the value of attribute attack_tick.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def attack_tick
  @attack_tick
end

#directionObject

Returns the value of attribute direction.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def direction
  @direction
end

#emoteObject

Returns the value of attribute emote.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def emote
  @emote
end

#healthObject

Returns the value of attribute health.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def health
  @health
end

#hook_dxObject

Returns the value of attribute hook_dx.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_dx
  @hook_dx
end

#hook_dyObject

Returns the value of attribute hook_dy.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_dy
  @hook_dy
end

#hook_stateObject

Returns the value of attribute hook_state.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_state
  @hook_state
end

#hook_tickObject

Returns the value of attribute hook_tick.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_tick
  @hook_tick
end

#hook_xObject

Returns the value of attribute hook_x.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_x
  @hook_x
end

#hook_yObject

Returns the value of attribute hook_y.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hook_y
  @hook_y
end

#hooked_playerObject

Returns the value of attribute hooked_player.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def hooked_player
  @hooked_player
end

#jumpedObject

Returns the value of attribute jumped.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def jumped
  @jumped
end

#tickObject

Returns the value of attribute tick.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def tick
  @tick
end

#triggered_eventsObject

Returns the value of attribute triggered_events.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def triggered_events
  @triggered_events
end

#vel_xObject

Returns the value of attribute vel_x.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def vel_x
  @vel_x
end

#vel_yObject

Returns the value of attribute vel_y.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def vel_y
  @vel_y
end

#weaponObject

Returns the value of attribute weapon.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def weapon
  @weapon
end

#xObject

Returns the value of attribute x.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def x
  @x
end

#yObject

Returns the value of attribute y.



7
8
9
# File 'lib/snapshot/items/character.rb', line 7

def y
  @y
end

Class Method Details

.match_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/snapshot/items/character.rb', line 39

def self.match_type?(type)
  type == NETOBJTYPE_CHARACTER
end