Skip to content

Commit

Permalink
Merge pull request #401 from AnthonyTornetta/cleanup
Browse files Browse the repository at this point in the history
Adding item + block textures
  • Loading branch information
AnthonyTornetta authored Jan 21, 2025
2 parents 6ae637d + 2fb4d2e commit de66b3c
Show file tree
Hide file tree
Showing 46 changed files with 171 additions and 117 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,19 @@ If you want to view the ordering of the systems, run (on linux) `cargo run --fea

See [the issues page](https://github.com/AnthonyTornetta/Cosmos/issues) for the list of current features/bugs in development.

## Release 0.0.8a
## Release 0.0.8a (In Progress)

- [ ] Screenshots
- [ ] More pirate ships
- [ ] More asteroid types
- [ ] More station types
- [ ] Fuel for reactor
- [ ] Performance fixes
- [ ] Fix server instability
- [ ] Reduce amount of packets server sends per second
- [ ] Rebalance shop prices
- [ ] Add recipes
- [ ] Add more randomly generated structures (e.g. stations)
- [ ] Add ability for player to die
- [ ] Respawn anchor

## Release 0.0.7a

Expand All @@ -97,6 +98,9 @@ See [the issues page](https://github.com/AnthonyTornetta/Cosmos/issues) for the
- [x] If not enough inventory room when player is mining something, drop item
- [x] Fix missing chunks on planets
- [x] Update to Bevy 0.15
- [x] Add recipes
- [x] Add intermediate blocks + items
- [x] Rework item rendering to be more consistent

## Release 0.0.6a

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cosmos_client/assets/cosmos/images/items/iron_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cosmos_client/assets/cosmos/images/items/missile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cosmos_client/assets/cosmos/images/items/sulfur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cosmos_client/assets/cosmos/images/items/uranium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions cosmos_client/assets/cosmos/lang/blocks/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ cosmos:logic_wire_dark_red=Dark Red Logic Wire
cosmos:logic_wire_yellow=Yellow Logic Wire
cosmos:logic_wire_dark_yellow=Dark Yellow Logic Wire
cosmos:logic_wire_mint=Mint Logic Wire

cosmos:copper_ore=Copper Ore
cosmos:lead_ore=Lead Ore
cosmos:uranium_ore=Uranium Ore
cosmos:sulfur_ore=Sulfur Ore
cosmos:gravitron_crystal_ore=Gravitron Crystal Ore
cosmos:energite_crystal_ore=Energite Crystal Ore
12 changes: 11 additions & 1 deletion cosmos_client/assets/cosmos/lang/items/en_us.lang
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
cosmos:photonium_crystal=Test Crystal
cosmos:photonium_crystal=Photonium Crystal
cosmos:iron_bar=Iron Bar
cosmos:missile=Missile
cosmos:fluid_cell=Fluid Cell
cosmos:fluid_cell_filled=Filled Fluid Cell
cosmos:copper_bar=Copper Bar
cosmos:lead_bar=Lead Bar
cosmos:uranium=Uranium
cosmos:sulfur=Sulfur
cosmos:gravitron_crystal=Gravitron Crystal
cosmos:energite_crystal=Energite Crystal
cosmos:uranium_fuel_cell=Uranium Fuel Cell
2 changes: 2 additions & 0 deletions cosmos_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ fn main() {
// PerfUiPlugin,
// BillboardPlugin,
))
// If you enable rapier debug, make sure to disable order independent transparency
// on camera.
// .add_plugins(RapierDebugRenderPlugin::default())
.add_systems(OnEnter(GameState::Connecting), connect::establish_connection)
.add_systems(Update, connect::wait_for_connection.run_if(in_state(GameState::Connecting)));
Expand Down
2 changes: 1 addition & 1 deletion cosmos_core/src/block/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ fn add_cosmos_blocks(
);

blocks.register(
BlockBuilder::new("cosmos:test_ore", 10.0, 50.0, 12.0)
BlockBuilder::new("cosmos:photonium_crystal_ore", 10.0, 50.0, 12.0)
.add_property(BlockProperty::Full)
.create(),
);
Expand Down
3 changes: 3 additions & 0 deletions cosmos_core/src/item/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ fn add_cosmos_items(
items.register(Item::new("cosmos:gravitron_crystal", DEFAULT_MAX_STACK_SIZE));
items.register(Item::new("cosmos:energite_crystal", DEFAULT_MAX_STACK_SIZE));

items.register(Item::new("cosmos:uranium_fuel_cell", DEFAULT_MAX_STACK_SIZE));
items.register(Item::new("cosmos:missile", DEFAULT_MAX_STACK_SIZE));

loading.finish_loading(id, &mut end_writer);
}

Expand Down
187 changes: 98 additions & 89 deletions cosmos_core/src/physics/block_colliders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,95 @@ impl BlockCollider {
}
}

fn create_cable_collider(size: f32, epsilon: f32) -> BlockColliderType {
BlockColliderType::Connected(Box::new(ConnectedCollider {
top: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(size, epsilon, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, size, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(size, 0.25, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.25, 0.0),
rotation: Quat::IDENTITY,
}],
},
bottom: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(size, epsilon, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, -size - epsilon, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(size, 0.25, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, -0.25, 0.0),
rotation: Quat::IDENTITY,
}],
},
front: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(size, size, epsilon),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, size),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(size, size, 0.25),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, 0.25),
rotation: Quat::IDENTITY,
}],
},
back: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(size, size, epsilon),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, -size - epsilon),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(size, size, 0.25),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, -0.25),
rotation: Quat::IDENTITY,
}],
},
right: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(epsilon, size, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(size, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.25, size, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.25, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
},
left: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(epsilon, size, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(-size - epsilon, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.25, size, size),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(-0.25, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
},
}))
}

fn register_custom_colliders(blocks: Res<Registry<Block>>, mut registry: ResMut<Registry<BlockCollider>>) {
registry.register(BlockCollider::new(BlockColliderType::Empty, "cosmos:air"));

Expand Down Expand Up @@ -167,95 +256,15 @@ fn register_custom_colliders(blocks: Res<Registry<Block>>, mut registry: ResMut<
}

if blocks.contains("cosmos:power_cable") {
registry.register(BlockCollider::new(
BlockColliderType::Connected(Box::new(ConnectedCollider {
top: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, EPSILON, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.2, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.25, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.25, 0.0),
rotation: Quat::IDENTITY,
}],
},
bottom: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, EPSILON, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, -0.2 - EPSILON, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.25, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, -0.25, 0.0),
rotation: Quat::IDENTITY,
}],
},
front: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.2, EPSILON),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, 0.2),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.2, 0.25),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, 0.25),
rotation: Quat::IDENTITY,
}],
},
back: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.2, EPSILON),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, -0.2 - EPSILON),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.2, 0.2, 0.25),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.0, 0.0, -0.25),
rotation: Quat::IDENTITY,
}],
},
right: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(EPSILON, 0.2, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.2, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.25, 0.2, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(0.25, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
},
left: FaceColldier {
non_connected: vec![CustomCollider {
collider: Collider::cuboid(EPSILON, 0.2, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(-0.2 - EPSILON, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
connected: vec![CustomCollider {
collider: Collider::cuboid(0.25, 0.2, 0.2),
mode: BlockColliderMode::NormalCollider,
offset: Vec3::new(-0.25, 0.0, 0.0),
rotation: Quat::IDENTITY,
}],
},
})),
"cosmos:power_cable",
));
registry.register(BlockCollider::new(create_cable_collider(0.2, EPSILON), "cosmos:power_cable"));
}

// TODO: Replace this with some other way of identifying specific groups of blocks
for block in blocks
.iter()
.filter(|x| x.unlocalized_name().contains("logic_wire") || x.unlocalized_name().contains("logic_bus"))
{
registry.register(BlockCollider::new(create_cable_collider(0.1, EPSILON), block.unlocalized_name()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 5
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"inputs": [
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 2
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"inputs": [
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"item": {
"Item": "cosmos:iron"
"Item": "cosmos:iron_bar"
},
"quantity": 1
}
Expand Down
Loading

0 comments on commit de66b3c

Please sign in to comment.