~starkingdoms/starkingdoms

06bf8871a9654d0f1cbef43db57f67d62b8838c1 — ghostlyzsh 2 years ago 72316e3
fixed cargo bounding boxes and weights
3 files changed, 12 insertions(+), 9 deletions(-)

M client/src/gateway.ts
M client/src/index.ts
M server/src/timer.rs
M client/src/gateway.ts => client/src/gateway.ts +2 -2
@@ 72,7 72,7 @@ export async function gateway_connect(gateway_url: string, username: string): Ga
    let handshake_start_msg;
    if (global.can_beam_out) {
        handshake_start_msg = MessageC2SHello.encode({
            version: 2,
            version: 3,
            requestedUsername: username,
            nextState: State.Play,
            user: window.localStorage.getItem("user")!,


@@ 80,7 80,7 @@ export async function gateway_connect(gateway_url: string, username: string): Ga
        }).finish();
    } else {
        handshake_start_msg = MessageC2SHello.encode({
            version: 2,
            version: 3,
            requestedUsername: username,
            nextState: State.Play,
            // @ts-ignore

M client/src/index.ts => client/src/index.ts +4 -4
@@ 218,17 218,17 @@ async function client_main(server: string, username: string, texture_quality: st

            global.context.save();

            global.context.rotate(module.rotation);
            global.context.translate(module.x - global.me!.x, module.y - global.me!.y);

            global.context.translate(module.x, module.y);
            global.context.rotate(module.rotation);

            global.context.drawImage(global.spritesheet_img!,
                                     tex.frame.x,
                                     tex.frame.y,
                                     tex.frame.w,
                                     tex.frame.h,
                                     (module.x - 25 - global.me?.x!),
                                     (module.y - 25 - global.me?.y!), 50, 50);
                                     -25,
                                     -25, 50, 50);

            global.context.restore();
        }

M server/src/timer.rs => server/src/timer.rs +6 -3
@@ 2,7 2,7 @@ use std::{time::Duration, sync::Arc, f64::consts::PI};
use log::{debug, warn};
use nalgebra::{vector, point};
use rand::Rng;
use rapier2d_f64::prelude::{PhysicsPipeline, ColliderBuilder, RigidBodyBuilder};
use rapier2d_f64::prelude::{PhysicsPipeline, ColliderBuilder, RigidBodyBuilder, MassProperties};
use async_std::sync::RwLock;
use async_std::task::sleep;
use starkingdoms_protocol::{player::Player, planet::PlanetType, module::ModuleType};


@@ 13,7 13,7 @@ use crate::orbit::orbit::{calculate_point_on_orbit, calculate_world_position_of_

pub const ROTATIONAL_FORCE: f64 = 100.0;
pub const LATERAL_FORCE: f64 = 100.0;
pub const MODULE_SPAWN: f64 = 1000.0;
pub const MODULE_SPAWN: f64 = 3000.0;
pub const MODULE_MAX: u32 = 10;

pub async fn timer_main(mgr: ClientManager, physics_data_orig: Arc<RwLock<PhysicsData>>, entities: Arc<RwLock<EntityHandler>>) {


@@ 73,7 73,10 @@ pub async fn timer_main(mgr: ClientManager, physics_data_orig: Arc<RwLock<Physic
                let mut rigid_body_set = physics_data.rigid_body_set.clone();
                let mut collider_set = physics_data.collider_set.clone();

                let module_collider = ColliderBuilder::cuboid(25. / SCALE, 25. / SCALE);
                let module_collider = ColliderBuilder::cuboid(18.75 / SCALE, 23.4375 / SCALE)
                    .translation(vector![0.0, 1.5625 / SCALE])
                    .mass_properties(MassProperties::new(point![0.0, 0.0], 120.0, 122500.0))
                    .build();
                let angle: f64 = {
                    let mut rng = rand::thread_rng();
                    rng.gen::<f64>() * PI * 2.