Mass Battle Frameworkv1.20.0

Death.h

USTRUCT ×2 Tag ×2

Source/MassBattle/Public/Fragments/Death.h

概述Overview

死亡流程的 fragment 集合:配置 FDeath(延迟删除、淡出、动画策略、死亡时碰撞/网格参与、自杀特殊规则)、运行时状态 FDying(死亡过程计时、致死实体与方向、碰撞禁用倒计时、片段 notify 游标、布娃娃请求位)与两个标记 FDyingTag(死亡中)/ FDestroyingTag(销毁中)。死亡时的 Actor / 特效 / 音效 / 战利品生成不在本片段上配置,改由 agent 配置的 notify 表以 Death 事件族的 Event 行驱动。

Death-flow fragments: config FDeath (despawn delay, fade-out, animation policy, dying-time grid/collision participation, suicide special rules), runtime state FDying (death timers, fatal entity and direction, collision-disable countdown, clip-notify cursor, ragdoll request flag) and two tags FDyingTag (dying) / FDestroyingTag (destroying). Death-time Actor / FX / sound / loot spawns are not configured on this fragment — they come from Event rows of family Death in the agent config's notify table.

FDeath USTRUCT

死亡配置 fragment(FA_MassBattleBaseFragment 派生)。可编辑字段为策划在 Agent 配置的 Death 面板中可调,运行时不变;末尾的生成数组仅为资产迁移保留——编辑器不显示、运行期不再读取。经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明为不可平凡拷贝(含 TArray 成员)。

Death config fragment (derived from FA_MassBattleBaseFragment). Its editable fields are designer-tunable on the Agent config's Death panel and constant at runtime; the trailing spawn arrays are kept for asset migration only — hidden from the editor, no longer read at runtime. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE as not-trivially-copyable (contains TArray members).

成员变量Members

名称Name类型Type默认值说明Description
bEnablebooltrue是否启用死亡逻辑。Whether to enable death logic.
DespawnDelayfloat3.f死亡后删除的延迟时间(秒)。Delay before despawn after death (seconds).
bCanFadeoutbooltrue是否启用淡出效果。Whether to enable the fade-out effect.
FadeOutDelayfloat2.f淡出效果的延迟时间(秒)。Delay for the fade-out effect (seconds).
bCanPlayAnimbooltrue是否播放死亡动画。Whether to play the death animation.
bAnimAsDurationboolfalse勾选后使用死亡动画长度作为死亡行为时长(动画长度定义在 Animation fragment 里)。仅当 bCanPlayAnim 为 true 时可编辑。When enabled, uses the death anim length as the death behavior duration (defined in the Animation fragment). Editable only when bCanPlayAnim is true.
AnimLengthfloat2.f死亡动画长度(秒)。仅当播动画且未用动画时长时可编辑。Death animation length (seconds). Editable only when animation is on and anim-as-duration is off.
LifeSpanfloat-1.f寿命(秒),负值为无限长。Lifespan (seconds); negative for infinite.
bExcludeFromHashGridbooltrue启用时,Agent 死亡时将不会注册到哈希网格。If enabled, the agent will not be registered to the hash grid when dying.
bCanFallDownbooltrue死亡的飞行单位坠落(重力)而非悬停。纯配置方案:坠落在移动处理器的 Z 决策点由已同步的死亡状态 + 本静态配置推导,Move.Z.bCanFly 不会在运行时被改写——运行时改写配置 fragment 会在实体按 DataAsset 模板重建后丢失,重建的尸体因此与服务端的姿势不一致。Dying flying agents fall to the ground (gravity) instead of hovering. Config-only: the fall is derived at the move processors' Z decision sites from the synced dying state plus this static config, and Move.Z.bCanFly is never mutated at runtime — a runtime write to a config fragment is lost when the entity is rebuilt from its DataAsset template, which would leave the rebuilt corpse out of step with the server's.
bDisableCollisionWithAgentbooltrue启用时,Agent 死亡时将不会与其他 Agent 发生碰撞(禁用 PBD)。If enabled, the agent will not collide with other agents when dying (PBD disabled).
DisableCollisionWithAgentDelayfloat0.f进入死亡状态后多久(秒)禁用与其他 Agent 的碰撞。0 = 立即禁用。仅 bDisableCollisionWithAgent 为 true 时可编辑。Delay (seconds) after entering the dying state before agent-vs-agent collision is disabled. 0 = disable immediately. Editable only when bDisableCollisionWithAgent is true.
bDisableCollisionWithObstboolfalse启用时,Agent 死亡时将不会与障碍物发生碰撞(禁用 PBD)。If enabled, the agent will not collide with obstacles when dying (PBD disabled).
bInstantRemovalOnSuicidebooltrue如果 Agent 死于自杀,则直接移除。If the death cause is suicide, remove the agent at once.
bDisableDeathSpawnOnSuicidebooltrue如果 Agent 死于自杀,不执行死亡生成逻辑。If the death cause is suicide, don't run death spawns.
bForceGroundAlignmentboolfalse启用时,死亡时强制启用地面对齐(俯仰和横滚匹配地面法线),无视 Move.Tilt 的 bAlignToGroundPitch/Roll 设置。If enabled, forces ground alignment (pitch and roll to match the ground normal) when dying, regardless of Move.Tilt's bAlignToGroundPitch/Roll settings.
SpawnActorTArray<FActorSpawnConfig>空empty遗留迁移字段:旧版死亡生成列表,编辑器不显示、运行期不再读取。死亡时生成 Actor 请改用 notify 表中 Death 事件族、动作为 Spawn Actor 的行。Legacy migration field: the old death-spawn list, hidden from the editor and no longer read at runtime. To spawn actors on death, use a Death-family Event row with action Spawn Actor in the notify table.
SpawnFxTArray<FFxConfig>空empty遗留迁移字段:旧版死亡特效列表,编辑器不显示、运行期不再读取。死亡时生成特效请改用 notify 表中 Death 事件族、动作为 Spawn FX 的行。Legacy migration field: the old death-effect list, hidden from the editor and no longer read at runtime. To spawn effects on death, use a Death-family Event row with action Spawn FX in the notify table.
PlaySoundTArray<FSoundConfig>空empty遗留迁移字段:旧版死亡音效列表,编辑器不显示、运行期不再读取。死亡时播放音效请改用 notify 表中 Death 事件族、动作为 Spawn Sound 的行。Legacy migration field: the old death-sound list, hidden from the editor and no longer read at runtime. To play sounds on death, use a Death-family Event row with action Spawn Sound in the notify table.
SpawnLootTArray<FLootConfig>空empty遗留迁移字段:旧版死亡掉落列表,编辑器不显示、运行期不再读取。死亡时生成战利品请改用 notify 表中 Death 事件族、动作为 Spawn Loot 的行。Legacy migration field: the old death-loot list, hidden from the editor and no longer read at runtime. To spawn loot on death, use a Death-family Event row with action Spawn Loot in the notify table.

FDying USTRUCT

死亡运行时状态 fragment(FA_MassBattleBaseFragment 派生)。由死亡相关处理器逐帧推进:Time 累计死亡过程时间、DeathDissolveTime 累计消融时间、DeathAnimTime 累计动画时间;位域标志 bInitialized / bIsSuicide 标记流程阶段。默认构造器将三个位域显式清零。NotifyCursor 记录本次死亡已经处理到的片段 notify 时刻,bRagdollRequested 由 notify 表的 Ragdoll 动作锁存。

Death runtime state fragment (derived from FA_MassBattleBaseFragment), advanced per frame by the death processors: Time accumulates the death process, DeathDissolveTime the dissolve time, DeathAnimTime the animation time; the bitfield flags bInitialized / bIsSuicide mark the flow stage. The default constructor zeroes all three bitfields explicitly. NotifyCursor records the clip-notify time this death has already handled, and bRagdollRequested is latched by the notify table's Ragdoll action.

成员变量Members

名称Name类型Type默认值说明Description
bInitializeduint8 : 10死亡过程已初始化标志。Death process initialized flag.
bIsSuicideuint8 : 10是否为自杀。Whether the death was a suicide.
Durationfloat0.0f死亡过程持续时间(进入时按配置初始化)。Duration of the death process (seeded at entry from config).
Timefloat0.0f当前死亡过程已持续时间。Current elapsed time of the death process.
DeathDissolveTimefloat0.0f当前死亡消融时间。Current death dissolve time.
DeathAnimTimefloat0.0f当前死亡动画时间。Current death animation time.
InstigatorFEntityHandle—造成死亡的实体。The entity that caused the death.
HitDirectionFVector3fZeroVector致命打击的方向。Direction of the fatal hit.
DisableCollisionWithAgentTimerfloat0.f死亡期间禁用与其他 Agent 碰撞前的剩余倒计时(秒)。死亡进入时由 Death.DisableCollisionWithAgentDelay 初始化,ReactionProcessor 中递减;>0 表示碰撞仍生效。Countdown (seconds) before agent-vs-agent collision is disabled while dying; seeded on dying entry from Death.DisableCollisionWithAgentDelay, ticked down in the ReactionProcessor; >0 means collision is still active.
NotifyCursorfloat-1.0f本次死亡已经处理到的片段 notify 时刻(秒)。-1 表示还没有,因此 t=0 的 notify 在第一个 tick 就会触发;播放头倒退意味着新的死亡,处理侧会自行重置游标。Clip-notify time (seconds) this death has already handled. -1 means none, so a notify authored at t=0 fires on the first tick; a playhead that moves backwards means a new death, and the handling side resets the cursor itself.
bRagdollRequestedboolfalse由 notify 表的 Ragdoll 动作锁存;渲染侧把它变成布娃娃池槽。从不清除:尸体拥有布娃娃,直到实体消亡、槽位被回收。Latched by the notify table's Ragdoll action; the render side turns it into a ragdoll pool slot. Never cleared: the corpse owns the ragdoll until the entity dies out and its slot is freed.

方法Methods

FDying (constructor) FDying(bool, float, float, float, float, const FEntityHandle&, const FVector3f&, bool)

带参构造:初始化标志、持续时间、消融/动画时间、致死实体与方向;注意 Time 恒被置 0.0f(无论传入的 InTime 参数如何——参数名与赋值不一致,源码如此)。

Parameterized constructor: initializes flags, duration, dissolve/anim times, instigator and hit direction; note Time is always set to 0.0f regardless of the passed InTime parameter (parameter name vs assignment mismatch — as in the source).

Input
参数Param类型Type说明Description
InInitialzedbool是否已初始化(写入 bInitialized)。Whether initialized (written to bInitialized).
InDurationfloat死亡过程持续时间。Death process duration.
InTimefloat传入但未使用——Time 恒置 0.0f。Passed but unused — Time is always set to 0.0f.
InDeathDissolveTimefloat死亡消融时间。Death dissolve time.
InDeathAnimTimefloat死亡动画时间。Death animation time.
InInstigatorconst FEntityHandle&致死实体句柄。Fatal entity handle.
InHitDirectionconst FVector3f&致命打击方向。Fatal hit direction.
InIsSuicidebool是否自杀(写入 bIsSuicide)。Whether suicide (written to bIsSuicide).
Output

无返回值。副作用:全字段初始化。

No return value. Side effect: all fields initialized.

标记Tags

FDyingTag

死亡中标记(FA_MassBattleBaseTag 派生)。附着在死亡流程进行中的实体上。

Dying marker (derived from FA_MassBattleBaseTag). Attached to entities currently in the death flow.

FDestroyingTag

销毁中标记(FA_MassBattleBaseTag 派生)。附着在进入销毁阶段的实体上。

Destroying marker (derived from FA_MassBattleBaseTag). Attached to entities entering the destroy stage.

管线角色Pipeline Role

FDeath / FDying 由行为/反应/移动处理器读取(grep 验证:MassBattleAgentBehaviorProcessor、MassBattleAgentReactionProcessor、MassBattleAgentMoveProcessor / MoveProcessorFP、MassBattleAgentSubsystem)。行为处理器推进死亡状态机,自杀路径按 bInstantRemovalOnSuicide / bDisableDeathSpawnOnSuicide 分支;DisableCollisionWithAgentTimer 在 ReactionProcessor 中递减。死亡期间的生成由 notify 表的 Death 事件族行触发(Spawn Actor / FX / Sound / Loot)——notify 行在各时钟所有者推进播放头后就地收集、串行 drain,没有专门的 notify 处理器;尸体布娃娃由该表的 Ragdoll 动作置位 bRagdollRequested,再由渲染侧变成布娃娃池槽。布娃娃的烘焙数据见 MassBattleRagdollTable.h。

FDeath / FDying are read by behavior / reaction / movement processors (verified by grep: MassBattleAgentBehaviorProcessor, MassBattleAgentReactionProcessor, MassBattleAgentMoveProcessor / MoveProcessorFP, MassBattleAgentSubsystem). The behavior processor advances the death state machine, with suicide paths branching on bInstantRemovalOnSuicide / bDisableDeathSpawnOnSuicide; DisableCollisionWithAgentTimer is ticked in the ReactionProcessor. Death-time spawns fire from the notify table's Death-family rows (Spawn Actor / FX / Sound / Loot) — notify rows are collected inline by each clock owner after it advances the playhead and drained serially; there is no dedicated notify processor. A corpse's ragdoll is requested by that table's Ragdoll action, which latches bRagdollRequested for the render side to turn into a ragdoll pool slot. The baked ragdoll data is documented in MassBattleRagdollTable.h.

补充说明Notes

文件末尾的 FDisableDeathTag 为注释掉的预留 Tag 定义,当前未启用。

The commented-out FDisableDeathTag at the end of the file is a reserved tag definition, currently disabled.