Skip to content

Commit

Permalink
[Bugfix] - Resolving squadmarker issues. (#154)
Browse files Browse the repository at this point in the history
* Attempted fix for marker reset upon player JIP.

* Fixed JIP players not seeing squad menu or getting a teleport ticket.

* Disable the cancel-button of the squad selector, when player respawns.
 - (they can still press ESC but if they do that and complain about no marker, skill issue.)
Prevent TP to origin if selecting squad with 0 members.
  • Loading branch information
Bubbus authored Mar 13, 2023
1 parent f0a758b commit d242d3b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/joinInProgress/ui/groupPickerDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CAFE_GroupPicker_Dialog

class CAFE_GroupPicker_CancelButton: CAFE_DefaultButton
{
idc = 1601;
idc = IDC_GROUPPICKER_CANCELBUTTON;
text = "Cancel";
x = 14 * GUI_GRID_W + GUI_GRID_X;
y = 19 * GUI_GRID_H + GUI_GRID_Y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if (_exitCode == 1) then
_groups = allGroups select {(side _x) isEqualTo _playerSide};

_selectedGroup = _groups param [_groups findIf {(groupId _x) isEqualTo _selectedGroupName}, grpNull];
private _countPriorToJoin = count units _selectedGroup;

if (isNull _selectedGroup) exitWith
{
Expand All @@ -59,7 +60,7 @@ if (_exitCode == 1) then

_isChecked = _teleportCheckbox ctrlChecked 0;

if (_isChecked) then
if (_isChecked and {(_countPriorToJoin > 0) and (leader _selectedGroup isNotEqualTo player)}) then
{
[leader _selectedGroup] spawn _doTeleport;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ else
{
_teleportCheckbox ctrlSetChecked true;
};


private _cancelDisabled = missionNamespace getVariable ["f_var_groupPicker_disableCancel", false];

if (_cancelDisabled) then
{
private _cancelButton = _display displayCtrl IDC_GROUPPICKER_CANCELBUTTON;
_cancelButton ctrlEnable false;
missionNamespace setVariable ["f_var_groupPicker_disableCancel", nil];
};
1 change: 1 addition & 0 deletions components/joinInProgress/ui_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#define IDC_GROUPPICKER_CURRENTSQUADTEXT 1003
#define IDC_GROUPPICKER_SQUADLIST 1500
#define IDC_GROUPPICKER_TELEPORTCHECKBOX 2500
#define IDC_GROUPPICKER_CANCELBUTTON 1601
3 changes: 2 additions & 1 deletion components/respawn/squad/onPlayerRespawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
private _didFirstSpawn = missionNamespace getVariable ["f_var_squad_didFirstSpawn", false];
missionNamespace setVariable ["f_var_squad_didFirstSpawn", true];

if ((!didJip) and _didFirstSpawn) exitWith
if (didJip or ((!didJip) and _didFirstSpawn)) exitWith
{
#ifdef ALLOW_TELEPORT_UPON_RESPAWN

player setVariable ["f_var_mayTeleportToGroup", true, true];

#endif

f_var_groupPicker_disableCancel = true;
createDialog "CAFE_GroupPicker_Dialog";
};
13 changes: 8 additions & 5 deletions startup/configuration/internals/squadMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ if (isNil "f_var_squadMarkers_already_run") then
{
WAIT_UNTIL_SETTINGS_READY();

#include "..\..\..\squadmarker_macros.hpp"
if (isServer) then
{
#include "..\..\..\squadmarker_macros.hpp"

#include "..\..\..\configuration\squadMarkers\squadMarkers_blufor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_opfor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_indfor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_civ.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_blufor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_opfor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_indfor.sqf"
#include "..\..\..\configuration\squadMarkers\squadMarkers_civ.sqf"
};

f_var_squadMarkers_configLoaded = true;
};
Expand Down

0 comments on commit d242d3b

Please sign in to comment.