mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
breakout the component types into a scoped enum (#1002)
* breakout the component types into a scoped enum tested that things are the same as they were before * fix missed rename * fix brick-by-brick name to be crafting because that's what it is
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgFans::OnStartup(Entity* self) {
|
||||
self->SetVar<bool>(u"alive", true);
|
||||
@@ -11,7 +12,7 @@ void AgFans::OnStartup(Entity* self) {
|
||||
|
||||
ToggleFX(self, false);
|
||||
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
if (renderComponent == nullptr) {
|
||||
return;
|
||||
@@ -24,7 +25,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
std::string fanGroup = self->GetGroups()[0];
|
||||
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
|
||||
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
if (renderComponent == nullptr) {
|
||||
return;
|
||||
@@ -39,7 +40,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
self->SetVar<bool>(u"on", false);
|
||||
|
||||
for (Entity* volume : fanVolumes) {
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(false);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
@@ -55,7 +56,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
self->SetVar<bool>(u"on", true);
|
||||
|
||||
for (Entity* volume : fanVolumes) {
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(true);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
|
@@ -4,12 +4,13 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgImagSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
bool maxImagGreaterThanZero = false;
|
||||
|
||||
if (killer) {
|
||||
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
if (dest) {
|
||||
maxImagGreaterThanZero = dest->GetMaxImagination() > 0;
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
|
||||
if (inUse) {
|
||||
@@ -86,12 +87,12 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
auto* mortar = entities[selected];
|
||||
|
||||
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(COMPONENT_TYPE_SKILL));
|
||||
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(eReplicaComponentType::SKILL));
|
||||
|
||||
mortar->SetOwnerOverride(builder);
|
||||
|
||||
SkillComponent* skillComponent;
|
||||
if (!mortar->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) {
|
||||
if (!mortar->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "AgStromlingProperty.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgStromlingProperty::OnStartup(Entity* self) {
|
||||
auto movementInfo = MovementAIInfo{
|
||||
@@ -12,5 +13,5 @@ void AgStromlingProperty::OnStartup(Entity* self) {
|
||||
};
|
||||
|
||||
auto* movementAIComponent = new MovementAIComponent(self, movementInfo);
|
||||
self->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAIComponent);
|
||||
self->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAIComponent);
|
||||
}
|
||||
|
@@ -4,13 +4,14 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void GfCampfire::OnStartup(Entity* self) {
|
||||
self->SetI32(u"counter", static_cast<int32_t>(0));
|
||||
self->SetProximityRadius(2.0f, "placeholder");
|
||||
self->SetBoolean(u"isBurning", true);
|
||||
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
if (render == nullptr)
|
||||
return;
|
||||
|
||||
@@ -20,7 +21,7 @@ void GfCampfire::OnStartup(Entity* self) {
|
||||
void GfCampfire::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "physicsReady") {
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
render->PlayEffect(295, u"running", "Burn");
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "Loot.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SGCannon::OnStartup(Entity* self) {
|
||||
Game::logger->Log("SGCannon", "OnStartup");
|
||||
@@ -295,7 +296,7 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (true) {
|
||||
auto* movementAI = new MovementAIComponent(enemy, {});
|
||||
|
||||
enemy->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAI);
|
||||
enemy->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAI);
|
||||
|
||||
movementAI->SetSpeed(toSpawn.initialSpeed);
|
||||
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
|
||||
|
@@ -2,12 +2,13 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE && missionID == 173) {
|
||||
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
destroyable->SetImagination(6);
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
mission->CompleteMission(664);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Character.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID, Entity* player, int reward) {
|
||||
if (missionID != 474) return;
|
||||
@@ -44,7 +45,7 @@ void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID,
|
||||
player->GetCharacter()->SetPlayerFlag(flagID, true);
|
||||
}
|
||||
|
||||
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
for (int mission : factionMissions) {
|
||||
mis->AcceptMission(mission);
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#include "NsModularBuild.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void NsModularBuild::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector<LOT> modules) {
|
||||
if (bCompleted) {
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
if (mission->GetMissionState(m_MissionNum) == eMissionState::ACTIVE) {
|
||||
for (LOT mod : modules) {
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SpecialImaginePowerupSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||
@@ -26,7 +27,7 @@ void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* enter
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
SkillComponent* skillComponent;
|
||||
if (!self->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) {
|
||||
if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* enter
|
||||
skillComponent->CalculateBehavior(13, 20, source);
|
||||
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (!self->TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)) {
|
||||
if (!self->TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user