Move weapon ammo display behind runtime owner

This commit is contained in:
Meta Vens 2026-06-14 18:05:26 +01:00
commit 6b8ac0cb07
4 changed files with 16 additions and 7 deletions

Binary file not shown.

View file

@ -69,9 +69,11 @@ public abstract class Weapon : Behavior, IActivatedBehavior
public abstract float DamagePerSecond { get; }
public abstract float RangeDamagePerSecond(float range);
public abstract int Ammo { get; }
public WeaponData WeaponData => _data;
public DamageType DamageType { get; }
public string EffectPrefab { get; }
public Guid AmmoType { get; }
public int MagazineSize { get; }
public bool UsesAmmo => AmmoType != Guid.Empty;
public GuidedProjectileTargetMode GuidedProjectileTargeting { get; private set; }
public bool HasGuidedProjectileProfile => GuidedProjectileTargeting != GuidedProjectileTargetMode.None;
public float4[] GuidedProjectileGuidanceCurve { get; private set; }
@ -102,6 +104,8 @@ public abstract class Weapon : Behavior, IActivatedBehavior
_data = data;
DamageType = data.DamageType;
EffectPrefab = data.EffectPrefab ?? "";
AmmoType = data.AmmoType;
MagazineSize = data.MagazineSize;
InitializeGuidedProjectileProfile(data);
}
@ -110,6 +114,8 @@ public abstract class Weapon : Behavior, IActivatedBehavior
_data = data;
DamageType = data.DamageType;
EffectPrefab = data.EffectPrefab ?? "";
AmmoType = data.AmmoType;
MagazineSize = data.MagazineSize;
InitializeGuidedProjectileProfile(data);
}

View file

@ -136,8 +136,8 @@ public class SchematicDisplay : MonoBehaviour
//x.ListElement.Label.text = x.Item.EquippableItem.Name;
if (!_enemy)
{
x.ListElement.InfiniteAmmoIcon.gameObject.SetActive(x.Weapon.WeaponData.AmmoType == Guid.Empty);
x.ListElement.AmmoLabel.gameObject.SetActive(x.Weapon.WeaponData.AmmoType != Guid.Empty);
x.ListElement.InfiniteAmmoIcon.gameObject.SetActive(!x.Weapon.UsesAmmo);
x.ListElement.AmmoLabel.gameObject.SetActive(x.Weapon.UsesAmmo);
}
}
}
@ -251,16 +251,16 @@ public class SchematicDisplay : MonoBehaviour
if (x.Cooldown != null)
x.ListElement.CooldownFill.anchorMax = new Vector2(x.Cooldown.Progress, 1);
x.ListElement.DurabilityLabel.text = $"{(int)(x.Item.EquippableItem.Durability / GetMaxDurability(x.Item.EquippableItem) * 100)}%";
if (x.Weapon.WeaponData.AmmoType != Guid.Empty)
if (x.Weapon.UsesAmmo)
{
if(x.Weapon.WeaponData.MagazineSize > 1)
if(x.Weapon.MagazineSize > 1)
x.ListElement.AmmoLabel.text = x.Weapon.Ammo.ToString();
else
x.ListElement.AmmoLabel.text = _entity.CountItemsInCargo(x.Weapon.WeaponData.AmmoType).ToString();
x.ListElement.AmmoLabel.text = _entity.CountItemsInCargo(x.Weapon.AmmoType).ToString();
}
}
if (x.Weapon.WeaponData != null)
if (x.Weapon != null)
{
if(x.ListElement.RangeLabel)
x.ListElement.RangeLabel.text = ((int) x.Weapon.Range).ToString();

View file

@ -1017,6 +1017,9 @@ First Aetheria surfaces to publish:
`GuidedWeaponData`; `GuidedProjectileManager` now consumes
`Weapon`-owned target mode, curve keys, dodge frequency, and evaluated
thrust/top-speed values.
- Done: move HUD ammo display reads off `WeaponData`; `SchematicDisplay`
consumes `Weapon.AmmoType`, `Weapon.MagazineSize`, and `Weapon.UsesAmmo`,
and the public `WeaponData` escape hatch has been removed.
- Done: delete the legacy `Behaviors` lists from `ConsumableItemData` and
`EquippableItemData`; item DTOs can no longer carry behavior config state.
- Done: move runtime blueprint price aggregation and conductivity restore