载入中...
搜索中...
未找到

载具模块(eve.Vehicle)。 更多...

#include <Vehicle.h>

类 eve::vehicle::Vehicle 继承关系图:
eve::Module

Public 成员函数

 Module_REG (Vehicle)
 
 Vehicle ()
 Vehicle.
 
 ~Vehicle () override
 Vehicle.
 
int registerVehiclesFromJson (const std::string &json)
 从 JSON 注册载具模板;返回成功注册数量。
 
void clearVehicleDefinitions ()
 清空全部载具模板。
 
int getVehicleDefinitionCount ()
 已注册载具模板数量。
 
bool hasVehicleDefinition (const std::string &id)
 载具模板查询。
 
std::string getVehicleDefinitionMobility (const std::string &id)
 Returns the vehicle definition mobility.
 
float getVehicleDefinitionMaxHealth (const std::string &id)
 Returns the vehicle definition max health.
 
eve::definitions::DefinitionRegistry & definitionRegistry () noexcept
 Return the canonical common registry for vehicle definitions.
 
VehicleEntity * newVehicle (const std::string &defId, float x, float y, float heading=0.f, const std::string &faction="")
 工厂:按模板创建载具并挂载武器挂点(ECS 表持有,脚本持有句柄)。
 
void moveTo (VehicleEntity *v, float x, float y)
 RTS 命令。
 
void attackMove (VehicleEntity *v, float x, float y)
 Attack move.
 
void attack (VehicleEntity *v, float x, float y, int targetId=0)
 Attack.
 
void stop (VehicleEntity *v)
 Stops .
 
void hold (VehicleEntity *v)
 Hold.
 
void clearOrders (VehicleEntity *v)
 Clears orders.
 
int orderCount (VehicleEntity *v)
 Order count.
 
std::string getCurrentOrderType (VehicleEntity *v)
 当前命令类型名("move" / "attack_move" / "attack" / "stop" / "hold" / "none")。
 
void setInput (VehicleEntity *v, float throttle, float steer, float brake=0.f, bool handbrake=false)
 直接驾驶输入(FPS / 脚本驱动;RTS 命令也会写 input)。
 
float getX (VehicleEntity *v)
 状态查询 / 设置。
 
float getY (VehicleEntity *v)
 Returns the y.
 
float getHeading (VehicleEntity *v)
 Returns the heading.
 
float getSpeed (VehicleEntity *v)
 Returns the speed.
 
void setPosition (VehicleEntity *v, float x, float y)
 Sets the position.
 
void setHeading (VehicleEntity *v, float deg)
 Sets the heading.
 
bool isArrived (VehicleEntity *v)
 True when arrived.
 
float getHealth (VehicleEntity *v)
 Returns the health.
 
void setHealth (VehicleEntity *v, float hp)
 Sets the health.
 
float getMaxHealth (VehicleEntity *v)
 Returns the max health.
 
std::string getFaction (VehicleEntity *v)
 Returns the faction.
 
void setFaction (VehicleEntity *v, const std::string &faction)
 Sets the faction.
 
bool attachPhysics2D (VehicleEntity *v, eve::physics::World *world)
 将载具绑定到 physics world 拥有的 2D 刚体。
 
bool attachPhysics3D (VehicleEntity *v, eve::physics::World3D *world, float heightY=1.f)
 将载具绑定到 physics world 拥有的 3D 刚体。
 
bool detachPhysics (VehicleEntity *v)
 解除绑定,并在 world 仍存活时销毁由载具创建的刚体。
 
bool hasPhysics (VehicleEntity *v)
 查询当前绑定是否仍能解析为存活刚体。
 
std::string getPhysicsSpace (VehicleEntity *v)
 返回存活绑定的 "2d"/"3d";缺失或 stale 时返回空字符串。
 
float getHeight (VehicleEntity *v)
 3D 车身高度(无 3D 物理时返回 0)。
 
void applyDamage (VehicleEntity *v, float amount, const std::string &zone="", int sourceId=0)
 伤害管线:修饰器 → 装甲区倍率 → 扣血 → 事件。
 
float getArmorZoneMult (VehicleEntity *v, const std::string &zone)
 装甲区倍率(未命中任何区返回 1)。
 
bool isDestroyed (VehicleEntity *v)
 是否已摧毁。
 
int getSeatCount (VehicleEntity *v)
 座位(FPS 面)。
 
std::string getSeatName (VehicleEntity *v, int seatIndex)
 Returns the seat name.
 
std::string getSeatCameraMode (VehicleEntity *v, int seatIndex)
 Returns the seat camera mode.
 
bool isSeatOccupied (VehicleEntity *v, int seatIndex)
 True when seat occupied.
 
int getSeatOccupant (VehicleEntity *v, int seatIndex)
 Returns the seat occupant.
 
eve::weapon::WeaponMountEntity * getSeatMount (VehicleEntity *v, int seatIndex)
 座位绑定的武器挂点(mountIndex 无效返回 nullptr)。
 
bool enterSeat (VehicleEntity *v, int seatIndex, int playerId)
 Enter seat.
 
bool exitSeat (VehicleEntity *v, int seatIndex)
 Exit seat.
 
int exitSeatByPlayer (VehicleEntity *v, int playerId)
 Exit seat by player.
 
void setPlayerControls (int playerId, float throttle, float steer, float brake, bool fire, float aimYaw, float aimPitch)
 写入玩家控制(归一化;角度为度)。
 
int getMountCount (VehicleEntity *v)
 挂点查询(返回 weapon 模块的挂点实体)。
 
eve::weapon::WeaponMountEntity * getMount (VehicleEntity *v, int index)
 Returns the mount.
 
void update (float dt)
 每帧推进全部载具(命令 → 移动 → RTS 自动瞄准)。
 
void clearEvents ()
 事件队列(order_completed 等,上一次 update 产生)。
 
int getEventCount () const
 Returns the event count.
 
std::string getEventType (int index) const
 Returns the event type.
 
std::string getEventVehicleId (int index) const
 Returns the event vehicle id.
 
std::string getEventDefId (int index) const
 Returns the event def id.
 
std::string getEventOrderType (int index) const
 Returns the event order type.
 
float getEventX (int index) const
 Returns the event x.
 
float getEventY (int index) const
 Returns the event y.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

静态 Public 成员函数

static void registerMobility (IVehicleMobility *mobility)
 注册移动模型(C++ 插件/游戏侧扩展点;同名替换)。
 
static int getMobilityCount ()
 已注册移动模型数量(内置 kinematic 起步)。
 

详细描述

载具模块(eve.Vehicle)。

在文件 Vehicle.h 第 33 行定义.

构造及析构函数说明

◆ Vehicle()

eve::vehicle::Vehicle::Vehicle ( )

◆ ~Vehicle()

eve::vehicle::Vehicle::~Vehicle ( )
override

成员函数说明

◆ applyDamage()

void eve::vehicle::Vehicle::applyDamage ( VehicleEntity *  v,
float  amount,
const std::string &  zone = "",
int  sourceId = 0 
)

◆ attachPhysics2D()

bool eve::vehicle::Vehicle::attachPhysics2D ( VehicleEntity *  v,
eve::physics::World *  world 
)

将载具绑定到 physics world 拥有的 2D 刚体。

返回
physics 可用且刚体与 generation link 均创建成功时返回 true。
备注
重复绑定会先解除旧绑定;world 先销毁时 link 自动失效。

在文件 Vehicle.cpp 第 520 行定义.

引用了 eve::vehicle::Applied, eve::vehicle::VehiclePhysics::attach2D(), v , 以及 world.

◆ attachPhysics3D()

bool eve::vehicle::Vehicle::attachPhysics3D ( VehicleEntity *  v,
eve::physics::World3D *  world,
float  heightY = 1.f 
)

将载具绑定到 physics world 拥有的 3D 刚体。

返回
physics 可用且刚体与 generation link 均创建成功时返回 true。
备注
载具不保留跨帧刚体指针;所有解析均在 owner thread 上检查 world 生命期与 generation。

在文件 Vehicle.cpp 第 524 行定义.

引用了 eve::vehicle::Applied, eve::vehicle::VehiclePhysics::attach3D(), v , 以及 world.

◆ attack()

void eve::vehicle::Vehicle::attack ( VehicleEntity *  v,
float  x,
float  y,
int  targetId = 0 
)

◆ attackMove()

void eve::vehicle::Vehicle::attackMove ( VehicleEntity *  v,
float  x,
float  y 
)

◆ clearEvents()

void eve::vehicle::Vehicle::clearEvents ( )

事件队列(order_completed 等,上一次 update 产生)。

在文件 Vehicle.cpp 第 653 行定义.

◆ clearOrders()

void eve::vehicle::Vehicle::clearOrders ( VehicleEntity *  v)

Clears orders.

在文件 Vehicle.cpp 第 337 行定义.

引用了 eve::vehicle::VehicleSystem::clearOrders() , 以及 v.

◆ clearVehicleDefinitions()

void eve::vehicle::Vehicle::clearVehicleDefinitions ( )

◆ definitionRegistry()

eve::definitions::DefinitionRegistry & eve::vehicle::Vehicle::definitionRegistry ( )
inlinenoexcept

Return the canonical common registry for vehicle definitions.

备注
The returned registry is borrowed, owner-thread affine, and is the binding point for VehicleDefinitionRuntime adapters.

在文件 Vehicle.h 第 59 行定义.

被这些函数引用 eve::vehicle::VehicleDefinitionRuntime::create().

◆ detachPhysics()

bool eve::vehicle::Vehicle::detachPhysics ( VehicleEntity *  v)

解除绑定,并在 world 仍存活时销毁由载具创建的刚体。

在文件 Vehicle.cpp 第 528 行定义.

引用了 eve::vehicle::Applied, eve::vehicle::VehiclePhysics::detach() , 以及 v.

◆ enterSeat()

bool eve::vehicle::Vehicle::enterSeat ( VehicleEntity *  v,
int  seatIndex,
int  playerId 
)

Enter seat.

在文件 Vehicle.cpp 第 480 行定义.

引用了 eve::vehicle::VehicleSystem::enterSeat() , 以及 v.

◆ exitSeat()

bool eve::vehicle::Vehicle::exitSeat ( VehicleEntity *  v,
int  seatIndex 
)

Exit seat.

在文件 Vehicle.cpp 第 484 行定义.

引用了 eve::vehicle::VehicleSystem::exitSeat() , 以及 v.

◆ exitSeatByPlayer()

int eve::vehicle::Vehicle::exitSeatByPlayer ( VehicleEntity *  v,
int  playerId 
)

Exit seat by player.

在文件 Vehicle.cpp 第 488 行定义.

引用了 eve::vehicle::VehicleSystem::exitSeat(), eve::vehicle::VehicleSystem::findSeatByPlayer(), idx , 以及 v.

◆ getArmorZoneMult()

float eve::vehicle::Vehicle::getArmorZoneMult ( VehicleEntity *  v,
const std::string &  zone 
)

装甲区倍率(未命中任何区返回 1)。

在文件 Vehicle.cpp 第 425 行定义.

引用了 v , 以及 z.

◆ getCurrentOrderType()

std::string eve::vehicle::Vehicle::getCurrentOrderType ( VehicleEntity *  v)

当前命令类型名("move" / "attack_move" / "attack" / "stop" / "hold" / "none")。

在文件 Vehicle.cpp 第 345 行定义.

引用了 eve::vehicle::VehicleSystem::currentOrder(), eve::vehicle::VehicleOrder::type, v , 以及 eve::vehicle::vehicleOrderTypeName().

◆ getEventCount()

int eve::vehicle::Vehicle::getEventCount ( ) const

Returns the event count.

在文件 Vehicle.cpp 第 655 行定义.

被这些函数引用 getEventDefId(), getEventOrderType(), getEventType(), getEventVehicleId(), getEventX() , 以及 getEventY().

◆ getEventDefId()

std::string eve::vehicle::Vehicle::getEventDefId ( int  index) const

Returns the event def id.

在文件 Vehicle.cpp 第 665 行定义.

引用了 getEventCount() , 以及 index.

◆ getEventOrderType()

std::string eve::vehicle::Vehicle::getEventOrderType ( int  index) const

Returns the event order type.

在文件 Vehicle.cpp 第 669 行定义.

引用了 getEventCount() , 以及 index.

◆ getEventType()

std::string eve::vehicle::Vehicle::getEventType ( int  index) const

Returns the event type.

在文件 Vehicle.cpp 第 657 行定义.

引用了 getEventCount(), index, type , 以及 eve::vehicle::vehicleEventTypeName().

◆ getEventVehicleId()

std::string eve::vehicle::Vehicle::getEventVehicleId ( int  index) const

Returns the event vehicle id.

在文件 Vehicle.cpp 第 661 行定义.

引用了 getEventCount() , 以及 index.

◆ getEventX()

float eve::vehicle::Vehicle::getEventX ( int  index) const

Returns the event x.

在文件 Vehicle.cpp 第 673 行定义.

引用了 getEventCount() , 以及 index.

◆ getEventY()

float eve::vehicle::Vehicle::getEventY ( int  index) const

Returns the event y.

在文件 Vehicle.cpp 第 675 行定义.

引用了 getEventCount() , 以及 index.

◆ getFaction()

std::string eve::vehicle::Vehicle::getFaction ( VehicleEntity *  v)

Returns the faction.

在文件 Vehicle.cpp 第 378 行定义.

引用了 v.

◆ getHeading()

float eve::vehicle::Vehicle::getHeading ( VehicleEntity *  v)

Returns the heading.

在文件 Vehicle.cpp 第 357 行定义.

引用了 v.

◆ getHealth()

float eve::vehicle::Vehicle::getHealth ( VehicleEntity *  v)

Returns the health.

在文件 Vehicle.cpp 第 372 行定义.

引用了 v.

◆ getHeight()

float eve::vehicle::Vehicle::getHeight ( VehicleEntity *  v)

3D 车身高度(无 3D 物理时返回 0)。

在文件 Vehicle.cpp 第 540 行定义.

引用了 eve::vehicle::VehiclePhysics::height() , 以及 v.

◆ getMaxHealth()

float eve::vehicle::Vehicle::getMaxHealth ( VehicleEntity *  v)

Returns the max health.

在文件 Vehicle.cpp 第 376 行定义.

引用了 v.

◆ getMobilityCount()

int eve::vehicle::Vehicle::getMobilityCount ( )
static

已注册移动模型数量(内置 kinematic 起步)。

在文件 Vehicle.cpp 第 220 行定义.

引用了 eve::vehicle::VehicleSystem::mobilityCount().

◆ getMount()

eve::weapon::WeaponMountEntity * eve::vehicle::Vehicle::getMount ( VehicleEntity *  v,
int  index 
)

Returns the mount.

在文件 Vehicle.cpp 第 548 行定义.

引用了 index , 以及 v.

◆ getMountCount()

int eve::vehicle::Vehicle::getMountCount ( VehicleEntity *  v)

挂点查询(返回 weapon 模块的挂点实体)。

返回
Borrowed nullable weapon-mount entity owned by the ECS world. @ownership The weapon module/ECS owns the mount; Vehicle never transfers or deletes it. @lifetime Valid until mount or world destruction; use its generation handle across frames. @thread Call on the Vehicle module's owning ECS thread. @reentrancy The query invokes no callbacks; do not retain the pointer across mutation.

在文件 Vehicle.cpp 第 546 行定义.

引用了 v.

◆ getPhysicsSpace()

std::string eve::vehicle::Vehicle::getPhysicsSpace ( VehicleEntity *  v)

返回存活绑定的 "2d"/"3d";缺失或 stale 时返回空字符串。

在文件 Vehicle.cpp 第 536 行定义.

引用了 eve::vehicle::VehiclePhysics::isAttached() , 以及 v.

◆ getSeatCameraMode()

std::string eve::vehicle::Vehicle::getSeatCameraMode ( VehicleEntity *  v,
int  seatIndex 
)

Returns the seat camera mode.

在文件 Vehicle.cpp 第 448 行定义.

引用了 v.

◆ getSeatCount()

int eve::vehicle::Vehicle::getSeatCount ( VehicleEntity *  v)

座位(FPS 面)。

在文件 Vehicle.cpp 第 439 行定义.

引用了 v.

◆ getSeatMount()

eve::weapon::WeaponMountEntity * eve::vehicle::Vehicle::getSeatMount ( VehicleEntity *  v,
int  seatIndex 
)

座位绑定的武器挂点(mountIndex 无效返回 nullptr)。

返回
Borrowed nullable weapon-mount entity owned by the ECS world. @ownership The weapon module/ECS owns the mount; Vehicle never transfers or deletes it. @lifetime Valid until mount or world destruction; a stored cross-frame reference must be a generation handle. @thread Call on the Vehicle module's owning ECS thread. @reentrancy The query invokes no callbacks; do not retain the pointer across seat or ECS mutation.

在文件 Vehicle.cpp 第 469 行定义.

引用了 s , 以及 v.

◆ getSeatName()

std::string eve::vehicle::Vehicle::getSeatName ( VehicleEntity *  v,
int  seatIndex 
)

Returns the seat name.

在文件 Vehicle.cpp 第 441 行定义.

引用了 name , 以及 v.

◆ getSeatOccupant()

int eve::vehicle::Vehicle::getSeatOccupant ( VehicleEntity *  v,
int  seatIndex 
)

Returns the seat occupant.

在文件 Vehicle.cpp 第 462 行定义.

引用了 v.

◆ getSpeed()

float eve::vehicle::Vehicle::getSpeed ( VehicleEntity *  v)

Returns the speed.

在文件 Vehicle.cpp 第 358 行定义.

引用了 v.

◆ getVehicleDefinitionCount()

int eve::vehicle::Vehicle::getVehicleDefinitionCount ( )

已注册载具模板数量。

在文件 Vehicle.cpp 第 193 行定义.

引用了 eve::definitions::DefinitionRegistry::countType().

◆ getVehicleDefinitionMaxHealth()

float eve::vehicle::Vehicle::getVehicleDefinitionMaxHealth ( const std::string &  id)

Returns the vehicle definition max health.

在文件 Vehicle.cpp 第 209 行定义.

◆ getVehicleDefinitionMobility()

std::string eve::vehicle::Vehicle::getVehicleDefinitionMobility ( const std::string &  id)

Returns the vehicle definition mobility.

在文件 Vehicle.cpp 第 200 行定义.

◆ getX()

float eve::vehicle::Vehicle::getX ( VehicleEntity *  v)

状态查询 / 设置。

在文件 Vehicle.cpp 第 355 行定义.

引用了 v.

◆ getY()

float eve::vehicle::Vehicle::getY ( VehicleEntity *  v)

Returns the y.

在文件 Vehicle.cpp 第 356 行定义.

引用了 v.

◆ hasPhysics()

bool eve::vehicle::Vehicle::hasPhysics ( VehicleEntity *  v)

查询当前绑定是否仍能解析为存活刚体。

在文件 Vehicle.cpp 第 532 行定义.

引用了 eve::vehicle::VehiclePhysics::isAttached() , 以及 v.

◆ hasVehicleDefinition()

bool eve::vehicle::Vehicle::hasVehicleDefinition ( const std::string &  id)

载具模板查询。

在文件 Vehicle.cpp 第 195 行定义.

引用了 eve::definitions::DefinitionRegistry::resolve().

◆ hold()

void eve::vehicle::Vehicle::hold ( VehicleEntity *  v)

◆ isArrived()

bool eve::vehicle::Vehicle::isArrived ( VehicleEntity *  v)

True when arrived.

在文件 Vehicle.cpp 第 370 行定义.

引用了 v.

◆ isDestroyed()

bool eve::vehicle::Vehicle::isDestroyed ( VehicleEntity *  v)

是否已摧毁。

在文件 Vehicle.cpp 第 433 行定义.

引用了 v.

◆ isSeatOccupied()

bool eve::vehicle::Vehicle::isSeatOccupied ( VehicleEntity *  v,
int  seatIndex 
)

True when seat occupied.

在文件 Vehicle.cpp 第 455 行定义.

引用了 occupied , 以及 v.

◆ Module_REG()

eve::vehicle::Vehicle::Module_REG ( Vehicle  )

◆ moveTo()

void eve::vehicle::Vehicle::moveTo ( VehicleEntity *  v,
float  x,
float  y 
)

◆ newVehicle()

VehicleEntity * eve::vehicle::Vehicle::newVehicle ( const std::string &  defId,
float  x,
float  y,
float  heading = 0.f,
const std::string &  faction = "" 
)

工厂:按模板创建载具并挂载武器挂点(ECS 表持有,脚本持有句柄)。

返回
Borrowed nullable pointer to the ECS-owned vehicle; null means validation or creation failed. @ownership The ECS world owns the entity; callers must not delete it. @lifetime Valid until ECS destroys the entity or world; retain its generation handle across frames. @thread Call on the Vehicle module's owning ECS thread. @reentrancy Creation does not invoke user callbacks; do not mutate the ECS world re-entrantly while using the result.

在文件 Vehicle.cpp 第 232 行定义.

引用了 eve::vehicle::VehicleEntity::MountSlot::aimMode, eve::vehicle::VehicleEntity::SeatSlot::cameraMode, eve::vehicle::VehicleEntity::createVehicle(), eve::vehicle::VehicleEntity::SeatSlot::driver, heading, m, eve::vehicle::VehicleDefinition::maxHealth, eve::vehicle::VehicleEntity::MountSlot::mount, eve::vehicle::VehicleEntity::SeatSlot::mountIndex, eve::vehicle::VehicleDefinition::mounts, eve::vehicle::VehicleEntity::SeatSlot::name, requireModInst, eve::vehicle::VehicleDefinition::seats, v, w, x , 以及 y.

◆ orderCount()

int eve::vehicle::Vehicle::orderCount ( VehicleEntity *  v)

Order count.

在文件 Vehicle.cpp 第 341 行定义.

引用了 v.

◆ registerMobility()

void eve::vehicle::Vehicle::registerMobility ( IVehicleMobility *  mobility)
static

注册移动模型(C++ 插件/游戏侧扩展点;同名替换)。

在文件 Vehicle.cpp 第 218 行定义.

引用了 eve::vehicle::VehicleSystem::registerMobility().

◆ registerVehiclesFromJson()

int eve::vehicle::Vehicle::registerVehiclesFromJson ( const std::string &  json)

◆ setFaction()

void eve::vehicle::Vehicle::setFaction ( VehicleEntity *  v,
const std::string &  faction 
)

Sets the faction.

在文件 Vehicle.cpp 第 380 行定义.

引用了 v.

◆ setHeading()

void eve::vehicle::Vehicle::setHeading ( VehicleEntity *  v,
float  deg 
)

Sets the heading.

在文件 Vehicle.cpp 第 366 行定义.

引用了 v.

◆ setHealth()

void eve::vehicle::Vehicle::setHealth ( VehicleEntity *  v,
float  hp 
)

Sets the health.

在文件 Vehicle.cpp 第 373 行定义.

引用了 v.

◆ setInput()

void eve::vehicle::Vehicle::setInput ( VehicleEntity *  v,
float  throttle,
float  steer,
float  brake = 0.f,
bool  handbrake = false 
)

直接驾驶输入(FPS / 脚本驱动;RTS 命令也会写 input)。

在文件 Vehicle.cpp 第 511 行定义.

引用了 v.

◆ setPlayerControls()

void eve::vehicle::Vehicle::setPlayerControls ( int  playerId,
float  throttle,
float  steer,
float  brake,
bool  fire,
float  aimYaw,
float  aimPitch 
)

写入玩家控制(归一化;角度为度)。

在文件 Vehicle.cpp 第 495 行定义.

引用了 c, eve::vehicle::VehicleSystem::setPlayerControls() , 以及 eve::vehicle::PlayerControl::throttle.

◆ setPosition()

void eve::vehicle::Vehicle::setPosition ( VehicleEntity *  v,
float  x,
float  y 
)

Sets the position.

在文件 Vehicle.cpp 第 360 行定义.

引用了 v, x , 以及 y.

◆ stop()

void eve::vehicle::Vehicle::stop ( VehicleEntity *  v)

◆ update()

void eve::vehicle::Vehicle::update ( float  dt)

每帧推进全部载具(命令 → 移动 → RTS 自动瞄准)。

在文件 Vehicle.cpp 第 559 行定义.

引用了 h, eve::vehicle::VehicleSystem::update() , 以及 v.


该类的文档由以下文件生成: