From a424be6bbc8061f2d61487171e9d1b2eb8001316 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 17:32:53 +0100 Subject: [PATCH] Move turret weapon stats behind runtime owner --- .voidbot/state/aetheria.cc | Bin 85623 -> 85367 bytes .../Behaviors/TurretController.cs | 8 ++------ .../Scripts/ServerShared/Behaviors/Weapon.cs | 10 ++++++++++ docs/aetheria-perfect-machine-map.md | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 1b405ae20540098081d1b4d04d96ffacf48431a5..a450437ae971f956001921c4ce444e91a0dbc675 100644 GIT binary patch delta 1268 zcmah}ziSjh6lP+K8YEp%ugOSIQg|0PKgZ^2pf5wvN_hjJJwI;X3mW>Fl(SVE1HH< zV2UkZbt#IfAqzdxRO*E8>LX$-eW+0%7 zi5gHQ0@{Q~`rNcj@BE1Ixbx-^Qe8p7eZ!mBz+>AKa>Yf>p#

aLuLAw4uS>SE{d@n+&)NYpltoDpii z2N5dEw`c%{@kr;2h9UMAM^U4YtyHxo)s1d0HJ7X+@$lhO!`_ z0$MaTmZCR{*AUouI+`_RD2{^ x`T&D1-E>UE`ltP2MNsujprsjIk7*ityji4{b z$f*&^d>^!yIF?how1xcEq`D2EevvF*A5DKQkimhxJ^i&nMsHLdR(_rSXL2&l4-#<< zN}F#{md;$_wazCu_fBto>>fiubR!1!0iQ8b?as=f)VU+Q{JPfObXlJNlg!dKG=u1=LLF8szS%Lu2RmdNlBHeQ6_fw(v{c>ohVPM|k}+9m!?m$f<_QXzW#2!){jt8XoF22=$9pFp^oKMY6)U z$S_y>#5HM#S=9BJzZ!Y1=+WA(S++v)R3!`REQwuS#`LMjCB^=#M=h+8@G^5POyFk= z9(Y*e86V6NVb0;vWTiG10Tgm5hQdC@p5TwE=`-&3;4&p1cY8gt#%)2R#DbS)4}JiN zbKGJDMn$!rLwvKyT)QVOdhJQTJm}}9Pn~K`+zRAiL5Y=)W8BuQ>H&=#NzXurO5|$= z^&*DHei8n&i|Okb;*$h{i`rleVr=--l`ziXzD8Fs0M8*nBPJ3MfjsJXToAE}O%7E> zVESD2DoQdiW>3jd@dC5)l3XTm zCZ-7-a-j;sr^|7PyEahhQqZjeKQn(PRyX|A)UmcV!yye`S{5XgQ>C<)*rFy=vnj}g z6)nF}LrZNm=4BKIurr#H6D7E=_C_s7DW)i4OsS{gbkhkZm`P};M15)*o3O)0F7DHU zd>eL`$D)-nbZKEhm%}FU`~bMB@RKe;qC2pYssPjBg5b{IDpl1851RYJ=RaDa@8hWD z;p`j{%ktl&smUtJmz1-#2U2EbAPU5!#ui;sF_WrM!th()Rk~M6&cuevR1LEs1IK|C zI-J&XY6~TvfXu{3(j}fOg0RX@+HtiFhdcT9aH8BE{yMsFZ(CQ?9!o0?o$STf`#M<( z{RbT(`k9+cQEg>5&^1NP|Hr+xfU#yF`r6jqKi@Yrk{^f;CeW4h`GJva7OrD<@x4!M z8AfOlb)Ma1t{E&5bzh>LDb&^qZw5#7CC!Bg^&R?V<_FZxjMgX7=QN}bYg6=M3UM9o ak1ud^ZW_HzLxbw^?$$KgKdoZ}*~Q _weapons = new List(); private float _shotSpeed; private bool _predictShots; @@ -33,12 +32,10 @@ public class TurretController : Behavior, IInitializableBehavior public TurretController(TurretControllerData data, EquippedItem item) : base(data, item) { - _data = data; } public TurretController(TurretControllerData data, ConsumableItemEffect item) : base(data, item) { - _data = data; } public void Initialize() @@ -46,7 +43,7 @@ public class TurretController : Behavior, IInitializableBehavior foreach (var weapon in Entity.GetBehaviors()) { _weapons.Add(weapon); - var vel = weapon.Evaluate(weapon.WeaponData.Velocity); + var vel = weapon.EvaluateVelocity(); if (vel > .1f) { _predictShots = true; @@ -77,11 +74,10 @@ public class TurretController : Behavior, IInitializableBehavior foreach (var x in _weapons) { - var data = x.Data as WeaponData; var fire = dot( x.Direction, Entity.LookDirection) > .99f; - if (x.Evaluate(data.Range) > dist && fire) + if (x.EvaluateRange() > dist && fire) { x.Activate(); } diff --git a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs index a780eacda..4d81c3691 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs @@ -126,4 +126,14 @@ public abstract class Weapon : Behavior, IActivatedBehavior { _firing = false; } + + public float EvaluateRange() + { + return Evaluate(_data.Range); + } + + public float EvaluateVelocity() + { + return Evaluate(_data.Velocity); + } } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 7172e809a..f1aa5d5e7 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -838,6 +838,9 @@ First Aetheria surfaces to publish: and target-stat count. - Done: extend behavior state rows for TurretController initialized weapon count, shot speed, and predictive-aim flag. + - Done: move TurretController weapon range and shot-speed evaluation behind + `Weapon` runtime methods, so turret AI no longer casts weapon config DTOs + to decide firing range or predictive aim. - Done: cut live simulation grids out of `RuntimeEntityBlueprint`; loadout and construction templates no longer capture or restore temperature, armor, max-armor, or hull-conductivity state. @@ -994,6 +997,9 @@ First Aetheria surfaces to publish: config bridge onto `Behavior.Kind` and `Behavior.Group`, so state snapshots, weapon snapshots, progress rows, stat-modifier matching, and behavior grouping use runtime instance identity. + - Done: move TurretController's weapon range/velocity reads off + `WeaponData` casts and onto `Weapon.EvaluateRange`/`EvaluateVelocity`; + weapon config fields remain private inputs to the weapon runtime owner. - 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