Show a message once a goal is made in soccer (#4304)
* log the goal on server once a player scored in soccer * show a message once a player made a goal in soccer * bug fix, add comments * remove server log
This commit is contained in:
parent
7829cb3928
commit
661688db2d
@ -23,6 +23,7 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/message_queue.hpp"
|
||||
#include "karts/abstract_kart_animation.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
@ -43,6 +44,7 @@
|
||||
#include "tracks/track_object_manager.hpp"
|
||||
#include "tracks/track_sector.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include <IMeshSceneNode.h>
|
||||
@ -510,13 +512,22 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
|
||||
m_karts[m_ball_hitter]->getKartModel()
|
||||
->setAnimation(KartModel::AF_WIN_START, true/* play_non_loop*/);
|
||||
}
|
||||
|
||||
else if (!sd.m_correct_goal)
|
||||
{
|
||||
m_karts[m_ball_hitter]->getKartModel()
|
||||
->setAnimation(KartModel::AF_LOSE_START, true/* play_non_loop*/);
|
||||
}
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
// show a message once a goal is made
|
||||
core::stringw msg;
|
||||
if (sd.m_correct_goal)
|
||||
msg = _("%s scored a goal!", sd.m_player);
|
||||
else
|
||||
msg = _("Oops, %s made an own goal!", sd.m_player);
|
||||
MessageQueue::add(MessageQueue::MT_GENERIC, msg);
|
||||
#endif
|
||||
|
||||
if (first_goal)
|
||||
{
|
||||
if (RaceManager::get()->hasTimeTarget())
|
||||
@ -623,6 +634,14 @@ void SoccerWorld::handlePlayerGoalFromServer(const NetworkString& ns)
|
||||
m_blue_scorers.push_back(sd);
|
||||
}
|
||||
|
||||
// show a message once a goal is made
|
||||
core::stringw msg;
|
||||
if (sd.m_correct_goal)
|
||||
msg = _("%s scored a goal!", sd.m_player);
|
||||
else
|
||||
msg = _("Oops, %s made an own goal!", sd.m_player);
|
||||
MessageQueue::add(MessageQueue::MT_GENERIC, msg);
|
||||
|
||||
if (ticks_now >= ticks_back_to_own_goal && !isStartPhase())
|
||||
{
|
||||
Log::warn("SoccerWorld", "Server ticks %d is too close to client ticks "
|
||||
|
Loading…
Reference in New Issue
Block a user