Skip to content

Commit

Permalink
Added NOTRAFFIC toggle for folks who don't want to see the traffic me…
Browse files Browse the repository at this point in the history
…ssages.
  • Loading branch information
luciensadi committed Jan 23, 2025
1 parent fa60204 commit afd4932
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 20 deletions.
16 changes: 11 additions & 5 deletions src/act.other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,8 @@ const char *tog_messages[][2] = {
"You will now display your playergroup affiliation in the wholist.\r\n"},
{"You will no longer receive the keepalive pulses from the MUD.\r\n",
"You will now receive keepalive pulses from the MUD.\r\n"},
{"Screenreader mode disabled. Your TOGGLE NOCOLOR, TOGGLE NOPROMPT, and TOGGLE NOPSEUDOLANGUAGE settings have not been altered.\r\n",
"Screenreader mode enabled. Extraneous text will be reduced. Color, prompts, and pseudolanguage strings have been disabled for you, you may TOGGLE NOCOLOR, TOGGLE NOPROMPT, and TOGGLE NOPSEUDOLANGUAGE respectively to restore them.\r\n"},
{"Screenreader mode disabled. Your TOGGLE NOCOLOR, TOGGLE NOPROMPT, TOGGLE NOPSEUDOLANGUAGE, and TOGGLE NOTRAFFIC settings have not been altered.\r\n",
"Screenreader mode enabled. Extraneous text will be reduced. Color, prompts, pseudolanguage strings, and traffic ambiance messages have been disabled for you, you may TOGGLE NOCOLOR, TOGGLE NOPROMPT, TOGGLE NOPSEUDOLANGUAGE, and TOGGLE NOTRAFFIC respectively to restore them.\r\n"},
{"You will now receive ANSI color codes again.\r\n",
"You will no longer receive ANSI color codes.\r\n"},
{"You will now receive prompts.\r\n",
Expand Down Expand Up @@ -1207,7 +1207,9 @@ const char *tog_messages[][2] = {
{"You will now see your prompt displayed when you change it.\r\n",
"OK, your prompt will no longer display when you change it.\r\n"},
{"You will now participate in combat again.\r\n",
"OK, you will no longer be able to initiate combat or fight back.\r\n"}
"OK, you will no longer be able to initiate combat or fight back.\r\n"},
{"You will now see ambiance messages and environmental echoes about traffic.\r\n",
"You will no longer see ambiance messages and environmental echoes about traffic.\r\n"}
};

ACMD(do_toggle)
Expand All @@ -1227,9 +1229,9 @@ ACMD(do_toggle)
int printed = 0;
for (int i = 0; i < PRF_MAX; i++) {
// Skip the unused holes in our preferences.
if (i == PRF_UNUSED2_PLS_REPLACE) {
/* if (i == PRF_UNUSED2_PLS_REPLACE) {
continue;
}
}*/

// Skip the things that morts should not see.
if (!IS_SENATOR(ch) && preference_bits_v2[i].staff_only) {
Expand Down Expand Up @@ -1410,6 +1412,7 @@ ACMD(do_toggle)
PRF_FLAGS(ch).SetBit(PRF_NOCOLOR);
PRF_FLAGS(ch).SetBit(PRF_NOPROMPT);
PRF_FLAGS(ch).SetBit(PRF_NOPSEUDOLANGUAGE);
PRF_FLAGS(ch).SetBit(PRF_NOTRAFFIC);
}
mode = 29;
} else if (is_abbrev(argument, "nocolors") || is_abbrev(argument, "colors") || is_abbrev(argument, "colours")) {
Expand Down Expand Up @@ -1494,6 +1497,9 @@ ACMD(do_toggle)
} else if (is_abbrev(argument, "passive combat")) {
result = PRF_TOG_CHK(ch, PRF_PASSIVE_IN_COMBAT);
mode = 51;
} else if (is_abbrev(argument, "traffic") || is_abbrev(argument, "notraffic") || is_abbrev(argument, "no traffic")) {
result = PRF_TOG_CHK(ch, PRF_NOTRAFFIC);
mode = 52;
} else {
send_to_char("That is not a valid toggle option.\r\n", ch);
return;
Expand Down
4 changes: 2 additions & 2 deletions src/awake.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ enum {
#define PRF_PKER 11 /* is able to pk/be pked */
#define PRF_HIRED 12 /* Participating in a prun */
#define PRF_AFK 13 /* Afk */
#define PRF_SUPPRESS_STAFF_RADIO 14 /* EMPTY SPACE, FILL ME! */
#define PRF_UNUSED2_PLS_REPLACE 15 /* EMPTY SPACE, FILL ME! 15 */
#define PRF_SUPPRESS_STAFF_RADIO 14 /* Ignore staff radio. */
#define PRF_NOTRAFFIC 15 /* Ignore traffic messages. */
#define PRF_NOHASSLE 16 /* Aggr mobs won't attack */
#define PRF_ROOMFLAGS 17 /* Can see room flags (ROOM_x) */
#define PRF_HOLYLIGHT 18 /* Can see in dark */
Expand Down
12 changes: 6 additions & 6 deletions src/comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ void send_to_host(vnum_t room, const char *messg, struct matrix_icon *icon, bool
}
}

void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, bool torig, ...)
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, bool torig, bool is_ignorable_spam, ...)
{
struct char_data *i;

Expand All @@ -2922,7 +2922,7 @@ void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch,
}
}

void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, struct char_data *cha, bool torig)
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, struct char_data *cha, bool torig, bool is_ignorable_spam)
{
struct char_data *i;

Expand All @@ -2937,23 +2937,23 @@ void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch,
{
for (i = veh->people; i; i = i->next_in_veh)
if (i != ch && i != cha && i->desc) {
if (!(!torig && AFF_FLAGGED(i, AFF_RIG)))
if (!(is_ignorable_spam && PRF_FLAGGED(i, PRF_NOTRAFFIC)) && !(!torig && AFF_FLAGGED(i, AFF_RIG)))
SEND_TO_Q(messg, i->desc);
}
if (torig && veh->rigger && veh->rigger->desc)
if (torig && veh->rigger && veh->rigger->desc && !(is_ignorable_spam && PRF_FLAGGED(veh->rigger, PRF_NOTRAFFIC)))
SEND_TO_Q(messg, veh->rigger->desc);
}
}

void send_to_room(const char *messg, struct room_data *room, struct veh_data *exclude_veh)
void send_to_room(const char *messg, struct room_data *room, struct veh_data *exclude_veh, bool is_ignorable_spam)
{
struct char_data *i;
struct veh_data *v;

if (messg && room) {
for (i = room->people; i; i = i->next_in_room) {
if (i->desc)
if (!(PLR_FLAGGED(i, PLR_REMOTE) || PLR_FLAGGED(i, PLR_MATRIX)) && AWAKE(i))
if (!(is_ignorable_spam && PRF_FLAGGED(i, PRF_NOTRAFFIC)) && !(PLR_FLAGGED(i, PLR_REMOTE) || PLR_FLAGGED(i, PLR_MATRIX)) && AWAKE(i))
SEND_TO_Q(messg, i->desc);

if (i == i->next_in_room) {
Expand Down
6 changes: 3 additions & 3 deletions src/comm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ void shutdown(int code = FAILURE);
void send_to_all(const char *messg);
void send_to_char(const char *messg, struct char_data *ch);
void send_to_char(struct char_data *ch, const char * const messg, ...);
void send_to_room(const char *messg, struct room_data *room, struct veh_data *exclude_veh=NULL);
void send_to_room(const char *messg, struct room_data *room, struct veh_data *exclude_veh=NULL, bool is_ignorable_spam=0);
void send_to_driver(char *messg, struct veh_data *veh);
void send_to_host(vnum_t room, const char *messg, struct matrix_icon *icon, bool needsee);
void send_to_icon(struct matrix_icon *icon, const char * const messg, ...);
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, bool torig, ...);
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, struct char_data *cha, bool torig);
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, bool torig, bool is_ignorable_spam=0, ...);
void send_to_veh(const char *messg, struct veh_data *veh, struct char_data *ch, struct char_data *cha, bool torig, bool is_ignorable_spam=0);
void send_to_outdoor(const char *messg, bool is_weather, bool to_special_jurisdiction);
void free_editing_structs(struct descriptor_data *d, int state);
void close_socket(struct descriptor_data *d);
Expand Down
4 changes: 2 additions & 2 deletions src/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ struct preference_bit_struct preference_bits_v2[] = {
{ "On Quest" , FALSE, FALSE },
{ "AFK" , FALSE, TRUE },
{ "Suppress Staff Radio" , TRUE , TRUE },
{ "UNUSED-15" , FALSE, TRUE },
{ "No Traffic" , FALSE, TRUE },
{ "No Hassle" , TRUE , TRUE },
{ "Roomflags" , TRUE , TRUE },
{ "Holylight" , TRUE , TRUE },
Expand Down Expand Up @@ -761,7 +761,7 @@ const char *preference_bits[] =
"QUEST",
"AFK",
"STAFF_RADSUPPRESS",
"UNUSED-15",
"NOTRAFFIC",
"NOHASSLE",
"ROOMFLAGS",
"HOLYLIGHT",
Expand Down
4 changes: 4 additions & 0 deletions src/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,11 @@ struct command_info cmd_info[] =
{ "date" , POS_DEAD , do_date , 0, SCMD_DATE, ALLOWS_IDLE_REWARD },
{ "dc" , POS_DEAD , do_dc , LVL_EXECUTIVE, 0, BLOCKS_IDLE_REWARD },
{ "deactivate" , POS_LYING , do_deactivate, 0, 0, BLOCKS_IDLE_REWARD },
#ifdef IS_BUILDPORT
{ "debug" , POS_DEAD , do_debug , LVL_ADMIN, 0, BLOCKS_IDLE_REWARD },
#else
{ "debug" , POS_DEAD , do_debug , LVL_PRESIDENT, 0, BLOCKS_IDLE_REWARD },
#endif
{ "decline" , POS_LYING , do_decline , 0, 0, BLOCKS_IDLE_REWARD },
{ "decompress" , POS_LYING , do_compact , 0, 1, BLOCKS_IDLE_REWARD },
{ "decorate" , POS_DEAD , do_decorate , 0, 0, ALLOWS_IDLE_REWARD },
Expand Down
4 changes: 2 additions & 2 deletions src/traffic_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,9 @@ SPECIAL(traffic)

if (!cmd && room->people) {
if (GET_JURISDICTION(room) == JURISDICTION_SECRET) {
send_to_room(current_traffic_msg[TRAFFIC_MESSAGES_DEPRESSING], room);
send_to_room(current_traffic_msg[TRAFFIC_MESSAGES_DEPRESSING], room, NULL, TRUE);
} else {
send_to_room(current_traffic_msg[TRAFFIC_MESSAGES_NORMAL], room);
send_to_room(current_traffic_msg[TRAFFIC_MESSAGES_NORMAL], room, NULL, TRUE);
}
}

Expand Down

0 comments on commit afd4932

Please sign in to comment.