Skip to content

Commit

Permalink
Updated starting inventory to be more generous
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyTornetta committed Oct 26, 2023
1 parent 81f5ae0 commit ba27c29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
7 changes: 0 additions & 7 deletions cosmos_core/src/block/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cosmos_core/src/item/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 15 additions & 9 deletions cosmos_server/src/events/netty/netty_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand All @@ -25,23 +27,27 @@ use crate::netty::network_helpers::{ClientTicks, ServerLobby};
fn generate_player_inventory(items: &Registry<Item>) -> 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
}
Expand Down

0 comments on commit ba27c29

Please sign in to comment.