mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Another consistency pass
- change NotifyObject to use u16 string - move stuff to header that is inline - use u16strings instead of converting to u16 string - move entity to dEntity
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "AmBridge.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AmBridge::OnStartup(Entity* self) {
|
||||
|
||||
@@ -14,7 +15,7 @@ void AmBridge::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
|
||||
auto* console = consoles[0];
|
||||
|
||||
console->NotifyObject(self, "BridgeBuilt");
|
||||
console->NotifyObject(self, u"BridgeBuilt");
|
||||
|
||||
self->AddTimer("SmashBridge", 50);
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AmDrawBridge::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
@@ -72,8 +73,8 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
}
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "BridgeBuilt") {
|
||||
void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) {
|
||||
if (name == u"BridgeBuilt") {
|
||||
self->SetVar(u"BridgeID", sender->GetObjectID());
|
||||
|
||||
self->AddTimer("SmashEffectBridge", 45);
|
||||
|
@@ -7,7 +7,7 @@ public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void MoveBridgeDown(Entity* self, Entity* bridge, bool down);
|
||||
void NotifyDie(Entity* self, Entity* other);
|
||||
|
@@ -10,7 +10,7 @@ void AmSkullkinDrillStand::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(new dpEntity(self->GetObjectID(), { 6, 14, 6 }), "knockback");
|
||||
}
|
||||
|
||||
void AmSkullkinDrillStand::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
void AmSkullkinDrillStand::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@ class AmSkullkinDrillStand : public CppScripts::Script
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "NjRailPostServer.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void NjRailPostServer::OnStartup(Entity* self) {
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
@@ -9,11 +10,11 @@ void NjRailPostServer::OnStartup(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1,
|
||||
void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1,
|
||||
int32_t param2) {
|
||||
if (name == "PostRebuilt") {
|
||||
if (name == u"PostRebuilt") {
|
||||
self->SetNetworkVar<bool>(NetworkNotActiveVariable, false);
|
||||
} else if (name == "PostDied") {
|
||||
} else if (name == u"PostDied") {
|
||||
self->SetNetworkVar<bool>(NetworkNotActiveVariable, true);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +25,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (relatedRail == nullptr)
|
||||
return;
|
||||
|
||||
relatedRail->NotifyObject(self, "PostRebuilt");
|
||||
relatedRail->NotifyObject(self, u"PostRebuilt");
|
||||
|
||||
if (self->GetVar<bool>(NotActiveVariable))
|
||||
return;
|
||||
@@ -35,7 +36,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (relatedRail == nullptr)
|
||||
return;
|
||||
|
||||
relatedRail->NotifyObject(self, "PostDied");
|
||||
relatedRail->NotifyObject(self, u"PostDied");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
class NjRailPostServer : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) override;
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
private:
|
||||
Entity* GetRelatedRail(Entity* self);
|
||||
|
@@ -4,8 +4,8 @@
|
||||
#include "Entity.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "BouncerBuilt") {
|
||||
void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) {
|
||||
if (name == u"BouncerBuilt") {
|
||||
// start a timer for the arm to player the with bouncer animation
|
||||
self->AddTimer("PlatAnim", .75);
|
||||
|
||||
@@ -46,7 +46,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (bouncer == nullptr) return;
|
||||
|
||||
// bounce all players
|
||||
bouncer->NotifyObject(bouncer, "bounceAllInProximity"); // Likely to trigger server side bounce, bodging this
|
||||
bouncer->NotifyObject(bouncer, u"bounceAllInProximity"); // Likely to trigger server side bounce, bodging this
|
||||
// add a delay to play the animation
|
||||
self->AddTimer("launchAnim", .3);
|
||||
} else if (timerName == "resetArm") {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
class CatapultBaseServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "CatapultBouncerServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void CatapultBouncerServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"Built", 0, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
@@ -10,6 +11,6 @@ void CatapultBouncerServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto base = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"BaseGroup"));
|
||||
|
||||
for (auto* obj : base) {
|
||||
obj->NotifyObject(self, "BouncerBuilt");
|
||||
obj->NotifyObject(self, u"BouncerBuilt");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user