~starkingdoms/starkingdoms

84d27d15396e4e6bd3a49acb1895c19c368ce6bc — ghostlyzsh 2 years ago 899987c
bug fix attempts?
2 files changed, 6 insertions(+), 6 deletions(-)

M server/src/manager.rs
M server/src/timer.rs
M server/src/manager.rs => server/src/manager.rs +4 -4
@@ 4,7 4,7 @@ use std::net::SocketAddr;
use std::sync::Arc;
use nalgebra::point;
use rapier2d_f64::na::Vector2;
use rapier2d_f64::prelude::{IntegrationParameters, PhysicsPipeline, IslandManager, BroadPhase, NarrowPhase, ImpulseJointSet, MultibodyJointSet, CCDSolver, RigidBodySet, ColliderSet, RigidBodyHandle, ImpulseJointHandle, RigidBodyBuilder, ColliderBuilder, FixedJointBuilder, Real, MassProperties, Isometry};
use rapier2d_f64::prelude::{IntegrationParameters, PhysicsPipeline, IslandManager, BroadPhase, NarrowPhase, ImpulseJointSet, MultibodyJointSet, CCDSolver, RigidBodySet, ColliderSet, RigidBodyHandle, ImpulseJointHandle, RigidBodyBuilder, ColliderBuilder, FixedJointBuilder, Real, MassProperties, Isometry, PrismaticJointBuilder};
use async_std::sync::RwLock;
use async_std::channel::Sender;
use starkingdoms_protocol::api::APISavedPlayerData;


@@ 163,7 163,7 @@ impl AttachedModule {
        let module_collider = ColliderBuilder::cuboid(25.0 / SCALE, 25.0 / SCALE)
            .mass_properties(module.mass_properties)
            .build();
        let module_body = RigidBodyBuilder::dynamic()
        let module_body = RigidBodyBuilder::fixed()
            .translation(module.translation)
            .rotation(module.heading)
            .build();


@@ 173,10 173,10 @@ impl AttachedModule {
            -0. / SCALE * rotation.cos() +100. / SCALE * rotation.sin(), 
            -0. / SCALE * rotation.sin() -100. / SCALE * rotation.cos()
        ];
        let attach_joint = FixedJointBuilder::new()
        let attach_joint = PrismaticJointBuilder::new(Vector2::x_axis())
            .local_anchor1(anchor)
            .local_anchor2(point![0.0, 0.0 / SCALE])
            .local_frame2(Isometry::rotation(rotation))
            //.local_frame2(Isometry::rotation(rotation))
            .build();
        let attach_joint_handle = data.impulse_joint_set.insert(parent_handle, attached_handle, attach_joint, true);
        let attached_module = AttachedModule {

M server/src/timer.rs => server/src/timer.rs +2 -2
@@ 103,7 103,7 @@ pub async fn timer_main(mgr: ClientManager, physics_data_orig: Arc<RwLock<Physic
                module_body.reset_forces(true);
                module_body.reset_torques(true);
                let grav_force = entities.gravity((module_body.translation().x, module_body.translation().y), module_body.mass());
                module_body.apply_impulse(vector![grav_force.0, grav_force.1], true);
                //module_body.apply_impulse(vector![grav_force.0, grav_force.1], true);
                let id = entities.get_from_module(module).unwrap();
                if let Entity::Module(p_module) = entities.entities.get_mut(&id).unwrap() {
                    p_module.lifetime += 5./1000.;


@@ 134,7 134,7 @@ pub async fn timer_main(mgr: ClientManager, physics_data_orig: Arc<RwLock<Physic
                player_body.reset_torques(true);
                let planets = entities.read().await;
                let grav_force = planets.gravity((player_body.translation().x, player_body.translation().y), player_body.mass());
                player_body.apply_impulse(vector![grav_force.0, grav_force.1], true);
                //player_body.apply_impulse(vector![grav_force.0, grav_force.1], true);

                let mut left_top_thruster: f64 = 0.0;
                let mut right_top_thruster: f64 = 0.0;