summaryrefslogtreecommitdiff
path: root/src/systems/useitem.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-05 20:04:33 +0200
committertroido <troido@protonmail.com>2020-04-05 20:04:33 +0200
commit48c24ec8b011d081550dc78329cbe61de67b30e9 (patch)
treed2d700897dc5ba3d0f52e8a1cd57c0f4880272fd /src/systems/useitem.rs
parent84c70cee089b72720a85d285ee0437b65be298b9 (diff)
items are now mostly replaced by itemids, with a mapping to the item in the encyclopedia
Diffstat (limited to 'src/systems/useitem.rs')
-rw-r--r--src/systems/useitem.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/systems/useitem.rs b/src/systems/useitem.rs
index 8763843..605f083 100644
--- a/src/systems/useitem.rs
+++ b/src/systems/useitem.rs
@@ -21,7 +21,7 @@ use crate::{
Flags
},
resources::{NewEntities, Ground},
- components::item::ItemAction::{None, Build, Eat, Equip},
+ item::ItemAction::{None, Build, Eat, Equip},
controls::Control,
};
@@ -44,7 +44,7 @@ impl <'a> System<'a> for Use {
match &controller.control {
Control::Use(rank) => {
if let Some(entry) = inventory.items.get_mut(*rank) {
- match &entry.0.action {
+ match &entry.item.action {
Build(template, required_flags, blocking_flags) => {
let ground_flags = ground.flags_on(position.pos, &flags);
if required_flags.is_subset(&ground_flags) && blocking_flags.is_disjoint(&ground_flags){
@@ -59,13 +59,13 @@ impl <'a> System<'a> for Use {
Equip(equippable) => {
let slot = equippable.slot;
for otherentry in inventory.items.iter_mut() {
- if let Equip(other) = &otherentry.0.action {
+ if let Equip(other) = &otherentry.item.action {
if other.slot == slot {
- otherentry.1 = false;
+ otherentry.is_equipped = false;
}
}
}
- inventory.items[*rank].1 = true;
+ inventory.items[*rank].is_equipped = true;
}
None => {}
}