Add type to snap items
This commit is contained in:
parent
c726756b5c
commit
cacb75ac62
|
@ -7,6 +7,7 @@ class NetEvent
|
||||||
attr_accessor :client_id, :angle, :health_ammount, :armor_amount, :self
|
attr_accessor :client_id, :angle, :health_ammount, :armor_amount, :self
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_DAMAGE
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
client_id
|
client_id
|
||||||
angle
|
angle
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetEvent
|
||||||
attr_accessor :client_id
|
attr_accessor :client_id
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_DEATH
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
client_id
|
client_id
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,6 +5,7 @@ require_relative '../snap_item_base'
|
||||||
class NetEvent
|
class NetEvent
|
||||||
class Explosion < SnapEventBase
|
class Explosion < SnapEventBase
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_EXPLOSION
|
||||||
@field_names = []
|
@field_names = []
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ require_relative '../snap_item_base'
|
||||||
class NetEvent
|
class NetEvent
|
||||||
class HammerHit < SnapEventBase
|
class HammerHit < SnapEventBase
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_HAMMERHIT
|
||||||
@field_names = []
|
@field_names = []
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetEvent
|
||||||
attr_accessor :sound_id
|
attr_accessor :sound_id
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_SOUNDWORLD
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
sound_id
|
sound_id
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,6 +5,7 @@ require_relative '../snap_item_base'
|
||||||
class NetEvent
|
class NetEvent
|
||||||
class Spawn < SnapEventBase
|
class Spawn < SnapEventBase
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETEVENTTYPE_SPAWN
|
||||||
@field_names = []
|
@field_names = []
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ class NetObj
|
||||||
:health, :armor, :ammo_count, :weapon, :emote, :attack_tick, :triggered_events
|
:health, :armor, :ammo_count, :weapon, :emote, :attack_tick, :triggered_events
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_CHARACTER
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
tick
|
tick
|
||||||
x
|
x
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :local, :team
|
attr_accessor :local, :team
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_DE_CLIENTINFO
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
local
|
local
|
||||||
team
|
team
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :x, :y, :team
|
attr_accessor :x, :y, :team
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_FLAG
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
x
|
x
|
||||||
y
|
y
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :game_start_tick, :game_state_flags, :game_state_end_tick
|
attr_accessor :game_start_tick, :game_state_flags, :game_state_end_tick
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_GAMEDATA
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
game_start_tick
|
game_start_tick
|
||||||
game_state_flags
|
game_state_flags
|
||||||
|
|
|
@ -8,6 +8,7 @@ class NetObj
|
||||||
:flag_drop_tick_red, :flag_drop_tick_blue
|
:flag_drop_tick_red, :flag_drop_tick_blue
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_GAMEDATAFLAG
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
flag_carrier_red
|
flag_carrier_red
|
||||||
flag_carrier_blue
|
flag_carrier_blue
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :teamscore_red, :teamscore_blue
|
attr_accessor :teamscore_red, :teamscore_blue
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_GAMEDATATEAM
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
teamscore_red
|
teamscore_red
|
||||||
teamscore_blue
|
teamscore_blue
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :x, :y, :from_x, :from_y, :start_tick
|
attr_accessor :x, :y, :from_x, :from_y, :start_tick
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_LASER
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
x
|
x
|
||||||
y
|
y
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :x, :y, :type
|
attr_accessor :x, :y, :type
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_PICKUP
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
x
|
x
|
||||||
y
|
y
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :player_flags, :score, :latency
|
attr_accessor :player_flags, :score, :latency
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_PLAYERINFO
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
player_flags
|
player_flags
|
||||||
score
|
score
|
||||||
|
|
|
@ -10,6 +10,7 @@ class NetObj
|
||||||
:next_weapon, :prev_weapon
|
:next_weapon, :prev_weapon
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_PLAYERINPUT
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
direction
|
direction
|
||||||
target_x
|
target_x
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :x, :y, :vel_x, :vel_y, :type, :start_tick
|
attr_accessor :x, :y, :vel_x, :vel_y, :type, :start_tick
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_PROJECTILE
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
x
|
x
|
||||||
y
|
y
|
||||||
|
|
|
@ -7,6 +7,7 @@ class NetObj
|
||||||
attr_accessor :spec_mode, :spectator_id, :x, :y
|
attr_accessor :spec_mode, :spectator_id, :x, :y
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
|
@type = NETOBJTYPE_SPECTATORINFO
|
||||||
@field_names = %i[
|
@field_names = %i[
|
||||||
spec_mode
|
spec_mode
|
||||||
spectator_id
|
spectator_id
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require_relative '../packer'
|
require_relative '../packer'
|
||||||
|
|
||||||
class SnapItemBase
|
class SnapItemBase
|
||||||
attr_reader :notes, :name, :id
|
attr_reader :notes, :name, :type, :id
|
||||||
|
|
||||||
def initialize(hash_or_raw)
|
def initialize(hash_or_raw)
|
||||||
@fields = @field_names.map do |_|
|
@fields = @field_names.map do |_|
|
||||||
|
|
Loading…
Reference in a new issue