diff --git a/README.md b/README.md index c2bc67225..e81a2287b 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,6 @@ See [the issues page](https://github.com/AnthonyTornetta/Cosmos/issues) for the - [ ] Perhaps done via a sphere surrounding the planet that always faces the nearest star - [ ] Sun-set skybox - [ ] Night-side skybox - - [ ] Caves - - [ ] Lit up underground blocks - [ ] Animated textures - [ ] Sounds - [x] Laser cannon fire @@ -80,10 +78,10 @@ See [the issues page](https://github.com/AnthonyTornetta/Cosmos/issues) for the - [x] Background space music - [ ] Block break - [ ] Place rotated blocks -- [ ] Multiblock machines (if enough time) - - [ ] Revamp power generation to use reactor multiblock structure - - [ ] Colored laser - - [ ] Colored glass placed in front of laser +- [x] Multiblock machines + - [x] Revamp power generation to use reactor multiblock structure +- [ ] Colored laser + - [ ] Colored glass placed in front of laser - [x] Inventory GUI - [x] Able to open inventory - [x] Abstract the 3d block GUI camera diff --git a/cosmos_client/assets/blocks/laser_cannon.json b/cosmos_client/assets/blocks/laser_cannon.json index a992386ae..073e9414b 100644 --- a/cosmos_client/assets/blocks/laser_cannon.json +++ b/cosmos_client/assets/blocks/laser_cannon.json @@ -1,7 +1,7 @@ { "texture": { - "back": "laser_cannon_back", - "front": "laser_cannon_front", + "front": "laser_cannon_back", + "back": "laser_cannon_front", "left": "laser_cannon_left_right", "right": "laser_cannon_left_right", "top": "laser_cannon_top_bottom", diff --git a/cosmos_client/assets/blocks/reactor_controller.json b/cosmos_client/assets/blocks/reactor_controller.json new file mode 100644 index 000000000..806b5dbe8 --- /dev/null +++ b/cosmos_client/assets/blocks/reactor_controller.json @@ -0,0 +1,6 @@ +{ + "texture": { + "all": "reactor_casing", + "back": "reactor_controller" + } +} \ No newline at end of file diff --git a/cosmos_client/assets/images/blocks/reactor_casing.png b/cosmos_client/assets/images/blocks/reactor_casing.png new file mode 100644 index 000000000..c22c71a89 Binary files /dev/null and b/cosmos_client/assets/images/blocks/reactor_casing.png differ diff --git a/cosmos_client/assets/images/blocks/reactor_cell.png b/cosmos_client/assets/images/blocks/reactor_cell.png new file mode 100644 index 000000000..489e5f396 Binary files /dev/null and b/cosmos_client/assets/images/blocks/reactor_cell.png differ diff --git a/cosmos_client/assets/images/blocks/reactor_controller.png b/cosmos_client/assets/images/blocks/reactor_controller.png new file mode 100644 index 000000000..4d09d39ea Binary files /dev/null and b/cosmos_client/assets/images/blocks/reactor_controller.png differ diff --git a/cosmos_client/assets/images/blocks/reactor_window.png b/cosmos_client/assets/images/blocks/reactor_window.png new file mode 100644 index 000000000..d98df825b Binary files /dev/null and b/cosmos_client/assets/images/blocks/reactor_window.png differ diff --git a/cosmos_client/assets/lang/blocks/en_us.lang b/cosmos_client/assets/lang/blocks/en_us.lang index 332b3a64a..40c7c6712 100644 --- a/cosmos_client/assets/lang/blocks/en_us.lang +++ b/cosmos_client/assets/lang/blocks/en_us.lang @@ -41,3 +41,7 @@ cosmos:ship_hull_dark_red=Dark Red Ship Hull cosmos:ship_hull_yellow=Yellow Ship Hull cosmos:ship_hull_dark_yellow=Dark Yellow Ship Hull cosmos:ship_hull_mint=Mint Ship Hull +cosmos:reactor_controller=Reactor Controller +cosmos:reactor_casing=Reactor Casing +cosmos:reactor_window=Reactor Window +cosmos:reactor_cell=Reactor Power Cell \ No newline at end of file diff --git a/cosmos_client/src/events/block/block_events.rs b/cosmos_client/src/events/block/block_events.rs index a245ea7c2..f7771aeea 100644 --- a/cosmos_client/src/events/block/block_events.rs +++ b/cosmos_client/src/events/block/block_events.rs @@ -3,7 +3,7 @@ use bevy::prelude::*; use bevy_renet::renet::RenetClient; use cosmos_core::{ - block::BlockFace, + block::{block_events::BlockInteractEvent, BlockFace}, netty::{client_reliable_messages::ClientReliableMessages, cosmos_encoder, NettyChannelClient}, structure::structure_block::StructureBlock, }; @@ -34,15 +34,6 @@ pub struct BlockPlaceEvent { pub block_up: BlockFace, } -#[derive(Debug, Event)] -/// Sent whenever the player interacts with a block -pub struct BlockInteractEvent { - /// The structure this block is on - pub structure_entity: Entity, - /// block coords - pub coords: StructureBlock, -} - fn handle_block_break( mut event_reader: EventReader, mut client: ResMut, @@ -88,7 +79,7 @@ fn handle_block_interact( NettyChannelClient::Reliable, cosmos_encoder::serialize(&ClientReliableMessages::InteractWithBlock { structure_entity: network_mapping.server_from_client(&ev.structure_entity).unwrap(), - block: ev.coords, + block: ev.structure_block, }), ); } diff --git a/cosmos_client/src/interactions/block_interactions.rs b/cosmos_client/src/interactions/block_interactions.rs index d7e534057..a209d8f39 100644 --- a/cosmos_client/src/interactions/block_interactions.rs +++ b/cosmos_client/src/interactions/block_interactions.rs @@ -3,7 +3,7 @@ use bevy::prelude::*; use bevy_rapier3d::prelude::{QueryFilter, RapierContext, DEFAULT_WORLD_ID}; use cosmos_core::{ - block::BlockFace, + block::{block_events::BlockInteractEvent, BlockFace}, blockitems::BlockItems, inventory::Inventory, item::Item, @@ -58,7 +58,7 @@ fn process_player_interaction( } // this fails if the player is a pilot - let Ok((player_body, mut inventory, looking_at)) = player_body.get_single_mut() else { + let Ok((player_entity, mut inventory, looking_at)) = player_body.get_single_mut() else { return; }; @@ -75,7 +75,7 @@ fn process_player_interaction( cam_trans.forward(), 10.0, true, - QueryFilter::new().exclude_rigid_body(player_body), // don't want to hit yourself + QueryFilter::new().exclude_rigid_body(player_entity), // don't want to hit yourself ) else { if let Some(mut looking_at) = looking_at { looking_at.looking_at_block = None; @@ -110,7 +110,7 @@ fn process_player_interaction( if let Some(mut looking_at) = looking_at { looking_at.looking_at_block = looking_at_block; } else { - commands.entity(player_body).insert(LookingAt { looking_at_block }); + commands.entity(player_entity).insert(LookingAt { looking_at_block }); } } @@ -163,7 +163,8 @@ fn process_player_interaction( if let Ok(coords) = structure.relative_coords_to_local_coords_checked(point.x, point.y, point.z) { interact_writer.send(BlockInteractEvent { structure_entity: structure.get_entity().unwrap(), - coords: StructureBlock::new(coords), + structure_block: StructureBlock::new(coords), + interactor: player_entity, }); } } diff --git a/cosmos_client/src/netty/gameplay/receiver.rs b/cosmos_client/src/netty/gameplay/receiver.rs index d5d60f2de..fdf3eff51 100644 --- a/cosmos_client/src/netty/gameplay/receiver.rs +++ b/cosmos_client/src/netty/gameplay/receiver.rs @@ -56,7 +56,10 @@ use crate::{ rendering::MainCamera, state::game_state::GameState, structure::{planet::client_planet_builder::ClientPlanetBuilder, ship::client_ship_builder::ClientShipBuilder}, - ui::crosshair::CrosshairOffset, + ui::{ + crosshair::CrosshairOffset, + message::{HudMessage, HudMessages}, + }, }; #[derive(Component)] @@ -99,9 +102,16 @@ fn update_crosshair( } } +#[derive(Resource, Debug, Clone, Copy)] +struct RequestedEntity { + server_entity: Entity, + client_entity: Entity, + seconds_since_request: f32, +} + #[derive(Resource, Debug, Default)] pub(crate) struct RequestedEntities { - entities: Vec<(Entity, f32)>, + entities: Vec, } #[derive(Component, Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)] @@ -182,20 +192,21 @@ pub(crate) fn client_sync_players( time: Res