From 398d6399f45173b6d82494457a9ba7945c9b0c21 Mon Sep 17 00:00:00 2001 From: Dom Date: Sat, 4 Apr 2020 11:04:24 +0100 Subject: [PATCH 1/5] Marker update --- .../core/civilian/fn_civMarkers.sqf | 80 ++++++------ Altis_Life.Altis/core/cop/fn_copMarkers.sqf | 79 ++++++------ .../core/functions/fn_checkMap.sqf | 50 ++++---- .../core/medical/fn_medicMarkers.sqf | 114 ++++++++---------- 4 files changed, 150 insertions(+), 173 deletions(-) diff --git a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf index c1dc99ed1..bf43692d2 100644 --- a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf +++ b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf @@ -1,44 +1,36 @@ -/* - File: fn_civMarkers.sqf - Author: - - Description: - Add markers for civilians in groups. -*/ -private ["_markers","_members"]; -_markers = []; -_members = []; - -for "_i" from 0 to 1 step 0 do { - sleep 0.5; - if (visibleMap) then - { - _members = units (group player); - { - if !(_x isEqualTo player) then { - _marker = createMarkerLocal [format ["%1_marker",_x],visiblePosition _x]; - _marker setMarkerColorLocal "ColorCivilian"; - _marker setMarkerTypeLocal "Mil_dot"; - _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - _markers pushBack [_marker,_x]; - }; - } forEach _members; - - while {visibleMap} do - { - { - private ["_unit"]; - _unit = _x select 1; - if (!isNil "_unit" && !isNull _unit) then { - (_x select 0) setMarkerPosLocal (visiblePosition _unit); - }; - } forEach _markers; - if (!visibleMap) exitWith {}; - sleep 0.02; - }; - - {deleteMarkerLocal (_x select 0);} forEach _markers; - _markers = []; - _members = []; - }; -}; +/* + File: fn_civMarkers.sqf + Author: + + Description: + Add markers for civilians in groups. +*/ +private _markers = []; + +{ + if !(_x isEqualTo player) then { + private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; + _marker setMarkerColorLocal "ColorCivilian"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + _markers pushBack [_marker,_x]; + }; +} forEach (units (group player)); + +while {visibleMap} do { + { + _x params [ + ["_mark",""], + ["_unit",objNull] + ]; + if !(isNull _unit) then { + _mark setMarkerPosLocal (getPosATL _unit); + }; + } forEach _markers; + sleep 0.01; +}; + +{ + _x params [["_mark",""]]; + deleteMarkerLocal _mark; +} forEach _markers; diff --git a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf index 1c6c14251..8781aeb33 100644 --- a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf +++ b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf @@ -1,43 +1,36 @@ -/* - File: fn_copMarkers.sqf - Author: Bryan "Tonic" Boardwine - - Description: - Marks cops on the map for other cops. Only initializes when the actual map is open. -*/ -private ["_markers","_cops"]; -_markers = []; -_cops = []; - -sleep 0.5; -if (visibleMap) then { - {if (side _x isEqualTo west) then {_cops pushBack _x;}} forEach playableUnits; //Fetch list of cops / blufor - - //Create markers - { - if !(_x isEqualTo player) then { - _marker = createMarkerLocal [format ["%1_marker",_x],visiblePosition _x]; - _marker setMarkerColorLocal "ColorBLUFOR"; - _marker setMarkerTypeLocal "Mil_dot"; - _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - - _markers pushBack [_marker,_x]; - }; - } forEach _cops; - - while {visibleMap} do { - { - private ["_unit"]; - _unit = _x select 1; - if (!isNil "_unit" && !isNull _unit) then { - (_x select 0) setMarkerPosLocal (visiblePosition _unit); - }; - } forEach _markers; - if (!visibleMap) exitWith {}; - sleep 0.02; - }; - - {deleteMarkerLocal (_x select 0);} forEach _markers; - _markers = []; - _cops = []; -}; +/* + File: fn_copMarkers.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Marks cops on the map for other cops. Only initializes when the actual map is open. +*/ +private _markers = []; + +{ + if (side _x isEqualTo west) then { + private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; + _marker setMarkerColorLocal "ColorBLUFOR"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + _markers pushBack [_marker,_x]; + }; +} forEach (playableUnits - [player]); + +while {visibleMap} do { + { + _x params [ + ["_mark",""], + ["_unit",objNull] + ]; + if !(isNull _unit) then { + _mark setMarkerPosLocal (getPosATL _unit); + }; + } forEach _markers; + sleep 0.01; +}; + +{ + _x params [["_mark",""]]; + deleteMarkerLocal _mark; +} forEach _markers; diff --git a/Altis_Life.Altis/core/functions/fn_checkMap.sqf b/Altis_Life.Altis/core/functions/fn_checkMap.sqf index 03de18e19..f7627fa5a 100644 --- a/Altis_Life.Altis/core/functions/fn_checkMap.sqf +++ b/Altis_Life.Altis/core/functions/fn_checkMap.sqf @@ -1,25 +1,25 @@ -/* - File: fn_checkMap.sqf - Author: DomT602 - Description: - Checks if the map is being opened or closed, then puts markers according to side. - */ - - params [ - ["_mapOpen",false,[false]] - ]; - - if (_mapOpen) then { - switch playerSide do { - case west: {[] spawn life_fnc_copMarkers}; - case independent: {[] spawn life_fnc_medicMarkers}; - case civilian: {[] spawn life_fnc_civMarkers}; - }; - - if (life_markers && {!(life_markers_active)}) then { - [true] spawn life_fnc_adminMarkers; - }; - - } else { - life_markers_active = false; - }; +/* + File: fn_checkMap.sqf + Author: DomT602 + Description: + Checks if the map is being opened or closed, then puts markers according to side. + */ + + params [ + ["_mapOpen",false,[false]] + ]; + + if (_mapOpen) then { + switch playerSide do { + case west: {[] spawn life_fnc_copMarkers}; + case independent: {[] spawn life_fnc_medicMarkers}; + case civilian: {[] spawn life_fnc_civMarkers}; + }; + + if (life_markers && {!life_markers_active}) then { + [true] spawn life_fnc_adminMarkers; + }; + + } else { + life_markers_active = false; + }; diff --git a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf index 2e02f6bdb..d5d514baa 100644 --- a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf +++ b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf @@ -1,61 +1,53 @@ -/* - File: fn_medicMarkers.sqf - Author: Bryan "Tonic" Boardwine - - Description: - Marks downed players on the map when it's open. -*/ -private ["_markers","_units","_medics"]; -_markers = []; -_markersMedecin = []; -_units = []; -_medics = []; - -sleep 0.25; -if (visibleMap) then { - {if (side _x isEqualTo independent) then {_medics pushBack _x;}} forEach playableUnits; //Fetch list of cops / blufor - { - _name = _x getVariable "name"; - _down = _x getVariable ["Revive",false]; - if (!isNil "_name" && !_down) then { - _units pushBack _x; - }; - } forEach allDeadMen; - - { - if !(_x isEqualTo player) then { - _markerss = createMarkerLocal [format ["%1_marker",_x],visiblePosition _x]; - _markerss setMarkerColorLocal "ColorIndependent"; - _markerss setMarkerTypeLocal "Mil_dot"; - _markerss setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - - _markersMedecin pushBack [_markerss,_x]; - }; - } forEach _medics; - - //Loop through and create markers. - { - _marker = createMarkerLocal [format ["%1_dead_marker",_x],visiblePosition _x]; - _marker setMarkerColorLocal "ColorRed"; - _marker setMarkerTypeLocal "loc_Hospital"; - _marker setMarkerTextLocal format ["%1",(_x getVariable ["name","Unknown Player"])]; - _markers pushBack _marker; - } forEach _units; - - while {visibleMap} do { - { - private ["_unit"]; - _unit = _x select 1; - if (!isNil "_unit" && !isNull _unit) then { - (_x select 0) setMarkerPosLocal (visiblePosition _unit); - }; - } forEach _markersMedecin; - if (!visibleMap) exitWith {}; - sleep 0.02; - }; - {deleteMarkerLocal (_x select 0);} forEach _markersMedecin; - _markersMedecin = []; - _medics = []; - waitUntil {!visibleMap}; - {deleteMarkerLocal _x;} forEach _markers; -}; +/* + File: fn_medicMarkers.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Marks downed players on the map when it's open. +*/ +private _deadMarkers = []; +private _medicMarkers = []; + +{ + if (side _x isEqualTo independent) then { + private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; + _marker setMarkerColorLocal "ColorIndependent"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + _medicMarkers pushBack [_marker,_x]; + }; +} forEach (playableUnits - [player]); + +{ + private _name = _x getVariable "name"; + private _down = _x getVariable ["Revive",false]; + if (!isNil "_name" && !_down) then { + private _marker = createMarkerLocal [format ["%1_dead_marker",_x],getPosATL _x]; + _marker setMarkerColorLocal "ColorRed"; + _marker setMarkerTypeLocal "loc_Hospital"; + _marker setMarkerTextLocal format ["%1",_name]; + _deadMarkers pushBack _marker; + }; +} forEach allDeadMen; + +while {visibleMap} do { + { + _x params [ + ["_mark",""], + ["_unit",objNull] + ]; + if !(isNull _unit) then { + _mark setMarkerPosLocal (getPosATL _unit); + }; + } forEach _medicMarkers; + sleep 0.01; +}; + +{ + _x params [["_mark",""]]; + deleteMarkerLocal _mark; +} forEach _medicMarkers; + +{ + deleteMarkerLocal _x; +} forEach _deadMarkers; From 6aa1d57de58798d30d40aa83567809a083faf3c3 Mon Sep 17 00:00:00 2001 From: Dom Date: Sun, 12 Apr 2020 11:13:44 +0100 Subject: [PATCH 2/5] Update file description --- Altis_Life.Altis/core/cop/fn_copMarkers.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf index 8781aeb33..92ac2011f 100644 --- a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf +++ b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf @@ -3,7 +3,7 @@ Author: Bryan "Tonic" Boardwine Description: - Marks cops on the map for other cops. Only initializes when the actual map is open. + Marks cops on the map for other cops. */ private _markers = []; From 8f16136cb690f9c01c2a5e258ce71920fda1eb9b Mon Sep 17 00:00:00 2001 From: dom Date: Wed, 29 Dec 2021 11:32:09 +0000 Subject: [PATCH 3/5] Consistency across forEach's --- Altis_Life.Altis/core/civilian/fn_civMarkers.sqf | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf index 67447dc59..758e52773 100644 --- a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf +++ b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf @@ -8,14 +8,12 @@ private _markers = []; { - if !(_x isEqualTo player) then { - private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; - _marker setMarkerColorLocal "ColorCivilian"; - _marker setMarkerTypeLocal "Mil_dot"; - _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; + _marker setMarkerColorLocal "ColorCivilian"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; _markers pushBack [_marker,_x]; - }; -} forEach (units (group player)); +} forEach ((units (group player)) - [player]); while {visibleMap} do { { From 4a74ce6bfc55b04b1f39c0b3ceaea5660d5bf3ad Mon Sep 17 00:00:00 2001 From: dom Date: Mon, 3 Jan 2022 20:30:15 +0000 Subject: [PATCH 4/5] Suggestions implemented --- Altis_Life.Altis/core/civilian/fn_civMarkers.sqf | 6 +++--- Altis_Life.Altis/core/cop/fn_copMarkers.sqf | 14 ++++++-------- Altis_Life.Altis/core/functions/fn_checkMap.sqf | 14 +++++++------- Altis_Life.Altis/core/medical/fn_medicMarkers.sqf | 14 ++++++-------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf index 758e52773..1f0267322 100644 --- a/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf +++ b/Altis_Life.Altis/core/civilian/fn_civMarkers.sqf @@ -8,11 +8,11 @@ private _markers = []; { - private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; + private _marker = createMarkerLocal [format ["%1_marker",netID _x],getPosATL _x]; _marker setMarkerColorLocal "ColorCivilian"; _marker setMarkerTypeLocal "Mil_dot"; _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - _markers pushBack [_marker,_x]; + _markers pushBack [_marker,_x]; } forEach ((units (group player)) - [player]); while {visibleMap} do { @@ -25,7 +25,7 @@ while {visibleMap} do { _mark setMarkerPosLocal (getPosATL _unit); }; } forEach _markers; - sleep 0.01; + uiSleep 0.01; }; { diff --git a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf index f3b2391ac..7f0b3f2ce 100644 --- a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf +++ b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf @@ -8,14 +8,12 @@ private _markers = []; { - if (side _x isEqualTo west) then { - private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; - _marker setMarkerColorLocal "ColorBLUFOR"; - _marker setMarkerTypeLocal "Mil_dot"; - _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - _markers pushBack [_marker,_x]; - }; -} forEach (playableUnits - [player]); + private _marker = createMarkerLocal [format ["%1_marker",netID _x],getPosATL _x]; + _marker setMarkerColorLocal "ColorBLUFOR"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + _markers pushBack [_marker,_x]; +} forEach ((units west) - [player]); while {visibleMap} do { { diff --git a/Altis_Life.Altis/core/functions/fn_checkMap.sqf b/Altis_Life.Altis/core/functions/fn_checkMap.sqf index f7627fa5a..01c279823 100644 --- a/Altis_Life.Altis/core/functions/fn_checkMap.sqf +++ b/Altis_Life.Altis/core/functions/fn_checkMap.sqf @@ -10,15 +10,15 @@ ]; if (_mapOpen) then { - switch playerSide do { - case west: {[] spawn life_fnc_copMarkers}; - case independent: {[] spawn life_fnc_medicMarkers}; - case civilian: {[] spawn life_fnc_civMarkers}; - }; + switch playerSide do { + case west: {[] spawn life_fnc_copMarkers}; + case independent: {[] spawn life_fnc_medicMarkers}; + case civilian: {[] spawn life_fnc_civMarkers}; + }; - if (life_markers && {!life_markers_active}) then { + if (life_markers && {!life_markers_active}) then { [true] spawn life_fnc_adminMarkers; - }; + }; } else { life_markers_active = false; diff --git a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf index d5d514baa..21612e4a3 100644 --- a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf +++ b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf @@ -9,14 +9,12 @@ private _deadMarkers = []; private _medicMarkers = []; { - if (side _x isEqualTo independent) then { - private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x]; - _marker setMarkerColorLocal "ColorIndependent"; - _marker setMarkerTypeLocal "Mil_dot"; - _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; - _medicMarkers pushBack [_marker,_x]; - }; -} forEach (playableUnits - [player]); + private _marker = createMarkerLocal [format ["%1_marker",netID _x],getPosATL _x]; + _marker setMarkerColorLocal "ColorIndependent"; + _marker setMarkerTypeLocal "Mil_dot"; + _marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]]; + _medicMarkers pushBack [_marker,_x]; +} forEach ((units independent) - [player]); { private _name = _x getVariable "name"; From ccafeec982acb1f282deb57d3cc4a9ca2a7526f4 Mon Sep 17 00:00:00 2001 From: dom Date: Mon, 3 Jan 2022 20:33:43 +0000 Subject: [PATCH 5/5] Sleep --- Altis_Life.Altis/core/cop/fn_copMarkers.sqf | 2 +- Altis_Life.Altis/core/medical/fn_medicMarkers.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf index 7f0b3f2ce..c30edb2c4 100644 --- a/Altis_Life.Altis/core/cop/fn_copMarkers.sqf +++ b/Altis_Life.Altis/core/cop/fn_copMarkers.sqf @@ -25,7 +25,7 @@ while {visibleMap} do { _mark setMarkerPosLocal (getPosATL _unit); }; } forEach _markers; - sleep 0.01; + uiSleep 0.01; }; { diff --git a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf index 21612e4a3..2bc796fb8 100644 --- a/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf +++ b/Altis_Life.Altis/core/medical/fn_medicMarkers.sqf @@ -38,7 +38,7 @@ while {visibleMap} do { _mark setMarkerPosLocal (getPosATL _unit); }; } forEach _medicMarkers; - sleep 0.01; + uiSleep 0.01; }; {