-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Line 1321 in 70bb0e0
| weaponMax = APIs.WeaponCore.GetMaxWeaponRange(termBlock as MyEntity, 0); |
Occasionally, this function works fine, but at other times it returns 0 meters, rendering the weapon useless.
Examining the logs shows that it successfully retrieved and applied 0 meters from the WC API GetMaxWeaponRange; otherwise, it would have been the default 800. This WC method is set to return 0f if the result is null, leading me to believe that MES may be sending incorrect weapon reference data to WC.
public float GetMaxWeaponRange(Sandbox.ModAPI.Ingame.IMyTerminalBlock weapon, int weaponId) =>
_getMaxWeaponRange?.Invoke(weapon, weaponId) ?? 0f;I can't tell if it the bug is on MES's end, or WC's end. In the log, the Hurricane and Sentinel are both MyObjectBuilder_LargeMissileTurret TypeIds, so I don't think the issue is related to specific TypeIds. Also, on some NPCs the same Sentinel turret range is set to max just fine.
Additionally, but likely a different problem, is that MES is setting the weapon range on the same weapon 13 times. This is coincidentally the total number of grids and subgrids for this specific NPC (one main grid and 12 wheels), leading me to believe it is trying to apply this to all subgrids unnecessarily, since wheels do not have weapons.
SetWeaponsToMaxRange log sample.txt
NPC in question:
