@@ 92,7 92,7 @@ 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
+ pub save_amount: HashMap<PartType, u32>, // PartType, amount of each module type
}
#[derive(Bundle)]
@@ 36,9 36,7 @@ use component::*;
use hmac::{Hmac, Mac};
use jwt::VerifyWithKey;
use packet::*;
-use part::{
- HEARTY_THRUST_ENERGY, LANDING_THRUSTER_ENERGY,
-};
+use part::{HEARTY_THRUST_ENERGY, LANDING_THRUSTER_ENERGY};
use rand::Rng;
use serde::{Deserialize, Serialize};
use sha2::Sha256;
@@ 320,7 318,7 @@ fn on_message(
} => {
// auth
// plz no remove
- if let Some(token) = jwt {
+ /*if let Some(token) = jwt {
let key: Hmac<Sha256> = Hmac::new_from_slice(&app_keys.app_key).unwrap();
let claims: UserToken = match token.verify_with_key(&key) {
Ok(c) => c,
@@ 354,7 352,7 @@ fn on_message(
});
event_queue.push(WsEvent::Close { addr: *from });
continue;
- }
+ }*/
let angle: f32 = {
let mut rng = rand::thread_rng();
@@ 373,13 371,11 @@ fn on_message(
energy: part::HEARTY_CAPACITY,
save_amount: HashMap::new(),
};
- let mut entity_id = commands.spawn(
- PartBundle {
- part_type: PartType::Hearty,
- transform: TransformBundle::from(transform),
- flags: PartFlags { attached: false },
- },
- );
+ let mut entity_id = commands.spawn(PartBundle {
+ part_type: PartType::Hearty,
+ transform: TransformBundle::from(transform),
+ flags: PartFlags { attached: false },
+ });
entity_id
.insert(Collider::cuboid(0.5, 0.5))
.insert(AdditionalMassProperties::MassProperties(MassProperties {
@@ 748,7 744,9 @@ fn on_message(
// THANKS!
let unused_modules = if let Some(ref old_save) = old_save {
- if let Ok(old_savedata) = unpack_savefile(&app_keys.app_key, old_save.to_string()) {
+ if let Ok(old_savedata) =
+ unpack_savefile(&app_keys.app_key, old_save.to_string())
+ {
old_savedata.unused_modules
} else {
Vec::new()
@@ 161,10 161,16 @@
let img = textures.get(selected!)!;
ctx.save();
- ctx.translate(canvas_x + grid_size/2, canvas_y + grid_size/2);
- ctx.rotate(rotation*Math.PI/2);
+ ctx.translate(canvas_x + grid_size / 2, canvas_y + grid_size / 2);
+ ctx.rotate((rotation * Math.PI) / 2);
ctx.globalAlpha = 0.2;
- ctx.drawImage(img, -grid_size/2, -grid_size/2, grid_size, grid_size);
+ ctx.drawImage(
+ img,
+ -grid_size / 2,
+ -grid_size / 2,
+ grid_size,
+ grid_size,
+ );
ctx.globalCompositeOperation = "source-atop";
if (selected === null) {
ctx.fillStyle = "rgb(24, 24, 37)";
@@ 174,7 180,7 @@
ctx.fillStyle = "rgb(243, 139, 169)";
}
ctx.globalAlpha = 0.5;
- ctx.fillRect(-grid_size/2, -grid_size/2, grid_size, grid_size);
+ ctx.fillRect(-grid_size / 2, -grid_size / 2, grid_size, grid_size);
ctx.restore();
}
})();
@@ 200,7 206,11 @@
let canvas_x = x_coord * grid_size + x;
let canvas_y = y_coord * grid_size + y;
- ctx.drawImage(img, canvas_x, canvas_y, grid_size, grid_size);
+ ctx.save();
+ ctx.translate(canvas_x + grid_size / 2, canvas_y + grid_size / 2);
+ ctx.rotate((rotation * Math.PI) / 2);
+ ctx.drawImage(img, -grid_size/2, -grid_size/2, grid_size, grid_size);
+ ctx.restore();
});
});
}
@@ 251,13 261,13 @@
place(x, y + 1, children[0], rotation);
}
if (children[1] !== null) {
- place(x + 1, y, children[1], (rotation+1)%4);
+ place(x + 1, y, children[1], (rotation + 1) % 4);
}
if (children[2] !== null) {
- place(x, y - 1, children[2], (rotation+2)%4);
+ place(x, y - 1, children[2], (rotation + 2) % 4);
}
if (children[3] !== null) {
- place(x - 1, y, children[3], (rotation+3)%4);
+ place(x - 1, y, children[3], (rotation + 3) % 4);
}
}
@@ 348,16 358,16 @@
grid = grid;
}
}
- canvas.focus()
+ canvas.focus();
}
function keydown(e: KeyboardEvent) {
console.log("here");
if (e.code == "KeyQ") {
- rotation = (rotation - 1) % 4;
+ rotation = (rotation - 1) % 4;
}
if (e.code == "KeyE") {
- rotation = (rotation + 1) % 4;
+ rotation = (rotation + 1) % 4;
}
}
</script>