Slice 2 (WIP): class carrier (GoInGameRequest.ClassId) + Warrior cone archetype

The per-player class travels on GoInGameRequest.ClassId (client reads a ClassSelection
singleton); GoInGameServerSystem seeds the class at spawn via ClassTraits (AbilityRef +
permanent trait StatModifiers on a reserved ClassSourceId; CharacterStatsRef stays Default
so the DRG-asymmetry deltas ride the replicated OwnerSendType.All buffer). AbilityFireSystem
gains the aim-directed Cone archetype: cooldown predicted both worlds, server-only cone
damage to living enemies (same-tick, SourceTick-stamped, like the melee cleave). 345/345.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-18 00:30:20 -07:00
parent d9d67c4e78
commit a7fdd6f71d
9 changed files with 127 additions and 9 deletions
@@ -64,14 +64,18 @@ namespace ProjectM.Simulation
bool isServer = state.WorldUnmanaged.IsServer();
// Server-only auto-target candidate set: training-dummy world XZ positions, collected once.
// Server-only target set (LIVING enemies/dummies), collected once: positions feed the gamepad
// auto-target assist, and entities+positions feed the Warrior CONE archetype's server-only cleave.
var candidatePositions = new NativeList<float3>(Allocator.Temp);
var coneTargets = new NativeList<Entity>(Allocator.Temp);
var coneTargetPos = new NativeList<float3>(Allocator.Temp);
if (isServer)
{
foreach (var dummyTransform in
SystemAPI.Query<RefRO<LocalTransform>>().WithAny<TrainingDummyTag, EnemyTag>())
foreach (var (tx, th, te) in
SystemAPI.Query<RefRO<LocalTransform>, RefRO<Health>>().WithAny<TrainingDummyTag, EnemyTag>().WithEntityAccess())
{
candidatePositions.Add(dummyTransform.ValueRO.Position);
candidatePositions.Add(tx.ValueRO.Position);
if (th.ValueRO.Current > 0f) { coneTargets.Add(te); coneTargetPos.Add(tx.ValueRO.Position); }
}
}
var candidates = candidatePositions.AsArray();
@@ -105,6 +109,35 @@ namespace ProjectM.Simulation
// abilities are Projectile (0); hitscan/cone/aoe archetypes plug in at this point in MC-6.
ref var adb = ref abilityDb.Value.Value;
byte archetype = adb.TryGetAbility(abilityRef.ValueRO.Id, out var adef) ? adef.Archetype : (byte)AbilityArchetype.Projectile;
// Slice 2: the Warrior's aim-directed CONE secondary (no projectile ghost). Predict the cooldown on
// both worlds; apply server-only cone damage to living enemies (mirrors the MeleeComboSystem cleave,
// same-tick: this runs before HealthApplyDamageSystem in the predicted group). SourceTick-stamped.
if (archetype == (byte)AbilityArchetype.Cone)
{
if (isServer)
{
float2 cFace = facing.ValueRO.Direction;
cFace = math.lengthsq(cFace) < 1e-6f ? new float2(0f, 1f) : math.normalize(cFace);
float cRange = math.max(0.1f, eff.ValueRO.Range);
float cCosHalf = math.cos(math.clamp(eff.ValueRO.AutoTargetConeRadians, 0.01f, 3.14159f));
uint cStamp = TickUtil.NonZero(serverTick.TickIndexForValidTick);
for (int ci = 0; ci < coneTargets.Length; ci++)
{
if (!MeleeConeMath.InCone(xform.ValueRO.Position, cFace, cRange, cCosHalf, coneTargetPos[ci]))
continue;
ecb.AppendToBuffer(coneTargets[ci], new DamageEvent
{
Amount = eff.ValueRO.Damage,
SourceNetworkId = owner.ValueRO.NetworkId,
SourceTick = cStamp,
});
}
}
uint coneCd = (uint)math.max(1, eff.ValueRO.CooldownTicks);
cd.ValueRW.NextFireTick = TickUtil.NonZero(serverTick.TickIndexForValidTick + coneCd);
continue;
}
if (archetype != (byte)AbilityArchetype.Projectile)
continue;
@@ -179,6 +212,8 @@ namespace ProjectM.Simulation
ecb.Playback(state.EntityManager);
ecb.Dispose();
candidatePositions.Dispose();
coneTargets.Dispose();
coneTargetPos.Dispose();
}
}
}