First volume of optimizations

This commit is contained in:
EmosewaMC 2022-06-22 01:22:59 -07:00
parent d79d8d4991
commit cb746f2a96
29 changed files with 34 additions and 52 deletions

View File

@ -11,6 +11,8 @@
#include "dConfig.h" #include "dConfig.h"
#include "dServer.h" #include "dServer.h"
#include "tinyxml2.h" #include "tinyxml2.h"
#include "Game.h"
#include "dLogger.h"
#include <fstream> #include <fstream>

View File

@ -2,18 +2,12 @@
void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state) void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state)
{ {
Game::logger->Log("ActNinjaTurret", "Rebuild state: %i\n", state);
if (state == eRebuildState::REBUILD_COMPLETED) if (state == eRebuildState::REBUILD_COMPLETED)
{ {
Game::logger->Log("ActNinjaTurret", "I am build\n");
self->SetVar(u"AmBuilt", true); self->SetVar(u"AmBuilt", true);
} }
else if (state == eRebuildState::REBUILD_RESETTING) else if (state == eRebuildState::REBUILD_RESETTING)
{ {
Game::logger->Log("ActNinjaTurret", "I am not build\n");
self->SetVar(u"AmBuilt", false); self->SetVar(u"AmBuilt", false);
} }
} }
@ -22,8 +16,6 @@ void
ActNinjaTurret::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, ActNinjaTurret::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) int32_t param3)
{ {
Game::logger->Log("ActNinjaTurret", "Got server side event %s\n", args.c_str());
if (args == "ISpawned" && self->GetVar<bool>(u"AmBuilt")) if (args == "ISpawned" && self->GetVar<bool>(u"AmBuilt"))
{ {
sender->Smash(); sender->Smash();

View File

@ -1,25 +1,16 @@
#include "ActSharkPlayerDeathTrigger.h" #include "ActSharkPlayerDeathTrigger.h"
#include "Entity.h" #include "Entity.h"
#include "GameMessages.h"
#include "Game.h"
#include "dLogger.h"
void ActSharkPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
}
void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) { int32_t param2, int32_t param3) {
if (args == "achieve") { if (args == "achieve") {
MissionComponent* mis = static_cast<MissionComponent*>(sender->GetComponent(COMPONENT_TYPE_MISSION)); auto missionComponent = sender->GetComponent<MissionComponent>();
if (!mis) return; if (!missionComponent) return;
mis->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, 8419); missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, 8419);
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
Game::logger->Log("ActSharkPlayerDeathTrigger", "%i\n", self->GetLOT());
if (sender->GetCharacter()) { if (sender->GetCharacter()) {
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death"); sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");
} }

View File

@ -4,8 +4,7 @@
class ActSharkPlayerDeathTrigger : public CppScripts::Script class ActSharkPlayerDeathTrigger : public CppScripts::Script
{ {
public: public:
void OnCollisionPhantom(Entity* self, Entity* target);
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
int32_t param3); int32_t param3) override;
}; };

View File

@ -4,6 +4,7 @@
#include "LeaderboardManager.h" #include "LeaderboardManager.h"
#include "GameMessages.h" #include "GameMessages.h"
#include <algorithm> #include <algorithm>
#include "dLogger.h"
bool ActivityManager::IsPlayerInActivity(Entity *self, LWOOBJID playerID) { bool ActivityManager::IsPlayerInActivity(Entity *self, LWOOBJID playerID) {
const auto* sac = self->GetComponent<ScriptedActivityComponent>(); const auto* sac = self->GetComponent<ScriptedActivityComponent>();

View File

@ -1,7 +1,6 @@
#include "AgBugsprayer.h" #include "AgBugsprayer.h"
#include "SkillComponent.h" #include "SkillComponent.h"
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target)
{ {
self->AddTimer("castSkill", 1); self->AddTimer("castSkill", 1);

View File

@ -1,8 +1,6 @@
#include "AgBusDoor.h" #include "AgBusDoor.h"
#include "Entity.h" #include "Entity.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Game.h"
#include "dLogger.h"
#include "ProximityMonitorComponent.h" #include "ProximityMonitorComponent.h"
void AgBusDoor::OnStartup(Entity* self) { void AgBusDoor::OnStartup(Entity* self) {

View File

@ -12,7 +12,11 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
} }
//Set the flag & mission status: //Set the flag & mission status:
user->GetCharacter()->SetPlayerFlag(74, true); auto character = user->GetCharacter();
if (!character) return;
character->SetPlayerFlag(74, true);
//Remove the maelstrom cube: //Remove the maelstrom cube:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY)); auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));

View File

@ -1,5 +1,8 @@
#include "AgFans.h" #include "AgFans.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "PhantomPhysicsComponent.h"
#include "RenderComponent.h" #include "RenderComponent.h"
void AgFans::OnStartup(Entity* self) { void AgFans::OnStartup(Entity* self) {

View File

@ -1,8 +1,5 @@
#pragma once #pragma once
#include "CppScripts.h" #include "CppScripts.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "PhantomPhysicsComponent.h"
class AgFans : public CppScripts::Script class AgFans : public CppScripts::Script
{ {

View File

@ -4,7 +4,6 @@
class AgImagSmashable : public CppScripts::Script { class AgImagSmashable : public CppScripts::Script {
public: public:
void OnDie(Entity* self, Entity* killer); void OnDie(Entity* self, Entity* killer);
private: private:
void CrateAnimal(Entity* self); void CrateAnimal(Entity* self);
}; };

View File

@ -1,15 +1,8 @@
#include "AgJetEffectServer.h" #include "AgJetEffectServer.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h" #include "SkillComponent.h"
void AgJetEffectServer::OnStartup(Entity* self)
{
}
void AgJetEffectServer::OnUse(Entity* self, Entity* user) void AgJetEffectServer::OnUse(Entity* self, Entity* user)
{ {
if (inUse) if (inUse)
@ -41,7 +34,6 @@ void AgJetEffectServer::OnUse(Entity* self, Entity* user)
GameMessages::SendPlayFXEffect(effect, 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(effect, 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
self->AddTimer("radarDish", 2); self->AddTimer("radarDish", 2);
//self->AddTimer("PlayEffect", 2.5f);
self->AddTimer("CineDone", 9); self->AddTimer("CineDone", 9);
} }

View File

@ -4,16 +4,12 @@
class AgJetEffectServer final : public CppScripts::Script class AgJetEffectServer final : public CppScripts::Script
{ {
public: public:
void OnStartup(Entity* self) override;
void OnUse(Entity* self, Entity* user) override; void OnUse(Entity* self, Entity* user) override;
void OnRebuildComplete(Entity* self, Entity* target) override; void OnRebuildComplete(Entity* self, Entity* target) override;
void OnTimerDone(Entity* self, std::string timerName) override; void OnTimerDone(Entity* self, std::string timerName) override;
private: private:
LWOOBJID builder; LWOOBJID builder;
bool inUse; bool inUse;
}; };

View File

@ -1,5 +1,9 @@
#include "AgLaserSensorServer.h" #include "AgLaserSensorServer.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h"
#include "EntityManager.h"
#include "AgMonumentLaserServer.h"
#include "EntityManager.h" #include "EntityManager.h"
void AgLaserSensorServer::OnStartup(Entity* self) { void AgLaserSensorServer::OnStartup(Entity* self) {

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "CppScripts.h" #include "CppScripts.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h" class SkillComponent;
#include "EntityManager.h"
#include "AgMonumentLaserServer.h"
class AgLaserSensorServer : public CppScripts::Script { class AgLaserSensorServer : public CppScripts::Script {
public: public:

View File

@ -3,6 +3,7 @@
#include "MovingPlatformComponent.h" #include "MovingPlatformComponent.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "ProximityMonitorComponent.h" #include "ProximityMonitorComponent.h"
#include "dLogger.h"
#include "MissionComponent.h" #include "MissionComponent.h"
void AmSkullkinDrill::OnStartup(Entity* self) void AmSkullkinDrill::OnStartup(Entity* self)

View File

@ -3,6 +3,7 @@
#include "dZoneManager.h" #include "dZoneManager.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "Spawner.h" #include "Spawner.h"
#include "dLogger.h"
void BaseRandomServer::BaseStartup(Entity* self) void BaseRandomServer::BaseStartup(Entity* self)
{ {

View File

@ -1,11 +1,8 @@
#pragma once #pragma once
#include "dCommonVars.h" #include "dCommonVars.h"
#include "RakNetTypes.h"
#include <string> #include <string>
#include "MissionComponent.h" #include "MissionComponent.h"
#include "MissionState.h" #include "MissionState.h"
#include "Game.h"
#include "dLogger.h"
#include "Loot.h" #include "Loot.h"
class User; class User;

View File

@ -1,6 +1,7 @@
#include "ForceVolumeServer.h" #include "ForceVolumeServer.h"
#include "PhantomPhysicsComponent.h" #include "PhantomPhysicsComponent.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "dLogger.h"
void ForceVolumeServer::OnStartup(Entity* self) void ForceVolumeServer::OnStartup(Entity* self)

View File

@ -3,6 +3,7 @@
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "dZoneManager.h" #include "dZoneManager.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "dLogger.h"
void FvFacilityBrick::OnStartup(Entity* self) void FvFacilityBrick::OnStartup(Entity* self)

View File

@ -1,6 +1,7 @@
#include "FvHorsemenTrigger.h" #include "FvHorsemenTrigger.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "dLogger.h"
void FvHorsemenTrigger::OnStartup(Entity* self) void FvHorsemenTrigger::OnStartup(Entity* self)
{ {

View File

@ -1,5 +1,6 @@
#include "FvMaelstromCavalry.h" #include "FvMaelstromCavalry.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "dLogger.h"
void FvMaelstromCavalry::OnStartup(Entity* self) void FvMaelstromCavalry::OnStartup(Entity* self)
{ {

View File

@ -4,6 +4,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "dLogger.h"
#include "InventoryComponent.h" #include "InventoryComponent.h"
int32_t ImgBrickConsoleQB::ResetBricks = 30; int32_t ImgBrickConsoleQB::ResetBricks = 30;

View File

@ -2,7 +2,7 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "Player.h" #include "Player.h"
#include "Character.h" #include "Character.h"
#include "Game.h" #include "dLogger.h"
#include "dServer.h" #include "dServer.h"
void InstanceExitTransferPlayerToLastNonInstance::OnUse(Entity* self, Entity* user) void InstanceExitTransferPlayerToLastNonInstance::OnUse(Entity* self, Entity* user)

View File

@ -4,7 +4,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "InventoryComponent.h" #include "InventoryComponent.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "dLogger.h"
void NtCombatChallengeServer::OnUse(Entity* self, Entity* user) void NtCombatChallengeServer::OnUse(Entity* self, Entity* user)
{ {

View File

@ -1,7 +1,7 @@
#include "NtSentinelWalkwayServer.h" #include "NtSentinelWalkwayServer.h"
#include "PhantomPhysicsComponent.h" #include "PhantomPhysicsComponent.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "dLogger.h"
void NtSentinelWalkwayServer::OnStartup(Entity* self) void NtSentinelWalkwayServer::OnStartup(Entity* self)
{ {

View File

@ -1,6 +1,7 @@
#include "TriggerAmbush.h" #include "TriggerAmbush.h"
#include "dZoneManager.h" #include "dZoneManager.h"
#include "dLogger.h"
#include "EntityManager.h" #include "EntityManager.h"
void TriggerAmbush::OnStartup(Entity* self) void TriggerAmbush::OnStartup(Entity* self)

View File

@ -1,4 +1,5 @@
#include "ZoneAgMedProperty.h" #include "ZoneAgMedProperty.h"
#include "dLogger.h"
void ZoneAgMedProperty::SetGameVariables(Entity *self) { void ZoneAgMedProperty::SetGameVariables(Entity *self) {
Game::logger->Log("Properties", "Setting variables in instance\n"); Game::logger->Log("Properties", "Setting variables in instance\n");

View File

@ -7,6 +7,7 @@
#include "dZoneManager.h" #include "dZoneManager.h"
#include "LDFFormat.h" #include "LDFFormat.h"
#include "RenderComponent.h" #include "RenderComponent.h"
#include "dLogger.h"
void ZoneAgProperty::SetGameVariables(Entity *self) { void ZoneAgProperty::SetGameVariables(Entity *self) {
self->SetVar<std::string>(GuardGroup, "Guard"); self->SetVar<std::string>(GuardGroup, "Guard");