From 69e38997aeaf4846fc24a6618e978df5708d9c0e Mon Sep 17 00:00:00 2001 From: vbawol Date: Thu, 16 Jun 2016 16:53:59 -0500 Subject: [PATCH] use new custom var to track mission state EPOCH_playerMissionArray --- Sources/epoch_code/System/task_control.fsm | 8 +++--- .../epoch_code/compile/EPOCH_debugMonitor.sqf | 2 +- .../compile/missions/EPOCH_mission_accept.sqf | 28 +++++++++---------- .../tasks/traderDebug_resetMissions.sqf | 4 +-- .../missions/EPOCH_mission_refresh.sqf | 24 ++++++++-------- Sources/epoch_code/init/both_init.sqf | 3 +- .../epoch_config/Configs/CfgEpochClient.hpp | 3 +- Tools/SQF/saveLootPositionsVector.sqf | 12 ++++---- 8 files changed, 43 insertions(+), 41 deletions(-) diff --git a/Sources/epoch_code/System/task_control.fsm b/Sources/epoch_code/System/task_control.fsm index 8157af0b..6608e305 100644 --- a/Sources/epoch_code/System/task_control.fsm +++ b/Sources/epoch_code/System/task_control.fsm @@ -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 diff --git a/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf b/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf index b54cc107..dd7b9430 100644 --- a/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf +++ b/Sources/epoch_code/compile/EPOCH_debugMonitor.sqf @@ -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["%1: %2°F | %3°C
", _x,_val,_val call EPOCH_convertTemp]; } else { diff --git a/Sources/epoch_code/compile/missions/EPOCH_mission_accept.sqf b/Sources/epoch_code/compile/missions/EPOCH_mission_accept.sqf index 478b385a..a0391ab4 100644 --- a/Sources/epoch_code/compile/missions/EPOCH_mission_accept.sqf +++ b/Sources/epoch_code/compile/missions/EPOCH_mission_accept.sqf @@ -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 ["Already on a mission - %1",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["Mission Not Allowed !",_menuCondition], 5] call Epoch_dynamicText; }; diff --git a/Sources/epoch_code/compile/missions/tasks/traderDebug_resetMissions.sqf b/Sources/epoch_code/compile/missions/tasks/traderDebug_resetMissions.sqf index 7d5025e9..7079dc55 100644 --- a/Sources/epoch_code/compile/missions/tasks/traderDebug_resetMissions.sqf +++ b/Sources/epoch_code/compile/missions/tasks/traderDebug_resetMissions.sqf @@ -1,2 +1,2 @@ -player setVariable ["SERVER_VARS",[],true]; -[format ["%1","Missions Reset - Re-open Trader Menu."], 5] call Epoch_dynamicText; \ No newline at end of file +missionNamespace setVariable ["EPOCH_playerMissionArray",[]]; +[format ["%1","Missions Reset - Re-open Trader Menu."], 5] call Epoch_dynamicText; diff --git a/Sources/epoch_code/gui/scripts/missions/EPOCH_mission_refresh.sqf b/Sources/epoch_code/gui/scripts/missions/EPOCH_mission_refresh.sqf index 3a19cb31..34abe7f5 100644 --- a/Sources/epoch_code/gui/scripts/missions/EPOCH_mission_refresh.sqf +++ b/Sources/epoch_code/gui/scripts/missions/EPOCH_mission_refresh.sqf @@ -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; diff --git a/Sources/epoch_code/init/both_init.sqf b/Sources/epoch_code/init/both_init.sqf index 3e2c82f2..4c895848 100644 --- a/Sources/epoch_code/init/both_init.sqf +++ b/Sources/epoch_code/init/both_init.sqf @@ -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; { diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 94a0a2fd..2bb28a1f 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -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"}; diff --git a/Tools/SQF/saveLootPositionsVector.sqf b/Tools/SQF/saveLootPositionsVector.sqf index 1a255a3c..0947203e 100644 --- a/Tools/SQF/saveLootPositionsVector.sqf +++ b/Tools/SQF/saveLootPositionsVector.sqf @@ -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; };