Use typed behavior kinds for schematic weapons
This commit is contained in:
parent
7084b8137e
commit
e998a8d789
3 changed files with 24 additions and 2 deletions
|
|
@ -12,6 +12,16 @@ using static Unity.Mathematics.math;
|
|||
|
||||
public class SchematicDisplay : MonoBehaviour
|
||||
{
|
||||
private static readonly HashSet<string> WeaponBehaviorKinds = new HashSet<string>(StringComparer.Ordinal)
|
||||
{
|
||||
"GuidedWeapon",
|
||||
"Launcher",
|
||||
"InstantWeapon",
|
||||
"ConstantWeapon",
|
||||
"ChargedWeapon",
|
||||
"AutoWeapon"
|
||||
};
|
||||
|
||||
public GameSettings Settings;
|
||||
public Prototype ListElementPrototype;
|
||||
|
||||
|
|
@ -108,7 +118,7 @@ public class SchematicDisplay : MonoBehaviour
|
|||
}
|
||||
|
||||
_schematicItems = entity.Equipment
|
||||
.Where(x => x.Behaviors.Any(b => b.Data is WeaponData))
|
||||
.Where(HasTypedWeaponBehavior)
|
||||
.Select(x => new SchematicDisplayItem
|
||||
{
|
||||
Item = x,
|
||||
|
|
@ -144,6 +154,12 @@ public class SchematicDisplay : MonoBehaviour
|
|||
}
|
||||
|
||||
|
||||
private static bool HasTypedWeaponBehavior(EquippedItem item)
|
||||
{
|
||||
var typedItem = FindTypedItem(item.EquippableItem);
|
||||
return typedItem?.BehaviorKinds.Any(WeaponBehaviorKinds.Contains) == true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_entity != null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue