Skip to content

Commit b1ccac2

Browse files
committed
Added ECSUtil Spell
Updated ECS Component (Model, Unit) added scale Updated ECS Component (Unit) added isAutoAttacking, attackReadyAnimation, attackMainHandAnimation, attackOffHandAnimation Added ECS Components (UnitPowersComponent, UnitResistancesComponent, UnitStatsComponent) Updated ECS Singleton (CharacterSingleton) added primaryAttackTimer, secondaryAttackTimer Added ECS Singleton (SpellSingleton) Added support for selecting units with right click, and initiating auto attacking with right click Fixed an issue where networked units were not using their AABB when being added to the networked vis tree Fixed an issue where uiSingleton could be missing first frame Added Spell Editor Fixed an issue where MapLoader would continue to attempt to load the same map over and over Fixed an issue where Model Scale was not being applied Added Script PlayerUnitFrames, UnitFrame Fixed Script Type Definitions Updated Submodule Engine
1 parent 6734a10 commit b1ccac2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3146
-532
lines changed

Source/Game-Lib/Game-Lib/Application/Application.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33

44
#include "Game-Lib/ECS/Scheduler.h"
55
#include "Game-Lib/ECS/Components/Events.h"
6-
#include "Game-Lib/ECS/Singletons/Database/CameraSaveSingleton.h"
7-
#include "Game-Lib/ECS/Singletons/Database/ClientDBSingleton.h"
86
#include "Game-Lib/ECS/Singletons/EngineStats.h"
9-
#include "Game-Lib/ECS/Singletons/Database/MapSingleton.h"
107
#include "Game-Lib/ECS/Singletons/NetworkState.h"
118
#include "Game-Lib/ECS/Singletons/RenderState.h"
9+
#include "Game-Lib/ECS/Singletons/Database/CameraSaveSingleton.h"
10+
#include "Game-Lib/ECS/Singletons/Database/ClientDBSingleton.h"
11+
#include "Game-Lib/ECS/Singletons/Database/MapSingleton.h"
1212
#include "Game-Lib/ECS/Util/EventUtil.h"
1313
#include "Game-Lib/ECS/Util/Database/CameraUtil.h"
1414
#include "Game-Lib/ECS/Util/Database/CursorUtil.h"
1515
#include "Game-Lib/ECS/Util/Database/IconUtil.h"
1616
#include "Game-Lib/ECS/Util/Database/ItemUtil.h"
1717
#include "Game-Lib/ECS/Util/Database/LightUtil.h"
1818
#include "Game-Lib/ECS/Util/Database/MapUtil.h"
19+
#include "Game-Lib/ECS/Util/Database/SpellUtil.h"
1920
#include "Game-Lib/ECS/Util/Database/TextureUtil.h"
2021
#include "Game-Lib/ECS/Util/Database/UnitCustomizationUtil.h"
2122
#include "Game-Lib/Editor/EditorHandler.h"
@@ -352,8 +353,9 @@ bool Application::Init()
352353

353354
auto globalKey = Scripting::ZenithInfoKey::MakeGlobal(0, 0);
354355
_luaManager->GetZenithStateManager().Add(globalKey);
356+
357+
_luaManager->Init();
355358
}
356-
_luaManager->Init();
357359

358360
return true;
359361
}
@@ -495,6 +497,7 @@ void Application::DatabaseReload()
495497
ECSUtil::Map::Refresh();
496498
ECSUtil::Light::Refresh();
497499
ECSUtil::Texture::Refresh();
500+
ECSUtil::Spell::Refresh();
498501
ECSUtil::Item::Refresh();
499502
ECSUtil::UnitCustomization::Refresh();
500503
}

Source/Game-Lib/Game-Lib/ECS/Components/AABB.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ namespace ECS::Components
55
{
66
struct AABB
77
{
8+
public:
89
vec3 centerPos;
910
vec3 extents;
1011
};
1112

1213
struct WorldAABB
1314
{
15+
public:
1416
vec3 min;
1517
vec3 max;
1618
};

Source/Game-Lib/Game-Lib/ECS/Components/CastInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ namespace ECS::Components
1010
entt::entity target;
1111

1212
f32 castTime = 0.0f;
13-
f32 duration = 0.0f;
13+
f32 timeToCast = 0.0f;
1414
};
1515
}

Source/Game-Lib/Game-Lib/ECS/Components/Model.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace ECS::Components
2222
u32 instanceID = std::numeric_limits<u32>().max();
2323
u32 modelHash = std::numeric_limits<u32>().max();
2424
f32 opacity = 1.0f;
25+
f32 scale = 1.0f;
2526
};
2627

2728
struct ModelQueuedGeometryGroups

Source/Game-Lib/Game-Lib/ECS/Components/Unit.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ namespace ECS::Components
1919
GameDefine::UnitClass unitClass;
2020
GameDefine::UnitRace race;
2121
GameDefine::UnitGender gender;
22+
f32 scale = 1.0f;
2223

2324
u32 bodyID = std::numeric_limits<u32>().max();
2425
::Animation::Defines::Type overrideAnimation = ::Animation::Defines::Type::Invalid;
2526

2627
bool positionOrRotationIsDirty = false;
28+
bool isAutoAttacking = false;
29+
30+
::Animation::Defines::Type attackReadyAnimation = ::Animation::Defines::Type::Invalid;
31+
::Animation::Defines::Type attackMainHandAnimation = ::Animation::Defines::Type::Invalid;
32+
::Animation::Defines::Type attackOffHandAnimation = ::Animation::Defines::Type::Invalid;
2733
};
2834
}

Source/Game-Lib/Game-Lib/ECS/Components/UnitEquipment.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <Base/Types.h>
55

6+
#include <Meta/Generated/Shared/UnitEnum.h>
7+
68
#include <entt/fwd.hpp>
79

810
#include <robinhood/robinhood.h>
@@ -14,11 +16,11 @@ namespace ECS
1416
struct UnitEquipment
1517
{
1618
public:
17-
std::array<u32, (u32)Database::Item::ItemEquipSlot::Count> equipmentSlotToItemID;
18-
robin_hood::unordered_set<Database::Item::ItemEquipSlot> dirtyItemIDSlots;
19+
std::array<u32, (u32)Generated::ItemEquipSlotEnum::EquipmentEnd + 1u> equipmentSlotToItemID;
20+
robin_hood::unordered_set<Generated::ItemEquipSlotEnum> dirtyItemIDSlots;
1921

20-
std::array<u32, (u32)Database::Item::ItemEquipSlot::Count> equipmentSlotToVisualItemID;
21-
robin_hood::unordered_set<Database::Item::ItemEquipSlot> dirtyVisualItemIDSlots;
22+
std::array<u32, (u32)Generated::ItemEquipSlotEnum::EquipmentEnd + 1u> equipmentSlotToVisualItemID;
23+
robin_hood::unordered_set<Generated::ItemEquipSlotEnum> dirtyVisualItemIDSlots;
2224
};
2325

2426
struct UnitEquipmentDirty { };
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
#include <Base/Types.h>
3+
4+
#include <Meta/Generated/Shared/UnitEnum.h>
5+
6+
#include <robinhood/robinhood.h>
7+
8+
namespace ECS
9+
{
10+
struct UnitPower
11+
{
12+
public:
13+
f64 base = 0.0;
14+
f64 current = 0.0;
15+
f64 max = 0.0;
16+
};
17+
18+
namespace Components
19+
{
20+
struct UnitPowersComponent
21+
{
22+
public:
23+
robin_hood::unordered_map<Generated::PowerTypeEnum, UnitPower> powerTypeToValue;
24+
robin_hood::unordered_set<Generated::PowerTypeEnum> dirtyPowerTypes;
25+
};
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
#include <Base/Types.h>
3+
4+
#include <Meta/Generated/Shared/UnitEnum.h>
5+
6+
#include <robinhood/robinhood.h>
7+
8+
namespace ECS
9+
{
10+
struct UnitResistance
11+
{
12+
public:
13+
f64 base = 0.0;
14+
f64 current = 0.0;
15+
f64 max = 0.0;
16+
};
17+
18+
namespace Components
19+
{
20+
struct UnitResistancesComponent
21+
{
22+
public:
23+
robin_hood::unordered_map<Generated::ResistanceTypeEnum, UnitResistance> resistanceTypeToValue;
24+
robin_hood::unordered_set<Generated::ResistanceTypeEnum> dirtyResistanceTypes;
25+
};
26+
}
27+
}

Source/Game-Lib/Game-Lib/ECS/Components/UnitStatsComponent.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33

44
#include <Meta/Generated/Shared/UnitEnum.h>
55

6-
namespace ECS::Components
6+
#include <robinhood/robinhood.h>
7+
8+
namespace ECS
79
{
8-
struct UnitStatsComponent
10+
struct UnitStat
911
{
1012
public:
11-
f32 baseHealth;
12-
f32 currentHealth;
13-
f32 maxHealth;
14-
15-
f32 basePower[(u32)Generated::PowerTypeEnum::Count];
16-
f32 currentPower[(u32)Generated::PowerTypeEnum::Count];
17-
f32 maxPower[(u32)Generated::PowerTypeEnum::Count];
18-
19-
i32 baseStat[(u32)Generated::StatTypeEnum::Count];
20-
i32 currentStat[(u32)Generated::StatTypeEnum::Count];
21-
22-
i32 baseResistance[(u32)Generated::ResistanceTypeEnum::Count];
23-
i32 currentResistance[(u32)Generated::ResistanceTypeEnum::Count];
13+
f64 base = 0.0;
14+
f64 current = 0.0;
2415
};
16+
17+
namespace Components
18+
{
19+
struct UnitStatsComponent
20+
{
21+
public:
22+
robin_hood::unordered_map<Generated::StatTypeEnum, UnitStat> statTypeToValue;
23+
robin_hood::unordered_set<Generated::StatTypeEnum> dirtyStatTypes;
24+
};
25+
}
2526
}

Source/Game-Lib/Game-Lib/ECS/Singletons/CharacterSingleton.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ namespace ECS::Singletons
2121
public:
2222
entt::entity controllerEntity = entt::null;
2323
entt::entity moverEntity = entt::null;
24-
25-
vec3 rayStart = vec3(0.0f);
26-
vec3 rayEnd = vec3(0.0f, 0.0f, -1.0f);
24+
f32 primaryAttackTimer = 0.0f;
25+
f32 secondaryAttackTimer = 0.0f;
2726

2827
JPH::CharacterVirtual* character = nullptr;
2928
KeybindGroup* keybindGroup = nullptr;

0 commit comments

Comments
 (0)