~starkingdoms/starkingdoms

0070a881c94767b7255adb74dcf638e2aef8028f — ghostlyzsh 1 year, 11 months ago 0f5e9b7
appease the git
1 files changed, 16 insertions(+), 14 deletions(-)

M server/src/main.rs
M server/src/main.rs => server/src/main.rs +16 -14
@@ 520,7 520,8 @@ fn on_message(
                } => {
                    let x = x / CLIENT_SCALE;
                    let y = y / CLIENT_SCALE;
                    for (entity, mut q_player, _transform, _velocity, mut attach) in &mut player_query
                    for (entity, mut q_player, _transform, _velocity, mut attach) in
                        &mut player_query
                    {
                        if q_player.addr == *from {
                            if released {


@@ 1061,15 1062,14 @@ fn attach_on_module_tree(
        };
    }
    let is_player = player_query.contains(this);
    let (entity, transform, mut attach, velocity, can_attach) =
        if attached_query.contains(this) {
            let (entity, _, transform, attach, velocity, can_attach, _, _) = attached_query.get_mut(this).unwrap();
            (entity, *transform, attach, velocity, can_attach)
        }
        else {
            let (entity, _, transform, velocity, attach) = player_query.get_mut(this).unwrap();
            (entity, *transform, attach, velocity, Some(&CanAttach(15)))
        };
    let (entity, transform, mut attach, velocity, can_attach) = if attached_query.contains(this) {
        let (entity, _, transform, attach, velocity, can_attach, _, _) =
            attached_query.get_mut(this).unwrap();
        (entity, *transform, attach, velocity, can_attach)
    } else {
        let (entity, _, transform, velocity, attach) = player_query.get_mut(this).unwrap();
        (entity, *transform, attach, velocity, Some(&CanAttach(15)))
    };

    let p_pos = transform.translation;
    let (rel_x, rel_y) = (p_pos.x - x, p_pos.y - y);


@@ 1082,7 1082,7 @@ fn attach_on_module_tree(

    let attachable = match can_attach {
        Some(s) => s.0,
        None => return false
        None => return false,
    };
    let mut attachment_slot = 5;
    let mut offset = Vec2::ZERO;


@@ 1129,11 1129,11 @@ fn attach_on_module_tree(
    let new_transform = Transform::from_xyz(
        p_pos.x + offset.x * angle.cos() - offset.y * angle.sin(),
        p_pos.y + offset.x * angle.sin() + offset.y * angle.cos(),
        0.
        0.,
    )
    .with_rotation(Quat::from_euler(
        EulerRot::ZYX,
        angle+angle_offset,
        angle + angle_offset,
        0.,
        0.,
    ));


@@ 1145,7 1145,9 @@ fn attach_on_module_tree(
        };
        *module.2 = new_transform;
        module.3.linvel = velocity.linvel;
        let joint = FixedJointBuilder::new().local_anchor1(offset).local_basis2(angle_offset);
        let joint = FixedJointBuilder::new()
            .local_anchor1(offset)
            .local_basis2(angle_offset);
        let mut children = [None, None, None, None];
        if let Some(loose_attach) = module.4 {
            commands.entity(entity).remove::<LooseAttach>();