tracers: add option to only trace to players

master
cron 2020-10-07 00:16:08 +00:00
parent fde77217cb
commit e7bb8d8cee
4 changed files with 16 additions and 2 deletions

View File

@ -2272,3 +2272,5 @@ no_force_rotate (NoForceRotate) bool false
enable_tracers (Tracers) bool false
no_slow (NoSlow) bool false
trace_players_only (Only trace to players) bool true

View File

@ -200,6 +200,11 @@ public:
return m_prop.stepheight;
}
inline bool isPlayer() const
{
return m_is_player;
}
inline bool isLocalPlayer() const
{
return m_is_local_player;
@ -276,6 +281,6 @@ public:
{
return m_prop.infotext;
}
float m_waiting_for_reattach;
};

View File

@ -93,6 +93,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("no_force_rotate", "false");
settings->setDefault("enable_tracers", "false");
settings->setDefault("no_slow", "false");
settings->setDefault("trace_players_only", "true");
// Keymap
settings->setDefault("remote_port", "30000");

View File

@ -22,6 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/camera.h"
#include "tracers.h"
#include "constants.h"
#include "settings.h"
#include "client/content_cao.h"
#include <iostream>
void Tracers::draw(video::IVideoDriver* driver, Client *client)
{
@ -36,6 +39,9 @@ void Tracers::draw(video::IVideoDriver* driver, Client *client)
ClientActiveObject *obj = allObject.obj;
if (obj->isLocalPlayer() || obj->getParent())
continue;
driver->draw3DLine(head_pos, obj->getPosition(), video::SColor(255, 255, 255, 255));
GenericCAO *cao = env.getGenericCAO(obj->getId());
if (!g_settings->getBool("trace_players_only") || (cao && cao->isPlayer()))
driver->draw3DLine(head_pos, obj->getPosition(), video::SColor(255, 255, 255, 255));
}
}