|
R-Type
Distributed multiplayer game engine in C++
|
Factory for creating game entity prefabs. More...
#include <PrefabFactory.hpp>

Classes | |
| struct | EnemySpawnData |
Static Public Member Functions | |
| static ecs::Address | createPlayer (ecs::Registry ®istry, uint32_t playerId) |
| Create a player entity. | |
| static ecs::Address | createEnemy (ecs::Registry ®istry, int enemyType, float posX, float posY) |
| Create an enemy entity. | |
| static ecs::Address | createEnemy (ecs::Registry ®istry, const std::string &enemyType, float posX, float posY, float health, int scoreValue, const std::string &scriptPath="") |
| Create an enemy entity with custom parameters (for SpawnSystem) | |
| static ecs::Address | createEnemyFromRegistry (ecs::Registry ®istry, const std::string &enemyType, float posX, float posY, float health, int scoreValue, const std::string &scriptPath="") |
| Create an enemy entity directly from Registry (for SpawnSystem) | |
| static ecs::Address | createProjectile (ecs::Registry ®istry, uint32_t ownerId, float posX, float posY, float dirX, float dirY, float speed, int damage, bool friendly) |
| Create a projectile entity. | |
| static ecs::Address | createPowerUp (ecs::Registry ®istry, ecs::BuffType buffType, float duration, float value, float posX, float posY) |
| Create a collectible power-up entity. | |
| static ecs::Address | createHealthPack (ecs::Registry ®istry, int healthRestore, float posX, float posY) |
| Create a health pack collectible. | |
| static ecs::Address | createWall (ecs::Registry ®istry, float posX, float posY, float width, float height, bool destructible=false, int health=0) |
| Create a wall/obstacle entity. | |
| static ecs::Address | createOrbitalModule (ecs::Registry ®istry, uint32_t parentEntityId, float orbitRadius=50.0f, float orbitSpeed=2.0f, float startAngle=0.0f, int damage=10, int moduleHealth=50) |
| Create an orbital module (drone) entity. | |
Static Private Member Functions | |
| static EnemySpawnData | _getEnemySpawnData (int enemyType) |
| static int | _enemyTypeFromString (const std::string &enemyType) |
Factory for creating game entity prefabs.
Used to instantiate entities with predefined components and settings.
Definition at line 45 of file PrefabFactory.hpp.
|
staticprivate |
Definition at line 186 of file PrefabFactory.cpp.
References LOG_WARNING.
Referenced by createEnemy(), and createEnemyFromRegistry().
|
staticprivate |
Definition at line 171 of file PrefabFactory.cpp.
Referenced by createEnemy(), createEnemy(), and createEnemyFromRegistry().
|
static |
Create an enemy entity with custom parameters (for SpawnSystem)
| registry | ECS registry |
| enemyType | Type string ("basic", "advanced", "fast", "boss") |
| posX | Starting X position |
| posY | Starting Y position |
| health | Custom health value |
| scoreValue | Custom score value |
| scriptPath | Optional Lua script path for AI behavior |
Definition at line 80 of file PrefabFactory.cpp.
References _enemyTypeFromString(), _getEnemySpawnData(), ecs::PrefabFactory::EnemySpawnData::colliderHeight, ecs::PrefabFactory::EnemySpawnData::colliderWidth, LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), ecs::Registry::setComponent(), and ecs::PrefabFactory::EnemySpawnData::speed.

|
static |
Create an enemy entity.
| registry | ECS registry |
| enemyType | Type of enemy (0=basic, 1=heavy, 2=fast, etc.) |
| posX | Starting X position |
| posY | Starting Y position |
Definition at line 36 of file PrefabFactory.cpp.
References _getEnemySpawnData(), ecs::PrefabFactory::EnemySpawnData::colliderHeight, ecs::PrefabFactory::EnemySpawnData::colliderWidth, ecs::PrefabFactory::EnemySpawnData::health, LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), ecs::PrefabFactory::EnemySpawnData::scoreValue, ecs::Registry::setComponent(), and ecs::PrefabFactory::EnemySpawnData::speed.

|
static |
Create an enemy entity directly from Registry (for SpawnSystem)
| registry | ECS registry |
| enemyType | Type string ("basic", "advanced", "fast", "boss") |
| posX | Starting X position |
| posY | Starting Y position |
| health | Custom health value |
| scoreValue | Custom score value |
| scriptPath | Optional Lua script path for AI behavior |
Definition at line 109 of file PrefabFactory.cpp.
References _enemyTypeFromString(), _getEnemySpawnData(), ecs::PrefabFactory::EnemySpawnData::colliderHeight, ecs::PrefabFactory::EnemySpawnData::colliderWidth, LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), ecs::Registry::setComponent(), and ecs::PrefabFactory::EnemySpawnData::speed.

|
static |
Create a health pack collectible.
| registry | ECS registry |
| healthRestore | Amount of health to restore |
| posX | Starting X position |
| posY | Starting Y position |
Definition at line 155 of file PrefabFactory.cpp.
References LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), and ecs::Registry::setComponent().

|
static |
Create an orbital module (drone) entity.
| registry | ECS registry |
| parentEntityId | ID of the entity to orbit around (typically player) |
| orbitRadius | Distance from parent center |
| orbitSpeed | Angular velocity in radians per second |
| startAngle | Initial angle in radians (default: 0) |
| damage | Damage dealt on contact with enemies |
| moduleHealth | Health points for the module |
Definition at line 225 of file PrefabFactory.cpp.
References AnimDB::createOrbitalModuleAnimations(), ecs::Registry::getComponent(), ecs::Transform::getPosition(), ecs::Registry::hasComponent(), LOG_ERROR, LOG_INFO, ecs::CollisionLayers::MASK_PLAYER_MODULE, ecs::CollisionLayers::PLAYER_MODULE, and ecs::Registry::setComponent().
Referenced by server::GameLogic::spawnPlayer().

|
static |
Create a player entity.
| world | ECS world wrapper |
| playerId | Unique player ID |
| playerName | Display name |
Definition at line 16 of file PrefabFactory.cpp.
References LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), and ecs::Registry::setComponent().

|
static |
Create a collectible power-up entity.
| registry | ECS registry |
| buffType | Type of buff to grant |
| duration | Duration of buff (0.0f for permanent) |
| value | Buff value/multiplier |
| posX | Starting X position |
| posY | Starting Y position |
Definition at line 138 of file PrefabFactory.cpp.
References LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), and ecs::Registry::setComponent().

|
static |
Create a projectile entity.
| registry | ECS registry |
| ownerId | Owner entity ID (shooter) |
| posX | Starting X position |
| posY | Starting Y position |
| dirX | Direction X component |
| dirY | Direction Y component |
| speed | Movement speed |
| damage | Damage value |
| friendly | True for player projectile, false for enemy |
Definition at line 56 of file PrefabFactory.cpp.
References AnimDB::createPlayerBulletAnimations(), LOG_ERROR, ecs::Registry::newEntity(), and ecs::Registry::setComponent().

|
static |
Create a wall/obstacle entity.
| registry | ECS registry |
| posX | Starting X position |
| posY | Starting Y position |
| width | Wall width |
| height | Wall height |
| destructible | Whether the wall can be destroyed |
| health | Health points (0 = indestructible) |
Definition at line 199 of file PrefabFactory.cpp.
References LOG_ERROR, LOG_INFO, ecs::Registry::newEntity(), and ecs::Registry::setComponent().
