Require typed consumable activation
This commit is contained in:
parent
a4665d6065
commit
bc04526d35
3 changed files with 7 additions and 35 deletions
Binary file not shown.
|
|
@ -314,48 +314,17 @@ public abstract class Entity
|
|||
_activeConsumables.Add(new ConsumableItemEffect(item, this));
|
||||
}
|
||||
|
||||
public ConsumableItemEffect FindActiveConsumable(ConsumableItemData data)
|
||||
{
|
||||
return data == null ? null : FindActiveConsumable(data.ID);
|
||||
}
|
||||
|
||||
public ConsumableItemEffect FindActiveConsumable(Guid itemId)
|
||||
{
|
||||
return _activeConsumables.FirstOrDefault(ac => ac.Item?.Data?.ItemId == itemId);
|
||||
}
|
||||
|
||||
public bool CanActivateConsumable(ConsumableItemData data)
|
||||
{
|
||||
var typedItem = ItemManager.GetRuntimeItem(data?.ID ?? Guid.Empty);
|
||||
if (typedItem == null)
|
||||
return data != null && (data.Stackable || FindActiveConsumable(data) == null);
|
||||
|
||||
return CanActivateConsumable(typedItem);
|
||||
}
|
||||
|
||||
public bool CanActivateConsumable(AetheriaRuntimeCatalogItem item)
|
||||
{
|
||||
var itemId = GetLegacyGuid(item);
|
||||
return item != null && itemId != Guid.Empty && (item.Stackable || FindActiveConsumable(itemId) == null);
|
||||
}
|
||||
|
||||
public bool TryActivateConsumable(ConsumableItemData data)
|
||||
{
|
||||
var typedItem = ItemManager.GetRuntimeItem(data?.ID ?? Guid.Empty);
|
||||
if (typedItem != null)
|
||||
return TryActivateConsumable(typedItem);
|
||||
|
||||
if (!CanActivateConsumable(data)) return false;
|
||||
|
||||
var bay = FindItemInCargo(data.ID);
|
||||
if (bay == null) return false;
|
||||
|
||||
var item = (ConsumableItem) bay.ItemsOfType[data.ID].First();
|
||||
ActivateConsumable(item);
|
||||
bay.Remove(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryActivateConsumable(AetheriaRuntimeCatalogItem typedItem)
|
||||
{
|
||||
if (!CanActivateConsumable(typedItem)) return false;
|
||||
|
|
|
|||
|
|
@ -804,10 +804,13 @@ First Aetheria surfaces to publish:
|
|||
Wwise parameter updates off `EquippableItemData.AudioStats`; missing
|
||||
typed audio stat bindings produce no parameter updates.
|
||||
- Done: add typed consumable stackability, duration, and effectiveness curve
|
||||
fields and route action-bar consumable activation/runtime evaluation
|
||||
through typed item rows; verifier records that the current mapped catalog
|
||||
has `0` consumable item rows, so future consumable content still needs
|
||||
typed coverage.
|
||||
fields and route action-bar consumable activation/runtime evaluation
|
||||
through typed item rows; verifier records that the current mapped catalog
|
||||
has `0` consumable item rows, so future consumable content still needs
|
||||
typed coverage.
|
||||
- Done: delete `Entity` consumable activation overloads that accepted
|
||||
`ConsumableItemData`; active lookup uses item ids and activation commands
|
||||
accept typed runtime catalog rows only.
|
||||
- Done: import action-bar icon resource paths into typed item definitions and
|
||||
move `ActionBarSlot` custom gear icon lookup onto typed runtime item rows.
|
||||
- Done: move `Ship` drag, combat/turret predicted shot height, and thruster
|
||||
|
|
|
|||
Loading…
Reference in a new issue