static keys - items in inventory will save their assigned key
precursor to cleaning up/modularising inventory display, instead of needing to iterate through every item held to find unique copies, we can just check if the button pressed corresponds to any entity's Key {} index
This commit is contained in:
parent
a7b4f621fb
commit
d11971126c
19 changed files with 445 additions and 122 deletions
|
|
@ -30,6 +30,7 @@ use super::{
|
|||
Viewshed,
|
||||
WantsToMelee,
|
||||
WantsToPickupItem,
|
||||
WantsToAssignKey,
|
||||
get_dest,
|
||||
Destination,
|
||||
DamageType,
|
||||
|
|
@ -640,7 +641,9 @@ fn get_item(ecs: &mut World) -> RunState {
|
|||
return RunState::AwaitingInput;
|
||||
}
|
||||
Some(item) => {
|
||||
let mut assignkey = ecs.write_storage::<WantsToAssignKey>();
|
||||
let mut pickup = ecs.write_storage::<WantsToPickupItem>();
|
||||
assignkey.insert(item, WantsToAssignKey {}).expect("Unable to insert WantsToAssignKey");
|
||||
pickup
|
||||
.insert(*player_entity, WantsToPickupItem { collected_by: *player_entity, item })
|
||||
.expect("Unable to insert want to pickup item.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue