WIP fixing pull request
This commit is contained in:
@@ -592,7 +592,7 @@ void Server::parseOnInputCommand(Packet& packet)
|
||||
e.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
||||
e.Value = packet.ReadPrimitive<float>();
|
||||
m_EventBroker->Publish(e);
|
||||
if (e.Command == "PrimaryFire" || e.Command == "Reload" || e.Command == "Jump") {
|
||||
if (e.Command == "PrimaryFire" || e.Command == "Reload") {
|
||||
m_InputCommandsToBroadcast.push_back(e);
|
||||
}
|
||||
//LOG_INFO("Server::parseOnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
|
||||
+3
-1
@@ -223,7 +223,9 @@ void Game::Tick()
|
||||
m_EventBroker->Swap();
|
||||
|
||||
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");
|
||||
m_SoundManager->Update(dt);
|
||||
if (m_IsClient) {
|
||||
m_SoundManager->Update(dt);
|
||||
}
|
||||
|
||||
// Update network
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
||||
|
||||
@@ -86,16 +86,20 @@ bool SoundSystem::OnCaptured(const Events::Captured & e)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Testing purposes atm...
|
||||
bool SoundSystem::OnPlayerDamage(const Events::PlayerDamage & e)
|
||||
{
|
||||
if (!IsClient) { // Only play for clients
|
||||
return false;
|
||||
}
|
||||
if (!e.Victim.Valid()) {
|
||||
if (!e.Victim.Valid() || !e.Inflictor.Valid()) {
|
||||
return false;
|
||||
}
|
||||
auto victimTeam = m_World->GetComponent(e.Victim.ID, "Team");
|
||||
auto inflictorTeam = m_World->GetComponent(e.Inflictor.ID, "Team");
|
||||
if ((int)victimTeam["Team"] == (int)inflictorTeam["Team"]) {
|
||||
// Victim and inflictor are the same team, should not play "hurt" sound.
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> paths;
|
||||
paths.push_back("Audio/Hurt/Hurt" + std::to_string(m_RandIntDistribution(m_RandomGenerator)) + ".wav");
|
||||
|
||||
@@ -141,9 +145,9 @@ bool SoundSystem::OnDoubleJump(const Events::DoubleJump & e)
|
||||
if (!IsClient) {
|
||||
return false;
|
||||
}
|
||||
Events::PlaySoundOnEntity ev;
|
||||
ev.Emitter = EntityWrapper(m_World, e.entityID);
|
||||
ev.FilePath = "Audio/Jump/Jump2.wav";
|
||||
m_EventBroker->Publish(ev);
|
||||
//Events::PlaySoundOnEntity ev;
|
||||
//ev.Emitter = EntityWrapper(m_World, e.entityID);
|
||||
//ev.FilePath = "Audio/Jump/Jump2.wav";
|
||||
//m_EventBroker->Publish(ev);
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user