Skip to content

Commit cacb75a

Browse files
committed
Add type to snap items
1 parent c726756 commit cacb75a

19 files changed

+19
-1
lines changed

lib/snapshot/events/damage.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Damage < SnapEventBase
77
attr_accessor :client_id, :angle, :health_ammount, :armor_amount, :self
88

99
def initialize(hash_or_raw)
10+
@type = NETEVENTTYPE_DAMAGE
1011
@field_names = %i[
1112
client_id
1213
angle

lib/snapshot/events/death.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Death < SnapEventBase
77
attr_accessor :client_id
88

99
def initialize(hash_or_raw)
10+
@type = NETEVENTTYPE_DEATH
1011
@field_names = %i[
1112
client_id
1213
]

lib/snapshot/events/explosion.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class NetEvent
66
class Explosion < SnapEventBase
77
def initialize(hash_or_raw)
8+
@type = NETEVENTTYPE_EXPLOSION
89
@field_names = []
910
super
1011
end

lib/snapshot/events/hammer_hit.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class NetEvent
66
class HammerHit < SnapEventBase
77
def initialize(hash_or_raw)
8+
@type = NETEVENTTYPE_HAMMERHIT
89
@field_names = []
910
super
1011
end

lib/snapshot/events/sound_world.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class SoundWorld < SnapEventBase
77
attr_accessor :sound_id
88

99
def initialize(hash_or_raw)
10+
@type = NETEVENTTYPE_SOUNDWORLD
1011
@field_names = %i[
1112
sound_id
1213
]

lib/snapshot/events/spawn.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class NetEvent
66
class Spawn < SnapEventBase
77
def initialize(hash_or_raw)
8+
@type = NETEVENTTYPE_SPAWN
89
@field_names = []
910
super
1011
end

lib/snapshot/items/character.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Character < SnapItemBase
99
:health, :armor, :ammo_count, :weapon, :emote, :attack_tick, :triggered_events
1010

1111
def initialize(hash_or_raw)
12+
@type = NETOBJTYPE_CHARACTER
1213
@field_names = %i[
1314
tick
1415
x

lib/snapshot/items/client_info.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class ClientInfo < SnapItemBase
77
attr_accessor :local, :team
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_DE_CLIENTINFO
1011
@field_names = %i[
1112
local
1213
team

lib/snapshot/items/flag.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Flag < SnapItemBase
77
attr_accessor :x, :y, :team
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_FLAG
1011
@field_names = %i[
1112
x
1213
y

lib/snapshot/items/game_data.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class GameData < SnapItemBase
77
attr_accessor :game_start_tick, :game_state_flags, :game_state_end_tick
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_GAMEDATA
1011
@field_names = %i[
1112
game_start_tick
1213
game_state_flags

lib/snapshot/items/game_data_flag.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class GameDataFlag < SnapItemBase
88
:flag_drop_tick_red, :flag_drop_tick_blue
99

1010
def initialize(hash_or_raw)
11+
@type = NETOBJTYPE_GAMEDATAFLAG
1112
@field_names = %i[
1213
flag_carrier_red
1314
flag_carrier_blue

lib/snapshot/items/game_data_team.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class GameDataTeam < SnapItemBase
77
attr_accessor :teamscore_red, :teamscore_blue
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_GAMEDATATEAM
1011
@field_names = %i[
1112
teamscore_red
1213
teamscore_blue

lib/snapshot/items/laser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Laser < SnapItemBase
77
attr_accessor :x, :y, :from_x, :from_y, :start_tick
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_LASER
1011
@field_names = %i[
1112
x
1213
y

lib/snapshot/items/pickup.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Pickup < SnapItemBase
77
attr_accessor :x, :y, :type
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_PICKUP
1011
@field_names = %i[
1112
x
1213
y

lib/snapshot/items/player_info.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class PlayerInfo < SnapItemBase
77
attr_accessor :player_flags, :score, :latency
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_PLAYERINFO
1011
@field_names = %i[
1112
player_flags
1213
score

lib/snapshot/items/player_input.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class PlayerInput < SnapItemBase
1010
:next_weapon, :prev_weapon
1111

1212
def initialize(hash_or_raw)
13+
@type = NETOBJTYPE_PLAYERINPUT
1314
@field_names = %i[
1415
direction
1516
target_x

lib/snapshot/items/projectile.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Projectile < SnapItemBase
77
attr_accessor :x, :y, :vel_x, :vel_y, :type, :start_tick
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_PROJECTILE
1011
@field_names = %i[
1112
x
1213
y

lib/snapshot/items/spectator_info.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class SpectatorInfo < SnapItemBase
77
attr_accessor :spec_mode, :spectator_id, :x, :y
88

99
def initialize(hash_or_raw)
10+
@type = NETOBJTYPE_SPECTATORINFO
1011
@field_names = %i[
1112
spec_mode
1213
spectator_id

lib/snapshot/snap_item_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative '../packer'
44

55
class SnapItemBase
6-
attr_reader :notes, :name, :id
6+
attr_reader :notes, :name, :type, :id
77

88
def initialize(hash_or_raw)
99
@fields = @field_names.map do |_|

0 commit comments

Comments
 (0)