ammo share fix?
This commit is contained in:
@@ -38,7 +38,6 @@ private:
|
|||||||
//Camera cameraFromEntity(EntityWrapper camera);
|
//Camera cameraFromEntity(EntityWrapper camera);
|
||||||
|
|
||||||
void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi);
|
void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi);
|
||||||
void RemoveBoostCheckHUD(WeaponInfo& wi);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
<Entity name="FriendlyBoostHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
<Entity name="FriendlyBoostHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>0.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Scale X="1.5" Y="1.5" Z="1"/>
|
<Scale X="1.5" Y="1.5" Z="1"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -44,6 +47,7 @@
|
|||||||
<Content>\1</Content>
|
<Content>\1</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.0149999997"/>
|
<Position X="0" Y="0" Z="0.0149999997"/>
|
||||||
@@ -56,7 +60,7 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>\1</Content>
|
<Content>\1</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="0.0784313753" G="0.0784313753" R="0.0784313753"/>
|
<Color A="1" B="0.784313738" G="0.784313738" R="0.784313738"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
||||||
@@ -80,6 +84,7 @@
|
|||||||
<Content>\2</Content>
|
<Content>\2</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -92,7 +97,7 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>\2</Content>
|
<Content>\2</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="0.0784313753" G="0.0784313753" R="0.0784313753"/>
|
<Color A="1" B="0.784313738" G="0.784313738" R="0.784313738"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
||||||
@@ -116,6 +121,7 @@
|
|||||||
<Content>\3</Content>
|
<Content>\3</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
<Color A="1" B="1.37254906" G="0.392156869" R="0"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -128,7 +134,7 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>\3</Content>
|
<Content>\3</Content>
|
||||||
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
<Resource>Fonts/Hind-Edited.otf,64</Resource>
|
||||||
<Color A="1" B="0.0784313753" G="0.0784313753" R="0.0784313753"/>
|
<Color A="1" B="0.784313738" G="0.784313738" R="0.784313738"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
<Position X="0" Y="0" Z="-8.43336147e-06"/>
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ BoostSystem::BoostSystem(SystemParams params)
|
|||||||
|
|
||||||
bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
||||||
{
|
{
|
||||||
if (!IsServer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.Victim == e.Inflictor) {
|
if (e.Victim == e.Inflictor) {
|
||||||
return false;
|
return false;
|
||||||
@@ -35,6 +33,9 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
if (className == "SidearmWeapon") { // give ammo
|
if (className == "SidearmWeapon") { // give ammo
|
||||||
giveAmmo(e.Inflictor, e.Victim);
|
giveAmmo(e.Inflictor, e.Victim);
|
||||||
} else { //give boost
|
} else { //give boost
|
||||||
|
if (!IsServer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
|
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
|
||||||
std::string classXML = "Schema/Entities/" + className + ".xml";
|
std::string classXML = "Schema/Entities/" + className + ".xml";
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
|||||||
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
|
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
|
||||||
{
|
{
|
||||||
EntityWrapper player(m_World, e.Player);
|
EntityWrapper player(m_World, e.Player);
|
||||||
if (!player.Valid()){// || !IsClient || player.ID == LocalPlayer.ID) {
|
if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -386,13 +386,11 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
|
|||||||
PickData pickData = m_Renderer->Pick(centerScreen);
|
PickData pickData = m_Renderer->Pick(centerScreen);
|
||||||
EntityWrapper victim(m_World, pickData.Entity);
|
EntityWrapper victim(m_World, pickData.Entity);
|
||||||
if (!victim.Valid()) {
|
if (!victim.Valid()) {
|
||||||
RemoveBoostCheckHUD(wi);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't let us somehow shoot ourselves in the foot
|
// Don't let us somehow shoot ourselves in the foot
|
||||||
if (victim == LocalPlayer) {
|
if (victim == LocalPlayer) {
|
||||||
RemoveBoostCheckHUD(wi);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +399,6 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
|
|||||||
victim = victim.FirstParentWithComponent("Player");
|
victim = victim.FirstParentWithComponent("Player");
|
||||||
}
|
}
|
||||||
if (!victim.Valid()) {
|
if (!victim.Valid()) {
|
||||||
RemoveBoostCheckHUD(wi);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,6 +460,12 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi
|
|||||||
} else {
|
} else {
|
||||||
EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD");
|
EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD");
|
||||||
if (friendlyBoostHud.Valid()) {
|
if (friendlyBoostHud.Valid()) {
|
||||||
|
if(friendlyBoostHud.HasComponent("Lifetime")) {
|
||||||
|
(Field<double>)friendlyBoostHud["Lifetime"]["Lifetime"] = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost");
|
EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost");
|
||||||
if (assaultBoostEntity.Valid()) {
|
if (assaultBoostEntity.Valid()) {
|
||||||
EntityWrapper active = assaultBoostEntity.FirstChildByName("Active");
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user