ammo share fix?

This commit is contained in:
viktorljung
2016-03-13 20:32:08 +01:00
parent 6bfed76e06
commit 1da3ec3c74
5 changed files with 20 additions and 18 deletions
+4 -3
View File
@@ -8,9 +8,7 @@ BoostSystem::BoostSystem(SystemParams params)
bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
{
if (!IsServer) {
return false;
}
if (e.Victim == e.Inflictor) {
return false;
@@ -35,6 +33,9 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
if (className == "SidearmWeapon") { // give ammo
giveAmmo(e.Inflictor, e.Victim);
} else { //give boost
if (!IsServer) {
return false;
}
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
std::string classXML = "Schema/Entities/" + className + ".xml";
+1 -1
View File
@@ -393,7 +393,7 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
{
EntityWrapper player(m_World, e.Player);
if (!player.Valid()){// || !IsClient || player.ID == LocalPlayer.ID) {
if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) {
return false;
}
@@ -386,13 +386,11 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
PickData pickData = m_Renderer->Pick(centerScreen);
EntityWrapper victim(m_World, pickData.Entity);
if (!victim.Valid()) {
RemoveBoostCheckHUD(wi);
return;
}
// Don't let us somehow shoot ourselves in the foot
if (victim == LocalPlayer) {
RemoveBoostCheckHUD(wi);
return;
}
@@ -401,7 +399,6 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
victim = victim.FirstParentWithComponent("Player");
}
if (!victim.Valid()) {
RemoveBoostCheckHUD(wi);
return;
}
@@ -463,6 +460,12 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
} else {
EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD");
if (friendlyBoostHud.Valid()) {
if(friendlyBoostHud.HasComponent("Lifetime")) {
(Field<double>)friendlyBoostHud["Lifetime"]["Lifetime"] = 0.5;
}
EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost");
if (assaultBoostEntity.Valid()) {
EntityWrapper active = assaultBoostEntity.FirstChildByName("Active");
@@ -504,10 +507,3 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
}
}
void AssaultWeaponBehaviour::RemoveBoostCheckHUD(WeaponInfo& wi)
{
EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment");
if (friendlyBoostHudSpawner.Valid()) {
friendlyBoostHudSpawner.DeleteChildren();
}
}