Skip to content

Commit

Permalink
Merge pull request scp-fs2open#6141 from Goober5000/emp_scramble_flag
Browse files Browse the repository at this point in the history
add ship flag to disable message scrambling when EMP is active
  • Loading branch information
Goober5000 authored May 14, 2024
2 parents 6fdb945 + d51f53f commit b946619
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion code/hud/hudtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4751,7 +4751,7 @@ int hud_communications_state(ship *sp, bool for_death_scream)
}

// Goober5000 - check for scrambled communications
if (emp_active_local() || sp->flags[Ship::Ship_Flags::Scramble_messages])
if ((emp_active_local() && !sp->flags[Ship::Ship_Flags::EMP_doesnt_scramble_messages]) || sp->flags[Ship::Ship_Flags::Scramble_messages])
return COMM_SCRAMBLED;

return COMM_OK;
Expand Down
8 changes: 4 additions & 4 deletions code/parse/sexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40553,14 +40553,14 @@ SCP_vector<sexp_help_struct> Sexp_help = {

//phreak
{ OP_SCRAMBLE_MESSAGES, "scramble-messages\r\n"
"\tCauses messages to be sent as if the player has sustained communications subsystem or EMP damage. This effect can be reversed using unscramble-messages. Takes zero or more arguments.\r\n"
"\tAll (Optional):\tName of the ship for which to scramble messages. If no ships are specified, message scrambling will be turned on for all messages the player receives.\r\n"
"\tCauses messages to be sent or received as if the player had sustained communications subsystem or EMP damage. This effect can be reversed using unscramble-messages. Takes zero or more arguments.\r\n"
"\tAll (Optional):\tName of the ship for which to scramble messages. If no ships are specified, message scrambling will be turned on for the player.\r\n"
},

//phreak
{ OP_UNSCRAMBLE_MESSAGES, "unscramble-messages\r\n"
"\tUndoes the effects of scramble-messages, causing messages to be sent clearly. Takes zero or more arguments.\r\n"
"\tAll (Optional):\tName of the ship for which to scramble messages. If no ships are specified, message scrambling will be turned on for all messages the player receives.\r\n"
"\tUndoes the effects of scramble-messages, causing messages to be sent or received clearly (conditions permitting). Takes zero or more arguments.\r\n"
"\tAll (Optional):\tName of the ship for which to scramble messages. If no ships are specified, message scrambling will be turned off for the player.\r\n"
},

{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
Expand Down
6 changes: 4 additions & 2 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ const int num_ai_tgt_weapon_info_flags = sizeof(ai_tgt_weapon_flags) / sizeof(fl

SCP_vector <ai_target_priority> Ai_tp_list;

// Constant for flag, Name of flag, In flags or flags2
// Constant for flag, Name of flag
ship_flag_name Ship_flag_names[] = {
{ Ship_Flags::Vaporize, "vaporize" },
{ Ship_Flags::Warp_broken, "break-warp" },
Expand Down Expand Up @@ -620,6 +620,7 @@ ship_flag_name Ship_flag_names[] = {
{ Ship_Flags::No_builtin_messages, "no-builtin-messages"},
{ Ship_Flags::Scramble_messages, "scramble-messages"},
{ Ship_Flags::Maneuver_despite_engines, "maneuver-despite-engines" },
{ Ship_Flags::EMP_doesnt_scramble_messages, "emp-doesn't-scramble-messages" },
};

ship_flag_description Ship_flag_descriptions[] = {
Expand Down Expand Up @@ -655,8 +656,9 @@ ship_flag_description Ship_flag_descriptions[] = {
{ Ship_Flags::No_death_scream, "Ship will never send a death message when destroyed."},
{ Ship_Flags::Always_death_scream, "Ship will always send a death message when destroyed."},
{ Ship_Flags::No_builtin_messages, "Ship will not send any persona messages."},
{ Ship_Flags::Scramble_messages, "All messages sent from this ship will appear scrambled, as if the ship had been hit by an EMP."},
{ Ship_Flags::Scramble_messages, "All messages sent from or received by this ship will appear scrambled, as if the ship had been hit by an EMP." },
{ Ship_Flags::Maneuver_despite_engines, "Ship can maneuver even if its engines are disabled or disrupted" },
{ Ship_Flags::EMP_doesnt_scramble_messages, "EMP does not affect whether messages appear scrambled when sent from or received by this ship." },
};

extern const size_t Num_ship_flag_names = sizeof(Ship_flag_names) / sizeof(ship_flag_name);
Expand Down
3 changes: 2 additions & 1 deletion code/ship/ship_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ namespace Ship {
No_thrusters, // The E - Thrusters on this ship are not rendered.
Ship_locked, // Karajorma - Prevents the player from changing the ship class on loadout screen
Weapons_locked, // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen
Scramble_messages, // Goober5000 - all messages sent from this ship appear scrambled
Scramble_messages, // Goober5000 - all messages sent from or received by this ship appear scrambled
EMP_doesnt_scramble_messages, // Goober5000 - when EMP is active, messages will not have the scramble effect
No_secondary_lockon, // zookeeper - secondary lock-on disabled
No_disabled_self_destruct, // Goober5000 - ship will not self-destruct after 90 seconds if engines or weapons destroyed (c.f. ai_maybe_self_destruct)
Subsystem_movement_locked, // The_E -- Rotating subsystems are locked in place.
Expand Down

0 comments on commit b946619

Please sign in to comment.