mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix modular crafting window showing an item output when it is not possible to craft two components together.
This commit is contained in:
parent
335fa514aa
commit
352d34557e
@ -392,7 +392,7 @@ pub enum ModularWeaponCreationError {
|
|||||||
/// Check if hand restrictions are compatible.
|
/// Check if hand restrictions are compatible.
|
||||||
///
|
///
|
||||||
/// If at least on of them is omitted, check is passed.
|
/// If at least on of them is omitted, check is passed.
|
||||||
fn compatible_handndess(a: Option<Hands>, b: Option<Hands>) -> bool {
|
pub fn compatible_handndess(a: Option<Hands>, b: Option<Hands>) -> bool {
|
||||||
match (a, b) {
|
match (a, b) {
|
||||||
(Some(a), Some(b)) => a == b,
|
(Some(a), Some(b)) => a == b,
|
||||||
_ => true,
|
_ => true,
|
||||||
|
@ -1122,15 +1122,19 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
|
|
||||||
let output_item = match recipe_kind {
|
let output_item = match recipe_kind {
|
||||||
RecipeKind::ModularWeapon => {
|
RecipeKind::ModularWeapon => {
|
||||||
if let Some((primary_comp, toolkind)) = primary_slot
|
if let Some((primary_comp, toolkind, hand_restriction)) = primary_slot
|
||||||
.invslot
|
.invslot
|
||||||
.and_then(|slot| self.inventory.get(slot))
|
.and_then(|slot| self.inventory.get(slot))
|
||||||
.and_then(|item| {
|
.and_then(|item| {
|
||||||
if let ItemKind::ModularComponent(
|
if let ItemKind::ModularComponent(
|
||||||
ModularComponent::ToolPrimaryComponent { toolkind, .. },
|
ModularComponent::ToolPrimaryComponent {
|
||||||
|
toolkind,
|
||||||
|
hand_restriction,
|
||||||
|
..
|
||||||
|
},
|
||||||
) = &*item.kind()
|
) = &*item.kind()
|
||||||
{
|
{
|
||||||
Some((item, *toolkind))
|
Some((item, *toolkind, *hand_restriction))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@ -1143,8 +1147,8 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
matches!(
|
matches!(
|
||||||
&*item.kind(),
|
&*item.kind(),
|
||||||
ItemKind::ModularComponent(
|
ItemKind::ModularComponent(
|
||||||
ModularComponent::ToolSecondaryComponent { toolkind: toolkind_b, .. }
|
ModularComponent::ToolSecondaryComponent { toolkind: toolkind_b, hand_restriction: hand_restriction_b, .. }
|
||||||
) if toolkind == *toolkind_b
|
) if toolkind == *toolkind_b && modular::compatible_handndess(hand_restriction, *hand_restriction_b)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.map(|secondary_comp| {
|
.map(|secondary_comp| {
|
||||||
|
Loading…
Reference in New Issue
Block a user