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 "dServer.h"
#include "tinyxml2.h"
#include "Game.h"
#include "dLogger.h"
#include <fstream>

View File

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

View File

@ -1,25 +1,16 @@
#include "ActSharkPlayerDeathTrigger.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,
int32_t param2, int32_t param3) {
if (args == "achieve") {
MissionComponent* mis = static_cast<MissionComponent*>(sender->GetComponent(COMPONENT_TYPE_MISSION));
if (!mis) return;
auto missionComponent = sender->GetComponent<MissionComponent>();
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
Game::logger->Log("ActSharkPlayerDeathTrigger", "%i\n", self->GetLOT());
if (sender->GetCharacter()) {
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");
}

View File

@ -4,8 +4,7 @@
class ActSharkPlayerDeathTrigger : public CppScripts::Script
{
public:
void OnCollisionPhantom(Entity* self, Entity* target);
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 "GameMessages.h"
#include <algorithm>
#include "dLogger.h"
bool ActivityManager::IsPlayerInActivity(Entity *self, LWOOBJID playerID) {
const auto* sac = self->GetComponent<ScriptedActivityComponent>();

View File

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

View File

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

View File

@ -12,7 +12,11 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
}
//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:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));

View File

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

View File

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

View File

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

View File

@ -1,15 +1,8 @@
#include "AgJetEffectServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h"
void AgJetEffectServer::OnStartup(Entity* self)
{
}
void AgJetEffectServer::OnUse(Entity* self, Entity* user)
{
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);
self->AddTimer("radarDish", 2);
//self->AddTimer("PlayEffect", 2.5f);
self->AddTimer("CineDone", 9);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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