Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 142: FTMemberMarkers fix JIP issues #156

Merged
merged 2 commits into from
May 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -19,14 +21,29 @@ if (!isDedicated && (isNull player)) then
// ====================================================================================

// 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 @@ -47,13 +64,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