mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-11-04 06:32:00 +00:00 
			
		
		
		
	actually check if the player can afford to dig
This commit is contained in:
		@@ -109,12 +109,14 @@ void PetDigServer::OnUse(Entity* self, Entity* user) {
 | 
				
			|||||||
	if (!petComponent) return;
 | 
						if (!petComponent) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(petComponent->GetIsReadyToDig()) { // TODO: Add handling of the "first time" dig message
 | 
						if(petComponent->GetIsReadyToDig()) { // TODO: Add handling of the "first time" dig message
 | 
				
			||||||
		petComponent->SetTreasureTime(2.0f);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		auto* destroyableComponent = user->GetComponent<DestroyableComponent>();
 | 
							auto* destroyableComponent = user->GetComponent<DestroyableComponent>();
 | 
				
			||||||
		if (!destroyableComponent) return;
 | 
							if (!destroyableComponent) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		auto imagination = destroyableComponent->GetImagination();
 | 
							auto imagination = destroyableComponent->GetImagination();
 | 
				
			||||||
 | 
							if (imagination == 0) return; // TODO: Check if there was special behavior for this in the live game
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							petComponent->SetTreasureTime(2.0f); // TODO: Get rid of this magic number
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		imagination -= 1; // TODO: Get rid of this magic number
 | 
							imagination -= 1; // TODO: Get rid of this magic number
 | 
				
			||||||
		destroyableComponent->SetImagination(imagination);
 | 
							destroyableComponent->SetImagination(imagination);
 | 
				
			||||||
		Game::entityManager->SerializeEntity(user);
 | 
							Game::entityManager->SerializeEntity(user);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user