Skip to main content

subtr_actor/
constants.rs

1pub static BALL_TYPES: [&str; 5] = [
2    "Archetypes.Ball.Ball_Default",
3    "Archetypes.Ball.Ball_Basketball",
4    "Archetypes.Ball.Ball_Puck",
5    "Archetypes.Ball.CubeBall",
6    "Archetypes.Ball.Ball_Breakout",
7];
8
9pub static BOOST_TYPE: &str = "Archetypes.CarComponents.CarComponent_Boost";
10pub static CAR_TYPE: &str = "Archetypes.Car.Car_Default";
11pub static DODGE_TYPE: &str = "Archetypes.CarComponents.CarComponent_Dodge";
12pub static DOUBLE_JUMP_TYPE: &str = "Archetypes.CarComponents.CarComponent_DoubleJump";
13pub static GAME_TYPE: &str = "Archetypes.GameEvent.GameEvent_Soccar";
14pub static JUMP_TYPE: &str = "Archetypes.CarComponents.CarComponent_Jump";
15pub static PLAYER_REPLICATION_KEY: &str = "Engine.Pawn:PlayerReplicationInfo";
16pub static PLAYER_TYPE: &str = "TAGame.Default__PRI_TA";
17
18pub static BOOST_AMOUNT_KEY: &str = "TAGame.CarComponent_Boost_TA:ReplicatedBoostAmount";
19pub static BOOST_REPLICATED_KEY: &str = "TAGame.CarComponent_Boost_TA:ReplicatedBoost";
20pub static BALL_HIT_TEAM_NUM_KEY: &str = "TAGame.Ball_TA:HitTeamNum";
21pub static BALL_EXPLOSION_DATA_KEY: &str = "TAGame.Ball_TA:ReplicatedExplosionData";
22pub static BALL_EXPLOSION_DATA_EXTENDED_KEY: &str =
23    "TAGame.Ball_TA:ReplicatedExplosionDataExtended";
24pub static COMPONENT_ACTIVE_KEY: &str = "TAGame.CarComponent_TA:ReplicatedActive";
25pub static DEMOLISH_EXTENDED_KEY: &str = "TAGame.Car_TA:ReplicatedDemolishExtended";
26pub static DEMOLISH_GOAL_EXPLOSION_KEY: &str = "TAGame.Car_TA:ReplicatedDemolishGoalExplosion";
27pub static DODGES_REFRESHED_COUNTER_KEY: &str = "TAGame.Car_TA:DodgesRefreshedCounter";
28pub static IGNORE_SYNCING_KEY: &str = "TAGame.RBActor_TA:bIgnoreSyncing";
29pub static HANDBRAKE_KEY: &str = "TAGame.Vehicle_TA:bReplicatedHandbrake";
30pub static LAST_BOOST_AMOUNT_KEY: &str = "TAGame.CarComponent_Boost_TA:ReplicatedBoostAmount.Last";
31pub static MATCH_ASSISTS_KEY: &str = "TAGame.PRI_TA:MatchAssists";
32pub static MATCH_GOALS_KEY: &str = "TAGame.PRI_TA:MatchGoals";
33pub static MATCH_SAVES_KEY: &str = "TAGame.PRI_TA:MatchSaves";
34pub static MATCH_SCORE_KEY: &str = "TAGame.PRI_TA:MatchScore";
35pub static MATCH_SHOTS_KEY: &str = "TAGame.PRI_TA:MatchShots";
36pub static PLAYER_NAME_KEY: &str = "Engine.PlayerReplicationInfo:PlayerName";
37pub static REPLICATED_SCORED_ON_TEAM_KEY: &str =
38    "TAGame.GameEvent_Soccar_TA:ReplicatedScoredOnTeam";
39pub static RIGID_BODY_STATE_KEY: &str = "TAGame.RBActor_TA:ReplicatedRBState";
40pub static SECONDS_REMAINING_KEY: &str = "TAGame.GameEvent_Soccar_TA:SecondsRemaining";
41pub static TEAM_GAME_SCORE_KEY: &str = "TAGame.Team_Soccar_TA:GameScore";
42pub static TEAM_INFO_SCORE_KEY: &str = "Engine.TeamInfo:Score";
43pub static REPLICATED_STATE_NAME_KEY: &str = "TAGame.GameEvent_TA:ReplicatedStateName";
44pub static REPLICATED_GAME_STATE_TIME_REMAINING_KEY: &str =
45    "TAGame.GameEvent_TA:ReplicatedGameStateTimeRemaining";
46pub static BALL_HAS_BEEN_HIT_KEY: &str = "TAGame.GameEvent_Soccar_TA:bBallHasBeenHit";
47pub static TEAM_KEY: &str = "Engine.PlayerReplicationInfo:Team";
48pub static UNIQUE_ID_KEY: &str = "Engine.PlayerReplicationInfo:UniqueId";
49pub static VEHICLE_KEY: &str = "TAGame.CarComponent_TA:Vehicle";
50
51pub static EMPTY_ACTOR_IDS: [boxcars::ActorId; 0] = [];
52
53/// The maximum raw boost value stored in replay data.
54///
55/// Rocket League replays represent boost on a `0..=255` scale rather than a
56/// `0..=100` percentage scale.
57pub const BOOST_MAX_AMOUNT: f32 = u8::MAX as f32;
58
59/// The raw replay boost amount players spawn with at each standard kickoff.
60///
61/// Rocket League starts each kickoff with one third of a full tank, which maps
62/// cleanly to `85.0` on the replay's `0..=255` boost scale.
63pub const BOOST_KICKOFF_START_AMOUNT: f32 = BOOST_MAX_AMOUNT / 3.0;
64
65/// The rate at which boost drains while active, in raw replay units per second.
66pub const BOOST_USED_RAW_UNITS_PER_SECOND: f32 = 80.0 / 0.93;
67
68/// The rate at which boost drains while active, in percentage points per second.
69pub const BOOST_USED_PERCENT_PER_SECOND: f32 =
70    BOOST_USED_RAW_UNITS_PER_SECOND * 100.0 / BOOST_MAX_AMOUNT;
71
72/// Converts a raw replay boost amount (`0..=255`) to a percentage (`0..=100`).
73pub fn boost_amount_to_percent(boost_amount: f32) -> f32 {
74    boost_amount * 100.0 / BOOST_MAX_AMOUNT
75}
76
77/// Converts a boost percentage (`0..=100`) to a raw replay boost amount (`0..=255`).
78pub fn boost_percent_to_amount(boost_percent: f32) -> f32 {
79    boost_percent * BOOST_MAX_AMOUNT / 100.0
80}
81
82#[deprecated(
83    note = "BOOST_USED_PER_SECOND is measured in raw replay units. Use BOOST_USED_RAW_UNITS_PER_SECOND or BOOST_USED_PERCENT_PER_SECOND instead."
84)]
85pub const BOOST_USED_PER_SECOND: f32 = BOOST_USED_RAW_UNITS_PER_SECOND;
86
87pub static MAX_DEMOLISH_KNOWN_FRAMES_PASSED: usize = 150;