~starkingdoms/starkingdoms

7128e45af0d1be2fc5fdd15720f93c65cac21dc9 — ghostlyzsh 2 years ago f6bb0eb
alright lets go stuff broke again
3 files changed, 7 insertions(+), 4 deletions(-)

M client/src/lib.rs
M server/src/handler.rs
M web/play.html
M client/src/lib.rs => client/src/lib.rs +2 -0
@@ 5,6 5,7 @@ use futures::stream::{SplitSink, SplitStream};
use futures::{StreamExt, TryFutureExt};
use log::{debug, error, info, Level, trace, warn};
use wasm_bindgen::prelude::*;
use web_sys::console::debug;
use ws_stream_wasm::{WsErr, WsMessage, WsMeta, WsStream};
use starkingdoms_protocol::{ProtocolPlanet, State};
use starkingdoms_protocol::PROTOCOL_VERSION;


@@ 235,6 236,7 @@ pub async fn update_socket() -> Result<(), JsError> {
                chatbox.append_child(&new_elem).unwrap();
            },
            MessageS2C::Pong {} => {
                info!("this is a pong response");
                client_data.pong_timeout = (js_sys::Date::now() as u64 / 1000) + PONG_MAX_TIMEOUT
            },
            MessageS2C::PlanetData { planets } => {

M server/src/handler.rs => server/src/handler.rs +2 -1
@@ 1,7 1,7 @@
use std::error::Error;
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::{Duration, SystemTime};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use futures::stream::{SplitSink, SplitStream};
use futures::{FutureExt, SinkExt, StreamExt};
use hyper::upgrade::Upgraded;


@@ 23,6 23,7 @@ pub async fn handle_client(mgr: ClientManager, data: Arc<RwLock<PhysicsData>>, r
    let mut ping_timeout = SystemTime::now() + Duration::from_secs(5);

    loop {
        info!("{}", ping_timeout.duration_since(UNIX_EPOCH).unwrap().as_secs() - SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs());
        if let Some(msg) = rx.recv().await {
            match msg {
                ClientHandlerMessage::Tick => {} // this intentionally does nothing,

M web/play.html => web/play.html +3 -3
@@ 56,10 56,10 @@

                        render_frame(delta);
                        start = time;
                        requestAnimationFrame(animateFrame)
                        //requestAnimationFrame(animateFrame)
                    }

                    requestAnimationFrame(animateFrame);
                    //requestAnimationFrame(animateFrame);

                    if (urlSearchParams.has("showTextures")) {
                        let textures = ["autoplr_cfg", "autoplr_error", "autoplr_on", "cargo_off", "cargo_on", "earth", "ecothruster_on", "hearty", "hub_off", "hub_on", "landingleg", "landingthruster_off", "landingthruster_on", "powerhub_off", "powerhub_on", "superthruster_off", "superthruster_on", "thruster_off", "thruster_on"];


@@ 85,4 85,4 @@
            })
        </script>
    </body>
</html>
\ No newline at end of file
</html>