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.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
e.Value = packet.ReadPrimitive<float>();
|
||||||
m_EventBroker->Publish(e);
|
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);
|
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);
|
//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();
|
m_EventBroker->Swap();
|
||||||
|
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");
|
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");
|
||||||
m_SoundManager->Update(dt);
|
if (m_IsClient) {
|
||||||
|
m_SoundManager->Update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
// Update network
|
// Update network
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
||||||
|
|||||||
@@ -86,16 +86,20 @@ bool SoundSystem::OnCaptured(const Events::Captured & e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testing purposes atm...
|
|
||||||
bool SoundSystem::OnPlayerDamage(const Events::PlayerDamage & e)
|
bool SoundSystem::OnPlayerDamage(const Events::PlayerDamage & e)
|
||||||
{
|
{
|
||||||
if (!IsClient) { // Only play for clients
|
if (!IsClient) { // Only play for clients
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> paths;
|
std::vector<std::string> paths;
|
||||||
paths.push_back("Audio/Hurt/Hurt" + std::to_string(m_RandIntDistribution(m_RandomGenerator)) + ".wav");
|
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) {
|
if (!IsClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Events::PlaySoundOnEntity ev;
|
//Events::PlaySoundOnEntity ev;
|
||||||
ev.Emitter = EntityWrapper(m_World, e.entityID);
|
//ev.Emitter = EntityWrapper(m_World, e.entityID);
|
||||||
ev.FilePath = "Audio/Jump/Jump2.wav";
|
//ev.FilePath = "Audio/Jump/Jump2.wav";
|
||||||
m_EventBroker->Publish(ev);
|
//m_EventBroker->Publish(ev);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user