From 81ddf1a3c08824907de862888ff951611ad71dc7 Mon Sep 17 00:00:00 2001 From: Anthony Tornetta Date: Sun, 22 Dec 2024 20:45:22 -0500 Subject: [PATCH 01/31] Enabling more persistent component serialization customization --- .../src/block/specific_blocks/gravity_well.rs | 11 +- .../src/blocks/interactable/gravity_well.rs | 49 ++++++ cosmos_server/src/economy/mod.rs | 4 +- cosmos_server/src/entities/player/mod.rs | 4 +- cosmos_server/src/fluid/mod.rs | 6 +- cosmos_server/src/inventory/mod.rs | 4 +- cosmos_server/src/items/mod.rs | 6 +- .../src/persistence/make_persistent.rs | 141 +++++++++++++++--- .../src/structure/planet/planet_rotation.rs | 4 +- .../src/structure/shared/melt_down.rs | 4 +- cosmos_server/src/universe/spawners/pirate.rs | 6 +- 11 files changed, 202 insertions(+), 37 deletions(-) diff --git a/cosmos_core/src/block/specific_blocks/gravity_well.rs b/cosmos_core/src/block/specific_blocks/gravity_well.rs index fc2db4853..a8b9084b5 100644 --- a/cosmos_core/src/block/specific_blocks/gravity_well.rs +++ b/cosmos_core/src/block/specific_blocks/gravity_well.rs @@ -16,7 +16,10 @@ use bevy::{ use bevy_rapier3d::dynamics::{ExternalImpulse, ReadMassProperties}; use serde::{Deserialize, Serialize}; -use crate::{netty::system_sets::NetworkingSystemsSet, structure::coordinates::BlockCoordinate}; +use crate::{ + netty::{sync::IdentifiableComponent, system_sets::NetworkingSystemsSet}, + structure::coordinates::BlockCoordinate, +}; /// This component indicates the entity is under the affects of a gravity well. #[derive(Serialize, Deserialize, Component, Clone, Copy, Debug, Reflect)] @@ -29,6 +32,12 @@ pub struct GravityWell { pub block: BlockCoordinate, } +impl IdentifiableComponent for GravityWell { + fn get_component_unlocalized_name() -> &'static str { + "cosmos:gravity_well" + } +} + fn do_gravity_well( time: Res