载入中...
搜索中...
未找到
eve::weapon 命名空间参考

载具模块入口(eve.Vehicle):定义注册 / 实体工厂 / RTS 命令 / 帧调度。 设计文档:docs/dev/通用载具系统设计.md 更多...

类

class  AmmoPoolEntity
 共享弹药池实体:多把武器共用的备用弹药,装填时从池中取。 更多...
 
struct  AttackRequest
 一次攻击请求(C++ 系统 / 脚本发起)。角度均为度。 旧名 FireRequest 保留为别名,向后兼容。 更多...
 
struct  AttackResource
 触发资源模板(武器模板的一部分,用于运行时扣费 / 回复)。 更多...
 
struct  AttackStageSpec
 阶段时长(秒);各形态按需配置。 更多...
 
struct  CarrierBodyDefenseSample
 One body/shield sample used by SteerAvoidBody to curve around defenses. 更多...
 
struct  CarrierChildSpawn
 Deferred child spawn recorded during update. 更多...
 
struct  CarrierEvent
 Owning event emitted by an impact. 更多...
 
struct  CarrierFrame
 Owning result of one atomic carrier simulation step. 更多...
 
struct  CarrierHandle
 Generation-qualified reference to one pooled carrier slot. 更多...
 
struct  CarrierImpact
 One impact bound to a trigger kind. 更多...
 
struct  CarrierMotion
 Live motion snapshot for one carrier. 更多...
 
struct  CarrierMotionOp
 One ballistic operator plus its parameters. 更多...
 
struct  CarrierRecipe
 Data-driven composition recipe for one carrier family. 更多...
 
struct  CarrierRuntimeSnapshot
 Complete deterministic carrier-pool state for rollback/save. 更多...
 
struct  CarrierSlotSnapshot
 One pool slot including generation, retained while empty. 更多...
 
struct  CarrierSpawnRequest
 Owning spawn request. 更多...
 
struct  CarrierState
 Owning observable state for one live carrier. 更多...
 
struct  CarrierTrigger
 One trigger specification. 更多...
 
struct  CarrierVolleySpec
 Deterministic multi-direction spawn descriptor. 更多...
 
class  CombatCarrierRuntime
 Owner-thread deterministic carrier simulator with composable behaviors. 更多...
 
class  ICarrierBodyDefenseProvider
 Optional body/shield boundary for SteerAvoidBody. 更多...
 
class  ICarrierHitProbe
 Optional swept-hit boundary used only by OnHit triggers. 更多...
 
class  IProjectileService
 投射物服务:由游戏侧实现并注册为能力。 weapon 模块只认识这个接口,弹道/爆炸/受击由提供方负责。 更多...
 
class  IProjectileTargetProvider
 Optional target-position boundary used only by homing projectiles. 更多...
 
class  IWeaponLogic
 武器逻辑接口:注册到 WeaponSystem 的可插拔行为。 更多...
 
struct  ProjectileDefinition
 Data-driven trajectory and lifetime definition. 更多...
 
struct  ProjectileHandle
 Generation-qualified reference to one pooled projectile slot. 更多...
 
struct  ProjectilePoint
 Owning point in projectile simulation space. 更多...
 
class  ProjectileRuntime
 Owner-thread deterministic projectile simulator with a bounded reusable pool. 更多...
 
struct  ProjectileRuntimeSnapshot
 Complete deterministic projectile-pool state for rollback and save games. 更多...
 
struct  ProjectileSlotSnapshot
 One pool slot including its generation, retained even while empty. 更多...
 
struct  ProjectileSpawnRequest
 Owning spawn request; homing requests require a generation-checked target. 更多...
 
struct  ProjectileSpec
 投射物参数(武器模板的一部分,供游戏侧投射物服务使用)。 更多...
 
struct  ProjectileState
 Owning observable state for one live projectile. 更多...
 
struct  ProjectileUpdate
 Owning result of one atomic projectile simulation step. 更多...
 
struct  ProjectileVector
 Owning velocity or direction vector in projectile simulation space. 更多...
 
struct  Resource
 运行时触发资源(实体组件)。 更多...
 
struct  SpellCastPlan
 One compiled cast unit ready to register and spawn. 更多...
 
class  Weapon
 武器模块(eve.Weapon)。 更多...
 
class  WeaponActionAdapter
 Translates a WeaponDefinition/AttackRequest pair to Action values. 更多...
 
class  WeaponAttributeAdapter
 Adapts only Mana/Stamina trigger resources to AttributeProjection. 更多...
 
class  WeaponControl
 Exposes one weapon through the shared gameplay command protocol. 更多...
 
struct  WeaponDefinition
 武器模板(registerWeaponsFromJson 注册,进程级注册表)。 更多...
 
class  WeaponDefinitionRuntime
 Binds a typed WeaponDefinition to one mutable runtime instance. 更多...
 
class  WeaponEffectAdapter
 Weapon adapter with a single common lifecycle owner. 更多...
 
struct  WeaponEffectDefinition
 Typed weapon definition projected into the common lifecycle. 更多...
 
class  WeaponEffectExecutor
 Weapon executor applying heat, jam and recoil rules. 更多...
 
struct  WeaponEffectSnapshot
 In-memory weapon effect snapshot. 更多...
 
struct  WeaponEffectTarget
 Mutable weapon state interpreted by the typed executor. 更多...
 
struct  WeaponEffectUpdate
 Result of one weapon lifecycle step and domain settlement. 更多...
 
class  WeaponEntity
 武器实体:数据全部在组件里,行为在 WeaponSystem。 更多...
 
struct  WeaponEvent
 武器事件(帧缓存,脚本轮询,与 building/rpg 风格一致)。 更多...
 
class  WeaponMountEntity
 武器挂点实体:可持有武器并限制旋转(炮塔 / 机枪座 / 固定挂架)。 更多...
 
class  WeaponRigEntity
 手持位实体:面向 ARPG/RPG 角色手持武器(剑/法杖/步枪),无炮塔限位。 更多...
 
struct  WeaponRuntimeState
 Mutable state owned by one typed weapon runtime instance. 更多...
 
class  WeaponSystem
 武器系统:逻辑注册 + 更新 + 开火 + 装填。 更多...
 

类型定义

using WeaponEventSink = std::function< void(const WeaponEvent &)>
 事件汇:由 Weapon 模块(或测试)注册,把事件写入自己的队列。
 
using FireRequest = AttackRequest
 兼容别名:IProjectileService 等旧接口继续用 FireRequest 名。
 

枚举

enum class  CarrierMotionOpKind : std::uint8_t {
  SteerHoming , SteerAvoidBody , ApplyGravity , Accelerate ,
  CurveSway , CurveHelix , IntegrateLinear
}
 Ordered ballistic operators applied each simulation step. 更多...
 
enum class  CarrierTriggerKind : std::uint8_t {
  OnExpire , OnFuse , OnInterval , OnHit ,
  OnProximity
}
 When an impact may fire. 更多...
 
enum class  CarrierImpactKind : std::uint8_t {
  EmitHit , Splash , Pierce , Bounce ,
  Release , SpawnChild
}
 What happens when a matching trigger fires. 更多...
 
enum class  CarrierVolleyPattern : std::uint8_t { Fan , Ring }
 Multi-projectile aim pattern for one salvo. 更多...
 
enum class  ProjectileMode : std::uint8_t { Linear , Ballistic , Homing }
 Built-in trajectory integration mode. 更多...
 
enum class  WeaponEffectKind : std::uint8_t { Heat , Jam , Recoil }
 Weapon-specific effect strategy. 更多...
 
enum class  WeaponKind : uint8_t {
  Melee , Ranged , Magic , Missile ,
  Custom
}
 武器形态。 更多...
 
enum class  ResourceKind : uint8_t {
  None , Ammo , Mana , Charges ,
  Stamina
}
 触发资源的类型。 更多...
 
enum class  AttackStage : uint8_t { Idle , Windup , Active , Recover }
 攻击阶段。 更多...
 
enum class  FireMode : uint8_t { Single , Burst , Auto }
 开火模式(热武器保留字段)。 更多...
 
enum class  WeaponEventType : uint8_t {
  Fire , ReloadStart , ReloadEnd , Empty ,
  WindupStart , AttackEnd , AimIn , AimOut
}
 武器事件类型。 更多...
 

函数

Result< CarrierRecipe > decodeCarrierRecipe (const Value &value)
 Decode one CarrierRecipe from an owning Value object.
 
Result< Value > encodeCarrierRecipe (const CarrierRecipe &recipe)
 Encode one CarrierRecipe into an owning Value object (full form).
 
Result< CarrierRecipe > carrierRecipeFromProjectile (const ProjectileDefinition &definition, double damage=0.0)
 Build a default recipe matching a classic ProjectileDefinition mode.
 
void exposeCombatCarrierBindings (ssq::Table &table)
 Expose CombatCarrierRuntime class bindings under the shared eve table.
 
void exposeCombatCarrierModuleMethods (ssq::Class &cls)
 Register Weapon module methods that create owned carrier runtimes.
 
Result< SpellCastPlan > compileSpellFragments (const Value &fragments)
 Compile a fragment array Value into one cast plan.
 
Result< SpellCastPlan > compileSpellFragmentsJson (const std::string &json)
 Compile a JSON array string into one cast plan.
 
 Module_IMPL (Weapon, new Weapon())
 
const char * fireModeName (FireMode mode)
 开火模式的字符串名("single" | "burst" | "auto")。
 
FireMode fireModeFromName (const std::string &name)
 从字符串解析开火模式;未知名字回退 Single。
 
const char * weaponKindName (WeaponKind kind)
 武器形态的字符串名("melee" | "ranged" | "magic" | "missile" | "custom")。
 
WeaponKind weaponKindFromName (const std::string &name)
 从字符串解析武器形态;未知名字回退 Ranged。
 
const char * attackStageName (AttackStage stage)
 攻击阶段的字符串名("idle" | "windup" | "active" | "recover")。
 
const char * weaponEventTypeName (WeaponEventType type)
 事件类型的字符串名。
 
eve::Result< WeaponDefinition > parseWeaponDefinition (const eve::definitions::Definition &source)
 Parse one canonical registry definition into an owning typed snapshot.
 

详细描述

载具模块入口(eve.Vehicle):定义注册 / 实体工厂 / RTS 命令 / 帧调度。 设计文档:docs/dev/通用载具系统设计.md

武器模块数据模型:武器模板 / 武器实体 / 挂点实体 / 手持位实体。

武器行为静态系统:逻辑注册表 + 每帧推进 + 开火/装填。 与 rpg 的 *System 静态类同一设计语言;事件通过事件汇(sink) 交给模块/游戏侧缓存。

武器行为接口与投射物服务接口。

武器模块入口(eve.Weapon):定义注册 / 实体工厂 / 挂点操作 / 帧调度。 设计文档:docs/dev/通用载具系统设计.md

新增武器类型 = 实现 IWeaponLogic 并按名字注册到 WeaponSystem (registerLogic),不需要改引擎头文件。投射物/弹道表现由游戏侧 实现 IProjectileService 并通过 eve::cap::provide 注册,weapon 模块 不硬依赖 physics / graphics / particles。

v2 阶段钩子(begin / channel / end 均有默认空实现):近战 / 法杖 / 导弹通过阶段机驱动,fire() 在 Active 生效时刻被调用,channel() 在 Active 期逐帧调用,begin()/end() 分别在 Windup 起点与 Recover 起点。

与引擎其他玩法模块一致(参考 card / rpg):组件是纯数据结构体, 行为全部放在 WeaponSystem(静态类)与 IWeaponLogic(可插拔逻辑)里。

v2 设计(见 docs/dev/通用武器系统设计.md):用统一的「形态 kind + 资源 + 阶段机」泛化触发管线,让热武器 / 冷兵器 / 法杖 / 导弹共用同一套机制:

  • WeaponKind 声明武器形态(melee / ranged / magic / missile),
  • AttackResource 表达触发消耗(弹药 / 法力 / 充能 / 体力 / 无),
  • AttackStage 阶段机(Idle → Windup → Active → Recover)替代硬编码的装填/连发。

挂点(WeaponMountEntity)独立成实体,可挂在载具 / 建筑 / 炮台上, 炮塔被打掉 = 挂点标记 destroyed,不需要改动载具实体。 手持位(WeaponRigEntity)是轻量持有位,面向 ARPG/RPG 角色手持武器。

类型定义说明

◆ FireRequest

兼容别名:IProjectileService 等旧接口继续用 FireRequest 名。

在文件 WeaponTypes.h 第 232 行定义.

◆ WeaponEventSink

using eve::weapon::WeaponEventSink = typedef std::function<void(const WeaponEvent&)>

事件汇:由 Weapon 模块(或测试)注册,把事件写入自己的队列。

在文件 WeaponSystem.h 第 21 行定义.

枚举类型说明

◆ AttackStage

enum class eve::weapon::AttackStage : uint8_t
strong

攻击阶段。

枚举值
Idle 
Windup 
Active 
Recover 

在文件 WeaponTypes.h 第 62 行定义.

◆ CarrierImpactKind

enum class eve::weapon::CarrierImpactKind : std::uint8_t
strong

What happens when a matching trigger fires.

枚举值
EmitHit 

Push a damage-oriented CarrierEvent.

Splash 

Push a splash CarrierEvent at the carrier position.

Pierce 

Consume pierce budget and suppress release for this trigger.

Bounce 

Reflect velocity by contact normal; suppress release.

Release 

Request carrier release unless suppressed.

SpawnChild 

Queue a child spawn using childRecipeId.

在文件 CombatCarrier.h 第 51 行定义.

◆ CarrierMotionOpKind

enum class eve::weapon::CarrierMotionOpKind : std::uint8_t
strong

Ordered ballistic operators applied each simulation step.

枚举值
SteerHoming 

Rotate velocity toward a target; does not integrate.

SteerAvoidBody 

Deflect around injected body/shield samples; does not integrate.

ApplyGravity 

Subtract gravity from velocity.y.

Accelerate 

Increase speed along the current velocity direction.

CurveSway 

Add sinusoidal lateral velocity (curve modifier); does not integrate.

CurveHelix 

Add rotating lateral velocity (corkscrew); does not integrate.

IntegrateLinear 

Integrate position from velocity.

在文件 CombatCarrier.h 第 31 行定义.

◆ CarrierTriggerKind

enum class eve::weapon::CarrierTriggerKind : std::uint8_t
strong

When an impact may fire.

枚举值
OnExpire 

Age crossed lifetime this step.

OnFuse 

Age crossed fuse time this step.

OnInterval 

Periodic while alive.

OnHit 

Hit probe reported contact.

OnProximity 

Homing/proximity target entered radius.

在文件 CombatCarrier.h 第 42 行定义.

◆ CarrierVolleyPattern

enum class eve::weapon::CarrierVolleyPattern : std::uint8_t
strong

Multi-projectile aim pattern for one salvo.

枚举值
Fan 

Spread across ±spreadDegrees/2 in the aim plane.

Ring 

Evenly spaced around a full circle in the aim plane.

在文件 CombatCarrier.h 第 137 行定义.

◆ FireMode

enum class eve::weapon::FireMode : uint8_t
strong

开火模式(热武器保留字段)。

枚举值
Single 
Burst 
Auto 

在文件 WeaponTypes.h 第 82 行定义.

◆ ProjectileMode

enum class eve::weapon::ProjectileMode : std::uint8_t
strong

Built-in trajectory integration mode.

枚举值
Linear 
Ballistic 
Homing 

在文件 ProjectileRuntime.h 第 19 行定义.

◆ ResourceKind

enum class eve::weapon::ResourceKind : uint8_t
strong

触发资源的类型。

枚举值
None 
Ammo 
Mana 
Charges 
Stamina 

在文件 WeaponTypes.h 第 50 行定义.

◆ WeaponEffectKind

enum class eve::weapon::WeaponEffectKind : std::uint8_t
strong

Weapon-specific effect strategy.

枚举值
Heat 
Jam 
Recoil 

在文件 WeaponEffects.h 第 22 行定义.

◆ WeaponEventType

enum class eve::weapon::WeaponEventType : uint8_t
strong

武器事件类型。

枚举值
Fire 
ReloadStart 
ReloadEnd 
Empty 
WindupStart 
AttackEnd 
AimIn 
AimOut 

在文件 WeaponTypes.h 第 98 行定义.

◆ WeaponKind

enum class eve::weapon::WeaponKind : uint8_t
strong

武器形态。

枚举值
Melee 
Ranged 
Magic 
Missile 
Custom 

在文件 WeaponTypes.h 第 34 行定义.

函数说明

◆ attackStageName()

const char * eve::weapon::attackStageName ( AttackStage  stage)

攻击阶段的字符串名("idle" | "windup" | "active" | "recover")。

返回
Borrowed non-null pointer to immutable process-lifetime storage. @ownership The returned static text is not caller-owned and must not be freed. @lifetime Valid for the process lifetime; copy it when storing it. @thread Thread-safe because the characters are immutable. @reentrancy Does not invoke callbacks.

在文件 Weapon.cpp 第 105 行定义.

引用了 Active, Idle, Recover , 以及 Windup.

被这些函数引用 eve::weapon::Weapon::getStage().

◆ carrierRecipeFromProjectile()

EVENGINE_API_WORLD Result< CarrierRecipe > eve::weapon::carrierRecipeFromProjectile ( const ProjectileDefinition &  definition,
double  damage = 0.0 
)

◆ compileSpellFragments()

EVENGINE_API_WORLD Result< SpellCastPlan > eve::weapon::compileSpellFragments ( const Value &  fragments)

Compile a fragment array Value into one cast plan.

参数
fragmentsArray of fragment objects (see docs in CombatCarrierScript).
返回
Owning plan with a validated primary recipe, or a path-aware failure. @ownership Returned plan owns all recipes; input is not retained. @thread Owner thread only. @reentrancy Does not invoke callbacks.

在文件 SpellFragmentCompiler.cpp 第 391 行定义.

引用了 eve::Value::arraySize(), eve::Value::at(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::getIf(), eve::InvalidArgument, eve::Value::isArray(), kind, path, eve::weapon::SpellCastPlan::recipe, eve::Result< T >::success() , 以及 eve::weapon::SpellCastPlan::volley.

被这些函数引用 compileSpellFragmentsJson().

◆ compileSpellFragmentsJson()

EVENGINE_API_WORLD Result< SpellCastPlan > eve::weapon::compileSpellFragmentsJson ( const std::string &  json)

Compile a JSON array string into one cast plan.

参数
jsonUTF-8 JSON array of fragment objects.

在文件 SpellFragmentCompiler.cpp 第 440 行定义.

引用了 compileSpellFragments(), eve::Result< T >::failure() , 以及 eve::Value::fromJson().

◆ decodeCarrierRecipe()

EVENGINE_API_WORLD Result< CarrierRecipe > eve::weapon::decodeCarrierRecipe ( const Value &  value)

Decode one CarrierRecipe from an owning Value object.

参数
valueObject tree; arrays and scalars must be finite where numeric.
返回
Owning validated recipe, or a path-aware diagnostic. @ownership Returned recipe owns all fields; input Value is not retained. @thread Owner thread only; no clock or RNG. @reentrancy Does not invoke callbacks.

在文件 CarrierRecipeCodec.cpp 第 543 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 value.

◆ encodeCarrierRecipe()

◆ exposeCombatCarrierBindings()

EVENGINE_API_WORLD void eve::weapon::exposeCombatCarrierBindings ( ssq::Table &  table)

Expose CombatCarrierRuntime class bindings under the shared eve table.

Adds CombatCarrierRuntime owned instances created via exposeCombatCarrierModuleMethods on eve.Weapon, plus recipe/fragment compile helpers usable from EveScript tables or JSON.

在文件 CombatCarrierScript.cpp 第 508 行定义.

引用了 capacity, count, dx, dy, dz, generation, pattern, radius, targetId, value, vm, x, y , 以及 z.

◆ exposeCombatCarrierModuleMethods()

EVENGINE_API_WORLD void eve::weapon::exposeCombatCarrierModuleMethods ( ssq::Class &  cls)

Register Weapon module methods that create owned carrier runtimes.

参数
clsScript class produced by table.addClass("Weapon", ...).

在文件 CombatCarrierScript.cpp 第 598 行定义.

引用了 capacity, cls , 以及 vm.

◆ fireModeFromName()

FireMode eve::weapon::fireModeFromName ( const std::string &  name)

从字符串解析开火模式;未知名字回退 Single。

在文件 Weapon.cpp 第 80 行定义.

引用了 Auto, Burst, name , 以及 Single.

被这些函数引用 eve::weapon::Weapon::setFireMode().

◆ fireModeName()

const char * eve::weapon::fireModeName ( FireMode  mode)

开火模式的字符串名("single" | "burst" | "auto")。

返回
Borrowed non-null pointer to immutable process-lifetime storage. @ownership The returned static text is not caller-owned and must not be freed. @lifetime Valid for the process lifetime; copy it when storing it. @thread Thread-safe because the characters are immutable. @reentrancy Does not invoke callbacks.

在文件 Weapon.cpp 第 71 行定义.

引用了 Auto, Burst , 以及 Single.

被这些函数引用 eve::weapon::Weapon::getFireMode() , 以及 eve::weapon::Weapon::getSelectableMode().

◆ Module_IMPL()

eve::weapon::Module_IMPL ( Weapon  ,
new   Weapon() 
)

◆ parseWeaponDefinition()

EVENGINE_API_WORLD eve::Result< WeaponDefinition > eve::weapon::parseWeaponDefinition ( const eve::definitions::Definition &  source)

Parse one canonical registry definition into an owning typed snapshot.

参数
sourceImmutable definition owned by DefinitionRegistry.
返回
A value-owned projection for one consumer, or a structured parse failure.
备注
The returned value is independent of the registry and does not form a second store.

在文件 WeaponDefinitionRuntime.cpp 第 409 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::DefinitionRef::fromId(), eve::LogicalId::fromParts(), eve::InvalidArgument, reference , 以及 source.

被这些函数引用 eve::weapon::Weapon::registerWeaponsFromJson().

◆ weaponEventTypeName()

const char * eve::weapon::weaponEventTypeName ( WeaponEventType  type)

事件类型的字符串名。

返回
Borrowed non-null pointer to immutable process-lifetime storage. @ownership The returned static text is not caller-owned and must not be freed. @lifetime Valid for the process lifetime; copy it when storing it. @thread Thread-safe because the characters are immutable. @reentrancy Does not invoke callbacks.

在文件 Weapon.cpp 第 115 行定义.

引用了 AimIn, AimOut, AttackEnd, Empty, Fire, ReloadEnd, ReloadStart, type , 以及 WindupStart.

被这些函数引用 eve::weapon::Weapon::getEventType().

◆ weaponKindFromName()

EVENGINE_API_WORLD WeaponKind eve::weapon::weaponKindFromName ( const std::string &  name)

从字符串解析武器形态;未知名字回退 Ranged。

在文件 Weapon.cpp 第 97 行定义.

引用了 Custom, Magic, Melee, Missile, name , 以及 Ranged.

◆ weaponKindName()

EVENGINE_API_WORLD const char * eve::weapon::weaponKindName ( WeaponKind  kind)

武器形态的字符串名("melee" | "ranged" | "magic" | "missile" | "custom")。

返回
Borrowed non-null pointer to immutable process-lifetime storage. @ownership The returned static text is not caller-owned and must not be freed. @lifetime Valid for the process lifetime; copy it when storing it. @thread Thread-safe because the characters are immutable. @reentrancy Does not invoke callbacks.

在文件 Weapon.cpp 第 86 行定义.

引用了 Custom, kind, Magic, Melee, Missile , 以及 Ranged.