pastebin - collaborative debugging tool
kpaste.net RSS


Untitled
Posted by z0TK on Tue 10th Sep 2013 05:24
raw | new post

  1. /*%FSM<COMPILE "C:\BIS\fsmeditor\scriptedFSM.cfg, FPS manager">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"START",0,250,-200.000000,-300.000000,-100.000000,-250.000000,0.000000,"START"};
  5. item1[] = {"Sites_init_done",4,218,-200.000000,-225.000000,-100.000000,-175.000000,0.000000,"Sites" \n "init done"};
  6. item2[] = {"hide_distant_obj",2,4346,-200.000000,-150.000000,-100.000000,-100.000000,0.000000,"hide" \n "distant objects"};
  7. item3[] = {"moved_far_enough",4,218,-250.000000,-75.000000,-150.000000,-25.000000,0.000000,"moved far" \n "enough"};
  8. item4[] = {"setPos_d",4,218,-150.000000,-75.000000,-50.000000,-25.000000,0.000000,"setPos'd"};
  9. item5[] = {"airborne",4,218,-350.000000,-75.000000,-250.000000,-25.000000,0.000000,"airborne"};
  10. item6[] = {"show_all_objects",2,250,-250.000000,0.000000,-150.000000,50.000000,0.000000,"show" \n "all objects"};
  11. item7[] = {"on_land",4,218,-250.000000,75.000000,-150.000000,125.000000,0.000000,"on land"};
  12. item8[] = {"",7,210,-379.000000,95.999992,-371.000000,104.000000,0.000000,""};
  13. item9[] = {"",7,210,-379.000000,-129.000000,-371.000000,-121.000000,0.000000,""};
  14. item10[] = {"rescan_new_objec",4,218,-50.000000,-75.000000,50.000000,-25.000000,0.000000,"rescan new" \n "objects"};
  15. item11[] = {"scan_for_new_obj",2,250,-150.000000,0.000000,-50.000000,50.000000,0.000000,"scan for" \n "new objects"};
  16. item12[] = {"always",8,218,-150.000000,75.000000,-50.000000,125.000000,0.000000,"always"};
  17. item13[] = {"",7,210,71.000000,96.000000,79.000000,104.000000,0.000000,""};
  18. item14[] = {"",7,210,71.000000,-129.000000,79.000000,-121.000000,0.000000,""};
  19. link0[] = {0,1};
  20. link1[] = {1,2};
  21. link2[] = {2,3};
  22. link3[] = {2,4};
  23. link4[] = {2,5};
  24. link5[] = {2,10};
  25. link6[] = {3,2};
  26. link7[] = {4,2};
  27. link8[] = {5,6};
  28. link9[] = {6,7};
  29. link10[] = {7,8};
  30. link11[] = {8,9};
  31. link12[] = {9,2};
  32. link13[] = {10,11};
  33. link14[] = {11,12};
  34. link15[] = {12,13};
  35. link16[] = {13,14};
  36. link17[] = {14,2};
  37. globals[] = {25.000000,1,0,0,16777215,640,480,1,180,6316128,1,-499.642944,187.944717,235.123749,-371.611145,1012,1031,1};
  38. window[] = {2,-1,-1,-1,-1,805,75,1335,75,3,1030};
  39. *//*%FSM</HEAD>*/
  40. class FSM
  41. {
  42.         fsmName = "FPS manager";
  43.         class States
  44.         {
  45.                 /*%FSM<STATE "START">*/
  46.                 class START
  47.                 {
  48.                         name = "START";
  49.                         itemno = 0;
  50.                         init = /*%FSM<STATEINIT""">*/"BIS_fps_rescanNewObjects = FALSE;" \n
  51.                          "_afterStartCheck = FALSE;" \n
  52.                          "_missionObjs = [];" \n
  53.                          "_toHide = [];" \n
  54.                          "_t = time;" \n
  55.                          "_t2 = time;" \n
  56.                          "_virtualSpeed = 15;" \n
  57.                          "" \n
  58.                          "_freezeDist = 2000;" \n
  59.                          "" \n
  60.                          "if (isNil ""BIS_persistent"") then {BIS_persistent = []};" \n
  61.                          "" \n
  62.                          "_spawnedBySites = [];" \n
  63.                          "{" \n
  64.                          "      if (!(isNil {_x getVariable ""garrison""})) then {" \n
  65.                          "              _site = _x;" \n
  66.                          "              {_spawnedBySites = _spawnedBySites + units _x} forEach (_site getVariable ""garrison"")" \n
  67.                          "      }" \n
  68.                          "} forEach allSites;" \n
  69.                          "" \n
  70.                          "_grabMissionObjs = {" \n
  71.                          "      _ret = [];" \n
  72.                          "      {" \n
  73.                          "              if (typeOf _x != """" && !(_x in (units player + BIS_persistent)) && !(_x isKindOf ""Logic"")) then {" \n
  74.                          "                      _ret = _ret + [_x];" \n
  75.                          "                      if (vehicle _x != _x && !(vehicle _x  in _ret)) then {_ret = _ret + [vehicle _x]}" \n
  76.                          "              }" \n
  77.                          "      } forEach _spawnedBySites;" \n
  78.                          "      {if (vehicleVarName _x != """" && !(_x in BIS_persistent)) then {BIS_persistent = BIS_persistent + [_x]}} forEach _ret;" \n
  79.                          "      {if (vehicle _x != _x && !(vehicle _x  in BIS_persistent)) then {BIS_persistent = BIS_persistent + [vehicle _x]}} forEach BIS_persistent;" \n
  80.                          "      _ret" \n
  81.                          "};"/*%FSM</STATEINIT""">*/;
  82.                         precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  83.                         class Links
  84.                         {
  85.                                 /*%FSM<LINK "Sites_init_done">*/
  86.                                 class Sites_init_done
  87.                                 {
  88.                                         itemno = 1;
  89.                                         priority = 0.000000;
  90.                                         to="hide_distant_obj";
  91.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  92.                                         condition=/*%FSM<CONDITION""">*/"!isNil ""BIS_initSitesDone"""/*%FSM</CONDITION""">*/;
  93.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  94.                                 };
  95.                                 /*%FSM</LINK>*/
  96.                         };
  97.                 };
  98.                 /*%FSM</STATE>*/
  99.                 /*%FSM<STATE "hide_distant_obj">*/
  100.                 class hide_distant_obj
  101.                 {
  102.                         name = "hide_distant_obj";
  103.                         itemno = 2;
  104.                         init = /*%FSM<STATEINIT""">*/"_oldPersistent = +BIS_persistent;" \n
  105.                          "_t = time;" \n
  106.                          "" \n
  107.                          "if (count _missionObjs == 0) then {_missionObjs = call _grabMissionObjs;};" \n
  108.                          "" \n
  109.                          "_hidden = +_toHide;" \n
  110.                          "_toHide = [];" \n
  111.                          "" \n
  112.                          "_checkFor_grps = [];" \n
  113.                          "_checkFor = [];" \n
  114.                          "{if (!(group _x in _checkFor_grps)) then {_checkFor_grps = _checkFor_grps + [group _x]}} forEach (playableUnits + switchableUnits);" \n
  115.                          "{_checkFor = _checkFor + units _x} forEach _checkFor_grps;" \n
  116.                          "{_x setVariable [""BIS_FPS_lastPos"", position vehicle _x, TRUE]} forEach _checkFor;" \n
  117.                          "" \n
  118.                          "{" \n
  119.                          "      _obj = _x;" \n
  120.                          "      if (count crew _obj == 0 && !((side _obj) in [sideLogic, sideUnknown])) then {" \n
  121.                          "              if ({_obj distance _x < _freezeDist} count _checkFor == 0 && !(_obj in _toHide)) then {" \n
  122.                          "                      _toHide = _toHide + [_obj];" \n
  123.                          "              }" \n
  124.                          "      } else {" \n
  125.                          "              if (!(_obj in _toHide) && !((side _obj) in [sideLogic, sideUnknown])) then {" \n
  126.                          "                      if ({_obj distance _x < _freezeDist} count _checkFor == 0 && leader _obj == _obj) then {" \n
  127.                          "                              {_toHide = _toHide + [_x]; if (!(vehicle _x in _toHide)) then {_toHide = _toHide + [vehicle _x]}} forEach units group _obj;" \n
  128.                          "                      }" \n
  129.                          "              }" \n
  130.                          "      }" \n
  131.                          "} forEach _missionObjs;" \n
  132.                          "" \n
  133.                          "{_x hideObject FALSE; _x enableSimulation TRUE} forEach (_hidden - _toHide + BIS_persistent);" \n
  134.                          "{_x hideObject TRUE; _x enableSimulation FALSE} forEach (_toHide - _hidden);" \n
  135.                          "" \n
  136.                          "if (isNil ""BIS_fps_manager_init"") then {BIS_fps_manager_init = TRUE};"/*%FSM</STATEINIT""">*/;
  137.                         precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  138.                         class Links
  139.                         {
  140.                                 /*%FSM<LINK "setPos_d">*/
  141.                                 class setPos_d
  142.                                 {
  143.                                         itemno = 4;
  144.                                         priority = 0.000000;
  145.                                         to="hide_distant_obj";
  146.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  147.                                         condition=/*%FSM<CONDITION""">*/"{vehicle _x distance (_x getVariable ""BIS_FPS_lastPos"") > (_freezeDist / 4)} count _checkFor > 0"/*%FSM</CONDITION""">*/;
  148.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  149.                                 };
  150.                                 /*%FSM</LINK>*/
  151.                                 /*%FSM<LINK "airborne">*/
  152.                                 class airborne
  153.                                 {
  154.                                         itemno = 5;
  155.                                         priority = 0.000000;
  156.                                         to="show_all_objects";
  157.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  158.                                         condition=/*%FSM<CONDITION""">*/"{vehicle _x isKindOf ""Air""} count _checkFor > 0"/*%FSM</CONDITION""">*/;
  159.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  160.                                 };
  161.                                 /*%FSM</LINK>*/
  162.                                 /*%FSM<LINK "rescan_new_objec">*/
  163.                                 class rescan_new_objec
  164.                                 {
  165.                                         itemno = 10;
  166.                                         priority = 0.000000;
  167.                                         to="scan_for_new_obj";
  168.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  169.                                         condition=/*%FSM<CONDITION""">*/"BIS_fps_rescanNewObjects || (count _oldPersistent != count BIS_persistent) || (time > 0 && !_afterStartCheck)"/*%FSM</CONDITION""">*/;
  170.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  171.                                 };
  172.                                 /*%FSM</LINK>*/
  173.                                 /*%FSM<LINK "moved_far_enough">*/
  174.                                 class moved_far_enough
  175.                                 {
  176.                                         itemno = 3;
  177.                                         priority = 0.000000;
  178.                                         to="hide_distant_obj";
  179.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  180.                                         condition=/*%FSM<CONDITION""">*/"time > _t + 10 && {vehicle _x distance (_x getVariable ""BIS_FPS_lastPos"") > (_freezeDist / 4)} count _checkFor > 0" \n
  181.                                          ""/*%FSM</CONDITION""">*/;
  182.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  183.                                 };
  184.                                 /*%FSM</LINK>*/
  185.                         };
  186.                 };
  187.                 /*%FSM</STATE>*/
  188.                 /*%FSM<STATE "show_all_objects">*/
  189.                 class show_all_objects
  190.                 {
  191.                         name = "show_all_objects";
  192.                         itemno = 6;
  193.                         init = /*%FSM<STATEINIT""">*/"{_x hideObject FALSE; _x enableSimulation TRUE} forEach _missionObjs;"/*%FSM</STATEINIT""">*/;
  194.                         precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  195.                         class Links
  196.                         {
  197.                                 /*%FSM<LINK "on_land">*/
  198.                                 class on_land
  199.                                 {
  200.                                         itemno = 7;
  201.                                         priority = 0.000000;
  202.                                         to="hide_distant_obj";
  203.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  204.                                         condition=/*%FSM<CONDITION""">*/"{vehicle _x isKindOf ""Air""} count _checkFor == 0"/*%FSM</CONDITION""">*/;
  205.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  206.                                 };
  207.                                 /*%FSM</LINK>*/
  208.                         };
  209.                 };
  210.                 /*%FSM</STATE>*/
  211.                 /*%FSM<STATE "scan_for_new_obj">*/
  212.                 class scan_for_new_obj
  213.                 {
  214.                         name = "scan_for_new_obj";
  215.                         itemno = 11;
  216.                         init = /*%FSM<STATEINIT""">*/"_afterStartCheck = TRUE;" \n
  217.                          "BIS_fps_rescanNewObjects = FALSE;" \n
  218.                          "" \n
  219.                          "_missionObjs = call _grabMissionObjs;"/*%FSM</STATEINIT""">*/;
  220.                         precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  221.                         class Links
  222.                         {
  223.                                 /*%FSM<LINK "always">*/
  224.                                 class always
  225.                                 {
  226.                                         itemno = 12;
  227.                                         priority = 0.000000;
  228.                                         to="hide_distant_obj";
  229.                                         precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  230.                                         condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  231.                                         action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  232.                                 };
  233.                                 /*%FSM</LINK>*/
  234.                         };
  235.                 };
  236.                 /*%FSM</STATE>*/
  237.         };
  238.         initState="START";
  239.         finalStates[] =
  240.         {
  241.         };
  242. };
  243. /*%FSM</COMPILE>*/

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at