mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-11-04 14:42:02 +00:00 
			
		
		
		
	rock hydrants work
This commit is contained in:
		@@ -6,7 +6,7 @@ void RockHydrantBroken::OnStartup(Entity* self)
 | 
			
		||||
{
 | 
			
		||||
	self->AddTimer("playEffect", 1);
 | 
			
		||||
 | 
			
		||||
	const auto hydrant = "hydrant0" + self->GetVar<std::string>(u"hydrant");
 | 
			
		||||
	const auto hydrant = "hydrant" + self->GetVar<std::string>(u"hydrant");
 | 
			
		||||
 | 
			
		||||
	const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +1,23 @@
 | 
			
		||||
#include "RockHydrantSmashable.h"
 | 
			
		||||
#include "EntityManager.h"
 | 
			
		||||
#include "SimplePhysicsComponent.h"
 | 
			
		||||
#include "Entity.h"
 | 
			
		||||
#include "GameMessages.h"
 | 
			
		||||
#include "Game.h"
 | 
			
		||||
#include "dLogger.h"
 | 
			
		||||
#include "GeneralUtils.h"
 | 
			
		||||
 | 
			
		||||
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
 | 
			
		||||
	SimplePhysicsComponent* physics = self->GetComponent<SimplePhysicsComponent>();
 | 
			
		||||
	NiPoint3 pos = physics->GetPosition();
 | 
			
		||||
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer)
 | 
			
		||||
{
 | 
			
		||||
	const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
 | 
			
		||||
 | 
			
		||||
	EntityInfo info;
 | 
			
		||||
	LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
 | 
			
		||||
 | 
			
		||||
	EntityInfo info {};
 | 
			
		||||
	info.lot = 12293;
 | 
			
		||||
	info.pos = pos;
 | 
			
		||||
	info.spawner = nullptr;
 | 
			
		||||
	info.pos = self->GetPosition();
 | 
			
		||||
	info.rot = self->GetRotation();
 | 
			
		||||
	info.settings = {data};
 | 
			
		||||
	info.spawnerID = self->GetSpawnerID();
 | 
			
		||||
	info.spawnerNodeID = 0;
 | 
			
		||||
 | 
			
		||||
	Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
 | 
			
		||||
	if (newEntity) {
 | 
			
		||||
		EntityManager::Instance()->ConstructEntity(newEntity);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
	Game::logger->Log("RockHydrantBroken", "Rock Hydrant spawned (%s)\n", data->GetString().c_str());
 | 
			
		||||
 | 
			
		||||
    auto* hydrant = EntityManager::Instance()->CreateEntity(info);
 | 
			
		||||
 | 
			
		||||
    EntityManager::Instance()->ConstructEntity(hydrant);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user