Remove an unequipped weapon from its weapon groups (Cut 10 fix)

TryUnequip removed a weapon from _weapons but left it in WeaponGroups, so an
unequipped weapon could still be fired from its action-bar group and
EntitySerializer.Pack wrote -1 for it. The removal mirrors the group toggle in
WeaponGroupAssignment.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 22:30:40 +02:00
commit 890063b8bb

View file

@ -504,7 +504,10 @@ public abstract class Entity
foreach (var b in item.Behaviors)
{
if (b is Weapon weapon)
{
_weapons.Remove(weapon);
foreach (var group in WeaponGroups) { group.items.Remove(item); group.weapons.Remove(weapon); }
}
if (b is Capacitor capacitor)
_capacitors.Remove(capacitor);
if (b is Reactor reactor)