mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-25 00:38:08 +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:
@@ -5,9 +5,9 @@ void WildNinjaBricks::OnStartup(Entity* self) {
|
||||
self->AddToGroups("Ninjastuff");
|
||||
}
|
||||
|
||||
void WildNinjaBricks::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == "Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == "Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
void WildNinjaBricks::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) {
|
||||
if (name == u"Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == u"Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == u"Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
class WildNinjaBricks : 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;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,27 +9,27 @@ void WildNinjaSensei::OnStartup(Entity* self) {
|
||||
void WildNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "CraneStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Crane");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, u"Crane");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("TigerStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"crane");
|
||||
} else if (timerName == "TigerStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Tiger");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, u"Tiger");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("MantisStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
} else if (timerName == "MantisStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Mantis");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, u"Mantis");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("CraneStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
} else if (timerName == "Bow") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Bow");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, u"Bow");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include "WildNinjaStudent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void WildNinjaStudent::OnStartup(Entity* self) {
|
||||
self->AddToGroups("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
||||
|
||||
void WildNinjaStudent::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == "Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == "Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
else if (name == "Bow") GameMessages::SendPlayAnimation(self, u"bow");
|
||||
void WildNinjaStudent::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) {
|
||||
if (name == u"Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == u"Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == u"Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
else if (name == u"Bow") GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
class WildNinjaStudent : 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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user