Build typed Aetheria client surfaces
This commit is contained in:
parent
74b3b3d72a
commit
2e96660d48
246 changed files with 37893 additions and 6728 deletions
|
|
@ -0,0 +1,36 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
|
||||
public static class AetheriaUnityWeaponPresentationPolicy
|
||||
{
|
||||
private static readonly HashSet<string> ArticulatedWeaponBehaviorKinds = new HashSet<string>(StringComparer.Ordinal)
|
||||
{
|
||||
"GuidedWeapon",
|
||||
"InstantWeapon",
|
||||
"ConstantWeapon",
|
||||
"ChargedWeapon",
|
||||
"AutoWeapon"
|
||||
};
|
||||
|
||||
public static bool HasArticulatedWeaponBehavior(
|
||||
AetheriaRuntimeCatalogSnapshot runtimeCatalog,
|
||||
EquippedItem item)
|
||||
{
|
||||
var typedItem = runtimeCatalog?.FindItem(item?.EquippableItem?.ItemKey ?? "");
|
||||
if (typedItem?.BehaviorKinds == null)
|
||||
return false;
|
||||
|
||||
foreach (var behaviorKind in typedItem.BehaviorKinds)
|
||||
{
|
||||
if (ArticulatedWeaponBehaviorKinds.Contains(behaviorKind))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue