Translates a WeaponDefinition/AttackRequest pair to Action values. 更多...
#include <WeaponAction.h>
静态 Public 成员函数 | |
| static eve::Result< std::optional< eve::resource::CostSpec > > | resourceCost (const WeaponDefinition &weapon) |
| Convert the weapon trigger resource into a canonical cost. | |
| static eve::Result< eve::transaction::TransactionReceipt > | fire (const WeaponDefinition &weapon, eve::resource::IResourceAccount &account, eve::transaction::ITransactionParticipant &effect, std::string transactionId={}) |
| Execute one already-built weapon effect and charge its resource atomically. | |
| static eve::Result< eve::transaction::TransactionReceipt > | fire (const WeaponDefinition &weapon, const AttackRequest &attack, eve::resource::IResourceAccount &account, eve::transaction::ITransactionParticipant &effect, eve::SimulationTick tick=eve::SimulationTick(1)) |
| Execute one weapon attack through the common Action lifecycle. | |
| static eve::Result< action::ActionDefinition > | makeDefinition (const WeaponDefinition &weapon, const AttackRequest &request) |
| Build an action definition for one attack request. | |
| static eve::Result< action::ActionRequest > | makeRequest (const WeaponDefinition &weapon, const AttackRequest &attack, std::optional< ecs::EntityHandle > source=std::nullopt, eve::SimulationTick requestedTick=eve::SimulationTick::zero()) |
| Build a request carrying the original weapon attack parameters. | |
详细描述
Translates a WeaponDefinition/AttackRequest pair to Action values.
The adapter never moves or mirrors magazine, spread, recoil, muzzle or projectile fields into the common action definition. Those remain owned by WeaponEntity/WeaponDefinition and are interpreted by an injected Active executor. ActionRuntime remains the only phase/timer owner.
在文件 WeaponAction.h 第 29 行定义.
成员函数说明
◆ fire() [1/2]
|
static |
Execute one weapon attack through the common Action lifecycle.
- 参数
-
weapon Borrowed weapon definition. attack Borrowed attack parameters copied into the ActionRequest. account Authoritative ammo/mana/charge account. effect Domain participant for the actual projectile/hit operation. tick Deterministic simulation tick at which the attack is applied.
- 返回
- The Action-backed transaction receipt. Condition, action, payment and effect failures leave the account and effect unchanged.
- 备注
- This is the preferred fire entry point. Callers do not need to call submit and then assemble a separate payment transaction.
在文件 WeaponAction.cpp 第 127 行定义.
◆ fire() [2/2]
|
static |
Execute one already-built weapon effect and charge its resource atomically.
- 参数
-
weapon Borrowed definition supplying the trigger cost. account Borrowed authoritative account for ammo/mana/charges/stamina. effect Borrowed transaction participant for the weapon effect. transactionId Non-empty correlation id; empty derives from weapon id.
- 返回
- A committed transaction receipt or structured lifecycle failure.
- 备注
- ActionRuntime remains the lifecycle owner for the regular action pipeline; this entry point is the synchronous effect boundary.
在文件 WeaponAction.cpp 第 120 行定义.
◆ makeDefinition()
|
static |
Build an action definition for one attack request.
- 参数
-
weapon Borrowed weapon definition observed during this call only. request Borrowed attack request; target selection affects the mode.
- 返回
- Common definition or a structured mapping failure.
在文件 WeaponAction.cpp 第 133 行定义.
引用了 active, eve::weapon::AttackStageSpec::activeTime, cost, eve::action::Explicit, eve::Result< T >::failure(), eve::weapon::WeaponDefinition::id, eve::weapon::WeaponDefinition::kind, eve::weapon::WeaponDefinition::logic, eve::action::None, eve::weapon::AttackStageSpec::recoverTime, request, resourceCost(), eve::weapon::WeaponDefinition::stages, status, eve::Result< T >::success(), valid , 以及 eve::weapon::AttackStageSpec::windupTime.
被这些函数引用 makeRequest().
◆ makeRequest()
|
static |
Build a request carrying the original weapon attack parameters.
- 参数
-
weapon Borrowed definition used only to select target mode. attack Borrowed request copied into owned ActionRequest parameters. source Optional source ECS handle; no raw pointer is retained. requestedTick Deterministic simulation tick of the request.
- 返回
- An owning action request or a structured mapping failure.
在文件 WeaponAction.cpp 第 165 行定义.
引用了 eve::action::ActionRequest::actionId, eve::weapon::AttackRequest::aoeRadius, eve::weapon::AttackRequest::arcAngle, eve::Result< T >::failure(), eve::weapon::AttackRequest::hasTarget, makeDefinition(), eve::weapon::AttackRequest::muzzleX, eve::weapon::AttackRequest::muzzleY, eve::weapon::AttackRequest::muzzleZ, eve::weapon::AttackRequest::pelletCount, eve::weapon::AttackRequest::pelletIndex, eve::weapon::AttackRequest::pitch, request, eve::weapon::AttackRequest::shooterId, source, eve::weapon::AttackRequest::spread, eve::Result< T >::success(), eve::weapon::AttackRequest::targetHandle, eve::weapon::AttackRequest::targetX, eve::weapon::AttackRequest::targetY, eve::weapon::AttackRequest::targetZ, valid , 以及 eve::weapon::AttackRequest::yaw.
◆ resourceCost()
|
static |
Convert the weapon trigger resource into a canonical cost.
- 参数
-
weapon Borrowed weapon definition observed during this call.
- 返回
- Empty for an infinite or resource-free weapon, otherwise a validated cost using the canonical resource id (
ammo,mana,chargesorstamina).
在文件 WeaponAction.cpp 第 69 行定义.
被这些函数引用 makeDefinition() , 以及 eve::weapon::WeaponControl::observeGameplay().
该类的文档由以下文件生成:
- src/modules/weapon/WeaponAction.h
- src/modules/weapon/WeaponAction.cpp