diff --git a/src/Game/Network/MultiplayerSnapshotFilter.cpp b/src/Game/Network/MultiplayerSnapshotFilter.cpp index 1131424b..db3d998e 100644 --- a/src/Game/Network/MultiplayerSnapshotFilter.cpp +++ b/src/Game/Network/MultiplayerSnapshotFilter.cpp @@ -14,6 +14,7 @@ bool MultiplayerSnapshotFilter::FilterComponent(EntityWrapper entity, SharedComp || component.Info.Name == "Physics" || component.Info.Name == "AssaultWeapon" || component.Info.Name == "DefenderWeapon" + || component.Info.Name == "SidearmWeapon" || component.Info.Name == "Animation" || component.Info.Name == "Blend" || component.Info.Name == "BlendAdditive" diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index 2ebfff73..5074e1c7 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -8,51 +8,52 @@ BoostSystem::BoostSystem(SystemParams params) bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) { - if (e.Victim.ID == e.Inflictor.ID) { - return false; - } + if (!IsClient) { - if (!e.Victim.Valid() || !LocalPlayer.Valid()) { - return false; - } - - if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { - return false; - } - - if (!e.Inflictor.Valid()) { - return false; - } - - //if its not friendly fire, return - if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { - return false; - } - - //determine the inflictors class - auto className = DetermineClass(e.Inflictor); - if (className == "") { - return false; - } - - - LOG_INFO("intflictor: %s, vicitm: %s", e.Inflictor.Name().c_str(), e.Victim.Name().c_str()); - if(className == "SidearmWeapon") { // give ammo - giveAmmo(e.Inflictor, e.Victim); - } else { //give boost - //get the XML file, example: "Schema/Entities/BoostclassName.xml" - std::string classXML = "Schema/Entities/" + className + ".xml"; - - //check if player already has a child with the component, if so delete that child - auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); - if (playerBoostAssaultEntity.Valid()) { - m_World->DeleteEntity(playerBoostAssaultEntity.ID); + if (e.Victim.ID == e.Inflictor.ID) { + return false; + } + + if (!e.Victim.Valid() || !LocalPlayer.Valid()) { + return false; + } + + if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + return false; + } + + if (!e.Inflictor.Valid()) { + return false; + } + + //if its not friendly fire, return + if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { + return false; + } + + //determine the inflictors class + auto className = DetermineClass(e.Inflictor); + if (className == "") { + return false; + } + + if (className == "SidearmWeapon") { // give ammo + giveAmmo(e.Inflictor, e.Victim); + } else { //give boost + //get the XML file, example: "Schema/Entities/BoostclassName.xml" + std::string classXML = "Schema/Entities/" + className + ".xml"; + + //check if player already has a child with the component, if so delete that child + auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); + if (playerBoostAssaultEntity.Valid()) { + m_World->DeleteEntity(playerBoostAssaultEntity.ID); + } + //load boost XML file, set it entity parented with the victim player + auto entityFile = ResourceManager::Load(classXML); + EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); + m_World->SetName(boostAssaultEntity.ID, className); + m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); } - //load boost XML file, set it entity parented with the victim player - auto entityFile = ResourceManager::Load(classXML); - EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); - m_World->SetName(boostAssaultEntity.ID, className); - m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); } return true;