M server/src/component.rs => server/src/component.rs +1 -1
@@ 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)]
M server/src/main.rs => server/src/main.rs +17 -0
@@ 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,
M starkingdoms-client/src/protocol.ts => starkingdoms-client/src/protocol.ts +1 -0
@@ 8,6 8,7 @@ export enum PlanetType {
}
export enum PartType {
Hearty = "Hearty",
+ Cargo = "Cargo",
}
export interface Planet {
planet_type: PlanetType;
M starkingdoms-client/src/textures.ts => starkingdoms-client/src/textures.ts +3 -0
@@ 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;
}