mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 04:32:06 +00:00 
			
		
		
		
	Use new logic for applying speed changes in ApplyBuff (#919)
This commit is contained in:
		| @@ -170,17 +170,10 @@ void BuffComponent::ApplyBuffEffect(int32_t id) { | ||||
|  | ||||
| 			destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination); | ||||
| 		} else if (parameter.name == "speed") { | ||||
| 			const auto speed = parameter.value; | ||||
|  | ||||
| 			auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 			if (controllablePhysicsComponent == nullptr) return; | ||||
|  | ||||
| 			const auto current = controllablePhysicsComponent->GetSpeedMultiplier(); | ||||
|  | ||||
| 			controllablePhysicsComponent->SetSpeedMultiplier(current + ((speed - 500.0f) / 500.0f)); | ||||
|  | ||||
| 			EntityManager::Instance()->SerializeEntity(this->GetParent()); | ||||
| 			if (!controllablePhysicsComponent) return; | ||||
| 			const auto speed = parameter.value; | ||||
| 			controllablePhysicsComponent->AddSpeedboost(speed); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -213,17 +206,10 @@ void BuffComponent::RemoveBuffEffect(int32_t id) { | ||||
|  | ||||
| 			destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination); | ||||
| 		} else if (parameter.name == "speed") { | ||||
| 			const auto speed = parameter.value; | ||||
|  | ||||
| 			auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 			if (controllablePhysicsComponent == nullptr) return; | ||||
|  | ||||
| 			const auto current = controllablePhysicsComponent->GetSpeedMultiplier(); | ||||
|  | ||||
| 			controllablePhysicsComponent->SetSpeedMultiplier(current - ((speed - 500.0f) / 500.0f)); | ||||
|  | ||||
| 			EntityManager::Instance()->SerializeEntity(this->GetParent()); | ||||
| 			if (!controllablePhysicsComponent) return; | ||||
| 			const auto speed = parameter.value; | ||||
| 			controllablePhysicsComponent->RemoveSpeedboost(speed); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aaron Kimbrell
					Aaron Kimbrell