LANTERN purge B6: delete the legacy single-ability path (sockets are THE ability model)

AbilityRef, AbilityCooldown, EffectiveAbilityStats, DefaultAbility deleted.
GoInGameServerSystem seeds the per-frame 4-socket Spark loadout UNCONDITIONALLY
(was gym-only); ClassSelectReceiveSystem + DebugOp.SetClass swap FrameId +
re-seed sockets + zero SocketCooldown; ClassSwapUtil.Apply drops newAbilityId;
EquipSystem weapons become stat-sticks (GrantedAbilityId removed from the item
blob/authoring); StatRecomputeSystem folds CharacterStatsRef + sockets only;
HUD cooldown bar reads socket 0 of SocketCooldown/EffectiveSocketStats; class
HUD readers are FrameId-only (ClassForAbility/AbilityFor deleted);
DebugModifierInjectionSystem drops CycleAbility.

390 tests green; Play-verified: a non-gym spawn gets frame=2 with Sparks
[7,8,6,9] and no console errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 15:47:12 -07:00
parent b34945c2d2
commit 4a8220ad3e
27 changed files with 137 additions and 275 deletions
@@ -11,14 +11,14 @@ namespace ProjectM.Server
/// Resolves the sender's player (SourceConnection -&gt; NetworkId -&gt; GhostOwner, the AbilityUpgradeSystem /
/// InventoryDepositSystem owner-map idiom) and applies the change IN-PLACE: moves the item between the
/// personal <see cref="InventorySlot"/> bag and the <see cref="EquipmentSlot"/> loadout (buffer index = slot),
/// sets <see cref="AbilityRef"/>.Id from the Weapon slot (restoring <see cref="DefaultAbility"/> on
/// weapon-unequip), and adds/strips the item's inline stat mods as <see cref="StatModifier"/>s tagged by a
/// and adds/strips the item's inline stat mods as <see cref="StatModifier"/>s tagged by a
/// per-slot SourceId (<c>Tuning.EquipSourceIdBase + slot</c>), stripped TARGET-AGNOSTICALLY via
/// <see cref="TimedModifierUtil.RemoveBySourceId"/>.
/// <see cref="TimedModifierUtil.RemoveBySourceId"/>. (LANTERN purge: weapons are stat-sticks — the old
/// weapon->ability grant is deleted; abilities live in the 4-socket Spark loadout.)
///
/// Effects are EVENT-DRIVEN (applied once here): AbilityRef + StatModifier are [GhostField]s re-folded by the
/// Effects are EVENT-DRIVEN (applied once here): StatModifier is a [GhostField] buffer re-folded by the
/// predicted StatRecomputeSystem every tick and replicated to the owner, so the swap is prediction-correct
/// (DebugModifierInjectionSystem.CycleAbility is the precedent) and survives respawn (the entity persists).
/// and survives respawn (the entity persists).
/// Atomicity: an equip into an occupied slot verifies the bag can hold the swapped-out item BEFORE any
/// withdrawal and rejects otherwise — no item loss (the co-op-placement commit-in-place rule). Plain server
/// SimulationSystemGroup (NOT predicted -&gt; applied once, no rollback double-apply); only the request entity
@@ -127,10 +127,8 @@ namespace ProjectM.Server
static void ApplySlotEffects(ref SystemState state, Entity player, byte slot, ItemDefBlob def)
{
// Weapon slot drives the active ability (swaps prefab + base stats via StatRecomputeSystem).
if (slot == EquipSlotId.Weapon && def.GrantedAbilityId != 0)
state.EntityManager.SetComponentData(player, new AbilityRef { Id = def.GrantedAbilityId });
// LANTERN purge: weapons are stat-sticks — the old weapon->AbilityRef ability grant is deleted
// (abilities live in the 4-socket Spark loadout).
var mods = state.EntityManager.GetBuffer<StatModifier>(player);
uint sourceId = Tuning.EquipSourceIdBase + (uint)slot;
for (int i = 0; i < ItemDefBlob.MaxMods; i++)
@@ -145,13 +143,6 @@ namespace ProjectM.Server
{
var mods = state.EntityManager.GetBuffer<StatModifier>(player);
TimedModifierUtil.RemoveBySourceId(mods, Tuning.EquipSourceIdBase + (uint)slot);
// Weapon slot: restore the unarmed/base ability.
if (slot == EquipSlotId.Weapon)
{
byte fallback = state.EntityManager.GetComponentData<DefaultAbility>(player).Id;
state.EntityManager.SetComponentData(player, new AbilityRef { Id = fallback });
}
}
static int StackMaxOf(ref ItemDatabaseBlob db, ushort itemId)