Skip to content

Commit

Permalink
[Feature] Add Respawn Details Into Briefing (#234)
Browse files Browse the repository at this point in the history
* feat: Added a Respawn-Details Briefing Entry

* feat: Implemented the Respawn Mode Field

* refactor: Using Switch Instead

* fix: Fixed the Default Case in Switch

* fix: Missing Underscores

Skill issue.

* fix: Set the Mode Names Properly

* chore: Addressed PR Comments

* Added private keyword to private vars.

---------

Co-authored-by: Bubbus <[email protected]>
  • Loading branch information
cow-co and Bubbus authored Dec 5, 2024
1 parent 7b41451 commit af55bde
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 2 deletions.
129 changes: 129 additions & 0 deletions components/briefing/briefings/ca_briefing_respawn.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// CA - Respawn briefing section
// ====================================================================================

private _briefing = "";
private _side = side player;

private _respawnModeTimedText = str RESPAWN_MODE_TIMED;
private _respawnModeTimedTicketsText = str RESPAWN_MODE_TIMED_TICKETS;
private _respawnModeTimedWavesText = str RESPAWN_MODE_TIMED_WAVES;
private _respawnModeTicketsText = str RESPAWN_MODE_TICKETS;
private _respawnModeTimedWavesTicketsText = str RESPAWN_MODE_TIMED_WAVES_TICKETS;
private _respawnModeTriggeredWavesText = str RESPAWN_MODE_TRIGGERED_WAVES;
private _respawnModeTriggeredWavesTicketsText = str RESPAWN_MODE_TRIGGERED_WAVES_TICKETS;

// Defaults for if macros are not defined
private _delay = "Not set";
private _modeName = "Not set";
private _sideTickets = "Not set";
private _individualTickets = "Not set";
private _mode = null;

if (_side == west) then {
#ifdef RESPAWN_DELAY_BLUFOR
_delay = RESPAWN_DELAY_BLUFOR;
#endif
#ifdef RESPAWN_MODE_BLUFOR
_mode = str RESPAWN_MODE_BLUFOR;
#endif
#ifdef RESPAWN_SIDE_TICKETS_BLUFOR
_sideTickets = RESPAWN_SIDE_TICKETS_BLUFOR;
#endif
#ifdef RESPAWN_PLAYER_TICKETS_BLUFOR
_individualTickets = RESPAWN_PLAYER_TICKETS_BLUFOR;
#endif
};

if (_side == east) then {
#ifdef RESPAWN_DELAY_OPFOR
_delay = RESPAWN_DELAY_OPFOR;
#endif
#ifdef RESPAWN_MODE_OPFOR
_mode = str RESPAWN_MODE_OPFOR;
#endif
#ifdef RESPAWN_SIDE_TICKETS_OPFOR
_sideTickets = RESPAWN_SIDE_TICKETS_OPFOR;
#endif
#ifdef RESPAWN_PLAYER_TICKETS_OPFOR
_individualTickets = RESPAWN_PLAYER_TICKETS_OPFOR;
#endif
};

if (_side == independent) then {
#ifdef RESPAWN_DELAY_INDFOR
_delay = RESPAWN_DELAY_INDFOR;
#endif
#ifdef RESPAWN_MODE_INDFOR
_mode = str RESPAWN_MODE_INDFOR;
#endif
#ifdef RESPAWN_SIDE_TICKETS_INDFOR
_sideTickets = RESPAWN_SIDE_TICKETS_INDFOR;
#endif
#ifdef RESPAWN_PLAYER_TICKETS_INDFOR
_individualTickets = RESPAWN_PLAYER_TICKETS_INDFOR;
#endif
};

if (_side == civilian) then {
#ifdef RESPAWN_DELAY_CIVILIAN
_delay = RESPAWN_DELAY_CIVILIAN;
#endif
#ifdef RESPAWN_MODE_CIVILIAN
_mode = str RESPAWN_MODE_CIVILIAN;
#endif
#ifdef RESPAWN_SIDE_TICKETS_CIVILIAN
_sideTickets = RESPAWN_SIDE_TICKETS_CIVILIAN;
#endif
#ifdef RESPAWN_PLAYER_TICKETS_CIVILIAN
_individualTickets = RESPAWN_PLAYER_TICKETS_CIVILIAN;
#endif
};

switch _mode do
{
case _respawnModeTimedText:
{
_modeName = RESPAWN_MODE_NAME_TIMED;
};
case _respawnModeTimedTicketsText:
{
_modeName = RESPAWN_MODE_NAME_TIMED_TICKETS;
};
case _respawnModeTimedWavesText:
{
_modeName = RESPAWN_MODE_NAME_TIMED_WAVES;
};
case _respawnModeTicketsText:
{
_modeName = RESPAWN_MODE_NAME_TICKETS;
};
case _respawnModeTimedWavesTicketsText:
{
_modeName = RESPAWN_MODE_NAME_TIMED_WAVES_TICKETS;
};
case _respawnModeTriggeredWavesText:
{
_modeName = RESPAWN_MODE_NAME_TRIGGERED_WAVES;
};
case _respawnModeTriggeredWavesTicketsText:
{
_modeName = RESPAWN_MODE_NAME_TRIGGERED_WAVES_TICKETS;
};
default
{
_modeName = "Not set";
};
};

_briefing = _briefing + format ["
Respawn Mode: %1
<br/>
Respawn Delay: %2
<br/>
Respawn Tickets (Side): %3
<br/>
Respawn Tickets (Per-Player): %4
<br/>
", _modeName, _delay, _sideTickets, _individualTickets];

player createDiaryRecord ["CAFE", ["Current Respawn Settings", _briefing]];
1 change: 1 addition & 0 deletions components/briefing/fn_briefing.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ _unitSide = side group player;
DEBUG_FORMAT1_CHAT("DEBUG (briefing.sqf): Player faction: %1", _unitSide)

#include "briefings\ca_briefing_player.sqf";
#include "briefings\ca_briefing_respawn.sqf";

// ====================================================================================

Expand Down
3 changes: 2 additions & 1 deletion components/briefing/macros.hpp
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "../../macros.hpp"
#include "../../macros.hpp"
#include "../../respawn_macros.hpp"
10 changes: 9 additions & 1 deletion respawn_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@

#define RESPAWN_DEFAULTS "CAFE_FixPlayerTickets", "CAFE_WeaponSafety", "Counter", "CAFE_Loadout", "CAFE_Squad", "CAFE_MoveToSpawn"

#define DEFAULT_RESPAWN_ARRAY {RESPAWN_DEFAULTS}
#define DEFAULT_RESPAWN_ARRAY {RESPAWN_DEFAULTS}

#define RESPAWN_MODE_NAME_TIMED "Timed"
#define RESPAWN_MODE_NAME_TIMED_TICKETS "Timed, with Tickets"
#define RESPAWN_MODE_NAME_TIMED_WAVES "Timed Waves"
#define RESPAWN_MODE_NAME_TICKETS "Tickets"
#define RESPAWN_MODE_NAME_TIMED_WAVES_TICKETS "Timed Waves, with Tickets"
#define RESPAWN_MODE_NAME_TRIGGERED_WAVES "Triggered Waves"
#define RESPAWN_MODE_NAME_TRIGGERED_WAVES_TICKETS "Triggered Waves, with Tickets"

0 comments on commit af55bde

Please sign in to comment.