Rename some variables

- Add order for loading Components
- Enforce all components have Entity* in the first argument
This commit is contained in:
David Markowitz
2023-06-09 02:46:01 -07:00
parent f555ba8c25
commit 6f057204be
49 changed files with 634 additions and 584 deletions

View File

@@ -7,7 +7,7 @@
#include "CDRewardsTable.h"
LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component(parent) {
m_OwningEntity = parent;
m_ParentEntity = parent;
m_Level = 1;
m_SpeedBase = 500.0f;
m_CharacterVersion = eCharacterVersion::LIVE;
@@ -49,12 +49,12 @@ void LevelProgressionComponent::HandleLevelUp() {
const auto& rewards = rewardsTable->GetByLevelID(m_Level);
bool rewardingItem = rewards.size() > 0;
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
auto* inventoryComponent = m_ParentEntity->GetComponent<InventoryComponent>();
auto* controllablePhysicsComponent = m_ParentEntity->GetComponent<ControllablePhysicsComponent>();
if (!inventoryComponent || !controllablePhysicsComponent) return;
// Tell the client we beginning to send level rewards.
if (rewardingItem) GameMessages::NotifyLevelRewards(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress(), m_Level, rewardingItem);
if (rewardingItem) GameMessages::NotifyLevelRewards(m_ParentEntity->GetObjectID(), m_ParentEntity->GetSystemAddress(), m_Level, rewardingItem);
for (auto* reward : rewards) {
switch (reward->rewardType) {
@@ -79,11 +79,11 @@ void LevelProgressionComponent::HandleLevelUp() {
}
}
// Tell the client we have finished sending level rewards.
if (rewardingItem) GameMessages::NotifyLevelRewards(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress(), m_Level, !rewardingItem);
if (rewardingItem) GameMessages::NotifyLevelRewards(m_ParentEntity->GetObjectID(), m_ParentEntity->GetSystemAddress(), m_Level, !rewardingItem);
}
void LevelProgressionComponent::SetRetroactiveBaseSpeed(){
if (m_Level >= 20) m_SpeedBase = 525.0f;
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
auto* controllablePhysicsComponent = m_ParentEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent) controllablePhysicsComponent->SetSpeedMultiplier(m_SpeedBase / 500.0f);
}