From ef5971d10deed2bbbca520fdd4e8b22466227980 Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Tue, 28 Nov 2023 23:39:51 -0600 Subject: [PATCH] 1 cargo spawns in --- server/src/component.rs | 2 +- server/src/main.rs | 17 +++++++++++++++++ starkingdoms-client/src/protocol.ts | 1 + starkingdoms-client/src/textures.ts | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/server/src/component.rs b/server/src/component.rs index 79ae11d40ff17c7f6f822b57eea923c92cfce95c..07057931bbe7fb273bf54a9b3d37aab0c3d5650c 100644 --- a/server/src/component.rs +++ b/server/src/component.rs @@ -10,7 +10,7 @@ pub enum PlanetType { #[derive(Component, Clone, Copy, Serialize, Deserialize, Debug)] pub enum PartType { - Hearty, + Hearty, Cargo, } #[derive(Component, Clone, Copy, Serialize, Deserialize, Debug, Default)] diff --git a/server/src/main.rs b/server/src/main.rs index a0fa3679563cda614835e022917d6b9ee2c38f4a..0edc21d3b876edc760c88022d0128fd9ec5d5428 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -43,6 +43,7 @@ fn main() { .add_plugins(TwiteServerPlugin) .add_systems(Startup, setup_integration_parameters) .add_systems(Startup, spawn_planets) + .add_systems(Startup, remove_later_module_spawn) .add_systems(Update, on_message) .add_systems(Update, on_close) .add_systems(FixedUpdate, on_position_change) @@ -73,6 +74,22 @@ fn spawn_planets(mut commands: Commands) { .insert(ReadMassProperties::default()) .insert(RigidBody::Fixed); } +fn remove_later_module_spawn(mut commands: Commands) { + commands + .spawn(PartBundle { + part_type: PartType::Cargo, + transform: TransformBundle::from(Transform::from_xyz(1100. / SCALE, 0., 0.)), + }) + //.insert(Collider::cuboid(18.75 / SCALE, 23.4375 / SCALE)) + .insert(RigidBody::Dynamic) + .with_children(|children| { + children.spawn(Collider::cuboid(18.75 / SCALE, 23.4375 / SCALE)) + .insert(TransformBundle::from(Transform::from_xyz(0., 1.5625 / SCALE, 0.))); + }) + .insert(ExternalForce::default()) + .insert(ExternalImpulse::default()) + .insert(ReadMassProperties::default()); +} fn on_message( mut commands: Commands, diff --git a/starkingdoms-client/src/protocol.ts b/starkingdoms-client/src/protocol.ts index c8304274ce53d6b8b41733c60fcbde1f169f9e2d..5464a287c85aefb30a1c45e97bce6ba197ab4872 100644 --- a/starkingdoms-client/src/protocol.ts +++ b/starkingdoms-client/src/protocol.ts @@ -8,6 +8,7 @@ export enum PlanetType { } export enum PartType { Hearty = "Hearty", + Cargo = "Cargo", } export interface Planet { planet_type: PlanetType; diff --git a/starkingdoms-client/src/textures.ts b/starkingdoms-client/src/textures.ts index e57ea5c6e73fb11fe1cbe611ea9af81619ce79ee..8c2e1f6d171011ac36db5519c099a1251b3b78fd 100644 --- a/starkingdoms-client/src/textures.ts +++ b/starkingdoms-client/src/textures.ts @@ -1,6 +1,7 @@ import { PartType, PlanetType } from "./protocol.ts"; import tex_earth from "./assets/earth.svg"; import tex_hearty from "./assets/hearty.svg"; +import tex_cargo_on from "./assets/cargo_on.svg"; import tex_missing from "./assets/missing.svg"; export function planet_texture_url(type: PlanetType): string { @@ -13,6 +14,8 @@ export function planet_texture_url(type: PlanetType): string { export function part_texture_url(type: PartType): string { if (type == PartType.Hearty) { return tex_hearty; + } else if (type == PartType.Cargo) { + return tex_cargo_on; } return tex_missing; }