mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-16 05:02:57 +03:00
Move group icons to separate slower loop
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
// OnEachFrame loop
|
||||
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"];
|
||||
|
||||
_group = player call dayz_filterGroup;
|
||||
if (!visibleMap && count _group > 1 && cameraView in ["INTERNAL","EXTERNAL","GUNNER"]) then {
|
||||
80000 cutRsc ["DZ_GroupIcons","PLAIN"];
|
||||
|
||||
_display = uiNamespace getVariable "DZ_GroupIcons";
|
||||
_index = 0;
|
||||
{
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
_distance = _pos distance player;
|
||||
_icon = _display displayCtrl (100 + _index);
|
||||
if (_distance > 1 && _distance < 2500 && vehicle _x != vehicle player) then {
|
||||
_pos set [2,(_pos select 2) + 1.5];
|
||||
_screen = worldToScreen _pos;
|
||||
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
|
||||
if (count _screen > 1) then {
|
||||
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)};
|
||||
_icon ctrlSetStructuredText _text;
|
||||
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
|
||||
_icon ctrlSetScale _scale;
|
||||
_icon ctrlSetFade ((1 - _scale) / 2);
|
||||
_icon ctrlCommit 0;
|
||||
_icon ctrlShow true;
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
if (dayz_oldGroupCount > count _group) then {
|
||||
_display displayCtrl (100 + _index) ctrlShow false;
|
||||
};
|
||||
|
||||
dayz_oldGroupCount = count _group;
|
||||
} else {
|
||||
80000 cutText ["","PLAIN"];
|
||||
};
|
||||
@@ -1,60 +1,63 @@
|
||||
// Two second loop
|
||||
private ["_count","_found","_group","_hasGPS","_index","_marker","_markBody","_markGroup","_markSelf","_pos","_self","_vehicle"];
|
||||
|
||||
_group = player call dayz_filterGroup;
|
||||
while {true} do {
|
||||
_group = player call dayz_filterGroup;
|
||||
|
||||
if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)}) exitWith {
|
||||
[player] joinSilent grpNull;
|
||||
_group = [];
|
||||
if (!isNull findDisplay 80000) then {findDisplay 80000 closeDisplay 2;};
|
||||
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
if (visibleMap or !isNull findDisplay 88890) then {
|
||||
_hasGPS = "ItemGPS" in items player;
|
||||
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));
|
||||
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS));
|
||||
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS));
|
||||
|
||||
_index = 0;
|
||||
{
|
||||
_self = _x == player;
|
||||
_vehicle = vehicle _x;
|
||||
if ((_self or _markGroup) && (!_self or _markSelf) && (effectiveCommander _vehicle == _x)) then {
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
_marker = createMarkerLocal [format["groupMember%1",_index],_pos];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal format ["%1",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];
|
||||
_marker setMarkerColorLocal "ColorGreen";
|
||||
} else {
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
// Remove markers for group members that left
|
||||
_count = count _group;
|
||||
if (dayz_oldMemberCount > _count) then {
|
||||
for "_i" from _count to dayz_oldMemberCount do {deleteMarkerLocal format["groupMember%1",_i];};
|
||||
};
|
||||
dayz_oldMemberCount = _count;
|
||||
|
||||
if (_markBody) then {
|
||||
_found = false;
|
||||
{
|
||||
if (_x getVariable["bodyName",""] == name player) exitWith {
|
||||
_found = true;
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
deleteMarkerLocal "MyBody";
|
||||
_marker = createMarkerLocal ["MyBody",_pos];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal localize "STR_EPOCH_RIP";
|
||||
_marker setMarkerColorLocal "ColorRed";
|
||||
};
|
||||
} count allDead;
|
||||
if (!_found) then {deleteMarkerLocal "MyBody";}; //Body was deleted or hidden
|
||||
if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)}) then {
|
||||
[player] joinSilent grpNull;
|
||||
_group = [];
|
||||
if (!isNull findDisplay 80000) then {findDisplay 80000 closeDisplay 2;};
|
||||
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
|
||||
} else {
|
||||
deleteMarkerLocal "MyBody";
|
||||
if (visibleMap or !isNull findDisplay 88890) then {
|
||||
_hasGPS = "ItemGPS" in items player;
|
||||
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));
|
||||
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS));
|
||||
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS));
|
||||
|
||||
_index = 0;
|
||||
{
|
||||
_self = _x == player;
|
||||
_vehicle = vehicle _x;
|
||||
if ((_self or _markGroup) && (!_self or _markSelf) && (effectiveCommander _vehicle == _x)) then {
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
_marker = createMarkerLocal [format["groupMember%1",_index],_pos];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal format ["%1",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];
|
||||
_marker setMarkerColorLocal "ColorGreen";
|
||||
} else {
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
// Remove markers for group members that left
|
||||
_count = count _group;
|
||||
if (dayz_oldMemberCount > _count) then {
|
||||
for "_i" from _count to dayz_oldMemberCount do {deleteMarkerLocal format["groupMember%1",_i];};
|
||||
};
|
||||
dayz_oldMemberCount = _count;
|
||||
|
||||
if (_markBody) then {
|
||||
_found = false;
|
||||
{
|
||||
if (_x getVariable["bodyName",""] == name player) exitWith {
|
||||
_found = true;
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
deleteMarkerLocal "MyBody";
|
||||
_marker = createMarkerLocal ["MyBody",_pos];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal localize "STR_EPOCH_RIP";
|
||||
_marker setMarkerColorLocal "ColorRed";
|
||||
};
|
||||
} count allDead;
|
||||
if (!_found) then {deleteMarkerLocal "MyBody";}; //Body was deleted or hidden
|
||||
} else {
|
||||
deleteMarkerLocal "MyBody";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
uiSleep 1;
|
||||
};
|
||||
46
SQF/dayz_code/groups/groupTags.sqf
Normal file
46
SQF/dayz_code/groups/groupTags.sqf
Normal file
@@ -0,0 +1,46 @@
|
||||
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"];
|
||||
|
||||
while {true} do {
|
||||
_group = player call dayz_filterGroup;
|
||||
|
||||
if (!visibleMap && count _group > 1 && cameraView in ["INTERNAL","EXTERNAL","GUNNER"]) then {
|
||||
80000 cutRsc ["DZ_GroupTags","PLAIN"];
|
||||
|
||||
_display = uiNamespace getVariable "DZ_GroupTags";
|
||||
_index = 0;
|
||||
{
|
||||
_pos = [_x] call FNC_GetPos;
|
||||
_distance = _pos distance player;
|
||||
_icon = _display displayCtrl (100 + _index);
|
||||
if (_distance > 1 && _distance < 2500 && vehicle _x != vehicle player) then {
|
||||
_pos set [2,(_pos select 2) + 1.5];
|
||||
_screen = worldToScreen _pos;
|
||||
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
|
||||
if (count _screen > 1) then {
|
||||
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)};
|
||||
_icon ctrlSetStructuredText _text;
|
||||
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
|
||||
_icon ctrlSetScale _scale;
|
||||
_icon ctrlSetFade ((1 - _scale) / 2);
|
||||
_icon ctrlCommit 0;
|
||||
_icon ctrlShow true;
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
if (dayz_oldGroupCount > count _group) then {
|
||||
_display displayCtrl (100 + _index) ctrlShow false;
|
||||
};
|
||||
|
||||
dayz_oldGroupCount = count _group;
|
||||
} else {
|
||||
80000 cutText ["","PLAIN"];
|
||||
};
|
||||
|
||||
uiSleep 0.01;
|
||||
};
|
||||
@@ -30,8 +30,6 @@ dayz_disbandGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\group
|
||||
dayz_filterGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\filter.sqf";
|
||||
dayz_getCrew = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getCrew.sqf";
|
||||
dayz_getPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getPlayer.sqf";
|
||||
dayz_groupIcons = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupIcons.sqf";
|
||||
dayz_groupMarkers = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupMarkers.sqf";
|
||||
dayz_inviteToGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\invite.sqf";
|
||||
dayz_joinGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\join.sqf";
|
||||
dayz_kickFromGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\kick.sqf";
|
||||
@@ -41,4 +39,10 @@ dayz_pickGroupMember = compile preprocessFileLineNumbers "\z\addons\dayz_code\gr
|
||||
dayz_pickPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\pickPlayer.sqf";
|
||||
dayz_promotePlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\promote.sqf";
|
||||
dayz_rejectGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\reject.sqf";
|
||||
dayz_groupInit = true;
|
||||
dayz_groupInit = true;
|
||||
|
||||
execVM "\z\addons\dayz_code\groups\groupTags.sqf";
|
||||
|
||||
if (dayz_requireRadio or {dayz_markGroup > 0} or {dayz_markSelf > 0} or {dayz_markBody > 0}) then {
|
||||
execVM "\z\addons\dayz_code\groups\groupMarkers.sqf";
|
||||
};
|
||||
Reference in New Issue
Block a user