diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h
index 0035d5eb..178f4eaf 100644
--- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h
+++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h
@@ -41,6 +41,7 @@ private:
// Utility
Camera cameraFromEntity(EntityWrapper camera);
+ void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi);
};
#endif
\ No newline at end of file
diff --git a/resources/Schema/Entities/FriendlyBoostAttachement.xml b/resources/Schema/Entities/FriendlyBoostAttachement.xml
new file mode 100644
index 00000000..38ac6643
--- /dev/null
+++ b/resources/Schema/Entities/FriendlyBoostAttachement.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Schema/Entities/FriendlyBoostBlueHUD.xml
+
+
+
+
+
+
+
+
+
diff --git a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml
index c181392e..1e0deebb 100644
--- a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml
+++ b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml
@@ -6,7 +6,7 @@
0.5
-
+
@@ -78,6 +78,19 @@
+
+
+
+ \2
+ Fonts/Hind-Edited.otf,64
+
+
+
+
+
+
+
+
@@ -92,19 +105,6 @@
-
-
-
- \2
- Fonts/Hind-Edited.otf,64
-
-
-
-
-
-
-
-
diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml
index 36fbfc03..e1d6b852 100644
--- a/resources/Schema/Entities/WeaponAssaultBlueView.xml
+++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml
@@ -224,15 +224,6 @@
-
-
-
- Schema/Entities/AmmoShareEffectView.xml
-
-
-
-
-
diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml
index 37fd2722..a8bdd68b 100644
--- a/resources/Schema/Entities/WeaponDefenderBlueView.xml
+++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml
@@ -218,6 +218,17 @@
+
+
+
+ Schema/Entities/FriendlyBoostBlueHUD.xml
+
+
+
+
+
+
+
diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp
index 275952d0..603f6991 100644
--- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp
+++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp
@@ -10,6 +10,7 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr
void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt)
{
+ CheckBoost(cWeapon, wi);
// Decrement reload timer
Field reloadTimer = cWeapon["ReloadTimer"];
reloadTimer = glm::max(0.0, reloadTimer - dt);
@@ -518,3 +519,148 @@ Camera DefenderWeaponBehaviour::cameraFromEntity(EntityWrapper camera)
cam.SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
return cam;
}
+
+void DefenderWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi)
+{
+ // Only check ammo client side
+ if (!IsClient) {
+ return;
+ }
+
+ // Only handle ammo check for the local player
+ if (wi.Player != LocalPlayer) {
+ return;
+ }
+
+ // Make sure the player isn't checking from the grave
+ if (!wi.Player.Valid()) {
+ return;
+ }
+
+ // 3D-pick middle of screen
+ Rectangle viewport = m_Renderer->GetViewportSize();
+ glm::vec2 centerScreen(viewport.Width / 2, viewport.Height / 2);
+ // TODO: Some horizontal spread
+ PickData pickData = m_Renderer->Pick(centerScreen);
+ EntityWrapper victim(m_World, pickData.Entity);
+ if (!victim.Valid()) {
+ return;
+ }
+
+ // Don't let us somehow shoot ourselves in the foot
+ if (victim == LocalPlayer) {
+ return;
+ }
+
+ // Only care about players being hit
+ if (!victim.HasComponent("Player")) {
+ victim = victim.FirstParentWithComponent("Player");
+ }
+ if (!victim.Valid()) {
+ return;
+ }
+
+
+ // If friendly fire, reduce damage to 0 (needed to make Boosts, Ammosharing work)
+ if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
+
+ EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment");
+ if (friendlyBoostHudSpawner.Valid()) {
+
+ EntityWrapper assaultBoost = victim.FirstChildByName("BoostAssault");
+ EntityWrapper defenderBoost = victim.FirstChildByName("BoostDefender");
+ EntityWrapper sniperBoost = victim.FirstChildByName("BoostSniper");
+
+ auto children = m_World->GetDirectChildren(friendlyBoostHudSpawner.ID);
+
+ if (children.first == children.second) {
+ if (friendlyBoostHudSpawner.HasComponent("Spawner")) {
+
+ EntityWrapper friendlyBoostHud = SpawnerSystem::Spawn(friendlyBoostHudSpawner, friendlyBoostHudSpawner);
+ if (friendlyBoostHud.Valid()) {
+ EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost");
+ if (assaultBoostEntity.Valid()) {
+ EntityWrapper active = assaultBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (assaultBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+
+ EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost");
+ if (defenderBoostEntity.Valid()) {
+ EntityWrapper active = defenderBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (defenderBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+
+ EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost");
+ if (sniperBoostEntity.Valid()) {
+ EntityWrapper active = sniperBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (sniperBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD");
+ if (friendlyBoostHud.Valid()) {
+ if (friendlyBoostHud.HasComponent("Lifetime")) {
+ (Field)friendlyBoostHud["Lifetime"]["Lifetime"] = 0.5;
+ }
+
+
+
+ EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost");
+ if (assaultBoostEntity.Valid()) {
+ EntityWrapper active = assaultBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (assaultBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+
+ EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost");
+ if (defenderBoostEntity.Valid()) {
+ EntityWrapper active = defenderBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (defenderBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+
+ EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost");
+ if (sniperBoostEntity.Valid()) {
+ EntityWrapper active = sniperBoostEntity.FirstChildByName("Active");
+ if (active.HasComponent("Text")) {
+ if (sniperBoost.Valid()) {
+ (Field)active["Text"]["Visible"] = true;
+ } else {
+ (Field)active["Text"]["Visible"] = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}