MassBattle Docsv1.19.20

LootHostConfig.h

USTRUCT ×4

Source/MassBattle/Public/Fragments/LootHostConfig.h

概述 Overview

战利品生成宿主配置体系,四层结构:生成内容 FLootSpawnContent(Actor/FX/音效列表)、生命周期生成表 FLootSpawn(出生/收集开始/收集完成/销毁四时机)、可配置条目 FLootConfig(EntityConfig 中每条的原始配置:数据资产、乘数、概率、附着)、运行时最终条目 FLootConfig_Final(由 FLootConfig 展开并附加运行时字段:随机流、句柄、生成变换、池化状态与模板数据)。另有确定性排序用命令记录 FLootOptCommand。

Loot spawn-host config system in four layers: spawn content FLootSpawnContent (actor/FX/sound lists), lifecycle spawn table FLootSpawn (birth / collect-begin / collect-end / destroy), configurable entry FLootConfig (the raw per-entry config in EntityConfig: data asset, multipliers, probability, attachment), and the runtime final entry FLootConfig_Final (expanded from FLootConfig with runtime fields: random stream, handles, spawn transform, pool state and template data). Plus FLootOptCommand for deterministic sorting.

FLootSpawnContent USTRUCT

战利品生命周期事件要生成的内容集合(普通 USTRUCT,非 fragment)。

Content set spawned by a loot lifecycle event (plain USTRUCT, not a fragment).

成员变量 Members

名称 Name类型 Type默认值说明 Description
bEnableboolfalse启用/禁用生成。Enable/disable spawning.
SpawnActorTArray<FActorSpawnConfig>空要生成的 Actor。Actors to spawn.
SpawnFxTArray<FFxConfig>空要生成的特效。FX to spawn.
PlaySoundTArray<FSoundConfig>空要播放的声音。Sounds to play.

FLootSpawn USTRUCT

战利品生命周期四个时机的生成表 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含 TArray)。

Lifecycle spawn table fragment derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains TArray members).

成员变量 Members

名称 Name类型 Type默认值说明 Description
OnBirthFLootSpawnContent—出生时生成什么。What to spawn on loot birth.
OnCollectBeginFLootSpawnContent—Agent 认领战利品(开始飞向 Agent)时生成什么。What to spawn when an agent claims the loot (starts flying toward the agent).
OnCollectEndFLootSpawnContent—战利品到达 Agent(收集完成)时生成什么。What to spawn when the loot reaches the agent (collection complete).
OnDestroyFLootSpawnContent—战利品销毁(超时/过期)时生成什么。What to spawn on loot destroy (timeout/expired).

FLootConfig USTRUCT

EntityConfig 中战利品生成条的原始配置(普通 USTRUCT,非 fragment)。运行时由子系统展开为 FLootConfig_Final。

Raw config of one loot spawn entry in EntityConfig (plain USTRUCT, not a fragment). Expanded at runtime by the subsystem into FLootConfig_Final.

成员变量 Members

名称 Name类型 Type默认值说明 Description
bEnablebooltrue启用。Enable.
LootConfigDataAssetTSoftObjectPtr<UMassBattleLootConfigDataAsset>—战利品数据资产(软引用)。仅 bEnable 为 true 时可编辑。Loot data asset (soft reference). Editable only when bEnable is true.
LootConfigDataAssetPtrTObjectPtr<UMassBattleLootConfigDataAsset>—战利品数据资产指针(运行时解析后的硬引用)。Loot data asset pointer (resolved hard reference at runtime).
MultipliersFLootMultipliers—战利品参数乘数(见 Fragments/Loot.h)。Loot parameter multipliers (see Fragments/Loot.h).
TransformFTransform3fIdentity相对生成点的偏移量。Offset relative to the spawn point.
SpawnOriginESpawnOriginAtSelf生成原点:自身位置或目标位置,枚举定义于 MassBattleEnums.h。Spawn origin: at self or at target; enum defined in MassBattleEnums.h.
bAttachedboolfalse是否附着到父实体。Whether attached to the parent entity.
bDespawnWhenNoParentbooltrue附着点失效后是否自毁。仅当 bEnable 且 bAttached 均为 true 时可编辑。Destroy when the attachment point becomes invalid. Editable only when both bEnable and bAttached are true.
Delayfloat0延时生成(秒)。仅 bEnable 为 true 时可编辑。Spawn delay (seconds). Editable only when bEnable is true.
SpawnProbabilityFVector4f(0, 1, 10000, 1)生成概率映射(X=AgentCountMin, Y=SpawnProbabilityAtMin, Z=AgentCountMax, W=SpawnProbabilityAtMax)——按指定行为状态的 Agent 数量插值概率。Spawn probability map (X=AgentCountMin, Y=SpawnProbabilityAtMin, Z=AgentCountMax, W=SpawnProbabilityAtMax) — probability interpolated by the count of agents in the specified behavior state.
AgentBehaviorStateEAgentBehaviorStateDying该战利品关联的 Agent 行为状态(用于概率计算),枚举定义于 MassBattleEnums.h。Agent behavior state this loot is associated with (used for probability); enum defined in MassBattleEnums.h.
InheritFromSpawnerFInheritFromSpawner—从生成者 agent 继承参数(事件接收者 / FlowField),结构定义于 MassBattleStructs.h(bInheritEventReceiver / bInheritFlowField 默认均 true)。仅 bEnable 为 true 时可编辑。Inherit parameters from the spawner agent (event receiver / FlowField); struct defined in MassBattleStructs.h (bInheritEventReceiver / bInheritFlowField, both default true). Editable only when bEnable is true.

FLootConfig_Final USTRUCT

战利品生成条的运行时最终配置 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含 TArray/模板数据)。前部字段与 FLootConfig 对应(由转换构造拷贝),后部为运行时字段:概率随机流、归属/附着句柄、生成变换、起点、流场指针(含快照恢复软引用)、初始化/生成/池化状态与模板数据。提供 Reset() 供池复用。

Runtime final config fragment of a loot entry, derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains TArray/template data). The front fields mirror FLootConfig (copied by the converting ctor); the rear holds runtime fields: probability random stream, owner/attach handles, spawn transform, from point, flow field pointer (with soft ref for snapshot restore), init/spawn/pool state and template data. Provides Reset() for pool reuse.

成员变量 Members

名称 Name类型 Type默认值说明 Description
bEnablebooltrue启用(自 FLootConfig 拷贝)。Enable (copied from FLootConfig).
LootConfigDataAssetTSoftObjectPtr<UMassBattleLootConfigDataAsset>—战利品数据资产(软引用)。Loot data asset (soft reference).
LootConfigDataAssetPtrTObjectPtr<UMassBattleLootConfigDataAsset>—战利品数据资产指针。Loot data asset pointer.
MultipliersFLootMultipliers—战利品参数乘数。Loot parameter multipliers.
TransformFTransform3fIdentity偏移量。Offset.
InitialRelativeTransformFTransform3fIdentity附着时的初始相对变换。Initial relative transform when attached.
SpawnOriginESpawnOriginAtSelf生成原点。Spawn origin.
bAttachedboolfalse是否附着。Whether attached.
bDespawnWhenNoParentbooltrue附着点失效后自毁。仅当 bEnable 且 bAttached 均为 true 时可编辑。Destroy when the attachment point becomes invalid. Editable only when both bEnable and bAttached are true.
Delayfloat0延时生成。Spawn delay.
SpawnProbabilityFVector4f(0, 1, 10000, 1)生成概率映射。Spawn probability map.
AgentBehaviorStateEAgentBehaviorStateDying关联的 Agent 行为状态。Associated agent behavior state.
InheritFromSpawnerFInheritFromSpawner—从生成者 agent 继承参数(事件接收者 / FlowField),自 FLootConfig 拷贝;结构定义于 MassBattleStructs.h。Inherit parameters from the spawner agent (event receiver / FlowField), copied from FLootConfig; struct defined in MassBattleStructs.h.
RandomStreamFRandomStream—概率检查的随机流。Random stream for probability checks.
OwnerEntityFEntityHandle无效句柄生成者实体。Owner entity.
AttachToEntityFEntityHandle无效句柄附着到的实体。Entity to attach to.
SpawnTransformFTransformIdentity生成变换。Spawn transform.
FromPointFVector(0,0,0)起点。From point.
FlowFieldPtrTObjectPtr<AFlowField>nullptr用于地面检测的流场指针。Flow field pointer for ground detection.
FlowFieldSoftPtrTSoftObjectPtr<AFlowField>—流场软引用快照来源——恢复后解析为 FlowFieldPtr。Flow field soft source for snapshot restore — resolves to FlowFieldPtr after restore.
bInitializedboolfalse运行时标志:是否已初始化(空 Tooltip)。Runtime flag: whether initialized (no tooltip).
bSpawnedboolfalse运行时标志:是否已生成(空 Tooltip)。Runtime flag: whether spawned (no tooltip).
bIsPooledboolfalse运行时标志:是否在池中(空 Tooltip)。Runtime flag: whether pooled (no tooltip).
bShouldDestroyboolfalse设置为 true 时,宿主实体将在下一帧被销毁。When set to true, the host entity will be destroyed on the next tick.
PoolCountdownfloat15.0f池中倒计时(秒),归零且池超下限时销毁(空 Tooltip)。Pool countdown in seconds; when it reaches zero and the pool exceeds the minimum, the entity is destroyed (no tooltip).
TemplateDataFMassEntityTemplateData—缓存的目标实体模板数据,用于快速 build。Cached target entity template data for fast building.
SpawnedLootFEntityHandle无效句柄已生成的战利品实体句柄——快照注册表字段(恢复按 UID 解析)。Handle of the spawned loot entity — snapshot registry field (restore resolves via UID).

方法 Methods

Reset void (InPoolIdleTTL = 15.0f)

复位运行时状态:初始化/生成/销毁标志清 false、bIsPooled = true、PoolCountdown = InPoolIdleTTL(统一池闲置倒计时,对应 HostSubsystem 的 PoolIdleLifeSpan;默认值保证非回收调用点行为不变)、模板数据清空、三个句柄清为无效。

Resets runtime state: init/spawn/destroy flags to false, bIsPooled = true, PoolCountdown = InPoolIdleTTL (the unified pool idle countdown, matching the HostSubsystem's PoolIdleLifeSpan; the default keeps non-recycle call sites unchanged), template data cleared, three handles invalidated.

Input
参数 Param类型 Type说明 Description
InPoolIdleTTLfloat池闲置倒计时初值(秒),默认 15.0f。Initial pool idle countdown in seconds; defaults to 15.0f.
Output

无返回值。副作用:运行时成员复位(配置字段不变)。

No return value. Side effect: runtime members reset (config fields unchanged).

FLootConfig_Final (const FLootConfig&)

转换构造:把 FLootConfig 的配置字段逐一拷贝,运行时字段保持默认。

Converting ctor: copies each config field from FLootConfig; runtime fields keep their defaults.

Input
参数 Param类型 Type说明 Description
Configconst FLootConfig&源配置条目。Source config entry.
Output

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

No return value. Side effect: initializes all config fields.

FLootOptCommand USTRUCT

战利品宿主操作命令记录(USTRUCT,非 fragment)。携带实体句柄与 OwnerUniqueID(-1 = 无效)——用于确定性排序,保证双端命令处理顺序一致。

Loot host-ops command record (USTRUCT, not a fragment). Carries the entity handle and OwnerUniqueID (-1 = invalid) — used for deterministic sorting so both peers process commands in the same order.

成员变量 Members

名称 Name类型 Type默认值说明 Description
EntityFMassEntityHandle—目标实体句柄。Target entity handle.
OwnerUniqueIDint32-1生成者 UID,用于确定性排序。Owner UID, for deterministic sorting.

管线角色 Pipeline Role

grep 验证:FLootConfig_Final 被 MassBattleAgentSubsystem(EntityConfig 展开为 Final)、MassBattleHostSubsystem(生成/池化管理)、MassBattleHostMonoProcessor(生命周期事件触发生成)、MassBattleNetworkProcessor 与 MassBattleSubsystem / MassBattleNetworkSubsystem(快照同步)引用。

Verified by grep: FLootConfig_Final is referenced by MassBattleAgentSubsystem (EntityConfig expanded to Final), MassBattleHostSubsystem (spawn/pool management), MassBattleHostMonoProcessor (lifecycle-event spawns), MassBattleNetworkProcessor and MassBattleSubsystem / MassBattleNetworkSubsystem (snapshot sync).