Compare commits

...

6 Commits

Author SHA1 Message Date
William Moberg 3436ba6656 Merge pull request #177 from teamfisk/AmmoPickup
Fixed some systems added twice in Game.cpp
2016-03-08 09:46:36 +01:00
verysecrethero fc3a3a8f2e Fixed a crashbug in Ammo/HealthPickup which was actually caused by systems being added twice in Game.cpp. This is also a possible fix for DamageIndicator,Capturepoint,TextField,KillFeed 2016-03-07 17:16:18 +01:00
Tobias Dahl 3edc2f4819 Merge pull request #174 from teamfisk/CapturePointFixBranch
CapturePoints now have red/blue/spectator model-children
2016-03-07 15:25:22 +01:00
Adam Byléhn 9c3fa25834 Merge pull request #176 from teamfisk/PlayerHUD
Player hud
2016-03-07 15:14:37 +01:00
verysecrethero 3eaad275ba New CapturePointAddition fixed to work on Network by Joachim 2016-03-07 14:50:31 +01:00
verysecrethero 64df3fd7ad CapturePoints now have red/blue/spectator model-children 2016-03-07 14:30:27 +01:00
9 changed files with 4377 additions and 4013 deletions
File diff suppressed because it is too large Load Diff
+30 -5
View File
@@ -4,14 +4,39 @@
<Components> <Components>
<c:AABB/> <c:AABB/>
<c:CapturePoint/> <c:CapturePoint/>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Team/> <c:Team/>
<c:Transform/>
<c:Trigger/> <c:Trigger/>
<c:Transform/>
</Components> </Components>
<Children/> <Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity> </Entity>
+22 -18
View File
@@ -92,15 +92,15 @@
</Entity> </Entity>
<Entity> <Entity>
<Components> <Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team> <c:Team>
<Team> <Team>
<Red/> <Red/>
</Team> </Team>
</c:Team> </c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
@@ -143,15 +143,15 @@
</Entity> </Entity>
<Entity> <Entity>
<Components> <Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team> <c:Team>
<Team> <Team>
<Blue/> <Blue/>
</Team> </Team>
</c:Team> </c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
@@ -209,24 +209,26 @@
<Components> <Components>
<c:AABB/> <c:AABB/>
<c:CapturePoint> <c:CapturePoint>
<CaptureTimer>-15</CaptureTimer>
<HomePointForTeam> <HomePointForTeam>
<Blue/> <Blue/>
</HomePointForTeam> </HomePointForTeam>
</c:CapturePoint> </c:CapturePoint>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="1" B="1" G="0.200000003" R="0"/>
</c:Model>
<c:Team> <c:Team>
<Team> <Team>
<Blue/> <Blue/>
</Team> </Team>
</c:Team> </c:Team>
<c:Trigger/>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="0.300000012" B="1" G="0" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform> <c:Transform>
<Position X="0" Y="0.773066521" Z="-18.975975"/> <Position X="0" Y="0.773066521" Z="-18.975975"/>
<Scale X="4.9000001" Y="0.600000024" Z="3.50000024"/> <Scale X="4.9000001" Y="0.600000024" Z="3.50000024"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -234,25 +236,27 @@
<Components> <Components>
<c:AABB/> <c:AABB/>
<c:CapturePoint> <c:CapturePoint>
<CaptureTimer>15</CaptureTimer>
<HomePointForTeam> <HomePointForTeam>
<Red/> <Red/>
</HomePointForTeam> </HomePointForTeam>
<CapturePointNumber>1</CapturePointNumber> <CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint> </c:CapturePoint>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="1" B="1" G="1" R="0"/>
</c:Model>
<c:Team> <c:Team>
<Team> <Team>
<Red/> <Red/>
</Team> </Team>
</c:Team> </c:Team>
<c:Trigger/>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="0.300000012" B="0" G="0" R="1"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform> <c:Transform>
<Position X="0" Y="0.452868998" Z="18.5607414"/> <Position X="0" Y="0.452868998" Z="18.5607414"/>
<Scale X="4.60000038" Y="0.900000036" Z="4.10000038"/> <Scale X="4.60000038" Y="0.900000036" Z="4.10000038"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0.980392158" G="1" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.100000001" Y="0" Z="0"/>
<Scale X="50" Y="1" Z="51.1000023"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight/>
<c:Transform>
<Orientation X="4.38500023" Y="0" Z="0.458000034"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
</c:Model>
<c:Transform>
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-20.6000004" Y="1" Z="21.7150002"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:PlayerSpawn/>
<c:Transform>
<Position X="-12.2000008" Y="1" Z="21.5000019"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="15.4000006" Y="1" Z="21.6000004"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="10.500001" Y="0" Z="21.9000015"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-9.70000076" Y="1" Z="-23.4000015"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-18.8000011" Y="1" Z="-22.3000011"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="8.10000038" Y="1" Z="-23.2000008"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="16.2000008" Y="1" Z="-23.2000008"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="39.2156868" G="0" R="3.13725495"/>
</c:Model>
<c:Transform>
<Scale X="-70" Y="-70" Z="-70"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>15</CaptureTimer>
<HomePointForTeam>
<Red/>
</HomePointForTeam>
</c:CapturePoint>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Trigger/>
<c:Transform>
<Position X="0" Y="0" Z="-4.10000038"/>
</c:Transform>
</Components>
<Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="2.70000005" Y="3.4000001" Z="4.60000038"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="1" Y="5.70000029" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>-15</CaptureTimer>
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Trigger/>
<c:Transform>
<Position X="0" Y="0" Z="4"/>
</c:Transform>
</Components>
<Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="4.4000001" Y="2" Z="3.70000029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Orientation X="0" Y="2.95000005" Z="0"/>
<Scale X="4.70000029" Y="3.60000014" Z="3.60000014"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="5.50000048" Y="2.5" Z="3.80000019"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+6 -5
View File
@@ -162,7 +162,7 @@ void Server::unreliableBroadcast(Packet& packet)
{ {
for (auto& kv : m_ConnectedPlayers) { for (auto& kv : m_ConnectedPlayers) {
packet.ChangePacketID(kv.second.PacketID); packet.ChangePacketID(kv.second.PacketID);
// m_Unreliable.Send(packet, kv.second); // m_Unreliable.Send(packet, kv.second);
} }
} }
@@ -649,13 +649,14 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
return true; return true;
} }
} }
return childEntity.HasComponent("Player") return childEntity.HasComponent("Player")
|| childEntity.FirstParentWithComponent("Player").Valid() || childEntity.FirstParentWithComponent("Player").Valid()
|| childEntity.HasComponent("CapturePoint") || childEntity.HasComponent("CapturePoint")
|| childEntity.HasComponent("HealthPickup") || childEntity.HasComponent("HealthPickup")
|| childEntity.HasComponent("AmmoPickup") || childEntity.HasComponent("AmmoPickup")
|| childEntity.HasComponent("ScoreScreen") || childEntity.HasComponent("ScoreScreen")
|| childEntity.FirstParentWithComponent("ScoreScreen").Valid(); || childEntity.FirstParentWithComponent("ScoreScreen").Valid()
|| childEntity.FirstParentWithComponent("CapturePoint").Valid();
} }
PlayerID Server::getPlayerIDFromEndpoint() PlayerID Server::getPlayerIDFromEndpoint()
@@ -674,7 +675,7 @@ PlayerID Server::getPlayerIDFromEndpoint()
PlayerID Server::getPlayerIDFromEntityID(EntityID entityID) PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
{ {
for(auto& kv : m_ConnectedPlayers) { for (auto& kv : m_ConnectedPlayers) {
if (entityID == kv.second.EntityID) { if (entityID == kv.second.EntityID) {
return kv.first; return kv.first;
} }
-7
View File
@@ -137,20 +137,13 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<TextFieldReader>(updateOrderLevel); m_SystemPipeline->AddSystem<TextFieldReader>(updateOrderLevel);
m_SystemPipeline->AddSystem<AbilityCooldownHUDSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<AbilityCooldownHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointArrowHUDSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<CapturePointArrowHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<TextFieldReader>(updateOrderLevel);
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel); m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer);
m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer);
+5 -4
View File
@@ -96,6 +96,7 @@ bool AmmoPickupSystem::OnAmmoPickup(Events::AmmoPickup & e)
} }
currentAmmo = std::min(currentAmmo + e.AmmoGain, maxWeaponAmmo); currentAmmo = std::min(currentAmmo + e.AmmoGain, maxWeaponAmmo);
return false; return false;
} }
@@ -114,8 +115,11 @@ bool AmmoPickupSystem::OnTriggerLeave(Events::TriggerLeave& e) {
} }
void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) { void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) {
//trigger should be valid but if it isnt we just return (to avoid crash)
if (!trigger.Valid()) {
return;
}
int maxWeaponAmmo = (int)player["AssaultWeapon"]["MaxAmmo"]; int maxWeaponAmmo = (int)player["AssaultWeapon"]["MaxAmmo"];
int& currentAmmo = (int)player["AssaultWeapon"]["Ammo"];
int ammoGiven = 0.01*(double)trigger["AmmoPickup"]["AmmoGain"] * maxWeaponAmmo; int ammoGiven = 0.01*(double)trigger["AmmoPickup"]["AmmoGain"] * maxWeaponAmmo;
Events::AmmoPickup ePlayerAmmoPickup; Events::AmmoPickup ePlayerAmmoPickup;
@@ -123,9 +127,6 @@ void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) {
ePlayerAmmoPickup.Player = player; ePlayerAmmoPickup.Player = player;
m_EventBroker->Publish(ePlayerAmmoPickup); m_EventBroker->Publish(ePlayerAmmoPickup);
//immediately give the player the ammo (on server)
currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo);
//copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object) //copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
//we need to copy all values since each value can be different for each ammoPickup //we need to copy all values since each value can be different for each ammoPickup
m_ETriggerTouchVector.push_back({ (glm::vec3)trigger["Transform"]["Position"], trigger["AmmoPickup"]["AmmoGain"], m_ETriggerTouchVector.push_back({ (glm::vec3)trigger["Transform"]["Position"], trigger["AmmoPickup"]["AmmoGain"],
+12
View File
@@ -69,6 +69,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
int ownedBy = teamComponent["Team"]; int ownedBy = teamComponent["Team"];
int redTeamPlayersStandingInside = 0; int redTeamPlayersStandingInside = 0;
int blueTeamPlayersStandingInside = 0; int blueTeamPlayersStandingInside = 0;
//note: old color system
if (capturePointEntity.HasComponent("Model")) { if (capturePointEntity.HasComponent("Model")) {
//Now sets team color to the capturepoint, or white if it is uncaptured. //Now sets team color to the capturepoint, or white if it is uncaptured.
capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.0f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.0f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3); capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.0f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.0f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3);
@@ -102,7 +103,18 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
nextPossibleCapturePoint["Blue"] = i - 1; nextPossibleCapturePoint["Blue"] = i - 1;
} }
} }
if (m_RecentlyCapturedNeedNextCapturePointNow) { if (m_RecentlyCapturedNeedNextCapturePointNow) {
//change what model is displaying (change all in case 2 capturepoints has been captured on the same frame)
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
auto owner = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"];
if (m_CapturePointNumberToEntityMap[i].FirstChildByName("Red").ID != EntityID_Invalid) {
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Red")["Model"]["Visible"] = owner == redTeam ? true : false;
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Blue")["Model"]["Visible"] = owner == blueTeam ? true : false;
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Spectator")["Model"]["Visible"] = owner == spectatorTeam ? true : false;
}
}
//save the next cap points and publish the captured event
m_CapturedEvent.BlueTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Blue"]]; m_CapturedEvent.BlueTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Blue"]];
m_CapturedEvent.RedTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Red"]]; m_CapturedEvent.RedTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Red"]];
m_EventBroker->Publish(m_CapturedEvent); m_EventBroker->Publish(m_CapturedEvent);
+4
View File
@@ -83,6 +83,10 @@ bool PickupSpawnSystem::OnTriggerLeave(Events::TriggerLeave& e)
} }
void PickupSpawnSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) void PickupSpawnSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger)
{ {
//trigger should be valid but if it isnt we just return (to avoid crash)
if (!trigger.Valid()) {
return;
}
double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"]; double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"];
//only the server will increase the players hp and set it in the next delta //only the server will increase the players hp and set it in the next delta