mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 12:41:55 +00:00 
			
		
		
		
	Fixup
This commit is contained in:
		| @@ -22,6 +22,7 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp" | ||||
| 	"DurationBehavior.cpp" | ||||
| 	"EmptyBehavior.cpp" | ||||
| 	"EndBehavior.cpp" | ||||
| 	"FallSpeedBehavior.cpp" | ||||
| 	"ForceMovementBehavior.cpp" | ||||
| 	"HealBehavior.cpp" | ||||
| 	"ImaginationBehavior.cpp" | ||||
|   | ||||
| @@ -7,19 +7,13 @@ | ||||
|  | ||||
| void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { | ||||
| 	branch.target = context->caster; | ||||
|  | ||||
| 	auto* target = EntityManager::Instance()->GetEntity(branch.target); | ||||
|  | ||||
| 	if (!target) return; | ||||
|  | ||||
| 	auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 	if (!controllablePhysicsComponent) return; | ||||
|  | ||||
| 	const auto current = controllablePhysicsComponent->GetGravityScale(); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetGravityScale(m_PercentSlowed); | ||||
|  | ||||
| 	EntityManager::Instance()->SerializeEntity(target); | ||||
|  | ||||
| 	if (branch.duration > 0.0f) { | ||||
| @@ -31,55 +25,26 @@ void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void FallSpeedBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { | ||||
| 	Handle(context, bitStream, branch); | ||||
| } | ||||
|  | ||||
| void FallSpeedBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) { | ||||
| 	auto* target = EntityManager::Instance()->GetEntity(branch.target); | ||||
|  | ||||
| 	if (!target) return; | ||||
|  | ||||
| 	auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 	if (!controllablePhysicsComponent) return; | ||||
|  | ||||
| 	const auto current = controllablePhysicsComponent->GetGravityScale(); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetGravityScale(m_PercentSlowed); | ||||
|  | ||||
| 	EntityManager::Instance()->SerializeEntity(target); | ||||
| 	End(context, branch, second); | ||||
| } | ||||
|  | ||||
| void FallSpeedBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { | ||||
| 	auto* target = EntityManager::Instance()->GetEntity(branch.target); | ||||
|  | ||||
| 	if (!target) return; | ||||
|  | ||||
| 	auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 	if (!controllablePhysicsComponent) return; | ||||
|  | ||||
| 	// const auto current = controllablePhysicsComponent->GetGravityScale(); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetIgnoreMultipliers(false); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetGravityScale(1); | ||||
|  | ||||
| 	EntityManager::Instance()->SerializeEntity(target); | ||||
| 	End(context, branch, LWOOBJID_EMPTY); | ||||
| } | ||||
|  | ||||
| void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) { | ||||
| 	auto* target = EntityManager::Instance()->GetEntity(branch.target); | ||||
|  | ||||
| 	if (!target) return; | ||||
|  | ||||
| 	auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); | ||||
|  | ||||
| 	if (!controllablePhysicsComponent) return; | ||||
|  | ||||
| 	// const auto current = controllablePhysicsComponent->GetGravityScale(); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetIgnoreMultipliers(false); | ||||
|  | ||||
| 	controllablePhysicsComponent->SetGravityScale(1); | ||||
|  | ||||
| 	EntityManager::Instance()->SerializeEntity(target); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -4,20 +4,13 @@ | ||||
| class FallSpeedBehavior final : public Behavior | ||||
| { | ||||
| public: | ||||
|  | ||||
| 	/* | ||||
| 	 * Inherited | ||||
| 	 */ | ||||
| 	explicit FallSpeedBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {} | ||||
|  | ||||
| 	void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override; | ||||
|  | ||||
| 	void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override; | ||||
| 	void Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override; | ||||
|  | ||||
| 	void End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) override; | ||||
|  | ||||
| 	void UnCast(BehaviorContext* context, BehaviorBranchContext branch) override; | ||||
|  | ||||
| 	void Load() override; | ||||
|  | ||||
| private: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aaron Kimbre
					Aaron Kimbre