From 6b8ac0cb0725dcfc061071a4d85b3332538227b4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 18:05:26 +0100 Subject: [PATCH] Move weapon ammo display behind runtime owner --- .voidbot/state/aetheria.cc | Bin 85314 -> 85201 bytes .../Scripts/ServerShared/Behaviors/Weapon.cs | 8 +++++++- Assets/Scripts/UI/HUD/SchematicDisplay.cs | 12 ++++++------ docs/aetheria-perfect-machine-map.md | 3 +++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 7fa6ae95d893ac691858eabe3cd27c54dd2c6d24..a400c09f1b167776e5084137dc15e259e7d24bff 100644 GIT binary patch delta 928 zcmZWoO;1xn6wRZcphjb2Y~0{Yj0+N5ND5LAltN8xf=EJ%#<-cjcS}d+&5SeiT8ax6 z#+|!o^3<(ST{I0 z(bq-iV)$*~MT%4>Dk&lgPjh4{MTQ4256r!MHa56FHt1BRuapRy4k}7YJtR`_67hXe zQUN#A$CBuARFOREJUTObKZ!#e56_({?qoTT)`5?Pc*KzMJC_maA3a}lJLnTb-8$8h zkv_PB>%d11X{U0{c53z|Udw^IWP@x|j%#$=f`of{U|pk*vu}Xq3NmOh>Mm!&x}6D9 z35m+|p+hvZ5IHFHMHjvDu0gJ;;71>BTS=zh;Mx%GB4|Syi#ZuWdDNVDuC~*eE$omk z6$-2lZ3kzWn~2iRp8)asJ11H5vkD& zpX^;&`d$~ng|Reki4tC58Kt%)daMcp>y7c+Y6DQaM50w@+)f#4o(G&LC3?}%d8arB zZOc?D)M$kmEA-DI5(5*~f7#l3#M73hrXE80Y46e~ZlN0_g{hEsz*yhr*_FBIMUQVf z4^~#P-Q$)Nu_Gygk>p{YO-~H`Wh-d@hD_mGRZp|4t-`yEEF&%}7UN z+od)ZtEE;?A}&5fV5Ehq-xwXB<~Sn&H0i;*;k3eiKwyY$Q-W5nXgVJuUDN6e-(=Ry(Q;hWF$kT9{vVjIY}n~ delta 1087 zcmb7EJx>)u6wM$gG*%cxt!(@O-u-xdXe=!E&fGKSo^$SgecAEpRmb5$Ti3v?!BJ;) zVrca_yR!GC?OCfZo)y%Er+Hy)U@$9mwqI+T?AYmTKk98~<2P@Na@X#wo zT0KG6iU3PGmR5wAmVEk7qRVWpF*lptgVTF}zE2$nq^g0dq=`cW4n;TAkVi^F3eTmB zX=94!ym13A!sc;~w{-ICBA2{^8Z>gxz~ijDq-qj9uv|APXdzS{_JJGgErboMn?CTA zS3&SKZpJ9xdLMA<0dDai=9U^mVGO+qwyI-e`>l$=L`Vlh8cXkh^1-69LRJdCPMKQ{ zzS6M3W9gDaSwS^4p#o2sDBuOx z`y{okKOj1pNI6248xqn}I^@!VuoybY_dBe+|29oR*uZr<6N1ET3*|=-fyZ>92?+w^ z8wRW*ne5)?hwkg|<`E-Uk?CRX7!YhKwJBVq>661rcD3Qaq9SSkWD4t86{M@=T9ehq zuq~g-*9f&0H1Rr;a0ng-m`R#ajNAE0k!5FsM|q$)q^A8}BFHNUDfh}V&dzI%esk~RkEP}1e??I$2$Vbx<@reb zod~j4(?$gKWNV5ou(jm#6dUPDH{d+~Vil6kY1Zg@pP!#u!2Mbl{$zKWm5VJN97(r0 t`8CasTa}4o(Jv<7?y;yd`yY%A4JAu6?8T-0YxwBr3~P239m6+Qe*<{hhxPyf diff --git a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs index 63b7e3ba9..0950b7015 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs @@ -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); } diff --git a/Assets/Scripts/UI/HUD/SchematicDisplay.cs b/Assets/Scripts/UI/HUD/SchematicDisplay.cs index 77f28e509..01a759be2 100644 --- a/Assets/Scripts/UI/HUD/SchematicDisplay.cs +++ b/Assets/Scripts/UI/HUD/SchematicDisplay.cs @@ -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(); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index bd713bfe2..952af081d 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -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