mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
cleanup logs, fix overrides, define LOTs in header
This commit is contained in:
parent
8fe5c00984
commit
f3dd71ccb1
@ -2,7 +2,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
|
|
||||||
void HydrantBroken::OnStartup(Entity* self)
|
void HydrantBroken::OnStartup(Entity* self)
|
||||||
{
|
{
|
||||||
self->AddTimer("playEffect", 1);
|
self->AddTimer("playEffect", 1);
|
||||||
|
|
||||||
@ -10,8 +10,6 @@ void HydrantBroken::OnStartup(Entity* self)
|
|||||||
|
|
||||||
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||||
|
|
||||||
Game::logger->Log("HydrantBroken", "Broken Hydrant spawned (%s)\n", hydrant.c_str());
|
|
||||||
|
|
||||||
for (auto* bouncer : bouncers)
|
for (auto* bouncer : bouncers)
|
||||||
{
|
{
|
||||||
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||||
@ -20,11 +18,11 @@ void HydrantBroken::OnStartup(Entity* self)
|
|||||||
|
|
||||||
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->AddTimer("KillBroken", 25);
|
self->AddTimer("KillBroken", 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HydrantBroken::OnTimerDone(Entity* self, std::string timerName)
|
void HydrantBroken::OnTimerDone(Entity* self, std::string timerName)
|
||||||
{
|
{
|
||||||
if (timerName == "KillBroken")
|
if (timerName == "KillBroken")
|
||||||
{
|
{
|
||||||
|
@ -2,20 +2,18 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
|
|
||||||
void HydrantSmashable::OnDie(Entity* self, Entity* killer)
|
void HydrantSmashable::OnDie(Entity* self, Entity* killer)
|
||||||
{
|
{
|
||||||
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
||||||
|
|
||||||
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
||||||
|
|
||||||
EntityInfo info {};
|
EntityInfo info {};
|
||||||
info.lot = 7328;
|
info.lot = HYDRANT_BROKEN;
|
||||||
info.pos = self->GetPosition();
|
info.pos = self->GetPosition();
|
||||||
info.rot = self->GetRotation();
|
info.rot = self->GetRotation();
|
||||||
info.settings = {data};
|
info.settings = {data};
|
||||||
info.spawnerID = self->GetSpawnerID();
|
info.spawnerID = self->GetSpawnerID();
|
||||||
|
|
||||||
Game::logger->Log("HydrantBroken", "Hydrant spawned (%s)\n", data->GetString().c_str());
|
|
||||||
|
|
||||||
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
|
|
||||||
class HydrantSmashable : public CppScripts::Script
|
class HydrantSmashable : public CppScripts::Script
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnDie(Entity* self, Entity* killer) override;
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
|
private:
|
||||||
|
LOT HYDRANT_BROKEN = 7328;
|
||||||
};
|
};
|
@ -10,8 +10,6 @@ void RockHydrantBroken::OnStartup(Entity* self)
|
|||||||
|
|
||||||
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||||
|
|
||||||
Game::logger->Log("RockHydrantBroken", "Broken Rock Hydrant spawned (%s)\n", hydrant.c_str());
|
|
||||||
|
|
||||||
for (auto* bouncer : bouncers)
|
for (auto* bouncer : bouncers)
|
||||||
{
|
{
|
||||||
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||||
|
@ -9,15 +9,13 @@ void RockHydrantSmashable::OnDie(Entity* self, Entity* killer)
|
|||||||
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
||||||
|
|
||||||
EntityInfo info {};
|
EntityInfo info {};
|
||||||
info.lot = 12293;
|
info.lot = ROCK_HYDRANT_BROKEN;
|
||||||
info.pos = self->GetPosition();
|
info.pos = self->GetPosition();
|
||||||
info.rot = self->GetRotation();
|
info.rot = self->GetRotation();
|
||||||
info.settings = {data};
|
info.settings = {data};
|
||||||
info.spawnerID = self->GetSpawnerID();
|
info.spawnerID = self->GetSpawnerID();
|
||||||
|
|
||||||
Game::logger->Log("RockHydrantBroken", "Rock Hydrant spawned (%s)\n", data->GetString().c_str());
|
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||||
|
|
||||||
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
EntityManager::Instance()->ConstructEntity(hydrant);
|
||||||
|
|
||||||
EntityManager::Instance()->ConstructEntity(hydrant);
|
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,7 @@ class RockHydrantSmashable : public CppScripts::Script
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnDie(Entity* self, Entity* killer);
|
void OnDie(Entity* self, Entity* killer);
|
||||||
|
private:
|
||||||
|
LOT ROCK_HYDRANT_BROKEN = 12293;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,4 +66,4 @@ void WhFans::OnDie(Entity* self, Entity* killer) {
|
|||||||
ToggleFX(self, true);
|
ToggleFX(self, true);
|
||||||
}
|
}
|
||||||
self->SetVar<bool>(u"alive", false);
|
self->SetVar<bool>(u"alive", false);
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
class WhFans : public CppScripts::Script
|
class WhFans : public CppScripts::Script
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void OnStartup(Entity* self);
|
void OnStartup(Entity* self) override;
|
||||||
void OnDie(Entity* self, Entity* killer);
|
void OnDie(Entity* self, Entity* killer) override;
|
||||||
void OnFireEventServerSide(
|
void OnFireEventServerSide(
|
||||||
Entity *self,
|
Entity *self,
|
||||||
Entity *sender,
|
Entity *sender,
|
||||||
@ -16,7 +16,7 @@ public:
|
|||||||
int32_t param1,
|
int32_t param1,
|
||||||
int32_t param2,
|
int32_t param2,
|
||||||
int32_t param3
|
int32_t param3
|
||||||
);
|
) override;
|
||||||
private:
|
private:
|
||||||
void ToggleFX(Entity* self, bool hit);
|
void ToggleFX(Entity* self, bool hit);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user