Use typed durability for thruster VFX
This commit is contained in:
parent
fee50c5ad6
commit
c21d166e39
3 changed files with 22 additions and 3 deletions
Binary file not shown.
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using GameCult.Aetheria.State.Unity;
|
||||
using UnityEngine;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
|
@ -129,11 +130,27 @@ public class ShipInstance : EntityInstance
|
|||
{
|
||||
var emissionModule = thrusterInstance.System.emission;
|
||||
var item = thrusterInstance.Thruster.Item.EquippableItem;
|
||||
var data = Entity.ItemManager.GetData(item);
|
||||
thrusterInstance.MaxParticleCount = thrusterInstance.System.particleCount;
|
||||
emissionModule.rateOverTimeMultiplier = thrusterInstance.BaseEmission * thrusterInstance.Thruster.Axis * (item.Durability / data.Durability);
|
||||
emissionModule.rateOverTimeMultiplier = thrusterInstance.BaseEmission * thrusterInstance.Thruster.Axis * (item.Durability / GetMaxDurability(item));
|
||||
}
|
||||
|
||||
transform.rotation = Ship.Rotation;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetMaxDurability(ItemInstance item)
|
||||
{
|
||||
var typedItem = FindTypedItem(item);
|
||||
if (typedItem != null && typedItem.Durability > 0)
|
||||
return (float)typedItem.Durability;
|
||||
|
||||
return Entity.ItemManager.GetData(item).Durability;
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
||||
{
|
||||
var itemId = item?.Data?.ItemId ?? Guid.Empty;
|
||||
return itemId == Guid.Empty
|
||||
? null
|
||||
: ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
legacy `WeaponItemData`.
|
||||
Hull and item durability percentages use typed max durability before falling
|
||||
back to legacy `ItemData.Durability`.
|
||||
Ship thruster VFX emission scaling also uses typed max durability before
|
||||
falling back to legacy `ItemData.Durability`.
|
||||
Runtime weapon behavior still owns ammo counts, active range, cooldowns,
|
||||
temperature, and durability display until those session facts have typed
|
||||
runtime surfaces.
|
||||
|
|
|
|||
Loading…
Reference in a new issue