Skip to content

Commit

Permalink
controllable (#16)
Browse files Browse the repository at this point in the history
 Update ControllablePhysics and FrameStats documentation (#16)
  • Loading branch information
EmosewaMC authored Oct 29, 2023
1 parent d6e7c32 commit 144e56d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
29 changes: 21 additions & 8 deletions src/raknet/client/replica/controllable_physics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,21 @@ pub struct CheatInfo {
}

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct Unknown1 {
pub struct MagnetAndFlyingUpdate {
pub loot_pickup_radius: f32,
pub unknown_2: bool,
pub is_flying: bool,
}

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct BubbleInfo {
pub bubble_type: i32,
pub special_animation: bool,
}

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct Unknown2 {
pub unknown_1: Option<Unknown1>,
pub struct BubbleUpdateInfo {
/// If option is not set, the bubble is removed.
pub bubble_info: Option<BubbleInfo>,
}

#[derive(Debug, PartialEq, ReplicaSerde)]
Expand All @@ -50,6 +57,10 @@ pub struct FrameStats {
pub rotation: Quaternion,
pub is_on_ground: bool,
pub is_on_rail: bool,

/// Default cases of the below `Option`s result in 0 for all fields in that options' struct.
/// This means that if `linear_velocity` is non-zero, you must write the struct, even if nothing
/// has changed frame over frame.
pub linear_velocity: Option<Vector3>,
pub angular_velocity: Option<Vector3>,
pub local_space_info: Option<LocalSpaceInfo>,
Expand All @@ -59,6 +70,8 @@ pub struct FrameStats {
pub struct LocalSpaceInfo {
pub object_id: ObjId,
pub position: Vector3,

/// Defaults to [`Vector3::ZERO`] if not set. Always write if non-zero.
pub linear_velocity: Option<Vector3>,
}

Expand All @@ -67,8 +80,8 @@ pub struct ControllablePhysicsConstruction {
pub jetpack_info: Option<JetpackInfo>,
pub stun_immunity_info: Option<StunImmunityInfo>,
pub cheat_info: Option<CheatInfo>,
pub unknown_1: Option<Unknown1>,
pub unknown_2: Option<Unknown2>,
pub magnet_and_flying_update: Option<MagnetAndFlyingUpdate>,
pub bubble_update_info: Option<BubbleUpdateInfo>,
pub frame_stats: Option<FrameStats>,
}

Expand All @@ -81,8 +94,8 @@ pub struct FrameStatsTeleportInfo {
#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct ControllablePhysicsSerialization {
pub cheat_info: Option<CheatInfo>,
pub unknown_1: Option<Unknown1>,
pub unknown_2: Option<Unknown2>,
pub magnet_and_flying_update: Option<MagnetAndFlyingUpdate>,
pub bubble_update_info: Option<BubbleUpdateInfo>,
pub frame_stats_teleport_info: Option<FrameStatsTeleportInfo>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ ControllablePhysicsConstruction {
gravity_scale: 8.0,
run_multiplier: 9.0,
}),
unknown_1: Some(Unknown1 {
magnet_and_flying_update: Some(MagnetAndFlyingUpdate {
loot_pickup_radius: 10.0,
unknown_2: true,
is_flying: true,
}),
unknown_2: Some(Unknown2 {
unknown_1: Some(Unknown1 {
loot_pickup_radius: 11.0,
unknown_2: true,
bubble_update_info: Some(BubbleUpdateInfo {
bubble_info: Some(BubbleInfo {
bubble_type: 1093664768,
special_animation: true,
}),
}),
frame_stats: Some(FrameStats {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ ControllablePhysicsSerialization {
gravity_scale: 8.0,
run_multiplier: 9.0,
}),
unknown_1: Some(Unknown1 {
magnet_and_flying_update: Some(MagnetAndFlyingUpdate {
loot_pickup_radius: 10.0,
unknown_2: true,
is_flying: true,
}),
unknown_2: Some(Unknown2 {
unknown_1: Some(Unknown1 {
loot_pickup_radius: 11.0,
unknown_2: true,
bubble_update_info: Some(BubbleUpdateInfo {
bubble_info: Some(BubbleInfo {
bubble_type: 1093664768,
special_animation: true,
}),
}),
frame_stats_teleport_info: Some(FrameStatsTeleportInfo {
Expand Down

0 comments on commit 144e56d

Please sign in to comment.