mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-26 18:11:59 +00:00 
			
		
		
		
	 455f9470a5
			
		
	
	455f9470a5
	
	
	
		
			
			* Move EntityManager to Game namespace * move initialization to later Need to wait for dZoneManager to be initialized. * Fix bugs - Cannot delete from a RandomAccessIterator while in a range based for loop. Touchup zone manager initialize replace magic numbers with better named constants replace magic zonecontrol id with a more readable hex alternative condense stack variables move initializers closer to their use initialize entity manager with zone control change initialize timings If zone is not zero we expect to initialize the entity manager during zone manager initialization Add constexpr for zone control LOT * Add proper error handling * revert vanity changes * Update WorldServer.cpp * Update dZoneManager.cpp
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "RockHydrantBroken.h"
 | |
| #include "EntityManager.h"
 | |
| #include "GameMessages.h"
 | |
| 
 | |
| void RockHydrantBroken::OnStartup(Entity* self) {
 | |
| 	self->AddTimer("playEffect", 1);
 | |
| 
 | |
| 	const auto hydrant = "hydrant" + self->GetVar<std::string>(u"hydrant");
 | |
| 
 | |
| 	const auto bouncers = Game::entityManager->GetEntitiesInGroup(hydrant);
 | |
| 
 | |
| 	for (auto* bouncer : bouncers) {
 | |
| 		self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
 | |
| 
 | |
| 
 | |
| 		GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
 | |
| 
 | |
| 		GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
 | |
| 	}
 | |
| 
 | |
| 	self->AddTimer("KillBroken", 10);
 | |
| }
 | |
| 
 | |
| void RockHydrantBroken::OnTimerDone(Entity* self, std::string timerName) {
 | |
| 	if (timerName == "KillBroken") {
 | |
| 		auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
 | |
| 
 | |
| 		if (bouncer != nullptr) {
 | |
| 			GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
 | |
| 
 | |
| 			GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"disableCollision", UNASSIGNED_SYSTEM_ADDRESS);
 | |
| 		}
 | |
| 
 | |
| 		self->Kill();
 | |
| 	} else if (timerName == "playEffect") {
 | |
| 		GameMessages::SendPlayFXEffect(self->GetObjectID(), 4737, u"water", "water", LWOOBJID_EMPTY, 1, 1, true);
 | |
| 	}
 | |
| }
 |