From a3a91d4f45b22fd487ecbc954ad979be5d03efdd Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:38:09 +0300 Subject: init --- Server/FSM/missions.fsm | 233 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 Server/FSM/missions.fsm (limited to 'Server/FSM/missions.fsm') diff --git a/Server/FSM/missions.fsm b/Server/FSM/missions.fsm new file mode 100644 index 0000000..ecc3b98 --- /dev/null +++ b/Server/FSM/missions.fsm @@ -0,0 +1,233 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,-74.017166,-296.043274,15.982856,-246.043442,0.000000,"Init"}; +item1[] = {"End",1,250,-198.827713,-59.197983,-108.827713,-9.198011,0.000000,"End"}; +item2[] = {"Update_Time",2,250,-73.728622,-145.167450,16.271379,-95.167450,0.000000,"Update Time"}; +item3[] = {"Loop",4,218,-74.092773,-224.973862,15.907227,-174.973846,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-197.991501,-144.482101,-107.991493,-94.482101,0.000000,"Gameover"}; +item5[] = {"Create",4,218,-73.431000,-64.188675,16.568987,-14.188683,1.000000,"Create"}; +item6[] = {"Assign_a_Mission",2,250,72.904373,-65.024872,162.904373,-15.024889,0.000000,"Assign a" \n "Mission"}; +item7[] = {"Skip",2,250,186.627869,-224.739502,276.627808,-174.739502,0.000000,"Skip"}; +item8[] = {"_",8,218,215.894943,-49.973213,248.197006,-28.404099,0.000000,""}; +link0[] = {0,3}; +link1[] = {2,3}; +link2[] = {2,4}; +link3[] = {2,5}; +link4[] = {3,2}; +link5[] = {4,1}; +link6[] = {5,6}; +link7[] = {6,8}; +link8[] = {7,3}; +link9[] = {8,7}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-348.696289,348.696289,188.145477,-327.791229,834,617,1}; +window[] = {0,-1,-1,-1,-1,762,25,1438,25,1,852}; +*//*%FSM*/ +class FSM +{ + fsmName = "missions"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_maxmissionswest = 'WFBE_MISSIONSMAXIMUM_WEST' Call GetNamespace;" \n + "_maxmissionseast = 'WFBE_MISSIONSMAXIMUM_EAST' Call GetNamespace;" \n + "_randomizer = 'WFBE_MISSIONSRANDOMIZER' Call GetNamespace;" \n + "_timeout = 'WFBE_MISSIONSTIMEOUT' Call GetNamespace;" \n + "_canReuseAfter = 'WFBE_MISSIONSREUSABILITY' Call GetNamespace;" \n + "_totalMissions = count('WFBE_M_CONTENT' Call GetNamespace) - 1;" \n + "" \n + "_lastUpdate = 0;" \n + "_lastMissionAssignedTime = -6000;" \n + "_lastMissionsIndex = [];" \n + "['_WFBE_M_RUNNINGMISSIONS_WEST',0,true] Call SetNamespace;" \n + "['_WFBE_M_RUNNINGMISSIONS_EAST',0,true] Call SetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!gameOver && time - _lastUpdate > 30"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Time + { + name = "Update_Time"; + init = /*%FSM*/"_lastUpdate = time;" \n + "" \n + "_runningMissionsWest = '_WFBE_M_RUNNINGMISSIONS_WEST' Call GetNamespace;" \n + "_runningMissionsEast = '_WFBE_M_RUNNINGMISSIONS_EAST' Call GetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Create + { + priority = 1.000000; + to="Assign_a_Mission"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!gameOver && time - _lastMissionAssignedTime >= _timeout && (_runningMissionsWest < _maxmissionswest || _runningMissionsEast < _maxmissionseast)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!gameOver && time - _lastUpdate > 30"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Assign_a_Mission + { + name = "Assign_a_Mission"; + init = /*%FSM*/"//--- Retrieve an updated version of the missions array." \n + "_missions = 'WFBE_M_CONTENT' Call GetNamespace;" \n + "_missionAssigned = false;" \n + "" \n + "//--- Retrieve a 'free' mission." \n + "_i = -1;" \n + "while {_i < 0} do {" \n + " _r = round (random _totalMissions);" \n + " if !(_r in _lastMissionsIndex) then {_i = _r};" \n + "};" \n + "" \n + "//--- Retrieve the current mission content." \n + "_mission = (_missions select _i);" \n + "" \n + "//--- Can we run it?" \n + "_go = false;" \n + "if ((_mission select 5) == civilian) then {if (_runningMissionsWest < _maxmissionswest && _runningMissionsEast < _maxmissionseast) then {_go = true}};" \n + "if ((_mission select 5) == west) then {if (_runningMissionsWest < _maxmissionswest) then {_go = true}};" \n + "if ((_mission select 5) == east) then {if (_runningMissionsEast < _maxmissionseast) then {_go = true}};" \n + "" \n + "if (_go) then {" \n + " _islandHeader = (_mission select 0) select 0;" \n + " //--- All" \n + " if (_islandHeader == '*') then {" \n + " _go = true;" \n + " } else {" \n + " if (_islandHeader == '!') then {" \n + " //--- If island not in." \n + " if !(worldName in (_mission select 0)) then {_go = true};" \n + " } else {" \n + " //--- If island in." \n + " if (worldName in (_mission select 0)) then {_go = true};" \n + " };" \n + " };" \n + "};" \n + "" \n + "//--- Go?" \n + "if (_go) then {" \n + " //--- Check for the mission condition (Compile it)." \n + " if (Call Compile (_mission select 4)) then {" \n + " [_mission select 2,_mission select 3,_mission select 5] ExecVM (_mission select 1);" \n + "" \n + " //--- Randomize the next mission delay." \n + " _lastMissionAssignedTime = (time)+random(_randomizer)-random(_randomizer);" \n + "" \n + " //--- Select the mission type (both, west ,east)" \n + " switch (_mission select 5) do {" \n + " case civilian: {['_WFBE_M_RUNNINGMISSIONS_WEST',_runningMissionsWest + 1, true] Call SetNamespace;['_WFBE_M_RUNNINGMISSIONS_EAST',_runningMissionsEast + 1, true] Call SetNamespace};" \n + " case west: {['_WFBE_M_RUNNINGMISSIONS_WEST',_runningMissionsWest + 1, true] Call SetNamespace};" \n + " case east: {['_WFBE_M_RUNNINGMISSIONS_EAST',_runningMissionsEast + 1, true] Call SetNamespace};" \n + " };" \n + " " \n + " //--- Increment Mission index (it will apply to the getter, no need to set again)." \n + " _mission set [3,(_mission select 3) + 1];" \n + "" \n + " //--- Push (i.e limit 4, [1,2,3,4] add 5 >> [5,1,2,3])." \n + " for [{_z = (count _lastMissionsIndex)},{_z > 0},{_z = _z - 1}] do {" \n + " _lastMissionsIndex set [_z, (_lastMissionsIndex select (_z - 1))];" \n + " };" \n + " " \n + " //--- Resize if we're above the limit." \n + " _lastMissionsIndex set [0, _i];" \n + " if (count _lastMissionsIndex >= _canReuseAfter) then {" \n + " _lastMissionsIndex resize (_canReuseAfter - 1);" \n + " };" \n + " };" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Skip"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Skip + { + name = "Skip"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!gameOver && time - _lastUpdate > 30"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file -- cgit v1.3.1