Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Use basket crab models instead of ants (#955)
Browse files Browse the repository at this point in the history
* Better debugging for failed assets

* Try to swap to new models

* Slightly nicer error messages

* Fix ant_egg -> crab_egg

* Fix intermittent panic on startup

* Fix scale on basket crab model

* Fix typo in crab hatching
  • Loading branch information
alice-i-cecile authored Jun 1, 2023
1 parent f92b588 commit 4694960
Show file tree
Hide file tree
Showing 25 changed files with 44 additions and 43 deletions.
3 changes: 0 additions & 3 deletions emergence_game/assets/icons/items/ant_egg.svg

This file was deleted.

3 changes: 3 additions & 0 deletions emergence_game/assets/icons/items/crab_egg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions emergence_game/assets/manifests/base_game.item_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"fluid": false,
"buoyant": true
},
"ant_egg": {
"crab_egg": {
"stack_size": 3,
"compostable": false,
"fluid": false,
"buoyant": true,
"seed": {
"Unit": "ant"
"Unit": "basket_crab"
}
},
"acacia_seed": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
},
"energy": 20.0
},
"ant_egg_production": {
"crab_egg_production": {
"inputs": {
"Exact": {
"leuco_chunk": 1
}
},
"outputs": {
"ant_egg": 1
"crab_egg": 1
},
"craft_time": 10,
"conditions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
"ant_hive": {
"kind": {
"Crafting": {
"starting_recipe": "ant_egg_production"
"starting_recipe": "crab_egg_production"
}
},
"construction_strategy": {
Expand Down
4 changes: 2 additions & 2 deletions emergence_game/assets/manifests/base_game.unit_manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"unit_types": {
"ant": {
"basket_crab": {
"organism_variety": {
"prototypical_form": {
"Unit": "ant"
"Unit": "basket_crab"
},
"lifecycle": {
"life_paths": []
Expand Down
3 changes: 0 additions & 3 deletions emergence_game/assets/units/BasketCrab_Proxy.blend

This file was deleted.

3 changes: 0 additions & 3 deletions emergence_game/assets/units/BasketCrab_Proxy.gltf

This file was deleted.

3 changes: 0 additions & 3 deletions emergence_game/assets/units/ant.blend

This file was deleted.

3 changes: 0 additions & 3 deletions emergence_game/assets/units/ant.gltf

This file was deleted.

3 changes: 3 additions & 0 deletions emergence_game/assets/units/basket_crab.blend
Git LFS file not shown
3 changes: 3 additions & 0 deletions emergence_game/assets/units/basket_crab.gltf
Git LFS file not shown
2 changes: 1 addition & 1 deletion emergence_lib/src/asset_management/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where
pub fn get(&self, id: Id<T>) -> &Data {
self.data_map
.get(&id)
.unwrap_or_else(|| panic!("ID {id:?} not found in manifest"))
.unwrap_or_else(|| panic!("ID {id:?} {} not found in manifest", self.name(id)))
}

/// Returns the human-readable name associated with the provided `id`.
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/structures/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Command for SpawnStructureCommand {
.insert(InputInventory::Exact {
// TODO: let this be configured by the user using the UI
inventory: Inventory::empty_from_item(
Id::from_name("ant_egg".to_string()),
Id::from_name("crab_egg".to_string()),
1,
),
})
Expand Down
7 changes: 6 additions & 1 deletion emergence_lib/src/structures/structure_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ impl Loadable for StructureHandles {
let scene_load_state = asset_server.get_load_state(scene_handle);

if scene_load_state != LoadState::Loaded {
info!("Structure {structure:?}'s scene is {scene_load_state:?}");
let maybe_path = asset_server.get_handle_path(scene_handle);
let path = maybe_path
.map(|p| format!("{:?}", p.path()))
.unwrap_or("unknown_path".to_string());

info!("Structure {structure:?}'s scene at {path} is {scene_load_state:?}");
return scene_load_state;
}
}
Expand Down
7 changes: 6 additions & 1 deletion emergence_lib/src/terrain/terrain_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ impl Loadable for TerrainHandles {
let scene_load_state = asset_server.get_load_state(scene_handle);

if scene_load_state != LoadState::Loaded {
info!("Terrain {terrain:?}'s scene is {scene_load_state:?}");
let maybe_path = asset_server.get_handle_path(scene_handle);
let path = maybe_path
.map(|p| format!("{:?}", p.path()))
.unwrap_or("unknown_path".to_string());

info!("Terrain {terrain:?}'s scene at {path} is {scene_load_state:?}");
return scene_load_state;
}
}
Expand Down
7 changes: 6 additions & 1 deletion emergence_lib/src/ui/ui_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ where
let load_state = asset_server.get_load_state(icon_handle);

if load_state != LoadState::Loaded {
info!("{data:?}'s icon is {load_state:?}");
let maybe_path = asset_server.get_handle_path(icon_handle);
let path = maybe_path
.map(|p| format!("{:?}", p.path()))
.unwrap_or("unknown_path".to_string());

info!("Icon {data:?}'s scene at {path} is {load_state:?}");
return load_state;
}
}
Expand Down
7 changes: 6 additions & 1 deletion emergence_lib/src/units/unit_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ impl Loadable for UnitHandles {
let scene_load_state = asset_server.get_load_state(scene_handle);

if scene_load_state != LoadState::Loaded {
info!("Unit {unit:?}'s scene is {scene_load_state:?}");
let maybe_path = asset_server.get_handle_path(scene_handle);
let path = maybe_path
.map(|p| format!("{:?}", p.path()))
.unwrap_or("unknown_path".to_string());

info!("Unit {unit:?}'s scene at {path} is {scene_load_state:?}");
return scene_load_state;
}
}
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/water/water_dynamics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub fn horizontal_water_movement(
for maybe_neighbor in map_geometry.valid_neighbors(tile_pos) {
let &Some(valid_neighbor) = maybe_neighbor else { continue };

let neighbor_entity = map_geometry.get_terrain(valid_neighbor).unwrap();
let Some(neighbor_entity) = map_geometry.get_terrain(valid_neighbor) else { continue };
let neighbor_query_item = terrain_query.get(neighbor_entity).unwrap();

let neighbor_tile_height = *neighbor_query_item.terrain_height;
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/world_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl Default for GenerationConfig {
landmark_chances.insert(Id::from_name("spring".to_string()), 5e-4);

let mut unit_chances: HashMap<Id<Unit>, f32> = HashMap::new();
unit_chances.insert(Id::from_name("ant".to_string()), 1e-2);
unit_chances.insert(Id::from_name("basket_crab".to_string()), 1e-2);

let mut structure_chances: HashMap<Id<Structure>, f32> = HashMap::new();
structure_chances.insert(Id::from_name("ant_hive".to_string()), 1e-3);
Expand Down
13 changes: 0 additions & 13 deletions emergence_lib/tests/serde_manifests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,6 @@ fn can_serialize_recipe_manifest() {
energy: None,
},
),
(
"hatch_ants".to_string(),
RawRecipeData {
inputs: RawRecipeInput::single("ant_egg", 1),
outputs: HashMap::new(),
craft_time: 10.,
conditions: Some(RecipeConditions {
workers_required: 1,
allowable_light_range: None,
}),
energy: None,
},
),
]),
};

Expand Down

0 comments on commit 4694960

Please sign in to comment.