--- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ab_glyph" @@ -589,13 +589,13 @@ [[package]] name = "chargrid_web" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0486990a8a2a7b6e027ce686bf06122e94a85a2c717b169e45934e38d39c0a05" +checksum = "eca10b37f24b6acc00078af2e2bb5a60badd76d240715118e157eb8844546aff" dependencies = [ - "chargrid_gamepad 0.3.1", - "chargrid_input 0.3.1", - "chargrid_runtime 0.1.0", + "chargrid_gamepad 0.4.0", + "chargrid_input 0.4.1", + "chargrid_runtime 0.2.0", "grid_2d", "js-sys", "wasm-bindgen", @@ -1787,7 +1787,6 @@ dependencies = [ "chargrid_ansi_terminal", "chargrid_ggez", - "chargrid_web", "coord_2d", "direction", "entity_table", @@ -1809,6 +1808,7 @@ checksum = "24998687d2f3fba75f03d661d351fde5226ab8c79f8d70992c3b5bea806ba599" dependencies = [ "chargrid", + "chargrid_web", "chargrid_wgpu", "coord_2d", "direction", @@ -3044,7 +3044,7 @@ version = "0.1.0" dependencies = [ "console_error_panic_hook", - "gridbugs 0.2.1", + "gridbugs 0.7.0", "log", "rainforest_app", "wasm-bindgen", --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -7,7 +7,7 @@ crate-type = ["cdylib"] [dependencies] -gridbugs = { version = "0.2", features = [ +gridbugs = { version = "0.7", features = [ "chargrid_web_gamepad", "storage_backend_web", "audio_backend_web", --- a/game/src/game.rs +++ b/game/src/game.rs @@ -1016,6 +1016,9 @@ .spatial_table .layers_at_checked(player_coord) .item + // FredyGames: beds, chairs, teapots and altars sit on the item layer without being items; + // picking them up hit item.unwrap() and froze the game. + .filter(|item| self.world.components.item.contains(*item)) { let item_data = self.world.components.remove_entity_data(item); self.world.spatial_table.remove(item); @@ -1039,6 +1042,9 @@ self.player_item = Some(item_data); ControlFlow::Prompt(message) } else { + if self.world.spatial_table.layers_at_checked(player_coord).item.is_some() { + return ActionError::err_msg("There is no item here!"); + } if let Some(current_item) = self.player_item.take() { let item = current_item.item.unwrap(); let entity = self.world.entity_allocator.alloc();