Skip to content

Commit

Permalink
Merge pull request #57 from ARCOMM/2.0-dev
Browse files Browse the repository at this point in the history
Revamp scheduled code, fix bugs and tidy code
  • Loading branch information
James Kingsley authored Jun 10, 2016
2 parents c74f573 + 6256e4b commit 554c008
Show file tree
Hide file tree
Showing 48 changed files with 684 additions and 941 deletions.
60 changes: 17 additions & 43 deletions ARCMF.VR/briefing.sqf
Original file line number Diff line number Diff line change
@@ -1,55 +1,29 @@
if (!isDedicated && (isNull player)) then {
waitUntil {sleep 0.1; !isNull player};
};
[{isDedicated || !isNull player}, {
private _unitfaction = toLower (faction player);

private ["_unitfaction"];
waitUntil {!isNil "f_var_debugMode"};

_unitfaction = toLower (faction player);

if (_unitfaction != toLower (faction (leader group player))) then {
_unitfaction = toLower (faction (leader group player));
};

if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Player faction: %1", _unitfaction];
};
if (_unitfaction != toLower (faction (leader group player))) then {
_unitfaction = toLower (faction (leader group player));
};

#include "f\briefing\f_briefing_arcmf.sqf"
#include "f\briefing\f_briefing_arcmf.sqf"

if (serverCommandAvailable "#kick" || isServer) then {
#include "f\briefing\f_briefing_admin.sqf"
if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Briefing for host selected.", _unitfaction];
if (serverCommandAvailable "#kick" || isServer) then {
#include "f\briefing\f_briefing_admin.sqf"
};
};

if (_unitfaction == "blu_f") exitWith {
#include "f\briefing\f_briefing_blufor.sqf"
if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Briefing for %1 slot selected.", _unitfaction];
if (_unitfaction == "blu_f") exitWith {
#include "f\briefing\f_briefing_blufor.sqf"
};
};

if (_unitfaction == "opf_f") exitWith {
#include "f\briefing\f_briefing_opfor.sqf"
if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Briefing for %1 slot selected.", _unitfaction];
if (_unitfaction == "opf_f") exitWith {
#include "f\briefing\f_briefing_opfor.sqf"
};
};

if (_unitfaction == "ind_f") exitWith {
#include "f\briefing\f_briefing_indfor.sqf"
if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Briefing for %1 slot selected.", _unitfaction];
if (_unitfaction == "ind_f") exitWith {
#include "f\briefing\f_briefing_indfor.sqf"
};
};

if (_unitfaction == "civ_f") exitWith {
#include "f\briefing\f_briefing_civ.sqf"
if (f_var_debugMode == 1) then {
player sideChat format ["DEBUG (briefing.sqf): Briefing for %1 slot selected.", _unitfaction];
if (_unitfaction == "civ_f") exitWith {
#include "f\briefing\f_briefing_civ.sqf"
};
};

player globalchat format ["DEBUG (briefing.sqf): Faction %1 is not defined.", _unitfaction];
}, []] call CBA_fnc_waitUntilAndExecute;
21 changes: 1 addition & 20 deletions ARCMF.VR/description.ext
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "f\arc\macros.hpp"

class Header {
gameType = Coop;
minPlayers = 1;
Expand All @@ -10,7 +8,6 @@ class Header {
onLoadName = "ARCMF";
onLoadMission = "ARCOMM Mission Framework.";
author = "Kingsley, tryteyker, Nelson";
overviewPicture = "splash.paa";
loadScreen = "splash.paa";
enableDebugConsole = 1;
disabledAI = 1;
Expand All @@ -36,13 +33,7 @@ class Params {
values[] = {0,1,2,3,4,5,6,7,8,9,10,15,30};
texts[] = {"Off","1","2","3","4","5","6","7","8","9","10","15","30"};
default = 30;
code = "f_param_mission_timer = %1 * 60";
};
class f_param_caching {
title = "Cache AI outside distance (m)";
values[] = {0,600,800,1000,1500,2000,2500,3000,3500,4000,4500,5000};
default = 0;
code = "f_param_caching = %1";
code = "f_var_mission_timer = %1 * 60";
};
class arc_param_duplex {
title = "ACRE Duplex Option";
Expand Down Expand Up @@ -131,7 +122,6 @@ class CfgFunctions {
class F {
class common {
file = "f\common";
class nearPlayer {};
class processParamsArray {
preInit = 1;
postInit = 1;
Expand All @@ -142,13 +132,6 @@ class CfgFunctions {
class mpEnd {};
class mpEndReceiver {};
};
class cache {
file = "f\cache";
class cInit {};
class cTracker {};
class gCache {};
class gUncache {};
};
class assignGear {
file = "f\assignGear";
class assignGear {};
Expand All @@ -160,8 +143,6 @@ class CfgFunctions {
class FTMemberMarkers {
file = "f\FTMemberMarkers";
class SetLocalFTMemberMarkers {};
class GetMarkerColor {};
class LocalFTMarkerSync {};
class GetMarker {};
};
class safeStart {
Expand Down
38 changes: 0 additions & 38 deletions ARCMF.VR/f/FTMemberMarkers/f_localFTMemberMarker.sqf

This file was deleted.

17 changes: 9 additions & 8 deletions ARCMF.VR/f/FTMemberMarkers/fn_GetMarker.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
private "_unit";
_unit = _this;
params [["_unit", objNull, [objNull]]];

if (getNumber(configFile >> "CfgVehicles" >> typeOf(_unit) >> "attendant") == 1) exitWith {"ST_STHudM_Medic";};
if (getNumber(configFile >> "CfgVehicles" >> typeOf(_unit) >> "engineer") == 1) exitWith {"ST_STHudM_Engineer";};
if (leader(_unit) == _unit) exitWith {"ST_STHudM_Leader";};
if (getText(configFile >> "CfgWeapons" >> primaryWeapon(_unit) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_mg_ca.paa") exitWith {"ST_STHudM_MG";};
if (getText(configFile >> "CfgWeapons" >> secondaryWeapon(_unit) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_at_ca.paa") exitWith {"ST_STHudM_AT";};
if (isNull _unit) exitWith {""};

"ST_STHudM_Rifleman";
if (leader _unit == _unit) exitWith {"ST_STHudM_Leader"};
if (getText (configFile >> "CfgWeapons" >> secondaryWeapon _unit >> "UIPicture") == "\a3\weapons_f\data\ui\icon_at_ca.paa") exitWith {"ST_STHudM_AT"};
if (getText (configFile >> "CfgWeapons" >> primaryWeapon _unit >> "UIPicture") == "\a3\weapons_f\data\ui\icon_mg_ca.paa") exitWith {"ST_STHudM_MG"};
if (getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant") == 1) exitWith {"ST_STHudM_Medic"};
if (getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1) exitWith {"ST_STHudM_Engineer"};

"ST_STHudM_Rifleman"
11 changes: 0 additions & 11 deletions ARCMF.VR/f/FTMemberMarkers/fn_GetMarkerColor.sqf

This file was deleted.

26 changes: 0 additions & 26 deletions ARCMF.VR/f/FTMemberMarkers/fn_LocalFTMarkerSync.sqf

This file was deleted.

61 changes: 38 additions & 23 deletions ARCMF.VR/f/FTMemberMarkers/fn_SetLocalFTMemberMarkers.sqf
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
if (!isDedicated && (isNull player)) then {
waitUntil {sleep 0.1; !isNull player};
};
[{isDedicated || !isNull player}, {
[{
{
private _unit = _x;
private _markerName = format ["ARC_unitMarker_%1", _unit];

f_fnc_SetTeamValue = {
_unit = _this select 0;
_color = _this select 1;
_unit setVariable ["assignedTeam", _color];
};
if (alive _unit) then {
private _markerColor = ["ColorWhite","ColorRed","ColorGreen","ColorBlue","ColorYellow"] select (["MAIN","RED","GREEN","BLUE","YELLOW"] find assignedTeam _unit) max 0;
private _markerIcon = [_unit] call f_fnc_GetMarker;
private _markerPos = getPosATL _unit;
private _markerAlpha = linearConversion [
0,
getNumber (missionConfigFile >> "CfgARCMF" >> "markers" >> (side (group _unit) call ARC_fnc_getFactionFromSide) >> "fireteamMemberFadeDistance"),
(_unit distance player),
1,
0,
true
];

[] spawn {
f_var_HandlerGroup = [];
while {!isNull player} do {
{
if (!(_x in f_var_HandlerGroup) && alive _x) then {
[_x] execVM "f\FTMemberMarkers\f_localFTMemberMarker.sqf";
f_var_HandlerGroup pushBack _x;
if (_markerName in allMapMarkers) then {
// Marker already exists
_markerName setMarkerPosLocal _markerPos;
_markerName setMarkerTypeLocal _markerIcon;
_markerName setMarkerColorLocal _markerColor;
_markerName setMarkerDirLocal (direction _unit);
_markerName setMarkerAlphaLocal _markerAlpha;
} else {
// Marker doesn't exist
_markerName = createMarkerLocal [_markerName, _markerPos];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerTypeLocal _markerIcon;
_markerName setMarkerColorLocal _markerColor;
_markerName setMarkerSizeLocal [0.8, 0.8];
_markerName setMarkerDirLocal (direction _unit);
_markerName setMarkerAlphaLocal _markerAlpha;
};
} else {
deleteMarkerLocal _markerName;
};
false
} count units (group player);
sleep 5;
};
};

if (player == leader (group player)) then {
[group player, player] spawn f_fnc_LocalFTMarkerSync;
};
}, 0.1, []] call CBA_fnc_addPerFrameHandler;
}, []] call CBA_fnc_waitUntilAndExecute;
Loading

0 comments on commit 554c008

Please sign in to comment.