Add type to snap items

This commit is contained in:
ChillerDragon 2024-02-21 14:44:49 +08:00
parent c726756b5c
commit cacb75ac62
19 changed files with 19 additions and 1 deletions

View file

@ -7,6 +7,7 @@ class NetEvent
attr_accessor :client_id, :angle, :health_ammount, :armor_amount, :self
def initialize(hash_or_raw)
@type = NETEVENTTYPE_DAMAGE
@field_names = %i[
client_id
angle

View file

@ -7,6 +7,7 @@ class NetEvent
attr_accessor :client_id
def initialize(hash_or_raw)
@type = NETEVENTTYPE_DEATH
@field_names = %i[
client_id
]

View file

@ -5,6 +5,7 @@ require_relative '../snap_item_base'
class NetEvent
class Explosion < SnapEventBase
def initialize(hash_or_raw)
@type = NETEVENTTYPE_EXPLOSION
@field_names = []
super
end

View file

@ -5,6 +5,7 @@ require_relative '../snap_item_base'
class NetEvent
class HammerHit < SnapEventBase
def initialize(hash_or_raw)
@type = NETEVENTTYPE_HAMMERHIT
@field_names = []
super
end

View file

@ -7,6 +7,7 @@ class NetEvent
attr_accessor :sound_id
def initialize(hash_or_raw)
@type = NETEVENTTYPE_SOUNDWORLD
@field_names = %i[
sound_id
]

View file

@ -5,6 +5,7 @@ require_relative '../snap_item_base'
class NetEvent
class Spawn < SnapEventBase
def initialize(hash_or_raw)
@type = NETEVENTTYPE_SPAWN
@field_names = []
super
end

View file

@ -9,6 +9,7 @@ class NetObj
:health, :armor, :ammo_count, :weapon, :emote, :attack_tick, :triggered_events
def initialize(hash_or_raw)
@type = NETOBJTYPE_CHARACTER
@field_names = %i[
tick
x

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :local, :team
def initialize(hash_or_raw)
@type = NETOBJTYPE_DE_CLIENTINFO
@field_names = %i[
local
team

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :x, :y, :team
def initialize(hash_or_raw)
@type = NETOBJTYPE_FLAG
@field_names = %i[
x
y

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :game_start_tick, :game_state_flags, :game_state_end_tick
def initialize(hash_or_raw)
@type = NETOBJTYPE_GAMEDATA
@field_names = %i[
game_start_tick
game_state_flags

View file

@ -8,6 +8,7 @@ class NetObj
:flag_drop_tick_red, :flag_drop_tick_blue
def initialize(hash_or_raw)
@type = NETOBJTYPE_GAMEDATAFLAG
@field_names = %i[
flag_carrier_red
flag_carrier_blue

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :teamscore_red, :teamscore_blue
def initialize(hash_or_raw)
@type = NETOBJTYPE_GAMEDATATEAM
@field_names = %i[
teamscore_red
teamscore_blue

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :x, :y, :from_x, :from_y, :start_tick
def initialize(hash_or_raw)
@type = NETOBJTYPE_LASER
@field_names = %i[
x
y

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :x, :y, :type
def initialize(hash_or_raw)
@type = NETOBJTYPE_PICKUP
@field_names = %i[
x
y

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :player_flags, :score, :latency
def initialize(hash_or_raw)
@type = NETOBJTYPE_PLAYERINFO
@field_names = %i[
player_flags
score

View file

@ -10,6 +10,7 @@ class NetObj
:next_weapon, :prev_weapon
def initialize(hash_or_raw)
@type = NETOBJTYPE_PLAYERINPUT
@field_names = %i[
direction
target_x

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :x, :y, :vel_x, :vel_y, :type, :start_tick
def initialize(hash_or_raw)
@type = NETOBJTYPE_PROJECTILE
@field_names = %i[
x
y

View file

@ -7,6 +7,7 @@ class NetObj
attr_accessor :spec_mode, :spectator_id, :x, :y
def initialize(hash_or_raw)
@type = NETOBJTYPE_SPECTATORINFO
@field_names = %i[
spec_mode
spectator_id

View file

@ -3,7 +3,7 @@
require_relative '../packer'
class SnapItemBase
attr_reader :notes, :name, :id
attr_reader :notes, :name, :type, :id
def initialize(hash_or_raw)
@fields = @field_names.map do |_|