7571091394
- SoD facing: PlayerFacing = body-yaw only (move-facing / cast-turn / idle-hold); every fire direction re-sourced to FacingMath.ResolveAim (pre-code review blocking catch); TickWindowMath shared windows with Movement-skip; reticle/FX coupled to the damage direction; cursor-dash kept. - Underwater feel: sharpness 15->6, turn 720->360, MoveSpeed 6->4.2; TuningKnob 26-28 (0 = no-override sentinels, dev-protocol bump on DebugTuningReport); stride footsteps + silt + cadence floor; bubbles; underwater ambience bed + distant groans; camera drag + dev scroll zoom. - Bathynaut kit in-engine: dome/tank/shoulder-lamp + bare head grafted (GraftSmr rigid rebase, RecalculateTangents); EmissiveGloamSkinned shader (Rukhanka deformation); shoulder lamp CASTS (warm steady spot on body yaw). - Gait: two-ring walk/run FreeformDirectional tree (walk @0.35, run @1.0) + blended-natural StrideScale; additive Posture(Bank) + Lead(chest-lead) layers; idle = AnimationIdles Base; banking driven from facing turn rate; flat terrain (Env_SeabedKit seabed squashed - CC is planar). - New packs: Synty AnimationIdles + AnimationSwordCombat (combat pass queued) + SyntyPropBoneTool; four authored clips (sway/trudge/banks/lean) + Anim_Player_Underwater.blend + suit-kit FBX. - Validation: 411/411 EditMode green; Play smokes (server==client facing, Aim-true projectile, bank/stride live-sampled, lamp beam verified); pre-code + post-impl adversarial reviews applied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
61 lines
3.5 KiB
C#
61 lines
3.5 KiB
C#
using Unity.Burst;
|
|
using Unity.Entities;
|
|
using Unity.Mathematics;
|
|
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Derives the LOCAL enableable <see cref="Dead"/> gate from the replicated <see cref="Health"/> every predicted
|
|
/// tick (Dead == Health.Current <= 0). Runs in BOTH worlds inside
|
|
/// <see cref="PredictedSimulationSystemGroup"/>, BEFORE movement/aim/fire, so a dead player is excluded from
|
|
/// those systems (which query <c>.WithDisabled<Dead>()</c>) on the server AND the owner-predicting client.
|
|
/// Because it is a pure function of the already-replicated, reconciled Health (the same derive-don't-replicate
|
|
/// pattern as <see cref="StatRecomputeSystem"/>), the gate is identical across server, owner-client, and rollback
|
|
/// — no replicated enabled bit required. Also zeroes <see cref="CharacterControl.MoveVelocity"/> while dead so
|
|
/// the kinematic character holds still (the movement system is skipped and would otherwise coast on stale
|
|
/// velocity). The authoritative recovery (Health refill + reposition) is owned server-side by
|
|
/// <c>PlayerRespawnSystem</c>. Visits dead players too via <c>.WithPresent<Dead>()</c> (required to write
|
|
/// the enabled bit on an entity whose Dead is currently disabled).
|
|
/// </summary>
|
|
[UpdateInGroup(typeof(PredictedSimulationSystemGroup))]
|
|
[UpdateBefore(typeof(PlayerControlSystem))]
|
|
[UpdateBefore(typeof(PlayerAimSystem))]
|
|
[BurstCompile]
|
|
public partial struct PlayerDeathStateSystem : ISystem
|
|
{
|
|
[BurstCompile]
|
|
public void OnUpdate(ref SystemState state)
|
|
{
|
|
foreach (var (health, control, deadEnabled, entity) in
|
|
SystemAPI.Query<RefRO<Health>, RefRW<CharacterControl>, EnabledRefRW<Dead>>()
|
|
.WithAll<PlayerTag, Simulate>()
|
|
.WithPresent<Dead>()
|
|
.WithEntityAccess())
|
|
{
|
|
bool isDead = health.ValueRO.Current <= 0f;
|
|
deadEnabled.ValueRW = isDead;
|
|
if (isDead)
|
|
{
|
|
control.ValueRW.MoveVelocity = float3.zero;
|
|
// MC-1: clear any in-flight dash window + restore base sharpness so a death mid-dash leaves
|
|
// no stale i-frames / stuck-fast on respawn (DashSystem skips dead players via .WithDisabled<Dead>()).
|
|
if (SystemAPI.HasComponent<DashState>(entity))
|
|
SystemAPI.SetComponent(entity, default(DashState));
|
|
// MC-4: clear any in-flight combo so a death mid-combo leaves no stale lock/step on respawn.
|
|
if (SystemAPI.HasComponent<MeleeCombo>(entity))
|
|
SystemAPI.SetComponent(entity, default(MeleeCombo));
|
|
if (SystemAPI.HasComponent<CharacterComponent>(entity))
|
|
{
|
|
var cc = SystemAPI.GetComponent<CharacterComponent>(entity);
|
|
// 07-15: honor the MoveSharpness dev-override (0 = authored const) like the dash/blink restores.
|
|
var tdc = SystemAPI.TryGetSingleton<TuningConfig>(out var tdcv) ? tdcv : TuningConfig.Defaults();
|
|
cc.GroundedMovementSharpness = tdc.MoveSharpness > 0f ? tdc.MoveSharpness : CharacterComponent.DefaultGroundedSharpness;
|
|
SystemAPI.SetComponent(entity, cc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|