From 46949607671a64f6d1933458820ff2b66c681bc6 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Thu, 1 Jun 2023 13:10:30 -0400 Subject: [PATCH] Use basket crab models instead of ants (#955) * 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 --- emergence_game/assets/icons/items/ant_egg.svg | 3 --- .../icons/items/{ant_egg.png => crab_egg.png} | 0 emergence_game/assets/icons/items/crab_egg.svg | 3 +++ .../assets/icons/units/{ant.png => basket_crab.png} | 0 .../assets/icons/units/{ant.svg => basket_crab.svg} | 0 .../assets/manifests/base_game.item_manifest.json | 4 ++-- .../assets/manifests/base_game.recipe_manifest.json | 4 ++-- .../manifests/base_game.structure_manifest.json | 2 +- .../assets/manifests/base_game.unit_manifest.json | 4 ++-- emergence_game/assets/units/BasketCrab_Proxy.blend | 3 --- emergence_game/assets/units/BasketCrab_Proxy.gltf | 3 --- emergence_game/assets/units/ant.blend | 3 --- emergence_game/assets/units/ant.gltf | 3 --- emergence_game/assets/units/basket_crab.blend | 3 +++ emergence_game/assets/units/basket_crab.gltf | 3 +++ .../{Crab_Proxy.gltf => basket_crab_no_basket.gltf} | 0 emergence_lib/src/asset_management/manifest/mod.rs | 2 +- emergence_lib/src/structures/commands.rs | 2 +- emergence_lib/src/structures/structure_assets.rs | 7 ++++++- emergence_lib/src/terrain/terrain_assets.rs | 7 ++++++- emergence_lib/src/ui/ui_assets.rs | 7 ++++++- emergence_lib/src/units/unit_assets.rs | 7 ++++++- emergence_lib/src/water/water_dynamics.rs | 2 +- emergence_lib/src/world_gen/mod.rs | 2 +- emergence_lib/tests/serde_manifests.rs | 13 ------------- 25 files changed, 44 insertions(+), 43 deletions(-) delete mode 100644 emergence_game/assets/icons/items/ant_egg.svg rename emergence_game/assets/icons/items/{ant_egg.png => crab_egg.png} (100%) create mode 100644 emergence_game/assets/icons/items/crab_egg.svg rename emergence_game/assets/icons/units/{ant.png => basket_crab.png} (100%) rename emergence_game/assets/icons/units/{ant.svg => basket_crab.svg} (100%) delete mode 100644 emergence_game/assets/units/BasketCrab_Proxy.blend delete mode 100644 emergence_game/assets/units/BasketCrab_Proxy.gltf delete mode 100644 emergence_game/assets/units/ant.blend delete mode 100644 emergence_game/assets/units/ant.gltf create mode 100644 emergence_game/assets/units/basket_crab.blend create mode 100644 emergence_game/assets/units/basket_crab.gltf rename emergence_game/assets/units/{Crab_Proxy.gltf => basket_crab_no_basket.gltf} (100%) diff --git a/emergence_game/assets/icons/items/ant_egg.svg b/emergence_game/assets/icons/items/ant_egg.svg deleted file mode 100644 index 7abd05076..000000000 --- a/emergence_game/assets/icons/items/ant_egg.svg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:48c2be3f04b427a523d7bde3ee420a3a57c805af238436d0cf9720ca76551909 -size 2390 diff --git a/emergence_game/assets/icons/items/ant_egg.png b/emergence_game/assets/icons/items/crab_egg.png similarity index 100% rename from emergence_game/assets/icons/items/ant_egg.png rename to emergence_game/assets/icons/items/crab_egg.png diff --git a/emergence_game/assets/icons/items/crab_egg.svg b/emergence_game/assets/icons/items/crab_egg.svg new file mode 100644 index 000000000..01be9e0f1 --- /dev/null +++ b/emergence_game/assets/icons/items/crab_egg.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c1b481a960eb3745b4e513f58ebf1f1ef88451acffddb6eaf386a3395e8cc8b +size 2392 diff --git a/emergence_game/assets/icons/units/ant.png b/emergence_game/assets/icons/units/basket_crab.png similarity index 100% rename from emergence_game/assets/icons/units/ant.png rename to emergence_game/assets/icons/units/basket_crab.png diff --git a/emergence_game/assets/icons/units/ant.svg b/emergence_game/assets/icons/units/basket_crab.svg similarity index 100% rename from emergence_game/assets/icons/units/ant.svg rename to emergence_game/assets/icons/units/basket_crab.svg diff --git a/emergence_game/assets/manifests/base_game.item_manifest.json b/emergence_game/assets/manifests/base_game.item_manifest.json index 9703f998f..2466fc16a 100644 --- a/emergence_game/assets/manifests/base_game.item_manifest.json +++ b/emergence_game/assets/manifests/base_game.item_manifest.json @@ -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": { diff --git a/emergence_game/assets/manifests/base_game.recipe_manifest.json b/emergence_game/assets/manifests/base_game.recipe_manifest.json index 0765de29c..2ebbc0c00 100644 --- a/emergence_game/assets/manifests/base_game.recipe_manifest.json +++ b/emergence_game/assets/manifests/base_game.recipe_manifest.json @@ -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": { diff --git a/emergence_game/assets/manifests/base_game.structure_manifest.json b/emergence_game/assets/manifests/base_game.structure_manifest.json index d1e9c3970..e8b3e8282 100644 --- a/emergence_game/assets/manifests/base_game.structure_manifest.json +++ b/emergence_game/assets/manifests/base_game.structure_manifest.json @@ -274,7 +274,7 @@ "ant_hive": { "kind": { "Crafting": { - "starting_recipe": "ant_egg_production" + "starting_recipe": "crab_egg_production" } }, "construction_strategy": { diff --git a/emergence_game/assets/manifests/base_game.unit_manifest.json b/emergence_game/assets/manifests/base_game.unit_manifest.json index 578e319b2..39054c38a 100644 --- a/emergence_game/assets/manifests/base_game.unit_manifest.json +++ b/emergence_game/assets/manifests/base_game.unit_manifest.json @@ -1,9 +1,9 @@ { "unit_types": { - "ant": { + "basket_crab": { "organism_variety": { "prototypical_form": { - "Unit": "ant" + "Unit": "basket_crab" }, "lifecycle": { "life_paths": [] diff --git a/emergence_game/assets/units/BasketCrab_Proxy.blend b/emergence_game/assets/units/BasketCrab_Proxy.blend deleted file mode 100644 index 4e245d22e..000000000 --- a/emergence_game/assets/units/BasketCrab_Proxy.blend +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a2dfd7d74bfa87732230d733e6b508a05dd198d7227d8ed0f5197dca1036d45a -size 1846912 diff --git a/emergence_game/assets/units/BasketCrab_Proxy.gltf b/emergence_game/assets/units/BasketCrab_Proxy.gltf deleted file mode 100644 index a73ff69da..000000000 --- a/emergence_game/assets/units/BasketCrab_Proxy.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dbd5954ac922b6ba9acd7fabb2caaaecc6716928e96e5ac32902baffb513f846 -size 316065 diff --git a/emergence_game/assets/units/ant.blend b/emergence_game/assets/units/ant.blend deleted file mode 100644 index 5430a8c07..000000000 --- a/emergence_game/assets/units/ant.blend +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75d160d757384499660bd36ece0d9e8e454857f37ed654f1dd96517067ad03b0 -size 2035268 diff --git a/emergence_game/assets/units/ant.gltf b/emergence_game/assets/units/ant.gltf deleted file mode 100644 index 2c50c303d..000000000 --- a/emergence_game/assets/units/ant.gltf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:795fa41dff018e586524f00723efe180eb0f58006f07d017346fdf0675d53e66 -size 503172 diff --git a/emergence_game/assets/units/basket_crab.blend b/emergence_game/assets/units/basket_crab.blend new file mode 100644 index 000000000..c19d1e0e6 --- /dev/null +++ b/emergence_game/assets/units/basket_crab.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ace56a3db989d1814e23b14a0f4c1513271372ae2b01cff5d65f57a2e3f9fe11 +size 1821744 diff --git a/emergence_game/assets/units/basket_crab.gltf b/emergence_game/assets/units/basket_crab.gltf new file mode 100644 index 000000000..dafdc0223 --- /dev/null +++ b/emergence_game/assets/units/basket_crab.gltf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02053bac1a1c74f58fc92a5e05c1dfbe07b5a64c5fb04e8a248099b7f25eaa79 +size 312696 diff --git a/emergence_game/assets/units/Crab_Proxy.gltf b/emergence_game/assets/units/basket_crab_no_basket.gltf similarity index 100% rename from emergence_game/assets/units/Crab_Proxy.gltf rename to emergence_game/assets/units/basket_crab_no_basket.gltf diff --git a/emergence_lib/src/asset_management/manifest/mod.rs b/emergence_lib/src/asset_management/manifest/mod.rs index 126c6c61c..a8082d7ad 100644 --- a/emergence_lib/src/asset_management/manifest/mod.rs +++ b/emergence_lib/src/asset_management/manifest/mod.rs @@ -76,7 +76,7 @@ where pub fn get(&self, id: Id) -> &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`. diff --git a/emergence_lib/src/structures/commands.rs b/emergence_lib/src/structures/commands.rs index 3750696c1..cd5ee948f 100644 --- a/emergence_lib/src/structures/commands.rs +++ b/emergence_lib/src/structures/commands.rs @@ -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, ), }) diff --git a/emergence_lib/src/structures/structure_assets.rs b/emergence_lib/src/structures/structure_assets.rs index 6eacd0c0e..f5fc7bb59 100644 --- a/emergence_lib/src/structures/structure_assets.rs +++ b/emergence_lib/src/structures/structure_assets.rs @@ -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; } } diff --git a/emergence_lib/src/terrain/terrain_assets.rs b/emergence_lib/src/terrain/terrain_assets.rs index e95a672e0..8fbd8a0cd 100644 --- a/emergence_lib/src/terrain/terrain_assets.rs +++ b/emergence_lib/src/terrain/terrain_assets.rs @@ -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; } } diff --git a/emergence_lib/src/ui/ui_assets.rs b/emergence_lib/src/ui/ui_assets.rs index 794af457c..9de4296b3 100644 --- a/emergence_lib/src/ui/ui_assets.rs +++ b/emergence_lib/src/ui/ui_assets.rs @@ -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; } } diff --git a/emergence_lib/src/units/unit_assets.rs b/emergence_lib/src/units/unit_assets.rs index c53826b45..1d09af7e8 100644 --- a/emergence_lib/src/units/unit_assets.rs +++ b/emergence_lib/src/units/unit_assets.rs @@ -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; } } diff --git a/emergence_lib/src/water/water_dynamics.rs b/emergence_lib/src/water/water_dynamics.rs index 27759a27f..5d07c15fe 100644 --- a/emergence_lib/src/water/water_dynamics.rs +++ b/emergence_lib/src/water/water_dynamics.rs @@ -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; diff --git a/emergence_lib/src/world_gen/mod.rs b/emergence_lib/src/world_gen/mod.rs index 7cf80a77f..c2cb3da8e 100644 --- a/emergence_lib/src/world_gen/mod.rs +++ b/emergence_lib/src/world_gen/mod.rs @@ -139,7 +139,7 @@ impl Default for GenerationConfig { landmark_chances.insert(Id::from_name("spring".to_string()), 5e-4); let mut unit_chances: HashMap, 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, f32> = HashMap::new(); structure_chances.insert(Id::from_name("ant_hive".to_string()), 1e-3); diff --git a/emergence_lib/tests/serde_manifests.rs b/emergence_lib/tests/serde_manifests.rs index bd29cc646..7cb05b2d2 100644 --- a/emergence_lib/tests/serde_manifests.rs +++ b/emergence_lib/tests/serde_manifests.rs @@ -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, - }, - ), ]), };