use new custom var to track mission state

EPOCH_playerMissionArray
This commit is contained in:
vbawol 2016-06-16 16:53:59 -05:00
parent 7218acaf5a
commit 69e38997ae
8 changed files with 43 additions and 41 deletions

View File

@ -66,13 +66,13 @@ class FSM
"" \n
"//Mission Control - WIP. TODO: Move to serverside mission control UINamespace not secure." \n
"//uiNameSpace setVariable [""axeTask"",_taskName];" \n
"_plyrVar = player getVariable [""SERVER_VARS"",[]];" \n
"_plyrVar = missionNamespace getVariable [""EPOCH_playerMissionArray"",[]];" \n
"_taskIndex = ((_plyrVar apply {_x find ""axeTask"" > -1;}) find true);" \n
"if(_taskIndex > -1)then{" \n
"_plyrVar deleteAt _taskIndex;" \n
"};" \n
"_plyrVar pushBack [""axeTask"",_taskName];" \n
"player setVariable [""SERVER_VARS"",_plyrVar,true];" \n
"missionNamespace setVariable [""EPOCH_playerMissionArray"",_plyrVar];" \n
"" \n
"missionNameSpace setVariable [""axeTask"",_taskName];" \n
"" \n
@ -268,12 +268,12 @@ class FSM
itemno = 6;
init = "//uiNameSpace setVariable [""axeTask"",nil];" \n
"if!(_doBin)then{" \n
"_plyrVar = player getVariable [""SERVER_VARS"",[]];" \n
"_plyrVar = missionNamespace getVariable [""EPOCH_playerMissionArray"",[]];" \n
"_taskIndex = ((_plyrVar apply {_x find ""axeTask"" > -1;}) find true);" \n
"if(_taskIndex > -1)then{" \n
"_plyrVar deleteAt _taskIndex;" \n
"};" \n
"player setVariable [""SERVER_VARS"",_plyrVar,true];" \n
"missionNamespace setVariable [""EPOCH_playerMissionArray"",_plyrVar];" \n
"};" \n
"if(count _missionCleanUp > 0)then{" \n
"{" \n

View File

@ -18,7 +18,7 @@ _hours = floor(servertime/60/60);
_customVars = "";
{
_val = missionNamespace getVariable [format ["EPOCH_player%1",_x],EPOCH_defaultVars select _forEachIndex];
if !(_x in ["AliveTime","SpawnArray","HitPoints"]) then {
if !(_x in ["AliveTime","SpawnArray","HitPoints","MissionArray"]) then {
if (_x == "Temp") then {
_customVars = _customVars + format["<t size='1.15' font='puristaLight' align='left'>%1: </t><t size='1.15' font='puristaLight' align='right'>%2°F | %3°C</t><br/>", _x,_val,_val call EPOCH_convertTemp];
} else {

View File

@ -32,16 +32,16 @@ _menuCondition = getText(getMissionConfig "epochMissions" >> (_missionClasses se
if!(_menuCondition=="")then{
if(call compile _menuCondition)then{_missionAllowed = false;};
};
if(_missionAllowed)then{
_selectedMission = _missionClasses select _missionIndex;
_missionTasks = getArray(getMissionConfig "epochMissions" >> _selectedMission >> "tasksList");
_simpleTask = getNumber (getMissionConfig "inGameTasks" >> (_missionTasks select 0) >> "simpleTask");
//systemChat format ["Simple Task: %1 | Mission: %2 from %3",_simpleTask,_selectedMission,_missionTasks];
if(_simpleTask > 0)then{//Simple Task
_simpleTaskFSM = getText (getMissionConfig "inGameTasks" >> (_missionTasks select 0) >> "initfsm");
@ -53,42 +53,42 @@ _menuCondition = getText(getMissionConfig "epochMissions" >> (_missionClasses se
_path = getText (getMissionConfig "inGameTasks" >> "file");
_taskNS = _tag + "_" + ((_simpleTaskSQF splitString ".") select 0);
_fnc_path = _path + "\" +_simpleTaskSQF;
if!((typeName _taskNS)=="CODE")then{
_itemCompile = compileFinal preprocessFileLineNumbers _fnc_path;
missionNamespace setvariable [_taskNS,_itemCompile];
}else{
_itemCompile = missionNamespace getVariable ["_taskNS",""];
};
//Emulating CfgClientFunctions - Is this required ?
[] call _itemCompile;
};
if!(_simpleTaskFSM == "")then{
_simpleTaskFSM = _path + "\" + _simpleTaskFSM;
epochSimpleTaskHandle = [] execFSM _simpleTaskFSM;
};
if!(_simpleTaskFNC == "")then{
call compile _simpleTaskFNC;
};
}else{//Run Task / Mission Monitor
_doTask = (_missionTasks select 0);
_allowTask = true;
//_uiNSTask = uiNameSpace getVariable ["axeTask",""];//TODO: Use hive to store this via dynamic vars. Or server mission control server_vars
_plyrVar = player getVariable ["SERVER_VARS",[]] select {_x find "axeTask" > -1;};
_plyrVar = missionNamespace getVariable ["EPOCH_playerMissionArray",[]] select {_x find "axeTask" > -1;};
_uiNSTask = "";
if(count _plyrVar > 0)then{
_uiNSTask = _plyrVar select 0 select 1;
};
_miNSTask = missionNameSpace getVariable ["axeTask",""];
//Allow continuation of mission from Cached Task
if!(_uiNSTask == "")then{
if!(_uiNSTask == "")then{
if(_miNSTask == "")then{
_doTask = _uiNSTask;
}else{
@ -96,7 +96,7 @@ _menuCondition = getText(getMissionConfig "epochMissions" >> (_missionClasses se
[format ["<t size='1.6' color='#99ffffff'>Already on a mission - %1</t>",selectRandom ['Chop Chop !','Get on With It !','What are you waiting for ?','No bonuses for tardiness !']], 5] call Epoch_dynamicText;
};
};
if(_allowTask)then{
epochTaskHandle = [_doTask] execFSM "epoch_code\System\task_control.fsm"
};
@ -104,7 +104,7 @@ _menuCondition = getText(getMissionConfig "epochMissions" >> (_missionClasses se
};
}else{
[format["<t size='1.6' color='#99ffffff'>Mission Not Allowed !</t>",_menuCondition], 5] call Epoch_dynamicText;
};

View File

@ -1,2 +1,2 @@
player setVariable ["SERVER_VARS",[],true];
[format ["<t size='1.6' color='#99ffffff'>%1</t>","Missions Reset - Re-open Trader Menu."], 5] call Epoch_dynamicText;
missionNamespace setVariable ["EPOCH_playerMissionArray",[]];
[format ["<t size='1.6' color='#99ffffff'>%1</t>","Missions Reset - Re-open Trader Menu."], 5] call Epoch_dynamicText;

View File

@ -15,39 +15,39 @@
private ["_lbl","_missionClasses","_missionName","_menuCondition","_toolTip","_plyrVar","_uiNSTask"];
params [["_currentTask",""]];
_missionClasses = getArray(getMissionConfig "EpochMissionList" >> "traderMissionClasses");
_plyrVar = player getVariable ["SERVER_VARS",[]] select {_x find "axeTask" > -1;};
_plyrVar = missionNamespace getVariable ["EPOCH_playerMissionArray",[]] select {_x find "axeTask" > -1;};
_uiNSTask = "";
if(count _plyrVar > 0)then{
_uiNSTask = _plyrVar select 0 select 1;
};
{
_missionName = getText(getMissionConfig "epochMissions" >> _x >> "missionName");
if!(_missionName == "")then{
_lbl = lbAdd[1500, _missionName];
lbSetValue[1500, _lbl, _forEachIndex];
_toolTip = getText(getMissionConfig "epochMissions" >> _x >> "missionToolTip");
_toolTip = getText(getMissionConfig "epochMissions" >> _x >> "missionToolTip");
_menuCondition = getText(getMissionConfig "epochMissions" >> _x >> "missionDeny");
if!(_menuCondition=="")then{
if(call compile _menuCondition)then{
lbSetColor [1500, _lbl, [0.73,0.24,0.11,1] ] ;
_toolTip = getText(getMissionConfig "epochMissions" >> _x >> "missionDenyToolTip");
_toolTip = getText(getMissionConfig "epochMissions" >> _x >> "missionDenyToolTip");
};
};
if(_uiNSTask in getArray(getMissionConfig "epochMissions" >> _x >> "tasksList"))then{
lbSetColor [1500, _lbl, [0.98,0.98,0.33,1]] ;
_toolTip = "CONTINUE - " + _toolTip;
};
lbSetTooltip [1500, _lbl, _toolTip];
};
}forEach _missionClasses;

View File

@ -42,7 +42,8 @@ EPOCH_customVarsDefaults = [
["Karma",0,[50000,-50000]],
["Alcohol",0,[100,0]],
["Radiation",0,[100,0]],
["Nuisance",0,[100,0]]
["Nuisance",0,[100,0]],
["MissionArray",[],[]]
];
_customVarsInit = ["CfgEpochClient", "customVarsDefaults", EPOCH_customVarsDefaults] call EPOCH_fnc_returnConfigEntryV2;
{

View File

@ -53,7 +53,8 @@ class CfgEpochClient
{"Karma",0,{50000,-50000}},
{"Alcohol",0,{100,0}},
{"Radiation",0,{100,0}},
{"Nuisance",0,{100,0}}
{"Nuisance",0,{100,0}},
{"MissionArray",{},{}}
};
// controls max group limit and cost
group_upgrade_lvl[] = {4,"100",6,"300",8,"500",10,"1000",12,"1500",13,"1750",14,"2000",15,"3000",16,"5000"};

View File

@ -62,7 +62,7 @@ Fridge_EPOCH = [[[0,0,1.1],[0,0,-0.1]],[[0,0,1.1],[0,0,2.1]],[[0,0,1.1],[0.5,0,1
Shelf_EPOCH = [[[0,0,1],[0,0,-0.1]],[[0,0,1],[0,0,1.8]],[[0,0,1],[0.5,0,1]],[[0,0,1],[-0.5,0,1]],[[0,0,1],[0,0.2,1]],[[0,0,1],[0,-0.6,1]]];
Couch_EPOCH = [[[0,0,0.4],[0,0,-0.1]],[[0,0,0.4],[0,0,1.2]],[[0,0,0.4],[1.3,0,0.4]],[[0,0,0.4],[-0.3,0,0.4]],[[0,0,0.4],[0,1.4,0.4]],[[0,0,0.4],[0,-1.4,0.4]]];
wardrobe_epoch = [[[0,0,1.3],[0,0,-0.1]],[[0,0,1.3],[0,0,2.3]],[[0,0,1.3],[0.7,0,1.3]],[[0,0,1.3],[-0.7,0,1.3]],[[0,0,1.3],[0,0.4,1.3]],[[0,0,1.3],[0,-0.6,1.3]]];
cooker_epoch = [[[0,0,0],[0,0,-0.7]],[[0,0,0],[0,0,0.7]],[[0,0,0],[0.4,0,0]],[[0,0,0],[-0.4,0,0]],[[0,0,0],[0,0.5,0]],[[0,0,0],[0,-0.7,0]]];
cooker_epoch = [[[0,0,0],[0,0,-0.1]],[[0,0,0],[0,0,0.7]],[[0,0,0],[0.4,0,0]],[[0,0,0],[-0.4,0,0]],[[0,0,0],[0,0.5,0]],[[0,0,0],[0,-0.7,0]]];
Chair_EPOCH = [[[0,0,0.5],[0,0,-0.1]],[[0,0,0.5],[0,0,1.5]],[[0,0,0.6],[0.6,0,0.6]],[[0,0,0.6],[-0.6,0,0.6]],[[0,0,0.6],[0,0.6,0.6]],[[0,0,0.5],[0,-0.6,0.5]]];
Filing_epoch = [[[0,0,0.8],[0,0,-0.1]],[[0,0,0.8],[0,0,1.6]],[[0,0,0.8],[0.3,0,0.8]],[[0,0,0.8],[-0.3,0,0.8]],[[0,0,0.8],[0,0.4,0.8]],[[0,0,0.8],[0,-0.5,0.8]]];
Pelican_EPOCH = [[[0,0,0.2],[0,0,-0.1]],[[0,0,0.2],[0,0,0.7]],[[0,0,0.2],[0.9,0,0.2]],[[0,0,0.2],[-0.9,0,0.2]],[[0,0,0.2],[0,0.6,0.2]],[[0,0,0.2],[0,-0.4,0.2]]];
@ -71,7 +71,7 @@ Locker_EPOCH = [[[0,0,1.1],[0,0,-0.1]],[[0,0,1.1],[0,0,2.1]],[[0,0,1.1],[1,0,1.1
ToolRack_EPOCH = [[[0,0,1.5],[0,0,-0.1]],[[0,0,1.5],[0,0,2.3]],[[0,0,1.5],[1,0,1.5]],[[0,0,1.5],[-0.9,0,1.5]],[[0,0,1.5],[0,0.05,1.5]],[[0,0,1.5],[0,-0.4,1.5]]];
Shoebox_EPOCH = [[[0,0,0.1],[0,0,-0.1]],[[0,0,0.1],[0,0,0.3]],[[0,0,0.1],[0.3,0,0.1]],[[0,0,0.1],[-0.3,0,0.1]],[[0,0,0.1],[0,0.2,0.1]],[[0,0,0.1],[0,-0.2,0.1]]];
Tarp_EPOCH = [[[0,0,0.2],[0,0,-0.1]],[[0,0,0.2],[0,0,1]],[[0,0,0.2],[0.9,0,0.2]],[[0,0,0.2],[-0.9,0,0.2]],[[0,0,0.2],[0,1,0.2]],[[0,0,0.2],[0,-0.9,0.2]]];
Freezer_EPOCH = [[[0,0,0.5],[0,0,-0.2]],[[0,0,0.5],[0,0,1.1]],[[0,0,0.5],[0.7,0,0.5]],[[0,0,0.5],[-0.7,0,0.5]],[[0,0,0.5],[0,0.5,0.5]],[[0,0,0.5],[0,-0.6,0.5]]];
Freezer_EPOCH = [[[0,0,0.5],[0,0,-0.1]],[[0,0,0.5],[0,0,1.1]],[[0,0,0.5],[0.7,0,0.5]],[[0,0,0.5],[-0.7,0,0.5]],[[0,0,0.5],[0,0.5,0.5]],[[0,0,0.5],[0,-0.6,0.5]]];
Cabinet_EPOCH = [[[0,0,0],[0,0,-0.4]],[[0,0,0],[0,0,0.4]],[[0,0,0],[0.2,0,0]],[[0,0,0],[-0.1,0,0]],[[0,0,0],[0,0.3,0]],[[0,0,0],[0,-0.3,0]]];
EPOCH_lootClassesRaw = [
@ -663,7 +663,7 @@ KK_boundingBox = {
DUMMY = "Sign_Arrow_Direction_F" createVehicle getpos player;
_blocked = false;
_target = player;
if (!isnull(EP_building)) then {
_target = EP_building;
@ -671,7 +671,7 @@ KK_boundingBox = {
_worldPos = player modelToWorld[0, EP_distance, 0];
_worldPos set [2,Base_Z_height];
if (_worldPos distance player > 10) then {
_blocked = true;
};
@ -681,7 +681,7 @@ KK_boundingBox = {
_finalVectorDir = [vectorDir _target, Base_angle] call BIS_fnc_returnVector;
DUMMY setVelocityTransformation [getPosASL DUMMY,_worldPos,velocity DUMMY,velocity DUMMY,vectorDir DUMMY,_finalVectorDir,vectorUp DUMMY,vectorUp player,1];
_targetType = typeof EPOCH_vehTarget;
{
_x params ["_startV","_stopV"];
@ -718,7 +718,7 @@ KK_boundingBox = {
];
} forEach (missionNamespace getVariable [_targetType,[]]);
if (_blocked) then {
_worldPos = getPosASL EPOCH_vehTarget;
};