~starkingdoms/starkingdoms

02df8a053b6bfd7d2ee9fbdbd60fe29137b63a7c — core 2 years ago 443029c + e34a49d
Merge branch 'bevy_rewrite' of gitlab.com:starkingdoms.tk/starkingdoms.tk into bevy_rewrite
1 files changed, 7 insertions(+), 7 deletions(-)

M server/src/main.rs
M server/src/main.rs => server/src/main.rs +7 -7
@@ 13,6 13,7 @@ pub mod packet;
pub mod macros;

const SCALE: f32 = 10.0;
const EARTH_SIZE: f32 = 1000.0;

fn main() {
    let subscriber = tracing_subscriber::FmtSubscriber::new();


@@ 44,13 45,12 @@ fn main() {
fn spawn_planets(mut commands: Commands) {
    info!("Spawning planets");
    let earth_pos = Transform::from_xyz(0.0, 0.0, 0.0);
    let earth_radius = 2000.0 / SCALE;
    commands
        .spawn(PlanetBundle {
            planet_type: PlanetType::Earth,
            transform: TransformBundle::from(earth_pos),
        })
        .insert(Collider::ball(earth_radius))
        .insert(Collider::ball(EARTH_SIZE / SCALE))
        .insert(RigidBody::Fixed);
}



@@ 80,7 80,7 @@ fn on_message(
                        let mut rng = rand::thread_rng();
                        rng.gen::<f32>() * std::f32::consts::PI * 2.
                    };
                    let mut transform = Transform::from_xyz(angle.cos() * 2050. / SCALE, angle.sin() * 2050. / SCALE, 0.0);
                    let mut transform = Transform::from_xyz(angle.cos() * 1100. / SCALE, angle.sin() * 1100. / SCALE, 0.0);
                    transform.rotate_z(angle);
                    let id = commands
                        .spawn(PlayerBundle {


@@ 102,7 102,7 @@ fn on_message(
                            planet_type: *planet_type,
                            transform: proto_transform!(Transform::from_translation(translation * SCALE)),
                            radius: match *planet_type {
                                PlanetType::Earth => 2000.0
                                PlanetType::Earth => EARTH_SIZE
                            }
                        }));
                    }


@@ 139,7 139,7 @@ fn on_message(
                    }
                    parts.push((id, Part {
                        part_type: PartType::Hearty,
                        transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
                        transform: proto_transform!(Transform::from_translation(transform.translation * SCALE).with_rotation(transform.rotation)),
                    }));
                    let packet = Packet::PartPositions {
                        parts 


@@ 198,7 198,7 @@ fn on_position_change(
        let id = commands.entity(entity).id().index();
        updated_parts.push((id, Part {
            part_type: *part_type,
            transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
            transform: proto_transform!(Transform::from_translation(transform.translation * SCALE).with_rotation(transform.rotation)),
        }));
    }



@@ 216,7 216,7 @@ fn on_position_change(
            planet_type: *planet_type,
            transform: proto_transform!(Transform::from_translation(transform.translation * SCALE)),
            radius: match *planet_type {
                PlanetType::Earth => 2000.0,
                PlanetType::Earth => EARTH_SIZE,
            }
        }));
    }