From ba27c29373cf81f801681d496bbab9d670918a6b Mon Sep 17 00:00:00 2001 From: Anthony Tornetta Date: Thu, 26 Oct 2023 09:05:48 -0400 Subject: [PATCH] Updated starting inventory to be more generous --- cosmos_core/src/block/blocks.rs | 7 ------ cosmos_core/src/item/mod.rs | 2 +- .../src/events/netty/netty_events.rs | 24 ++++++++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cosmos_core/src/block/blocks.rs b/cosmos_core/src/block/blocks.rs index e951721b0..93a73ca9a 100644 --- a/cosmos_core/src/block/blocks.rs +++ b/cosmos_core/src/block/blocks.rs @@ -43,13 +43,6 @@ fn add_cosmos_blocks( .create(), ); - blocks.register( - BlockBuilder::new("cosmos:log", 3.0) - .add_property(BlockProperty::Opaque) - .add_property(BlockProperty::Full) - .create(), - ); - blocks.register( BlockBuilder::new("cosmos:cherry_leaf", 0.1) .add_property(BlockProperty::Transparent) diff --git a/cosmos_core/src/item/mod.rs b/cosmos_core/src/item/mod.rs index 137cba8a9..9722d171e 100644 --- a/cosmos_core/src/item/mod.rs +++ b/cosmos_core/src/item/mod.rs @@ -31,7 +31,7 @@ impl Identifiable for Item { } /// The max stack size for items, should load this from config file in future -pub const DEFAULT_MAX_STACK_SIZE: u16 = 64; +pub const DEFAULT_MAX_STACK_SIZE: u16 = 999; impl Item { /// Creates an item diff --git a/cosmos_server/src/events/netty/netty_events.rs b/cosmos_server/src/events/netty/netty_events.rs index 045249102..489fdc6f1 100644 --- a/cosmos_server/src/events/netty/netty_events.rs +++ b/cosmos_server/src/events/netty/netty_events.rs @@ -6,6 +6,7 @@ use bevy_renet::renet::transport::NetcodeServerTransport; use bevy_renet::renet::{RenetServer, ServerEvent}; use cosmos_core::ecs::NeedsDespawned; use cosmos_core::entities::player::render_distance::RenderDistance; +use cosmos_core::inventory::itemstack::ItemStack; use cosmos_core::inventory::Inventory; use cosmos_core::item::Item; use cosmos_core::netty::netty_rigidbody::NettyRigidBodyLocation; @@ -14,6 +15,7 @@ use cosmos_core::netty::{cosmos_encoder, NettyChannelServer}; use cosmos_core::persistence::LoadingDistance; use cosmos_core::physics::location::{Location, Sector}; use cosmos_core::physics::player_world::WorldWithin; +use cosmos_core::registry::identifiable::Identifiable; use cosmos_core::registry::Registry; use cosmos_core::structure::chunk::CHUNK_DIMENSIONSF; use cosmos_core::{entities::player::Player, netty::netty_rigidbody::NettyRigidBody}; @@ -25,23 +27,27 @@ use crate::netty::network_helpers::{ClientTicks, ServerLobby}; fn generate_player_inventory(items: &Registry) -> Inventory { let mut inventory = Inventory::new(9 * 6, Some(0..9)); - inventory.insert_item_at(0, items.from_id("cosmos:ice").expect("Ice item to exist"), 1); + inventory.insert_item_at(0, items.from_id("cosmos:ship_hull").expect("Ship hull item to exist"), 999); - inventory.insert_item_at(1, items.from_id("cosmos:build_block").expect("Water item to exist"), 64); + inventory.insert_item_at(1, items.from_id("cosmos:glass").expect("Glass item to exist"), 999); - inventory.insert_item_at(2, items.from_id("cosmos:glass").expect("Glass item to exist"), 64); + inventory.insert_item_at(2, items.from_id("cosmos:build_block").expect("Build block item to exist"), 999); - inventory.insert_item_at(3, items.from_id("cosmos:thruster").expect("Thruster item to exist"), 64); + inventory.insert_item_at(3, items.from_id("cosmos:thruster").expect("Thruster item to exist"), 999); - inventory.insert_item_at(4, items.from_id("cosmos:laser_cannon").expect("Laser cannon item to exist"), 64); + inventory.insert_item_at(4, items.from_id("cosmos:laser_cannon").expect("Laser cannon item to exist"), 999); - inventory.insert_item_at(5, items.from_id("cosmos:reactor").expect("Reactor cannon item to exist"), 64); + inventory.insert_item_at(5, items.from_id("cosmos:reactor").expect("Reactor item to exist"), 999); - inventory.insert_item_at(6, items.from_id("cosmos:energy_cell").expect("Energy cell item to exist"), 64); + inventory.insert_item_at(6, items.from_id("cosmos:energy_cell").expect("Energy cell item to exist"), 999); - inventory.insert_item_at(7, items.from_id("cosmos:ship_hull").expect("Ship hull item to exist"), 64); + inventory.insert_item_at(7, items.from_id("cosmos:light").expect("Light item to exist"), 999); - inventory.insert_item_at(8, items.from_id("cosmos:light").expect("Light item to exist"), 64); + inventory.insert_item_at(8, items.from_id("cosmos:redwood_log").expect("Redwood log item to exist"), 999); + + for item in items.iter().filter(|item| item.unlocalized_name() != "cosmos:air") { + inventory.insert_itemstack(&ItemStack::with_quantity(item, 999)); + } inventory }