mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
marker sets (local)
Player Location Marker with Assigned GPS Death Marker location saved only when assigned GPS on death CfgEpochClient on/off toggle for hosts DynaMenu on map toggle for players New Marker Sets come to life! First set of functions for Local Marker Sets as needed for the above feature additions
This commit is contained in:
parent
b911897c31
commit
df12dc1b61
@ -0,0 +1,100 @@
|
||||
/*
|
||||
|
||||
Author: DirtySanchez
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Utilize new Epoch Active Markers, Backgrounds and Icons courtesy of DrokZ.
|
||||
|
||||
Licence:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_createLocalMarkerSet.sqf
|
||||
|
||||
usage:
|
||||
[_markerClass, _position] call EPOCH_fnc_createLocalMarkerSet;
|
||||
|
||||
_markerClass(_mClass) - use one of the class markers in the epoch_configs/Configs/CfgMarkerSets.hpp or create new
|
||||
|
||||
_position(_mPos) - position you would like to place the marker set on the map
|
||||
|
||||
Example:
|
||||
1. ['DeathMarker',_pos] call EPOCH_fnc_createLocalMarkerSet;
|
||||
|
||||
2. ['PlayerMarker',_pos] call EPOCH_fnc_createLocalMarkerSet;
|
||||
|
||||
*/
|
||||
private["_config", "_markerArray", "_markerName", "_ccText"];
|
||||
|
||||
params [ ["_mClass",""], ["_mPos",[0,0,0]], ["_data",[]] ];
|
||||
if(_mClass isEqualTo "") exitWith {
|
||||
diag_log "EPOCHDebug: createLocalMarkerSet -1- empty markerClass, nothing to create";
|
||||
};
|
||||
|
||||
// get config for custom marker sets
|
||||
_config = 'CfgLocalMarkerSets' call EPOCH_returnConfig;
|
||||
if !(isclass (_config >> _mClass)) exitwith {
|
||||
diag_log "EPOCHDebug: createLocalMarkerSet -2- not a class markerClass, nothing to create";
|
||||
};
|
||||
|
||||
// get array for custom marker set
|
||||
_markerArray = getArray(_config >> _mClass >> "markerArray");
|
||||
if(_markerArray isEqualTo []) exitWith {
|
||||
diag_log "EPOCHDebug: createLocalMarkerSet -3- empty markerArray, nothing to create";
|
||||
};
|
||||
|
||||
// get a markerName and check for it on map
|
||||
_markerName = (_markerArray select 0) select 0;
|
||||
if(_markerName in allMapMarkers) exitWith {
|
||||
diag_log "EPOCHDebug: createLocalMarkerSet -4- marker already exists on map";
|
||||
};
|
||||
|
||||
// check for defined Marker counter
|
||||
if(isNil {Epoch_markerCounter})then{Epoch_markerCounter = 0};
|
||||
|
||||
// run forEach loop on array
|
||||
{
|
||||
// double check all, use these defaults if not defined
|
||||
_x params [
|
||||
["_mName",format["marker_%1", Epoch_markerCounter]],
|
||||
["_mShape","ICON"],
|
||||
["_mType","hd_dot"],
|
||||
["_mColor","ColorRed"],
|
||||
["_mAlpha",1],
|
||||
["_mSize",[0.8,0.8]],
|
||||
["_mDir",0],
|
||||
["_mText",""]
|
||||
];
|
||||
|
||||
_marker = createMarkerLocal [_mName, _mPos];
|
||||
|
||||
_mName setMarkerShapeLocal _mShape;
|
||||
|
||||
if!(_mShape isEqualTo "ICON")then{
|
||||
if!(_mType in (getArray(_config >> "brushes")))exitWith{
|
||||
diag_log "EPOCHDebug: createLocalMarkerSet -5- Shape is Ellipse or Rectangle and needs a Brush Type";
|
||||
};
|
||||
};
|
||||
_mName setMarkerTypeLocal _mType;
|
||||
|
||||
_mName setMarkerAlphaLocal _mAlpha;
|
||||
_mName setMarkerSizeLocal _mSize;
|
||||
_mName setMarkerDirLocal _mDir;
|
||||
|
||||
if(_mText isEqualTo "playerName")then{
|
||||
_mText = str(name player);
|
||||
};
|
||||
|
||||
_ccText = call compile _mText;
|
||||
_mName setMarkerTextLocal _ccText;
|
||||
|
||||
if!(_mColor isEqualTo "")then{
|
||||
_mName setMarkerColorLocal _mColor
|
||||
};
|
||||
|
||||
if(_mName isEqualTo (format["marker_%1", Epoch_markerCounter]))then{
|
||||
Epoch_markerCounter = Epoch_markerCounter + 1;
|
||||
};
|
||||
}forEach _markerArray;
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Author: DirtySanchez - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Delete Marker Set
|
||||
|
||||
License:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_deleteLocalMarkerSet.sqf
|
||||
|
||||
usage:
|
||||
[_mClass] call EPOCH_fnc_deleteLocalMarkerSet;
|
||||
|
||||
_mClass - name of marker you used from: epoch_configs/Configs/CfgMarkerSets.hpp
|
||||
*/
|
||||
private["_config","_markerArray"];
|
||||
|
||||
params [ ["_mClass",""], ["_data",[]] ];
|
||||
|
||||
if(_mClass isEqualTo "") exitWith {
|
||||
diag_log "EPOCHDebug: deleteLocalMarkerSet -1- empty markerClass, nothing to delete";
|
||||
};
|
||||
|
||||
// get config for custom marker sets
|
||||
_config = 'CfgLocalMarkerSets' call EPOCH_returnConfig;
|
||||
if !(isclass (_config >> _mClass)) exitwith {
|
||||
diag_log "EPOCHDebug: deleteLocalMarkerSet -2- not a class markerClass, nothing to delete";
|
||||
};
|
||||
// get array for custom marker set
|
||||
_markerArray = getArray(_config >> _mClass >> "markerArray");
|
||||
if(_markerArray isEqualTo []) exitWith {
|
||||
diag_log "EPOCHDebug: deleteLocalMarkerSet -3- empty markerArray, nothing to delete";
|
||||
};
|
||||
// get a markerName and check for it on map
|
||||
_markerName = (_markerArray select 0) select 0;
|
||||
if!(_markerName in allMapMarkers) exitWith {
|
||||
diag_log "EPOCHDebug: deleteLocalMarkerSet -4- marker does not exist on map";
|
||||
};
|
||||
|
||||
{
|
||||
_mName = _x select 0;
|
||||
deleteMarkerLocal _mName;
|
||||
}forEach _markerArray;
|
@ -43,6 +43,13 @@ if (vehicle _unit != _unit) then {
|
||||
_unit action["Eject", vehicle _unit];
|
||||
};
|
||||
|
||||
// save death position
|
||||
profileNameSpace setVariable["EPOCHLastKnownDeath",[]];
|
||||
_deathMarkerON = (getNumber(_config >> "playerDeathMarkerGPSOnly") isEqualTo 1);
|
||||
if(_deathMarkerON && ('ItemGPS' in (assignedItems _unit)))then{
|
||||
profileNameSpace setVariable["EPOCHLastKnownDeath",getPos _unit];
|
||||
};
|
||||
|
||||
[player,_killer,toArray profileName,Epoch_personalToken] remoteExec ["EPOCH_server_deadPlayer",2];
|
||||
|
||||
// disable build mode
|
||||
|
@ -358,6 +358,25 @@ if !(_playerTempKey isEqualTo "EPOCH_playerTemp") then {
|
||||
EPOCH_playerNuisance = missionNamespace getVariable [_playerNuisanceKey, _playerNuisanceDefault];
|
||||
};
|
||||
|
||||
// Check for PlayerMarker and Update or Remove it
|
||||
_config = 'CfgLocalMarkerSets' call EPOCH_returnConfig;
|
||||
_markerArray = getArray(_config >> 'PlayerMarker' >> 'markerArray');
|
||||
_markerName = (_markerArray select 0) select 0;
|
||||
|
||||
if(_markerName in allMapMarkers)then{
|
||||
if!('ItemGPS' in (assignedItems player))then{
|
||||
['PlayerMarker'] call EPOCH_fnc_deleteLocalMarkerSet;
|
||||
if(((getArray(_config >> 'DeathMarker' >> 'markerArray') select 0) select 0) in allMapMarkers)then{
|
||||
['DeathMarker'] call EPOCH_fnc_deleteLocalMarkerSet;
|
||||
};
|
||||
}else{
|
||||
{
|
||||
(_x select 0) setMarkerPosLocal (position player);
|
||||
if(count(_x) >= 8)then{(_x select 0) setMarkerTextLocal (call compile (_x select 7))};
|
||||
}forEach _markerArray;
|
||||
};
|
||||
};
|
||||
|
||||
// force update
|
||||
if (EPOCH_forceUpdateNow) then {
|
||||
EPOCH_forceUpdateNow = false;
|
||||
|
@ -22,6 +22,7 @@ class CfgActionMenu
|
||||
dyna_inVehicle = "vehicle player != player";
|
||||
dyna_itemsPlayer = "items player";
|
||||
dyna_magazinesPlayer = "magazines player";
|
||||
dyna_assigneditems = "assignedItems player";
|
||||
dyna_sizeOf = "((sizeOf dyna_cursorTargetType/2) max 6) min 30";
|
||||
dyna_distance = "(player distance dyna_cursorTarget) <= dyna_sizeOf";
|
||||
|
||||
@ -38,6 +39,14 @@ class CfgActionMenu
|
||||
dyna_Turret = "if (!dyna_inVehicle) then {[]} else {if ((assignedVehicleRole player) isequalto ['driver']) then {[-1]} else {if (count (assignedVehicleRole player) == 2) then {(assignedVehicleRole player) select 1}else {[]}}}";
|
||||
dyna_weaponsTurret = "if (!dyna_inVehicle) then {[]}else {((vehicle player) weaponsTurret dyna_Turret) select {!((getArray(configFile >> 'CfgWeapons' >> _x >> 'magazines')) select {!((getText (configFile >> 'CfgMagazines' >> _x >> 'picture')) isequalto '')} isequalto [])}}";
|
||||
dyna_WeapsMagsTurret = "call {_out = [];if (dyna_inVehicle) then {_added = [];{_weapon = _x;_WeaponMags = ((vehicle player) magazinesTurret dyna_Turret) select {(_x in (getArray (configFile >> 'CfgWeapons' >> _weapon >> 'magazines'))) && !((getText (configFile >> 'CfgMagazines' >> _x >> 'picture')) isequalto '')};if !(_WeaponMags isequalto []) then {{if !(_x in _added) then {_out pushback [_weapon,_x];_added pushback _x;};} foreach _WeaponMags;};} foreach dyna_weaponsTurret;};_out}";
|
||||
|
||||
dyna_mapPlayerMarkerON = "(getNumber(('CfgEpochClient' call EPOCH_returnConfig) >> 'playerLocationMarkerGPSOnly') isEqualTo 1)";
|
||||
dyna_mapPlayerMarker = "(((getArray(('CfgLocalMarkerSets' call EPOCH_returnConfig) >> 'PlayerMarker' >> 'markerArray') select 0) select 0) in allMapMarkers)";
|
||||
|
||||
dyna_deathMarkerON = "(getNumber(('CfgEpochClient' call EPOCH_returnConfig) >> 'playerDeathMarkerGPSOnly') isEqualTo 1)";
|
||||
dyna_deathMarker = "profileNameSpace getVariable['EPOCHLastKnownDeath',[]]";
|
||||
dyna_deathMarkerAvail = "!(dyna_deathMarker isEqualTo [])";
|
||||
dyna_mapDeathMarker = "(((getArray(('CfgLocalMarkerSets' call EPOCH_returnConfig) >> 'DeathMarker' >> 'markerArray') select 0) select 0) in allMapMarkers)";
|
||||
};
|
||||
|
||||
class self
|
||||
|
@ -12,3 +12,32 @@
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_map.hpp
|
||||
*/
|
||||
|
||||
class playerMarker_on
|
||||
{
|
||||
condition = "dyna_mapPlayerMarkerON && 'ItemGPS' in dyna_assignedItems && !dyna_mapPlayerMarker";
|
||||
action = "['PlayerMarker',position player] call EPOCH_fnc_createLocalMarkerSet";
|
||||
icon = "x\addons\a3_epoch_community\buttons\gps.paa";
|
||||
tooltip = "Toggle ON player marker";
|
||||
};
|
||||
class playerMarker_off
|
||||
{
|
||||
condition = "dyna_mapPlayerMarkerON && dyna_mapPlayerMarker";
|
||||
action = "['PlayerMarker'] call EPOCH_fnc_deleteLocalMarkerSet";
|
||||
icon = "x\addons\a3_epoch_community\buttons\gps.paa";
|
||||
tooltip = "Toggle OFF player marker";
|
||||
};
|
||||
class deathMarker_on
|
||||
{
|
||||
condition = "dyna_deathMarkerON && dyna_deathMarkerAvail && !dyna_mapDeathMarker";
|
||||
action = "['DeathMarker',dyna_deathMarker] call EPOCH_fnc_createLocalMarkerSet";
|
||||
icon = "x\addons\a3_epoch_community\icons\skull.paa";
|
||||
tooltip = "Toggle ON death marker";
|
||||
};
|
||||
class deathMarker_off
|
||||
{
|
||||
condition = "dyna_deathMarkerON && dyna_mapDeathMarker";
|
||||
action = "{deleteMarkerLocal _x}forEach ['DeathMarker','DeathMarker1','DeathMarker2']";
|
||||
icon = "x\addons\a3_epoch_community\icons\skull.paa";
|
||||
tooltip = "Toggle OFF death marker";
|
||||
};
|
@ -164,6 +164,8 @@ class CfgClientFunctions
|
||||
class client_updatePlayerStat {};
|
||||
class fnc_getHitPointsDamageAverage {};
|
||||
class fnc_setVariableLimited {};
|
||||
class fnc_createLocalMarkerSet {};
|
||||
class fnc_deleteLocalMarkerSet {};
|
||||
};
|
||||
class environment
|
||||
{
|
||||
|
@ -176,6 +176,8 @@ class CfgEpochClient
|
||||
playerKilledScreen = "TapOut2";
|
||||
playerDisableRevenge = 0;
|
||||
playerRevengeMinAliveTime = 900;
|
||||
playerLocationMarkerGPSOnly = 1; // Map marker toggle in map dyna menu with assigned GPS only
|
||||
playerDeathMarkerGPSOnly = 1; // Map marker toggle in map dyna menu on death with assigned GPS only
|
||||
bankTransferTime[] = {0.0006,1.2,0.06};
|
||||
|
||||
// Favorite Bar
|
||||
|
28
Sources/epoch_config/Configs/CfgMarkerSets.hpp
Normal file
28
Sources/epoch_config/Configs/CfgMarkerSets.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
DirtySanchez
|
||||
|
||||
Local Markers are single instance and can only be seen by the player
|
||||
Use ['Name',position] call EPOCH_fnc_createLocalMarkerSet;
|
||||
|
||||
Global Markers are mostly for server use
|
||||
Use ['Name',position] call EPOCH_fnc_createGlobalMarkerSet;
|
||||
|
||||
*/
|
||||
class CfgLocalMarkerSets
|
||||
{
|
||||
brushes[] = {"Solid","SolidFull","Horizontal","Vertical","Grid","FDiagonal","BDiagonal","DiagGrid","Cross","Border","SolidBorder"};
|
||||
class PlayerMarker {
|
||||
markerArray[] = {
|
||||
{"PlayerMarker1","ICON","EpochGPS","ColorBlue",1,{0.8,0.8},0,"format['%1/%2',(format[mapGridPosition player]) select [0,3],(format[mapGridPosition player]) select [3,3]]"},
|
||||
{"PlayerMarker2","ICON","EpochActive_Hex","ColorBlue",1,{0.8,0.8}},
|
||||
{"PlayerMarker3","ICON","EpochBG_Hex","ColorWhite",0.3,{0.8,0.8}}
|
||||
};
|
||||
};
|
||||
class DeathMarker {
|
||||
markerArray[] = {
|
||||
{"DeathMarker1","ICON","EpochSkull","ColorRed",1,{0.8,0.8},0,"str(name player)"},
|
||||
{"DeathMarker2","ICON","EpochActive_Circle","ColorRed",1,{0.8,0.8}},
|
||||
{"DeathMarker3","ICON","EpochBG_Circle","ColorPink",0.3,{0.8,0.8}}
|
||||
};
|
||||
};
|
||||
};
|
@ -89,6 +89,7 @@ showHUD[] =
|
||||
#include "Configs\CfgVehicleUpgrades.hpp"
|
||||
#include "Configs\CfgReadingDocuments.hpp"
|
||||
#include "Configs\CfgDynamicSimulation.hpp"
|
||||
#include "Configs\CfgMarkerSets.hpp"
|
||||
|
||||
// A3 specific configs
|
||||
#include "Configs\CfgFunctions.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user