Skip to content

Commit

Permalink
Merge pull request #156 from shadow-fa/issue-142-FTMarkers
Browse files Browse the repository at this point in the history
Issue 142: FTMemberMarkers fix JIP issues
  • Loading branch information
SamLex authored May 19, 2018
2 parents ff53912 + 1e6a772 commit e6cbd51
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 67 deletions.
2 changes: 1 addition & 1 deletion f/FTMemberMarkers/f_localFTMemberMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ while{alive _unit && (_unit in f_var_HandlerGroup)} do
_mkr setMarkerDirLocal _dir;
// makes a call to the function defined in f_setLocalFTMemberMarkers.sqf
// retreives the stored color from the unit.
_mkr setMarkerColorLocal (_unit getvariable ["assignedTeam","ColorWhite"]);
_mkr setMarkerColorLocal ([_unit] call f_fnc_GetUpdatedTeamValue);
} else {
f_var_HandlerGroup = f_var_HandlerGroup - [_unit];
};
Expand Down
51 changes: 0 additions & 51 deletions f/FTMemberMarkers/fn_LocalFTMarkerSync.sqf

This file was deleted.

35 changes: 21 additions & 14 deletions f/FTMemberMarkers/fn_SetLocalFTMemberMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//
// ====================================================================================

if (!hasInterface) exitWith {};

// MAKE SURE THE PLAYER INITIALIZES PROPERLY
if (!isDedicated && (isNull player)) then
{
Expand All @@ -22,14 +24,29 @@ if (side player isEqualto sideLogic) exitWith {};
// ====================================================================================

// DEFINE HELPER-FUNCTION
// Define a small function to set a unit's team color
// Define a small function to get/set a unit's team color
// This function updates the assignedTeam variable
// if assignedTeam returns a new team(color).

f_fnc_SetTeamValue =
f_fnc_GetUpdatedTeamValue =
{
params["_unit", "_color"];
_unit setvariable ["assignedTeam",_color];
params["_unit"];
private _team = assignedTeam _unit;
private _color = _unit getvariable ["assignedTeam","ColorWhite"];
//_team can be nil if the player is controlling another unit (uav, zeus).
if(!isNil "_team") then
{
private _colorNew = [_team] call f_fnc_GetMarkerColor;
if(_color != _colorNew) then
{
_unit setVariable ["assignedTeam",_colorNew];
_color = _colorNew;
};
};
_color
};


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

// START DRAWING MARKERS
Expand All @@ -50,13 +67,3 @@ f_fnc_SetTeamValue =
sleep 5;
};
};

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

// SYNCHRONIZE TEAM COLORS
// If the player is the groupleader he will take charge of updateing the other units of the colorvalue.

if(player == leader (group player)) then
{
[group player,player] spawn f_fnc_LocalFTMarkerSync;
};
1 change: 0 additions & 1 deletion f/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class F // Defines the "owner"
file = "f\FTMemberMarkers";
class SetLocalFTMemberMarkers{};
class GetMarkerColor{};
class LocalFTMarkerSync{};
};
class bodyRemoval
{
Expand Down

0 comments on commit e6cbd51

Please sign in to comment.