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

Marker update #642

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
59 changes: 22 additions & 37 deletions Altis_Life.Altis/core/civilian/fn_civMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,30 @@
Description:
Add markers for civilians in groups.
*/

private _markers = [];
private _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 {
private _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];
};
true
} count _members;
{
private _marker = createMarkerLocal [format ["%1_marker",_x],getPosATL _x];
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
_marker setMarkerColorLocal "ColorCivilian";
_marker setMarkerTypeLocal "Mil_dot";
_marker setMarkerTextLocal format ["%1", _x getVariable ["realname",name _x]];
_markers pushBack [_marker,_x];
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
} forEach ((units (group player)) - [player]);

while {visibleMap} do
{
{
_x params ["_marker", "_unit"];
if (!isNil "_unit" && {!isNull _unit}) then {
_marker setMarkerPosLocal (visiblePosition _unit);
};
true
} count _markers;
if (!visibleMap) exitWith {};
sleep 0.02;
while {visibleMap} do {
{
_x params [
["_mark",""],
["_unit",objNull]
];
if !(isNull _unit) then {
_mark setMarkerPosLocal (getPosATL _unit);
};

{
deleteMarkerLocal (_x select 0);
true
} count _markers;

_markers = [];
_members = [];
};
} forEach _markers;
sleep 0.01;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};

{
_x params [["_mark",""]];
deleteMarkerLocal _mark;
} forEach _markers;
58 changes: 24 additions & 34 deletions Altis_Life.Altis/core/cop/fn_copMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,34 @@
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 = [];
private _cops = [];

sleep 0.5;
if (visibleMap) then {
_cops = playableUnits select {side _x isEqualTo west};

//Create markers
{
if !(_x isEqualTo player) then {
private _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];
};
true
} count _cops;

while {visibleMap} do {
{
_x params ["_marker","_unit"];
if (!isNil "_unit" && {!isNull _unit}) then {
_marker setMarkerPosLocal (visiblePosition _unit);
};
true
} count _markers;
if (!visibleMap) exitWith {};
sleep 0.02;
{
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]);
DomT602 marked this conversation as resolved.
Show resolved Hide resolved

while {visibleMap} do {
{
deleteMarkerLocal (_x select 0);
} count _markers;
_markers = [];
_cops = [];
_x params [
["_mark",""],
["_unit",objNull]
];
if !(isNull _unit) then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but what if it is? what if someone dies/respawns? (same for previous file)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just avoids moving the marker to [0,0,0] until they've closed the map it seems.

_mark setMarkerPosLocal (getPosATL _unit);
};
} forEach _markers;
sleep 0.01;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};

{
_x params [["_mark",""]];
deleteMarkerLocal _mark;
} forEach _markers;
50 changes: 25 additions & 25 deletions Altis_Life.Altis/core/functions/fn_checkMap.sqf
Original file line number Diff line number Diff line change
@@ -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;
};
114 changes: 53 additions & 61 deletions Altis_Life.Altis/core/medical/fn_medicMarkers.sqf
Original file line number Diff line number Diff line change
@@ -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]);
DomT602 marked this conversation as resolved.
Show resolved Hide resolved

{
private _name = _x getVariable "name";
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
private _down = _x getVariable ["Revive",false];
if (!isNil "_name" && !_down) then {
private _marker = createMarkerLocal [format ["%1_dead_marker",_x],getPosATL _x];
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerTypeLocal "loc_Hospital";
_marker setMarkerTextLocal format ["%1",_name];
_deadMarkers pushBack _marker;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};
} forEach allDeadMen;

while {visibleMap} do {
{
_x params [
["_mark",""],
["_unit",objNull]
];
if !(isNull _unit) then {
_mark setMarkerPosLocal (getPosATL _unit);
};
} forEach _medicMarkers;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
sleep 0.01;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};

{
_x params [["_mark",""]];
deleteMarkerLocal _mark;
} forEach _medicMarkers;

{
deleteMarkerLocal _x;
} forEach _deadMarkers;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved