~starkingdoms/starkingdoms

ade458f6b721549ef29a66b146537b24b65b6d73 — ghostlyzsh 1 year, 8 months ago 55589da
attachment bug fixed
2 files changed, 2 insertions(+), 12 deletions(-)

M server/src/component.rs
M server/src/main.rs
M server/src/component.rs => server/src/component.rs +0 -1
@@ 92,7 92,6 @@ pub struct Player {
    pub save_eligibility: bool,
    pub energy_capacity: u32,
    pub energy: u32,
    pub save_amount: HashMap<PartType, u32>, // PartType, amount of each module type
}

#[derive(Bundle)]

M server/src/main.rs => server/src/main.rs +2 -11
@@ 370,7 370,6 @@ fn on_message(
                        save_eligibility: false,
                        energy_capacity: part::HEARTY_CAPACITY,
                        energy: part::HEARTY_CAPACITY,
                        save_amount: HashMap::new(),
                    };
                    let mut entity_id = commands.spawn(PartBundle {
                        part_type: PartType::Hearty,


@@ 871,12 870,6 @@ fn load_savefile(
                module.id()
            };

            if let Some(amount) = player_comp.save_amount.get(&part_type) {
                player_comp.save_amount.insert(part_type, amount + 1);
            } else {
                player_comp.save_amount.insert(part_type, 1);
            }

            let children = if part_type != PartType::LandingThruster {
                load_savefile(
                    commands,


@@ 945,7 938,7 @@ fn load_savefile(

            let joint = FixedJointBuilder::new()
                .local_anchor1(vec2(offset.x, offset.y))
                .local_basis2(angle_offset);
                .local_basis1(angle_offset);

            module.insert(ImpulseJoint::new(parent, joint));



@@ 1276,7 1269,7 @@ fn attach_on_module_tree(
        module.3.linvel = velocity.linvel;
        let joint = FixedJointBuilder::new()
            .local_anchor1(offset)
            .local_basis2(angle_offset);
            .local_basis1(angle_offset);
        let mut children = [None, None, None, None];
        if let Some(loose_attach) = module.4 {
            if *module.1 == PartType::LandingThruster {


@@ 1302,8 1295,6 @@ fn attach_on_module_tree(
        attach.children[attachment_slot] = Some(module.0);
        module.5.attached = true;
        player_query.get_mut(player_id).unwrap().1.energy_capacity += capacity!(*module.1);
        let save = player_query.get(player_id).unwrap().1.save_amount.clone();
        println!("{:?}", save);
        if *module.1 == PartType::LandingThruster {
            let loose_attach = module.4.unwrap().clone();
            let mut transform = part_query