From 628d33984d9228f1781d13a65fbb80f35facc899 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:24 +0300 Subject: init --- Client/FSM/conquest_helper.fsm | 148 +++++++++++++++++++ Client/FSM/fasttimecli.fsm | 171 ++++++++++++++++++++++ Client/FSM/overcast.fsm | 177 ++++++++++++++++++++++ Client/FSM/resources_cli.fsm | 111 ++++++++++++++ Client/FSM/updateactions.fsm | 138 +++++++++++++++++ Client/FSM/updateavailableactions.fsm | 268 ++++++++++++++++++++++++++++++++++ Client/FSM/updatecapture.fsm | 262 +++++++++++++++++++++++++++++++++ Client/FSM/updateclient.fsm | 175 ++++++++++++++++++++++ Client/FSM/updatesalvage.fsm | 165 +++++++++++++++++++++ Client/FSM/updatesupply.fsm | 213 +++++++++++++++++++++++++++ Client/FSM/updateteamsmarkers.fsm | 125 ++++++++++++++++ Client/FSM/updatetownmarkers.fsm | 112 ++++++++++++++ 12 files changed, 2065 insertions(+) create mode 100644 Client/FSM/conquest_helper.fsm create mode 100644 Client/FSM/fasttimecli.fsm create mode 100644 Client/FSM/overcast.fsm create mode 100644 Client/FSM/resources_cli.fsm create mode 100644 Client/FSM/updateactions.fsm create mode 100644 Client/FSM/updateavailableactions.fsm create mode 100644 Client/FSM/updatecapture.fsm create mode 100644 Client/FSM/updateclient.fsm create mode 100644 Client/FSM/updatesalvage.fsm create mode 100644 Client/FSM/updatesupply.fsm create mode 100644 Client/FSM/updateteamsmarkers.fsm create mode 100644 Client/FSM/updatetownmarkers.fsm (limited to 'Client/FSM') diff --git a/Client/FSM/conquest_helper.fsm b/Client/FSM/conquest_helper.fsm new file mode 100644 index 0000000..fab822e --- /dev/null +++ b/Client/FSM/conquest_helper.fsm @@ -0,0 +1,148 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,53.240814,-221.988968,143.240845,-171.989166,0.000000,"Init"}; +item1[] = {"End",1,250,-216.387955,-52.508366,-126.387947,-2.508394,0.000000,"End"}; +item2[] = {"Update_Conquest",2,250,-82.090652,-139.314026,7.909359,-89.314034,0.000000,"Update" \n "Conquest"}; +item3[] = {"Loop",4,218,53.846153,-139.681244,143.846161,-89.681236,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.387955,-139.464890,-126.387947,-89.464890,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {2,3}; +link2[] = {2,4}; +link3[] = {3,2}; +link4[] = {4,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,8,6316128,1,-348.696411,348.696136,79.849762,-328.514618,921,592,1}; +window[] = {0,-1,-1,-1,-1,837,100,1513,100,1,939}; +*//*%FSM*/ +class FSM +{ + fsmName = "conquest_helper"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_ntime = 0;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Conquest"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time > _ntime"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Conquest + { + name = "Update_Conquest"; + init = /*%FSM*/"_t = [];" \n + "" \n + "{" \n + " if ((_x getVariable 'sideID') == sideID) then {_t = _t + [_x]};" \n + "} forEach towns;" \n + "" \n + "_set = [];" \n + "" \n + "if (count _t > 0) then {" \n + " {" \n + " _neighbors = _x getVariable ""neighbors"";" \n + " " \n + " if !(isNil ""_neighbors"") then {" \n + " {" \n + " if ((_x getVariable 'sideID') != sideID) then {" \n + " if (isNil {_x getVariable ""wfbe_marker""}) then {" \n + " _marker = Format [""wfbe_conquest_%1"", buildingMarker];" \n + " buildingMarker = buildingMarker + 1;" \n + " _x setVariable ['wfbe_marker', _marker];" \n + " createMarkerLocal [_marker, getPos _x];" \n + " _marker setMarkerColorLocal ""ColorOrange"";" \n + " _marker setMarkerShapeLocal ""ELLIPSE"";" \n + " _marker setMarkerAlphaLocal 0.4;" \n + " _marker setMarkerBrushLocal ""SOLID"";" \n + " _marker setMarkerSizeLocal [300,300];" \n + " };" \n + " if !(_x in _set) then {_set = _set + [_x]};" \n + " };" \n + " } forEach _neighbors;" \n + " };" \n + " } forEach _t;" \n + "} else {" \n + " _hq = (sideJoined) Call GetSideHQ;" \n + " _nearest = ([_hq, towns] Call SortByDistance) select 0;" \n + " if (isNil {_nearest getVariable ""wfbe_marker""}) then {" \n + " _marker = Format [""wfbe_conquest_%1"", buildingMarker];" \n + " buildingMarker = buildingMarker + 1;" \n + " _nearest setVariable ['wfbe_marker', _marker];" \n + " createMarkerLocal [_marker, getPos _nearest];" \n + " _marker setMarkerColorLocal ""ColorOrange"";" \n + " _marker setMarkerShapeLocal ""ELLIPSE"";" \n + " _marker setMarkerAlphaLocal 0.4;" \n + " _marker setMarkerBrushLocal ""SOLID"";" \n + " _marker setMarkerSizeLocal [300,300];" \n + " };" \n + " _set = [_nearest];" \n + "};" \n + "" \n + "_set = towns - _set;" \n + "{" \n + " if !(isNil {_x getVariable ""wfbe_marker""}) then {" \n + " deleteMarkerLocal (_x getVariable ""wfbe_marker"");" \n + " _x setVariable [""wfbe_marker"", nil];" \n + " };" \n + "} forEach _set;" \n + "" \n + "_ntime = time + 10;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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_Conquest"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time > _ntime"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/fasttimecli.fsm b/Client/FSM/fasttimecli.fsm new file mode 100644 index 0000000..870b433 --- /dev/null +++ b/Client/FSM/fasttimecli.fsm @@ -0,0 +1,171 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.063538,-295.568512,25.936447,-245.568604,0.000000,"Init"}; +item1[] = {"Update_Time",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Time"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Wait_for_Init",4,218,65.886307,-194.314407,155.886276,-144.314407,0.000000,"Wait for Init"}; +item6[] = {"Advanced_Init",2,250,-63.879562,-194.314392,26.121157,-144.314392,0.000000,"Advanced Init"}; +item7[] = {"_",8,218,-34.448154,-230.434799,-2.642141,-207.859543,0.000000,""}; +item8[] = {"Init_Done",2,4346,191.498337,-194.033432,281.498260,-144.033432,0.000000,"Init Done"}; +item9[] = {"Init_Done",4,218,-63.535187,-123.100403,26.464882,-73.100349,0.000000,"Init Done"}; +item10[] = {"",7,210,233.129700,-102.521011,241.129700,-94.521011,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +link5[] = {5,8}; +link6[] = {6,5}; +link7[] = {6,9}; +link8[] = {7,6}; +link9[] = {8,5}; +link10[] = {8,10}; +link11[] = {9,1}; +link12[] = {10,9}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,897,489,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,915}; +*//*%FSM*/ +class FSM +{ + fsmName = "fasttime"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_currentTime = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Advanced_Init"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Time + { + name = "Update_Time"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"";" \n + "SkipTime (_currentTime - DayTime);" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Advanced_Init + { + name = "Advanced_Init"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Init_Done"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Init_Done + { + name = "Init_Done"; + init = /*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Time"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Init_Done"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_currentTime"""/*%FSM*/; + action=/*%FSM*/"_currentTime = WF_Logic getVariable ""currentTime"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/overcast.fsm b/Client/FSM/overcast.fsm new file mode 100644 index 0000000..4c815fd --- /dev/null +++ b/Client/FSM/overcast.fsm @@ -0,0 +1,177 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.063538,-295.568512,25.936447,-245.568604,0.000000,"Init"}; +item1[] = {"Update_Weather",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Weather"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Wait_for_Init",4,218,65.886307,-194.314407,155.886276,-144.314407,0.000000,"Wait for Init"}; +item6[] = {"Advanced_Init",2,250,-63.879562,-194.314392,26.121157,-144.314392,0.000000,"Advanced Init"}; +item7[] = {"_",8,218,-34.448154,-230.434799,-2.642141,-207.859543,0.000000,""}; +item8[] = {"Wait",2,250,192.379745,-194.033447,282.379883,-144.033447,0.000000,"Wait"}; +item9[] = {"Init_Done",4,218,-63.535187,-123.100403,26.464882,-73.100349,0.000000,"Init Done"}; +item10[] = {"",7,210,233.129700,-102.521011,241.129700,-94.521011,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +link5[] = {5,8}; +link6[] = {6,5}; +link7[] = {6,9}; +link8[] = {7,6}; +link9[] = {8,5}; +link10[] = {8,10}; +link11[] = {9,1}; +link12[] = {10,9}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,897,514,1}; +window[] = {0,-1,-1,-1,-1,659,25,1285,25,1,915}; +*//*%FSM*/ +class FSM +{ + fsmName = "overcast"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastOverCast = -1;" \n + "_overCast = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Advanced_Init"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Weather + { + name = "Update_Weather"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (_overCast != _lastOverCast) then {" \n + " ('WFBE_WEATHERTRANSITION' Call GetNamespace) setOvercast _overCast;" \n + " _lastOverCast = _overCast;" \n + "};" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Advanced_Init + { + name = "Advanced_Init"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (time > 10) then {0 setOvercast _overCast;_lastOverCast = _overCast};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Wait + { + name = "Wait"; + init = /*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Init_Done + { + priority = 0.000000; + to="Update_Weather"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"";" \n + "if (time > 10) then {0 setOvercast _overCast;_lastOverCast = _overCast};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Wait_for_Init + { + priority = 0.000000; + to="Wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNil ""_overCast"""/*%FSM*/; + action=/*%FSM*/"_overCast = WF_Logic getVariable ""overCast"""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/resources_cli.fsm b/Client/FSM/resources_cli.fsm new file mode 100644 index 0000000..24899bb --- /dev/null +++ b/Client/FSM/resources_cli.fsm @@ -0,0 +1,111 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,65.361679,-140.426117,155.361542,-90.426193,0.000000,"Init"}; +item1[] = {"Update_Income",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Income"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-365.650940,391.210938,85.220795,-348.477112,758,514,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,776}; +*//*%FSM*/ +class FSM +{ + fsmName = "resources_cli"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_pside = _this;" \n + "" \n + "_lastUpdate = time;" \n + "" \n + "_is = 'WFBE_INCOMESYSTEM' Call GetNamespace;" \n + "_ii = 'WFBE_INCOMEINTERVAL' Call GetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Income"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > _ii && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Income + { + name = "Update_Income"; + init = /*%FSM*/"_lastUpdate = time;" \n + "" \n + "_income = 0;" \n + "" \n + "//--- Income Getter." \n + "{" \n + " _side = (_x getVariable ""sideID"") Call GetSideFromID;" \n + " _supply = _x getVariable ""supplyValue"";" \n + " if (_side == _pside) then {_income = _income + (_supply / _is)};" \n + "} forEach towns;" \n + "" \n + "//--- Only change the funds if needed." \n + "if (_income > 0) then {" \n + " (_income) Call ChangePlayerFunds;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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_Income"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > _ii && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateactions.fsm b/Client/FSM/updateactions.fsm new file mode 100644 index 0000000..27d60ad --- /dev/null +++ b/Client/FSM/updateactions.fsm @@ -0,0 +1,138 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Player",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Player"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Not_Alive",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Not Alive"}; +item5[] = {"Update_Actions",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Update Actions"}; +item6[] = {"Alive",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Alive"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-395.307037,395.306915,167.465607,-285.572937,407,514,1}; +window[] = {0,-1,-1,-1,-1,834,200,1460,200,1,425}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateactions"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_optionsID = -1;" \n + "_lastVehicle = player;" \n + "_UpdateActions = true;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Player + { + name = "Check_Player"; + init = /*%FSM*/"if (Vehicle player != _lastVehicle) then {_UpdateActions = true};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Not_Alive + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || !alive player"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Alive + { + priority = 0.000000; + to="Update_Actions"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"alive player && !gameOver && _UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 0.5 && !gameOver && alive player && !_UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/"_lastVehicle RemoveAction _optionsID"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Actions + { + name = "Update_Actions"; + init = /*%FSM*/"_UpdateActions = false;" \n + "_vehicle = Vehicle player;" \n + "if (_vehicle != player) then {_optionsID = _vehicle addAction ["""" + (localize ""STR_WF_Options"") + """",""Client\Action\Action_Menu.sqf"", """", 1, false, true, """", """"]} else {_lastVehicle RemoveAction _optionsID};" \n + "_lastVehicle = _vehicle;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Player"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 0.5 && !gameOver && alive player && !_UpdateActions"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateavailableactions.fsm b/Client/FSM/updateavailableactions.fsm new file mode 100644 index 0000000..ca1ee4c --- /dev/null +++ b/Client/FSM/updateavailableactions.fsm @@ -0,0 +1,268 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,64.986191,-133.045959,154.986206,-83.046036,0.000000,"Init"}; +item1[] = {"Update_Client_Ac",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Client" \n "Actions"}; +item2[] = {"End",1,250,-207.023727,26.287281,-117.023697,76.287277,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-64.280334,28.850353,25.719648,78.850410,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,38,6316128,1,-317.581665,500.648590,697.417725,-204.557556,596,657,1}; +window[] = {0,-1,-1,-1,-1,802,25,1285,25,1,614}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateavailableactions"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastUpdate = time;" \n + "_txt = '';" \n + "_handle = nil;" \n + "_ft = 'WFBE_FASTTRAVEL' Call GetNamespace;" \n + "_ftr = 'WFBE_FASTTRAVELRANGE' Call GetNamespace;" \n + "_mhqbr = 'WFBE_MHQBUILDINGRANGE' Call GetNamespace;" \n + "_pur = 'WFBE_PURCHASEUNITSRANGE' Call GetNamespace;" \n + "_pura = 'WFBE_PURCHASEUNITSRANGEAIR' Call GetNamespace;" \n + "_ccr = 'WFBE_COMMANDCENTERRANGE' Call GetNamespace;" \n + "_pgr = 'WFBE_PURCHASEGEARRANGE' Call GetNamespace;" \n + "_rptr = 'WFBE_REPAIRTRUCKRANGE' Call GetNamespace;" \n + "_spr = 'WFBE_SERVICEPOINTRANGE' Call GetNamespace;" \n + "_tpr = 'WFBE_TOWNBUILDPROTECTIONRANGE' Call GetNamespace;" \n + "_tcr = 'WFBE_TOWNCAPTURERANGE' Call GetNamespace;" \n + "_is = 'WFBE_INCOMESYSTEM' Call GetNamespace;" \n + "_ac = 'WFBE_ARTILLERYCOMPUTER' Call GetNamespace;" \n + "_buygearfrom = missionNamespace getVariable ""WFBE_TOWNGEAR"";" \n + "_acenabled = false;" \n + "" \n + "_fastTravel = false;" \n + "" \n + "_commandCenter = objNull;" \n + "" \n + "_typeRepair = Format['WFBE_%1REPAIRTRUCKS',sideJoinedText] Call GetNamespace;" \n + "" \n + "//--- Keep actions updated (GUI). - changed-MrNiceGuy " \n + "12450 cutRsc [""OptionsAvailable"",""PLAIN"",0];" \n + "_icons = [" \n + """Client\Images\icon_wf_building_mhq.paa"", //mhq deployable" \n + """Client\Images\icon_wf_building_barracks.paa"", //barracks " \n + """Client\Images\icon_wf_building_gear.paa"", //gear avail" \n + """Client\Images\icon_wf_building_lvs.paa"", //lvsp" \n + """Client\Images\icon_wf_building_hvs.paa"", //hvsp" \n + """Client\Images\icon_wf_building_air.paa"", //helipad" \n + """Client\Images\icon_wf_building_hangar.paa"", //hangar" \n + """Client\Images\icon_wf_building_repair.paa"", //rearm | repair | refuel" \n + """Client\Images\icon_wf_building_firstaid.paa"", //heal " \n + """Client\Images\icon_wf_support_fasttravel.paa"", //fast travel" \n + """Client\Images\icon_wf_building_cc.paa"", //command center" \n + """Client\Images\icon_wf_building_aa_radar.paa"", //AA radar" \n + """Client\Images\icon_wf_building_am_radar.paa"", //ARTY radar" \n + """Client\Images\icon_wf_support_transport.paa"", //transport" \n + """Client\Images\icon_wf_support_supplydrop.paa"", //supply drop" \n + """Client\Images\icon_wf_support_artilery.paa"", //ARTY" \n + """Client\Images\icon_wf_support_mortar.paa"", //ARTY - mortar" \n + """Client\Images\icon_wf_support_cas.paa"", //CAS" \n + """Client\Images\icon_wf_support_uav.paa"" //UAV" \n + "];" \n + "" \n + "_buildings = (sideJoinedText) Call GetSideStructures;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client_Ac"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastUpdate > 5 || WFBE_ForceUpdate) && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Client_Ac + { + name = "Update_Client_Ac"; + init = /*%FSM*/"_buildings = (sideJoinedText) Call GetSideStructures;" \n + "_base = (sideJoinedText) Call GetSideHQ;" \n + "_upgrades = (sideJoinedText) Call GetSideUpgrades;" \n + " " \n + "_purchaseRange = if (commandInRange) then {_ccr} else {_pur};" \n + " " \n + "_nearTown = [player,towns] Call SortByDistance;" \n + "_closest = _nearTown select 0;" \n + "" \n + "if (!isNull(commanderTeam) && paramHighCommand) then {" \n + " if (commanderTeam == group player) then {" \n + " {if !(isNil '_x') then {if !(_x in (hcAllGroups player)) then {player HCSetGroup [_x]}}} forEach clientTeams;" \n + " };" \n + "};" \n + "" \n + "//--- Boundaries are limited ?" \n + "if (paramBoundaries) then {" \n + " _isOnMap = Call BoundariesIsOnMap;" \n + " if !(_isOnMap && alive player) then {" \n + " if !(paramBoundariesRunning) then {_handle = [] Spawn BoundariesHandleOnMap};" \n + " } else {" \n + " if !(isNil '_handle') then {terminate _handle;_handle = nil};" \n + " paramBoundariesRunning = false;" \n + " };" \n + "};" \n + "" \n + "//--- Map info." \n + "if (visibleMap) then {" \n + " if (!isNull commanderTeam) then {_txt = format [localize 'STR_WF_Commander',name (leader commanderTeam)]} else {_txt = format [localize 'STR_WF_Commander',localize 'STR_WF_AI']};" \n + " _txt = _txt + ' ' + Format [localize ""STR_WF_Income"",Call GetPlayerFunds,(sideJoined) Call GetIncome];" \n + " if (_is in [3,4]) then {_txt = _txt + Format["" (%1%2)"", Call Compile Format[""%1CommanderPercent"",sideJoined],""%""]};" \n + " if !(paramMoneyOnly) then {_txt = _txt + ' ' + localize 'STR_WF_UPGRADE_Supply' + ': '+ str((sideJoined) Call GetSideSupply)};" \n + " (findDisplay 12 displayCtrl 116) ctrlSetText _txt;" \n + "};" \n + "" \n + "//--- HQ." \n + "if !(isNull _base) then {hqInRange = if ((player distance _base < _mhqbr)&&(alive _base)&&(player distance _closest > _tpr)) then {true} else {false}};" \n + "" \n + "barracksInRange = if (isNull (['BARRACKSTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "gearInRange = if (isNull (['BARRACKSTYPE',_buildings,_pgr,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "if !(gearInRange) then {" \n + " if (_buygearfrom in [1,2,3]) then {" \n + " _lookfor = switch (_buygearfrom) do { case 1:{WFCAMP}; case 2:{WFDEPOT}; case 3:{WFCAMP + WFDEPOT}; default{[]}};" \n + " _nObjects = nearestObjects [player, _lookfor, 5];" \n + " _nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + " if !(isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil '_sideID') then {" \n + " if (!gearInRange && sideID == _sideID) then {gearInRange = true} else {gearInRange = false};" \n + " };" \n + " };" \n + " };" \n + "};" \n + "" \n + "lightInRange = if (isNull (['LIGHTTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "heavyInRange = if (isNull (['HEAVYTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "aircraftInRange = if (isNull (['AIRCRAFTTYPE',_buildings,_purchaseRange,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "serviceInRange = if (isNull (['SERVICEPOINTTYPE',_buildings,_spr,sideJoined,player] Call BuildingInRange)) then {false} else {true};" \n + "" \n + "if !(serviceInRange) then {" \n + " _checks = (getPos player) nearEntities[_typeRepair,_rptr];" \n + " if (count _checks > 0) then {serviceInRange = true};" \n + "};" \n + "" \n + "if (paramAARadar) then {" \n + " _checks = [sideJoined, Format [""WFBE_%1AARADARTYPE"",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;" \n + " if (count _checks > 0) then {antiAirRadarInRange = true} else {antiAirRadarInRange = false};" \n + "};" \n + "" \n + "//--- Town Depot." \n + "_nObjects = nearestObjects [vehicle player, WFDEPOT,('WFBE_TOWNPURCHASERANGE' Call GetNamespace)];" \n + "_nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + "if (!isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil ""_sideID"") then {" \n + " if (_sideID == sideID) then {if (vehicle player distance _nObject < _tcr) then {serviceInRange = true;depotInRange = true} else {depotInRange = false}};" \n + " };" \n + "} else {depotInRange = false};" \n + "" \n + "_checks = ['COMMANDCENTERTYPE',_buildings,_ccr,sideJoined,player] Call BuildingInRange;" \n + "_commandCenter = _checks;" \n + "commandInRange = if (isNull _checks) then {false} else {true};" \n + "" \n + "//--- Airport." \n + "if (paramHangars) then {" \n + " _sorted = [player,Airfields] Call SortByDistance;" \n + " if (count _sorted > 0) then {" \n + " if ((_sorted select 0) distance player < _pura && alive(_sorted select 0)) then {hangarInRange = true} else {hangarInRange = false};" \n + " } else {hangarInRange = false};" \n + "};" \n + "" \n + "//--- Fast Travel." \n + "if ((_ft > 0) && commandInRange) then {" \n + " _fastTravel = false;" \n + " _isDeployed = (sideJoinedText) Call GetSideHQDeployed;" \n + " if (_upgrades select 12 > 0) then {" \n + " if (player distance _base < _ftr && alive _base && _isDeployed) then {_fastTravel = true} else {" \n + " _closest = _nearTown select 0;" \n + " _sideID = _closest getVariable 'sideID';" \n + " if (player distance _closest < _ftr && _sideID == sideID) then {_fastTravel = true} else {" \n + " if (!isNull _commandCenter) then {" \n + " if (player distance _commandCenter < _ftr) then {_fastTravel = true};" \n + " };" \n + " };" \n + " }; " \n + " }; " \n + "};" \n + "" \n + "//--- AC." \n + "if (_ac == 1 && !_acenabled && !WF_A2_Vanilla) then {" \n + " if ((_upgrades select 10) == 3) then {Call Compile ""enableEngineArtillery true;"";_acenabled = true};" \n + "};" \n + "" \n + "_usable = [hqInRange,barracksInRange,gearInRange,lightInRange,heavyInRange,aircraftInRange,hangarInRange,serviceInRange,serviceInRange,_fastTravel,commandInRange,antiAirRadarInRange];" \n + "" \n + "_c = 0;" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0]};" \n + "{" \n + " if (_x) then {" \n + " (([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl (3500 + _c)) CtrlSetText (_icons select _c);" \n + " } else {" \n + " (([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl (3500 + _c)) CtrlSetText """";" \n + " };" \n + " _c = _c + 1;" \n + "}forEach _usable;" \n + "" \n + "if (WFBE_ForceUpdate) then {WFBE_ForceUpdate = false};" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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_Client_Ac"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _lastUpdate > 5 || WFBE_ForceUpdate) && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatecapture.fsm b/Client/FSM/updatecapture.fsm new file mode 100644 index 0000000..0dd0934 --- /dev/null +++ b/Client/FSM/updatecapture.fsm @@ -0,0 +1,262 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,4346,64.981941,-136.945908,154.981949,-86.946060,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Update_Capture",2,250,66.545486,22.916348,156.545471,72.916397,0.000000,"Update Capture"}; +item6[] = {"In_Range",4,218,-66.545563,22.916351,23.454376,72.916374,0.000000,"In Range"}; +item7[] = {"Not_in_Range",4,218,-167.954971,85.174767,-77.955025,135.174774,0.000000,"Not in Range"}; +item8[] = {"Hide",2,250,215.453018,86.056137,305.453064,136.056137,0.000000,"Hide"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {1,7}; +link5[] = {3,1}; +link6[] = {4,2}; +link7[] = {5,3}; +link8[] = {6,5}; +link9[] = {7,8}; +link10[] = {8,3}; +globals[] = {0.000000,0,0,0,0,640,480,1,25,6316128,1,-526.153625,526.153442,261.834167,-341.160065,1024,906,1}; +window[] = {2,-1,-1,-1,-1,834,200,1460,200,3,1042}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatecapture"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"disableSerialization;" \n + "_delay = 4;" \n + "_lastCheck = """";" \n + "_lastSID = -1;" \n + "_lastUpdate = time;" \n + "" \n + "_tcarm = 'WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace;" \n + "" \n + "_colorBlue = [0,0,0.7,0.7];" \n + "_colorGreen = [0,0.7,0,0.7];" \n + "_colorRed = [0.7,0,0,0.7];" \n + "" \n + "_colorFriendly = switch ('Friendly' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorGreen};" \n + "};" \n + "" \n + "_colorEnemy = switch ('Enemy' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorRed};" \n + "};" \n + "" \n + "_coloResistance = switch ('Resistance' Call GetMarkerColoration) do {" \n + " case ""ColorGreen"": {_colorGreen};" \n + " case ""ColorBlue"": {_colorBlue};" \n + " case ""ColorRed"": {_colorRed};" \n + " default {_colorBlue};" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_sorted = [player,towns] Call SortByDistance;" \n + "_nearest = _sorted select 0;" \n + "_range = (_nearest getVariable ""range"") * _tcarm;" \n + "" \n + "_update = false;" \n + "if (player distance _nearest < _range && alive player) then {_update = true};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class In_Range + { + priority = 0.000000; + to="Update_Capture"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_update && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Not_in_Range + { + priority = 0.000000; + to="Hide"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!_update && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Capture + { + name = "Update_Capture"; + init = /*%FSM*/"_sideID = _nearest getVariable ""sideID"";" \n + "if (isNil '_sideID') then {_sideID = -1};" \n + "_curSV = _nearest getVariable ""supplyValue"";" \n + "_maxSV = _nearest getVariable ""maxSupplyValue"";" \n + "_txt = """";" \n + "_nObjects = nearestObjects [player, WFCAMP, 10];" \n + "_nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n + "if !(isNull _nObject) then {" \n + " _sideID = _nObject getVariable ""sideID"";" \n + " if !(isNil '_sideID') then {" \n + " _curSV = _nObject getVariable ""supplyValue"";" \n + " if (_lastCheck == ""Town"") then {_delay = 0};" \n + " _lastCheck = ""Camp"";" \n + " } else {" \n + " _sideID = -1;" \n + " };" \n + " if (player distance _nObject >= 10) then {" \n + " _lastCheck = ""Town"";" \n + " _sideID = _nearest getVariable ""sideID"";" \n + " _curSV = _nearest getVariable ""supplyValue"";" \n + " _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n + " };" \n + "} else {" \n + " if (_lastCheck == ""Camp"") then {_delay = 0};" \n + " _lastCheck = ""Town"";" \n + " _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n + "};" \n + "" \n + "_barColor = [];" \n + "if (_sideID == RESISTANCEID || _sideID == -1) then {_barColor = _coloResistance};" \n + "if ((_sideID == WESTID)&&(sideID == WESTID) || (_sideID == EASTID)&&(sideID == EASTID)) then {_barColor = _colorFriendly}; //--- Green" \n + "if ((_sideID == WESTID)&&(sideID == EASTID) || (_sideID == EASTID)&&(sideID == WESTID)) then {_barColor = _colorEnemy};" \n + "if (_sideID != _lastSID) then {_delay = 0};" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0];_delay = 0};" \n + "if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n + " _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n + " _control ctrlShow true;" \n + " _control CtrlSetBackgroundColor _barColor;" \n + " _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n + " _backgroundControl ctrlShow true;" \n + " _backgroundControl CtrlSetBackgroundColor [0.1882, 0.2588, 0.149, 0.76];" \n + " _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n + " _textControl ctrlShow true;" \n + " _textControl ctrlSetText _txt;" \n + " _maxWidth = (CtrlPosition _backgroundControl Select 2) - 0.02;" \n + " _position = CtrlPosition _control;" \n + " _position Set[2,_maxWidth * _curSV / _maxSV];" \n + " _control CtrlSetPosition _position;" \n + " _control CtrlCommit _delay;" \n + " _delay = 4;" \n + " _lastSID = _sideID;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Hide + { + name = "Hide"; + init = /*%FSM*/"_delay = 0;" \n + "if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0]};" \n + "if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n + " _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n + " _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n + " _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n + " _control ctrlShow false;" \n + " _backgroundControl ctrlShow false;" \n + " _textControl ctrlShow false;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 2 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateclient.fsm b/Client/FSM/updateclient.fsm new file mode 100644 index 0000000..f6f1538 --- /dev/null +++ b/Client/FSM/updateclient.fsm @@ -0,0 +1,175 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,66.278671,-152.869141,156.278748,-102.869209,0.000000,"Init"}; +item1[] = {"Update_Client",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Client"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +item5[] = {"Update_Commander",2,4346,66.545486,22.916348,156.545471,72.916397,0.000000,"Update" \n "Commander"}; +item6[] = {"Change_Commander",4,218,-66.545563,22.916351,23.454376,72.916374,0.000000,"Change" \n "Commander"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +globals[] = {0.000000,0,0,0,0,640,480,1,22,6316128,1,-345.209412,345.209290,108.499458,-297.536255,1028,906,1}; +window[] = {2,-1,-1,-1,-1,834,200,1652,200,3,1046}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateclient"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"commanderTeam = (SideJoined) Call GetCommanderTeam;" \n + "" \n + "_lastCommanderTeam = commanderTeam;" \n + "_changeCommander = false;" \n + "_timer = 0;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Client + { + name = "Update_Client"; + init = /*%FSM*/"commanderTeam = (sideJoined) Call GetCommanderTeam;" \n + "if (IsNull commanderTeam && !IsNull _lastCommanderTeam) then {_changeCommander = true};" \n + "if (!IsNull commanderTeam && IsNull _lastCommanderTeam) then {_changeCommander = true};" \n + "if (!isNull commanderTeam && !isNull _lastCommanderTeam) then {" \n + " if (commanderTeam != _lastCommanderTeam) then {_changeCommander = true};" \n + "};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Gameover + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Change_Commander + { + priority = 0.000000; + to="Update_Commander"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_changeCommander && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Commander + { + name = "Update_Commander"; + init = /*%FSM*/"_changeCommander = false;" \n + "_lastCommanderTeam = commanderTeam; " \n + "_MHQ = (sideJoinedText) Call GetSideHQ;" \n + "" \n + "if (IsNull commanderTeam) then {" \n + " if (!IsNull _MHQ) then {" \n + " _MHQ RemoveAction 0;" \n + " _MHQ RemoveAction 1;" \n + " _MHQ RemoveAction 2;" \n + " _MHQ RemoveAction 3;" \n + " };" \n + " if (!isNil ""HQAction"") then {player removeAction HQAction};" \n + " if (count (hcAllGroups player) > 0) then {HCRemoveAllGroups player};" \n + " {[_x,false] Call SetTeamAutonomous} forEach clientTeams;" \n + "};" \n + " " \n + "if (!isNull(commanderTeam)) then {" \n + " if (commanderTeam == Group player) then {" \n + " if (!IsNull _MHQ) then {" \n + " _MHQ addAction [localize ""STR_WF_Unlock_MHQ"",""Client\Action\Action_ToggleLock.sqf"", [], 95, false, true, '', 'alive _target && locked _target'];" \n + " _MHQ addAction [localize ""STR_WF_Lock_MHQ"",""Client\Action\Action_ToggleLock.sqf"", [], 94, false, true, '', 'alive _target && !(locked _target)'];" \n + " };" \n + " _deployed = (sideJoinedText) Call GetSideHQDeployed;" \n + " if (_deployed) then {" \n + " ['WFBE_AREAHQDEPLOYED' Call GetNameSpace,true,MCoin] Call Compile PreprocessFile ""Client\Init\Init_Coin.sqf"";" \n + " } else {" \n + " ['WFBE_AREAHQUNDEPLOYED' Call GetNamespace,false,MCoin] Call Compile PreprocessFile ""Client\Init\Init_Coin.sqf"";" \n + " };" \n + " HQAction = leader(group player) addAction [localize ""STR_WF_BuildMenu"",""Client\Action\Action_Build.sqf"", [_MHQ], 100, false, true, """", ""hqInRange && canBuildWHQ && (_target == player)""]; " \n + " if (paramHighCommand) then {player setVariable [""BIS_HC_scope"",HC];{if !(isNil '_x') then {player HCSetGroup [_x]; [_x,false] Call SetTeamAutonomous}} forEach clientTeams};" \n + " [Localize ""STR_WF_CHAT_PlayerCommander""] Call TitleTextMessage;" \n + " } else {" \n + " if (!isNil ""HQAction"") then {player removeAction HQAction};" \n + " if (count (hcAllGroups player) > 0 && paramHighCommand) then {HCRemoveAllGroups player};" \n + " };" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Client"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatesalvage.fsm b/Client/FSM/updatesalvage.fsm new file mode 100644 index 0000000..2030f0c --- /dev/null +++ b/Client/FSM/updatesalvage.fsm @@ -0,0 +1,165 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Truck_is_Dead",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Truck is" \n "Dead"}; +item5[] = {"Check_Wrecks",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Check Wrecks"}; +item6[] = {"Has_Driver",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Has Driver"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-280.138428,228.260757,186.219727,-258.197296,588,514,1}; +window[] = {0,-1,-1,-1,-1,732,48,1308,98,1,606}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatesalvage"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_vehicle = _this select 0;" \n + "" \n + "_salvagerRange = 'WFBE_SALVAGERRANGE' Call GetNamespace;" \n + "_percentage = 'WFBE_SALVAGERPERCENT' Call GetNamespace;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Truck_is_Dead + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || !(alive _vehicle)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Has_Driver + { + priority = 0.000000; + to="Check_Wrecks"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(isNull (driver _vehicle)) && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Wrecks + { + name = "Check_Wrecks"; + init = /*%FSM*/"_vehicles = nearestObjects [getPos _vehicle, ['Car','Motorcycle','Ship','Air','Tank','StaticWeapon'],_salvagerRange];" \n + "" \n + "_wrecks = [];" \n + "{" \n + " if !(alive _x) then {_wrecks = _wrecks + [_x]};" \n + "} forEach _vehicles;" \n + "" \n + "_hqw = (west) Call GetSideHQ;" \n + "_hqe = (east) Call GetSideHQ;" \n + "" \n + "_wrecks = _wrecks - [_hqw,_hqe];" \n + "" \n + "_overAllCost = 0;" \n + "{" \n + " _isNeeded = _x getVariable 'keepAlive';" \n + " " \n + " if (isNil '_isNeeded') then {" \n + " _get = (typeOf _x) Call GetNamespace;" \n + " _salvageCost = 250;" \n + " if !(isNil '_get') then {" \n + " _salvageCost = round(((_get select QUERYUNITPRICE)*_percentage) / 100);" \n + " };" \n + " " \n + " _overAllCost = _overAllCost + _salvageCost;" \n + " (Format [localize 'STR_WF_CHAT_Salvaged_Unit',_salvageCost,[typeOf _x,'displayName'] Call GetConfigInfo]) Call GroupChatMessage;" \n + " " \n + " deleteVehicle _x;" \n + " };" \n + "} foreach _wrecks;" \n + "" \n + "if (_overAllCost > 0) then {(_overAllCost) Call ChangePlayerfunds};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver && alive _vehicle"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End", + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatesupply.fsm b/Client/FSM/updatesupply.fsm new file mode 100644 index 0000000..1340f01 --- /dev/null +++ b/Client/FSM/updatesupply.fsm @@ -0,0 +1,213 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,-64.944939,-176.579712,25.055046,-126.579880,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Truck_is_Dead",4,218,-216.668854,-56.267559,-126.668869,-6.267574,1.000000,"Truck is" \n "Dead"}; +item5[] = {"Truck_Check",2,4346,66.545509,15.865158,156.545563,65.865219,0.000000,"Truck Check"}; +item6[] = {"Has_Driver",4,218,-66.545601,15.865162,23.454397,65.865189,0.000000,"Has Driver"}; +item7[] = {"_",8,218,-37.459465,-108.411957,-3.868937,-87.498108,0.000000,""}; +link0[] = {0,7}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {1,6}; +link4[] = {3,1}; +link5[] = {4,2}; +link6[] = {5,3}; +link7[] = {6,5}; +link8[] = {7,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,29,6316128,1,-395.307037,395.306915,167.465607,-285.572937,588,519,1}; +window[] = {0,-1,-1,-1,-1,745,56,1316,111,1,606}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatesupply"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_vehicle = _this select 0;" \n + "_side = _this select 1;" \n + "_driver = driver _vehicle;" \n + "_lastDriver = driver _vehicle;" \n + "" \n + "_SV = 1000;" \n + "_currentSV = 0;" \n + "_maxSV = 0;" \n + "_timer = 0;" \n + "_exit = false;" \n + "_canDeliver = false;" \n + "_hq = (sideJoinedText) Call GetSideHQ;" \n + "_lastDestination = _hq;" \n + "_delRange = 'WFBE_DELIVERYRANGE' Call GetNamespace;" \n + "_fpsp = 'WFBE_FUNDSPERSUPPLYPOINT' Call GetNamespace;" \n + "_spsp = 'WFBE_SCOREPERSUPPLYPOINT' Call GetNamespace;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class _ + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"if (!alive _vehicle || isNull _vehicle) then {_exit = true}; " \n + "" \n + "_driver = driver _vehicle;" \n + "_hasDriver = false;" \n + "_playerInVehicle = false;" \n + "if (!IsNull _driver) then {" \n + " if (Alive _driver) then {_hasDriver = true};" \n + " if (isPlayer _driver) then {_playerInVehicle = true};" \n + "};" \n + "" \n + "_lastDriver = _driver;" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Truck_is_Dead + { + priority = 1.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"gameOver || _exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Has_Driver + { + priority = 0.000000; + to="Truck_Check"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_hasDriver && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 3 && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + /*%FSM*/ + class Truck_Check + { + name = "Truck_Check"; + init = /*%FSM*/"if (!isNull _driver) then {" \n + " if (_driver != _lastDriver) then {" \n + " _lastDriver = _driver;" \n + " if (_playerInVehicle) then {" \n + " _txt = localize ""STR_WF_INFO_Supply_Full"";" \n + " if (_SV != 1000) then {_txt = Format [localize ""STR_WF_INFO_Supply_Status"",_SV]};" \n + " hint _txt;" \n + " };" \n + " };" \n + "};" \n + " " \n + "_hq = (sideJoinedText) Call GetSideHQ;" \n + "_isDeployed = (sideJoinedText) Call GetSideHQDeployed;" \n + "if (_vehicle Distance _hq < 70 && _SV != 1000 && getDammage _hq < 1 && _isDeployed) then {_SV = 1000;_vehicle setFuel 1;_lastDestination = _hq;if (_playerInVehicle) then {hint (localize ""STR_WF_INFO_Supply_Full"")}};" \n + "" \n + "if (_SV != 1000) then {" \n + " _buildings = (sideJoinedText) Call GetSideStructures;" \n + " _checks = [sideJoined,Format [""WFBE_%1SERVICEPOINTTYPE"",sideJoinedText] Call GetNamespace,_buildings] Call GetFactories;" \n + " if (count _checks > 0) then {" \n + " _sorted = [_vehicle,_checks] Call SortByDistance;" \n + " _nearest = _sorted select 0;" \n + " if (_vehicle distance _nearest < 70) then {_SV = 1000;_vehicle setFuel 1;_lastDestination = _nearest;if (_playerInVehicle) then {hint (localize ""STR_WF_INFO_Supply_Full"")}};" \n + " };" \n + "};" \n + "" \n + "_loc = [_vehicle,towns] Call SortByDistance;" \n + "_closest = _loc select 0;" \n + "_name = _closest getVariable ""name"";" \n + "_locationSide = (_closest getVariable ""sideID"") Call GetSideFromID;" \n + "" \n + "_canDeliver = if (_locationSide == _side) then {true} else {false};" \n + "" \n + "if ((_vehicle Distance _closest < _delRange)&&(_canDeliver)&&(_lastDestination != _closest)) then {" \n + " _lastDestination = _closest;" \n + " _currentSV = _closest getVariable ""supplyValue"";" \n + " _maxSV = _closest getVariable ""maxSupplyValue"";" \n + " if (_SV > _currentSV) then {" \n + " if (_currentSV != _maxSV) then {" \n + " _upgrades = (sideJoinedText) Call GetSideUpgrades;" \n + " _increaseOf = (Format[""WFBE_MAXSUPPLYTRUCKSSV%1"",_upgrades select 6] Call GetNamespace);" \n + " _currentSV = _currentSV + _increaseOf;" \n + " if (_currentSV > _maxSV) then {_currentSV = _maxSV};" \n + " _closest setVariable [""supplyValue"",_currentSV,true];" \n + " };" \n + " _SV = _currentSV;" \n + " _funds = _SV * _fpsp * 2;" \n + " hint Format[localize ""STR_WF_INFO_Supply_Deliver"",_name,_SV,_maxSV,_funds];" \n + " _funds Call ChangePlayerFunds;" \n + " } else {" \n + " hint Format[localize ""STR_WF_INFO_Supply_Equal"",_name,_currentSV,_maxSV];" \n + " _SV = _currentSV;" \n + " };" \n + " WFBE_RequestChangeScore = ['SRVFNCREQUESTCHANGESCORE',[player,score player + _spsp]];" \n + " publicVariable 'WFBE_RequestChangeScore';" \n + " if (isHostedServer) then {['SRVFNCREQUESTCHANGESCORE',[player,score player + _spsp]] Spawn HandleSPVF};" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 3 && !gameOver && !_exit"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updateteamsmarkers.fsm b/Client/FSM/updateteamsmarkers.fsm new file mode 100644 index 0000000..a304236 --- /dev/null +++ b/Client/FSM/updateteamsmarkers.fsm @@ -0,0 +1,125 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,66.542603,-131.405823,156.542603,-81.406097,0.000000,"Init"}; +item1[] = {"Update_Markers",2,4346,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Update Markers"}; +item2[] = {"End",1,250,-194.208939,14.422928,-104.208908,64.422928,0.000000,"End"}; +item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-192.871109,-57.148956,-102.871117,-7.148972,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-395.307037,395.306915,79.046959,-351.956635,725,514,1}; +window[] = {0,-1,-1,-1,-1,734,100,1360,100,1,743}; +*//*%FSM*/ +class FSM +{ + fsmName = "updateteamsmarkers"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_sideText = sideJoinedText;" \n + "_label = """";" \n + "" \n + "_count = 1;" \n + "{" \n + " _marker = Format[""%1AdvancedSquad%2Marker"",_sideText,_count];" \n + " createMarkerLocal [_marker,[0,0,0]];" \n + " _marker setMarkerTypeLocal ""b_inf"";" \n + " _marker setMarkerColorLocal ""ColorBlue"";" \n + " _marker setMarkerSizeLocal [1,1];" \n + " _count = _count +1;" \n + "} forEach clientTeams;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Update_Markers"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_Markers + { + name = "Update_Markers"; + init = /*%FSM*/"_count = 1;" \n + "{" \n + " if !(isNil '_x') then {" \n + " _markerType = ""b_inf"";" \n + " _marker = Format[""%1AdvancedSquad%2Marker"",_sideText,_count];" \n + " " \n + " if (alive (leader _x)) then {" \n + " _label = """";" \n + " if (isPlayer (leader _x)) then {_label = Format[""%1 [%2]"",name (leader _x),_count]} else {_label = Format[""AI [%1]"",_count]};" \n + " _marker setMarkerTextLocal _label;" \n + " _marker setMarkerPosLocal GetPos (leader _x);" \n + " } else {" \n + " _markerType = ""b_empty"";" \n + " };" \n + " " \n + " _marker setMarkerTypeLocal _markerType;" \n + " };" \n + " _count = _count + 1;" \n + "} forEach clientTeams;" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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_Markers"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 1 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/Client/FSM/updatetownmarkers.fsm b/Client/FSM/updatetownmarkers.fsm new file mode 100644 index 0000000..ac92ea9 --- /dev/null +++ b/Client/FSM/updatetownmarkers.fsm @@ -0,0 +1,112 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"Init",0,250,64.620567,-141.323822,154.620590,-91.323967,0.000000,"Init"}; +item1[] = {"Check_Towns",2,250,-65.773369,-55.204887,24.226547,-5.204931,0.000000,"Check Towns"}; +item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"}; +item3[] = {"Loop",4,4314,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"}; +item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"}; +link0[] = {0,3}; +link1[] = {1,3}; +link2[] = {1,4}; +link3[] = {3,1}; +link4[] = {4,2}; +globals[] = {0.000000,0,0,0,0,640,480,1,30,6316128,1,-395.307037,395.306915,93.428192,-337.575409,744,519,1}; +window[] = {0,-1,-1,-1,-1,721,66,1398,87,1,762}; +*//*%FSM*/ +class FSM +{ + fsmName = "updatetownmarkers"; + class States + { + /*%FSM*/ + class Init + { + name = "Init"; + init = /*%FSM*/"_lastUpdate = time;" \n + "_lastSV = [];" \n + "" \n + "_tcarm = 'WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class Loop + { + priority = 0.000000; + to="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Check_Towns + { + name = "Check_Towns"; + init = /*%FSM*/"_count = 0;" \n + "_units = (Units Group player) Call GetLiveUnits;" \n + "while {_count < totalTowns} do {" \n + " _location = towns Select _count;" \n + " _locationName = _location getVariable ""name"";" \n + " _maxSV = _location getVariable ""maxSupplyValue"";" \n + " _range = (_location getVariable ""range"") * _tcarm;" \n + " _sideID = _location getVariable ""sideID"";" \n + " _SV = _location getVariable ""supplyValue"";" \n + " _visible = false;" \n + " if (_sideID == sideID) then {_visible = true} else {{if (_x Distance _location < _range) then {_visible = true}} ForEach _units};" \n + " _marker = Format[""%1Depot"",Str _location];" \n + " if (_visible) then {_marker SetMarkerTextLocal Format["" SV: %1/%2"",_SV,_maxSV]} else {_marker SetMarkerTextLocal """"};" \n + " _lastSV set [_count,_SV];" \n + " _count = _count + 1;" \n + "};" \n + "" \n + "_lastUpdate = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%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="Check_Towns"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"time - _lastUpdate > 5 && !gameOver"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class End + { + name = "End"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ + }; + initState="Init"; + finalStates[] = + { + "End" + }; +}; +/*%FSM*/ \ No newline at end of file -- cgit v1.3.1