Epoch/Sources/epoch_code/System/Sapper_Brain.fsm

1871 lines
68 KiB
Plaintext
Raw Normal View History

2015-09-14 20:55:36 +00:00
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, sapper">*/
/*%FSM<HEAD>*/
/*
item0[] = {"sapper",0,4346,-225.000000,-325.000000,-125.000000,-275.000000,0.000000,"sapper"};
item1[] = {"_",8,218,75.000000,-200.000000,125.000000,-175.000000,0.000000,""};
item2[] = {"instinct",2,250,150.000000,-200.000000,250.000000,-150.000000,0.000000,"instinct"};
item3[] = {"no_decision",4,218,375.000000,-125.000000,475.000000,-75.000000,95.000000,"no decision"};
item4[] = {"action",2,250,150.000000,125.000000,250.000000,175.000000,0.000000,"action"};
item5[] = {"dispose",4,218,25.000000,-350.000000,125.000000,-300.000000,80.000000,"dispose"};
item6[] = {"_",8,218,125.406227,636.108887,177.358261,664.513977,0.000000,""};
item7[] = {"reset_vars",2,250,-50.000000,-200.000000,50.000000,-150.000000,0.000000,"reset vars"};
item8[] = {"complete",4,218,56.428787,-94.767609,146.429047,-44.767593,110.000000,"complete"};
item9[] = {"stalk",4,218,-50.000000,0.000000,50.000000,50.000000,50.000000,"stalk"};
item10[] = {"pre_boom",2,250,525.000000,225.000000,625.000000,275.000000,0.000000,"pre boom"};
item11[] = {"dispose",4,218,375.000000,125.000000,475.000000,175.000000,95.000000,"dispose"};
item12[] = {"loiter_large",4,218,250.000000,350.000000,350.000000,400.000000,30.000000,"loiter large"};
item13[] = {"check_threat",4,218,675.000000,-175.000000,775.000000,-125.000000,80.000000,"check threat"};
item14[] = {"instinct_done",4,218,150.000000,-100.000000,250.000000,-50.000000,100.000000,"instinct done"};
item15[] = {"charge",4,218,250.000000,-375.000000,350.000000,-325.000000,50.000000,"charge"};
item16[] = {"wait_action",4,218,375.000000,25.000000,475.000000,75.000000,100.000000,"wait action"};
item17[] = {"checking_status",2,250,625.000000,-50.000000,725.000000,0.000000,0.000000,"checking status"};
item18[] = {"choose_target",4,218,600.000000,-200.000000,700.000000,-150.000000,90.000000,"choose target"};
item19[] = {"final_checks",4,218,725.000000,25.000000,825.000000,75.000000,10.000000,"final checks"};
item20[] = {"done",4,218,475.000000,-50.000000,575.000000,0.000000,100.000000,"done"};
item21[] = {"loiter",4,218,375.000000,-300.000000,475.000000,-250.000000,30.000000,"loiter"};
item22[] = {"return",2,250,350.000000,-50.000000,450.000000,0.000000,0.000000,"return"};
item23[] = {"to_action",4,218,275.000000,25.000000,375.000000,75.000000,10.000000,"to action"};
item24[] = {"to_instinct",4,218,275.000000,-125.000000,375.000000,-75.000000,5.000000,"to instinct"};
item25[] = {"boom",4,218,375.000000,175.000000,475.000000,225.000000,90.000000,"boom"};
item26[] = {"reset",2,250,100.000000,500.000000,200.000000,550.000000,0.000000,"reset"};
item27[] = {"loiter_small",4,218,300.000000,325.000000,400.000000,375.000000,20.000000,"loiter small"};
item28[] = {"groan",4,218,175.000000,-400.000000,275.000000,-350.000000,60.000000,"groan"};
item29[] = {"charge",4,218,-50.000000,175.000000,50.000000,225.000000,70.000000,"charge"};
item30[] = {"stalking",4,218,-50.000000,50.000000,50.000000,100.000000,5.000000,"stalking"};
item31[] = {"Wait_random",4,218,-225.000000,-200.000000,-125.000000,-150.000000,10.000000,"Wait random"};
item32[] = {"groan",4,218,200.000000,375.000000,300.000000,425.000000,5.000000,"groan"};
item33[] = {"nest",4,218,375.000000,225.000000,475.000000,275.000000,10.000000,"nest"};
item34[] = {"detonate",4,218,100.000000,-375.000000,200.000000,-325.000000,70.000000,"detonate"};
item35[] = {"nest",4,218,-25.000000,-300.000000,75.000000,-250.000000,90.000000,"nest"};
item36[] = {"find_nest",2,250,525.000000,300.000000,625.000000,350.000000,0.000000,"find nest"};
item37[] = {"not_suitable",4,218,425.000000,375.000000,525.000000,425.000000,10.000000,"not suitable"};
item38[] = {"suitable",4,218,525.000000,375.000000,625.000000,425.000000,20.000000,"suitable"};
item39[] = {"none_found",4,218,375.000000,275.000000,475.000000,325.000000,30.000000,"none found"};
item40[] = {"make_nest",2,250,700.000000,375.000000,800.000000,425.000000,0.000000,"make nest"};
item41[] = {"_",8,218,625.000000,425.000000,675.000000,450.000000,0.000000,""};
item42[] = {"nest_disturbed",4,218,850.000000,450.000000,950.000000,500.000000,30.000000,"nest disturbed"};
item43[] = {"ba_boom",2,250,975.000000,450.000000,1075.000000,500.000000,0.000000,"ba boom"};
item44[] = {"groan",4,218,700.000000,550.000000,800.000000,600.000000,20.000000,"groan"};
item45[] = {"end",1,250,975.000000,0.000000,1075.000000,50.000000,0.000000,"end"};
item46[] = {"Wait_to_delete",4,218,975.000000,150.000000,1075.000000,200.000000,10.000000,"Wait to delete"};
item47[] = {"handle_dispose",2,250,525.000000,125.000000,625.000000,175.000000,0.000000,"handle dispose"};
item48[] = {"Wait_1_5_sec",4,218,650.000000,300.000000,750.000000,350.000000,0.000000,"Wait" \n "1.5 sec"};
item49[] = {"do_boom",2,250,650.000000,225.000000,750.000000,275.000000,0.000000,"do boom"};
item50[] = {"_",8,218,800.000000,250.000000,850.000000,275.000000,0.000000,""};
item51[] = {"do_groan",2,250,225.000000,500.000000,325.000000,550.000000,0.000000,"do groan"};
item52[] = {"do_stalk",2,250,-200.000000,50.000000,-100.000000,100.000000,0.000000,"do stalk"};
item53[] = {"do_loiter_big",2,250,350.000000,500.000000,450.000000,550.000000,0.000000,"do loiter big"};
item54[] = {"do_loiter_small",2,250,475.000000,500.000000,575.000000,550.000000,0.000000,"do loiter small"};
item55[] = {"do_charge",2,250,-200.000000,225.000000,-100.000000,275.000000,0.000000,"do charge"};
item56[] = {"hide",4,218,25.000000,325.000000,125.000000,375.000000,60.000000,"hide"};
item57[] = {"check_target",4,218,750.000000,-150.000000,850.000000,-100.000000,60.000000,"check target"};
item58[] = {"hide",4,218,325.000000,-350.000000,425.000000,-300.000000,40.000000,"hide"};
item59[] = {"find_spot",2,250,-200.000000,400.000000,-100.000000,450.000000,0.000000,"find spot"};
item60[] = {"not_safe",4,218,-250.000000,500.000000,-150.000000,550.000000,10.000000,"not safe"};
item61[] = {"is_safe",4,218,-150.000000,500.000000,-50.000000,550.000000,5.000000,"is safe"};
item62[] = {"do_hide",2,250,-150.000000,625.000000,-50.000000,675.000000,0.000000,"do hide"};
item63[] = {"smoke",2,250,775.000000,150.000000,875.000000,200.000000,0.000000,"smoke"};
item64[] = {"charged",4,218,-50.000000,275.000000,50.000000,325.000000,10.000000,"charged"};
item65[] = {"_",8,218,125.000000,375.000000,175.000000,400.000000,0.000000,""};
item66[] = {"circled",4,218,-50.000000,100.000000,50.000000,150.000000,10.000000,"circled"};
item67[] = {"stuck",4,218,800.000000,-25.000000,900.000000,25.000000,30.000000,"stuck"};
item68[] = {"monitor_nest",2,250,700.000000,450.000000,800.000000,500.000000,0.000000,"monitor nest"};
item69[] = {"target_near",4,218,800.000000,550.000000,900.000000,600.000000,10.000000,"target near"};
item70[] = {"shuffle",4,218,600.000000,550.000000,700.000000,600.000000,25.000000,"shuffle"};
item71[] = {"shot",4,218,650.000000,150.000000,750.000000,200.000000,5.000000,"shot"};
item72[] = {"feeling",4,218,800.000000,-100.000000,900.000000,-50.000000,50.000000,"feeling"};
item73[] = {"charging",4,218,-50.000000,225.000000,50.000000,275.000000,5.000000,"charging"};
item74[] = {"stalk",4,218,375.000000,-225.000000,475.000000,-175.000000,20.000000,"stalk"};
item75[] = {"not_shot",4,218,900.000000,125.000000,1000.000000,175.000000,10.000000,"not shot"};
item76[] = {"finished_boom",2,250,900.000000,225.000000,1000.000000,275.000000,0.000000,"finished boom"};
item77[] = {"pre_vars",4,218,525.000000,-175.000000,625.000000,-125.000000,95.000000,"pre vars"};
link0[] = {0,31};
link1[] = {1,2};
link2[] = {2,3};
link3[] = {2,5};
link4[] = {2,14};
link5[] = {2,15};
link6[] = {2,21};
link7[] = {2,28};
link8[] = {2,34};
link9[] = {2,35};
link10[] = {2,58};
link11[] = {2,74};
link12[] = {3,17};
link13[] = {4,8};
link14[] = {4,9};
link15[] = {4,11};
link16[] = {4,12};
link17[] = {4,16};
link18[] = {4,25};
link19[] = {4,27};
link20[] = {4,29};
link21[] = {4,32};
link22[] = {4,33};
link23[] = {4,56};
link24[] = {5,2};
link25[] = {6,26};
link26[] = {7,1};
link27[] = {8,7};
link28[] = {9,52};
link29[] = {10,48};
link30[] = {11,47};
link31[] = {12,53};
link32[] = {13,17};
link33[] = {14,4};
link34[] = {15,2};
link35[] = {16,17};
link36[] = {17,13};
link37[] = {17,18};
link38[] = {17,19};
link39[] = {17,20};
link40[] = {17,57};
link41[] = {17,67};
link42[] = {17,72};
link43[] = {17,77};
link44[] = {18,17};
link45[] = {19,17};
link46[] = {20,22};
link47[] = {21,2};
link48[] = {22,23};
link49[] = {22,24};
link50[] = {23,4};
link51[] = {24,2};
link52[] = {25,10};
link53[] = {26,65};
link54[] = {27,54};
link55[] = {28,2};
link56[] = {29,55};
link57[] = {30,4};
link58[] = {31,7};
link59[] = {32,51};
link60[] = {33,36};
link61[] = {34,2};
link62[] = {35,2};
link63[] = {36,37};
link64[] = {36,38};
link65[] = {36,39};
link66[] = {37,36};
link67[] = {38,40};
link68[] = {39,4};
link69[] = {40,41};
link70[] = {41,68};
link71[] = {42,43};
link72[] = {43,46};
link73[] = {44,68};
link74[] = {46,45};
link75[] = {47,71};
link76[] = {47,75};
link77[] = {48,49};
link78[] = {49,50};
link79[] = {50,76};
link80[] = {51,6};
link81[] = {52,30};
link82[] = {52,66};
link83[] = {53,6};
link84[] = {54,6};
link85[] = {55,64};
link86[] = {55,73};
link87[] = {56,59};
link88[] = {57,17};
link89[] = {58,2};
link90[] = {59,60};
link91[] = {59,61};
link92[] = {60,59};
link93[] = {61,62};
link94[] = {62,6};
link95[] = {63,50};
link96[] = {64,4};
link97[] = {65,4};
link98[] = {66,4};
link99[] = {67,17};
link100[] = {68,42};
link101[] = {68,44};
link102[] = {68,69};
link103[] = {68,70};
link104[] = {69,68};
link105[] = {70,68};
link106[] = {71,63};
link107[] = {72,17};
link108[] = {73,4};
link109[] = {74,2};
link110[] = {75,76};
link111[] = {76,46};
link112[] = {77,17};
globals[] = {25.000000,1,0,0,16777215,640,480,1,250,6316128,1,-262.051422,848.157593,315.865601,-539.311218,949,731,1};
window[] = {2,-1,-1,-1,-1,609,282,1307,84,3,967};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "sapper";
class States
{
/*%FSM<STATE "sapper">*/
class sapper
{
name = "sapper";
init = /*%FSM<STATEINIT""">*/"_sapper = _this select 0;" \n
"_sBomb = _this select 1;" \n
"_head = objNull;" \n
"_lastAlert = diag_tickTime;" \n
"_trgt = player;" \n
"" \n
"_sapper setBehaviour ""STEALTH"";" \n
"_sapper setUnitPos ""UP""; " \n
"" \n
"_entsArr = [""Epoch_Male_F"",""Epoch_Female_F"",""Epoch_Sapper_F"",""Fin_random_EPOCH"",""Alsatian_Random_EPOCH"",""Epoch_cloak_F"",""b_survivor_F"",""Epoch_Female_Camo_F""];" \n
"_trgtArr = [""Epoch_Man_Base_F"",""Epoch_Female_base_F""];" \n
"" \n
"" \n
"//Behaviour Vars" \n
"_detonateDistMax = getNumber (missionConfigFile >> ""CfgEpochSapper"" >> ""detonateDistMax"");//Random distance between 3 and this at which to detonate" \n
"_groanTrig = getNumber (missionConfigFile >> ""CfgEpochSapper"" >> ""groanTrig"");//Percentage chance of groan." \n
"_sRange = getNumber (missionConfigFile >> ""CfgEpochSapper"" >> ""sRange"") min 500;//Escape distance, range for sapper to look for current target(s)" \n
"_sHideTrig = 72;//Sapper will hide if fear rises above this level." \n
"_chargeTrig = 54;//Charges at this level of anger" \n
"_sHardness = floor (random 6) max 1;//LEvel to drop anger and fear as sapper calms down" \n
"_rndNest = floor (random 100);//1 in 100 chance of sapper creating a nest when spawned." \n
"_checkFreq = 2.5;//Frequency of live status check. Lower makes sapper quicker to respond to new stimulus." \n
"_welcomeWait = floor (random 18);//Random pause before sapper announces his presence" \n
"_config = 'CfgEpochClient' call EPOCH_returnConfig;" \n
"_jammerRange = getNumber(_config >> ""buildingJammerRange"");" \n
"_smellDist = getNumber (missionConfigFile >> ""CfgEpochSapper"" >> ""smellDist"");//Based on wind direction" \n
"_smellDistPerm = 24;" \n
"" \n
"//Check config vars" \n
"" \n
"if(_detonateDistMax < 4)then{_detonateDistMax = 8;};" \n
"if(_groanTrig < 4)then{_groanTrig = 16;};" \n
"if(_sRange < 150)then{_sRange = 300;};" \n
"if(_smellDist < 8)then{_smellDist = 24;};" \n
"" \n
"_vehArray = [""Car""];" \n
"_trgt = player;" \n
"_requestDispose = false;" \n
"" \n
"_nrstTrgt = objNull;" \n
"_lowDist = 0;" \n
"_currDist = 0;" \n
"_filterBuilds = [""Land_i_Addon_03_V1_F"",""Land_Offices_01_V1_F""];" \n
"_t = diag_tickTime;" \n
"_u = _t;" \n
"_c = _u;" \n
"_f = _c;" \n
"_h = _f;" \n
"_d2 = _h;" \n
"" \n
"" \n
"" \n
"_dirTo = 0;" \n
"_lDist = 0;" \n
"_checkEntry = """";" \n
"" \n
"_decisionMade = false;" \n
"_actionDone = false;" \n
"_sapperPos=[0,0,0];" \n
"_trgtPos=[0,0,0];" \n
"_hidePos = [0,0,0];" \n
"_nrPlyrs = [];" \n
"_circlePos = [0,0,0];" \n
"_behindPos = [0,0,0];" \n
"_sSide = 90;" \n
"_lastPos = [0,0,0];" \n
"_spottedPos = [0,0,0];" \n
"_lastAction = """";" \n
"_maxStalkDist = 48;" \n
"_maxStalkDistPerm = 48;" \n
"_minStalkDist = 12;" \n
"_minStalkDistPerm = 12;" \n
"_doWander = false;" \n
"_callHide = false;" \n
"_callBoom = false;" \n
"_callCharge = false;" \n
"_doneBoom = false;" \n
"" \n
"//Feeling vars" \n
"_sAnger = 50;" \n
"_sFear = 50;" \n
"_threateLevel = 0;" \n
"_addThreat = 0;" \n
"_sHit = [objNull, 0];" \n
"_sFiredNear = [objNull, 0];" \n
"" \n
"_stuckCount = 0;" \n
"" \n
"//Nest vars" \n
"" \n
"_nrBuild = nearestBuilding _sapper;" \n
"_doNest = false;" \n
"_nrBuild = objNull;" \n
"_nrBuild = [];" \n
"" \n
"_traderDispose = false;" \n
"" \n
"_doMove = false;" \n
"_sanityCheckDone = false;" \n
"_canSee = (!lineIntersects [aimPos _sapper, eyePos _trgt, _sapper, _trgt]);" \n
"_nrTrgts = [];" \n
"_threatLevel = 0;" \n
"_trgtDist = _trgt distance _sapper;" \n
"_sanityCheck = 0;" \n
"" \n
"" \n
"_doHide = false;" \n
"_doAttack = false;" \n
"_firedNear = 0;" \n
"" \n
"_randomGroan = {" \n
"_sounds = [""sapper_groan0"",""sapper_groan1"",""sapper_groan2""];" \n
"_sound = _sounds select (floor (random (count _sounds)));" \n
"" \n
"_sapper say3D _sound;" \n
"EPOCH_say3D_PVS = [player, _sapper,(EPOCH_sounds find _sound), Epoch_personalToken];" \n
"publicVariableServer ""EPOCH_say3D_PVS"";" \n
"};" \n
"" \n
"_doInterrupt = {" \n
"_actionDone = true;" \n
"_criteria = ""(true)"";" \n
"};" \n
"" \n
"//DEBUG" \n
"_jammerRange = 75;" \n
"//_rndNest = 1;" \n
"//_debugDo = ""START"";" \n
"//_mkrName = """";" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Wait_random">*/
class Wait_random
{
priority = 10.000000;
to="reset_vars";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _t) > _welcomeWait;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"call _randomGroan;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "instinct">*/
class instinct
{
name = "instinct";
init = /*%FSM<STATEINIT""">*/"_t = diag_tickTime;" \n
"//systemchat format[""I %1"",diag_tickTime];" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "instinct_done">*/
class instinct_done
{
priority = 100.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_decisionMade;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_t = diag_tickTime;" \n
"_decisionMade = false;" \n
"_actionDone = false;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "no_decision">*/
class no_decision
{
priority = 95.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_decisionMade && (diag_tickTime > _u + _checkFreq);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_checkEntry = ""instinct"";" \n
"_sanityCheck = 100;" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "nest">*/
class nest
{
priority = 90.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_rndNest < 1.5;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doNest = true;" \n
"_decisionMade = true;" \n
"_rndNest = 100;" \n
"" \n
"//_debugDo = ""NEST"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "dispose">*/
class dispose
{
priority = 80.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_trgt distance _sapper) > _sRange || !(alive _sapper) || _traderDispose;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doDispose = true;" \n
"_decisionMade = true;" \n
"_actionDone = false;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "detonate">*/
class detonate
{
priority = 70.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_callBoom || ((_trgtDist < _detonateDist) && _canSee);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_decisionMade = true;" \n
"_doBoom = true;" \n
"" \n
"//_debugDo = ""DETONATE"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "groan">*/
class groan
{
priority = 60.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_groanRnd < _groanTrig;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doGroan = true;" \n
"_decisionMade = true;" \n
"" \n
"" \n
"//_debugDo = ""GROAN"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "charge">*/
class charge
{
priority = 50.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_callCharge || (_canSee && (_sAnger > _chargeTrig || _trgtDist < _smellDist));"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doCharge = true;" \n
"_decisionMade = true;" \n
"" \n
"//_debugDo = ""CHARGE"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "hide">*/
class hide
{
priority = 40.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_callHide || (_sFear > _sHideTrig);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doHide = true;" \n
"_decisionMade = true;" \n
"" \n
"//_debugDo = ""HIDE"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "loiter">*/
class loiter
{
priority = 30.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sFear < _sHideTrig && _trgtDist < 25 && !_canSee;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doLoiter = true;" \n
"_loiterType = random 66;" \n
"_decisionMade = true;" \n
"" \n
"//_debugDo = ""LOITER"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "stalk">*/
class stalk
{
priority = 20.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_canSee;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doStalk= true;" \n
"_decisionMade = true;" \n
"" \n
"//_debugDo = ""STALK"";" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "action">*/
class action
{
name = "action";
init = /*%FSM<STATEINIT""">*/"//systemchat format[""A %1"",diag_tickTime];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "complete">*/
class complete
{
priority = 110.000000;
to="reset_vars";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_actionDone && (call compile _criteria || (diag_tickTime > (_t + _sWait)));"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"if (!isNil ""_criteriaMetAction"") then {" \n
"call _criteriaMetAction;" \n
"};" \n
"" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "wait_action">*/
class wait_action
{
priority = 100.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"diag_tickTime > _u + _checkFreq;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_checkEntry = ""action"";" \n
"_sanityCheck = 100;" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "dispose">*/
class dispose
{
priority = 95.000000;
to="handle_dispose";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_doDispose || !(alive _sapper));"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "boom">*/
class boom
{
priority = 90.000000;
to="pre_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doBoom;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "charge">*/
class charge
{
priority = 70.000000;
to="do_charge";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doCharge || _charging;" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doCharge = false;" \n
"_callCharge = false;" \n
"_lastAction = ""charge"";" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "hide">*/
class hide
{
priority = 60.000000;
to="find_spot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doHide;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doHide = false;" \n
"_callHide = false;" \n
"_posSafe = false;" \n
"_lastAction = ""hide"";" \n
"_sapper setBehaviour ""CARELESS"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "stalk">*/
class stalk
{
priority = 50.000000;
to="do_stalk";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doStalk || _stalking;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doStalk = false;" \n
"_lastAction = ""stalk"";" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "loiter_large">*/
class loiter_large
{
priority = 30.000000;
to="do_loiter_big";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doLoiter && (_loiterType > 33);"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doLoiter = false;" \n
"_lastAction = ""loiter"";" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "loiter_small">*/
class loiter_small
{
priority = 20.000000;
to="do_loiter_small";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doLoiter && (_loiterType < 34);" \n
"" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doLoiter = false;" \n
"_lastAction = ""loiter"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "nest">*/
class nest
{
priority = 10.000000;
to="find_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doNest;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_nrBuilds = nearestObjects [getPos _sapper,[""house""],500];" \n
"_nrBuild = nearestBuilding _sapper;" \n
"_jammers = nearestObjects[position _sapper, [""PlotPole_EPOCH""], _jammerRange];" \n
"_arrNest = [];" \n
"_nestFind = 0;" \n
"_s = diag_tickTime;" \n
"" \n
"" \n
"_doNest = false;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "groan">*/
class groan
{
priority = 5.000000;
to="do_groan";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_doGroan;" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_doGroan = false;" \n
"_lastAction = ""groan"";" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "reset_vars">*/
class reset_vars
{
name = "reset_vars";
init = /*%FSM<STATEINIT""">*/"//Saper Vars" \n
"_doStalk = false;" \n
"_stalking = false;" \n
"" \n
"_doLoiter = false;" \n
"_loiterType = 0;" \n
"" \n
"_doCharge = false;" \n
"_charging = false;" \n
"_chargeCount = 0;" \n
"_attempts = 0;" \n
"" \n
"_doBoom = false;" \n
"_doGroan = false;" \n
"" \n
"_rnd = 0;" \n
"_sWait = 0;" \n
"_doDispose = false;" \n
"_chooseTarget = false;" \n
"_t = diag_tickTime;" \n
"_detonateDist = (floor(random _detonateDistMax)) max 4;" \n
"_groanRnd = random 100;" \n
"_hideRnd = random 100;" \n
"_nrTrgts=[];" \n
"_doHide = false;" \n
"_moveTo = [0,0,0];" \n
"_spottedPos = [0,0,0];" \n
"" \n
"" \n
"//Brain Vars" \n
"_override = false;" \n
"_criteria =""(false)"";" \n
"_criteriaMet = false;" \n
"_criteriaMetAction = nil;" \n
"_allowInterrupt = false;" \n
"_interruptReason = ""(false)"";" \n
"" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "pre_boom">*/
class pre_boom
{
name = "pre_boom";
init = /*%FSM<STATEINIT""">*/"_t = diag_tickTime;" \n
"" \n
"_sound = ""sapper_explode"";" \n
"_sapper say3D _sound;" \n
"EPOCH_say3D_PVS = [player,_sapper,(EPOCH_sounds find _sound),Epoch_personalToken];" \n
"publicVariableServer ""EPOCH_say3D_PVS"";" \n
"_sapper playMoveNow ""Unconscious"";" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Wait_1_5_sec">*/
class Wait_1_5_sec
{
priority = 0.000000;
to="do_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _t) > 1.5"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "checking_status">*/
class checking_status
{
name = "checking_status";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "done">*/
class done
{
priority = 100.000000;
to="return";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck < 1;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "pre_vars">*/
class pre_vars
{
priority = 95.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 95;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_windDir = winddir;" \n
"" \n
"_sanityCheck = 95;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "choose_target">*/
class choose_target
{
priority = 90.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 90;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_nrstTrgt = objNull;" \n
"_nrTrgts = getPos _sapper nearEntities [_trgtArr, _sRange];" \n
"_lowDist = _sRange;" \n
"" \n
"_upwindPos = [_sapper, _smellDistPerm, _windDir] call BIS_fnc_relPos;" \n
"_upWindTrgts = _upwindPos nearEntities [_trgtArr, 12];" \n
"" \n
"if(count _upWindTrgts > 0)then{" \n
"_smellDist = _smellDistPerm + 12;" \n
"};" \n
"" \n
"{" \n
"if (alive _x) then {" \n
"_currDist = _x distance _sapper;" \n
" if (_currDist < _lowDist) then {" \n
" _nrstTrgt = _x;" \n
" _lowDist = _currDist;" \n
" };" \n
"};" \n
"}forEach _nrTrgts;" \n
"" \n
"if (!isNull _nrstTrgt) then {" \n
"_trgt = _nrstTrgt;" \n
"};" \n
"_sanityCheck = 90;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "check_threat">*/
class check_threat
{
priority = 80.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 80;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_avDist = 0;" \n
"_tDist = 0;" \n
"_wepCount = 0;" \n
"_addThreat = 0;" \n
"" \n
"_nrTrgtCount = (count _nrTrgts);" \n
"if (_nrTrgtCount>0) then {" \n
"{" \n
" if ((typeof _x) in _trgtArr) then {" \n
"" \n
" if!((currentWeapon _x) == """") then {" \n
" _tDist = _tDist + (_x distance _sapper);" \n
"" \n
" if!(lineIntersects [aimPos _sapper, eyePos _x, _sapper, _x]) then {" \n
" _wepCount = _wepCount + 1;" \n
" };" \n
"" \n
" };" \n
"" \n
" };" \n
"}forEach _nrTrgts;" \n
"" \n
"_avDist = _tDist / _nrTrgtCount;" \n
"_addThreat = _wepCount;" \n
"" \n
"" \n
"};" \n
"" \n
"" \n
"_sanityCheck = 80;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "check_target">*/
class check_target
{
priority = 60.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 60;" \n
"" \n
"" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"_trgtDist = _sapper distance _trgt;" \n
"_canSee = ((!lineIntersects [eyePos _sapper, aimPos _trgt, _sapper, _trgt]) && _trgtDist < _smellDist);" \n
"_trgtPos = getPosATL _trgt;" \n
"" \n
"" \n
"_sanityCheck = 60;" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "feeling">*/
class feeling
{
priority = 50.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 50;" \n
"" \n
"" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"if (_sFiredNear select 1 >0 && _sFiredNear select 1 < 50) then {" \n
"_sAnger = _sAnger + 6;" \n
"_sFear = _sFear + 4;" \n
"if (isPlayer (_sHit select 0)) then {" \n
"_trgt = _sHit select 0;" \n
"};" \n
"};" \n
"" \n
"if (_sHit select 1>0) then {" \n
"_sAnger = _sAnger + 12;" \n
"_sFear = _sFear + 8;" \n
"if (isPlayer (_sHit select 0)) then {" \n
"_trgt = _sHit select 0;" \n
"};" \n
"};" \n
"" \n
"//Can see target grrr" \n
"if (_canSee) then {" \n
"_sAnger = _sAnger + 2;" \n
"};" \n
"" \n
"//can see armed targets" \n
"if (_addThreat > 0) then {" \n
"_sFear = _sFear + _addThreat;" \n
"};" \n
"" \n
"//calm down calm down" \n
"if (diag_tickTime > _f + 60) then {" \n
"_sAnger = _sAnger - _sHardness;" \n
"_sFear = _sFear - _sHardness;" \n
"_f = diag_tickTime;" \n
"};" \n
"" \n
"" \n
"_sanityCheck = 50;" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "stuck">*/
class stuck
{
priority = 30.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 30;" \n
"" \n
"" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"if (_lastPos distance (getPos _sapper) < 0.5) then {" \n
"" \n
"if (!(_moveTo isEqualTo [0,0,0])) then {" \n
"_sapper moveTo _moveTo;" \n
"};" \n
"" \n
"_stuckCount = _stuckCount + 1;" \n
"}else{" \n
"" \n
"_lastPos = getPos _sapper;" \n
"" \n
"};" \n
"_sanityCheck = 30;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "final_checks">*/
class final_checks
{
priority = 10.000000;
to="checking_status";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sanityCheck > 10;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_sFiredNear = [objNull, 0];" \n
"_sHit = [objNull, 0];" \n
"" \n
"_sAnger =_sAnger min 100 max 0;" \n
"_sFear =_sFear min 100 max 0;" \n
"" \n
"//Interrupt cuurent action" \n
"//if (_sAnger > 80) then {" \n
"//_actionDone = true;" \n
"//_cirteria = ""(true)"";" \n
"//};" \n
"" \n
"" \n
"//Blow up if stuck" \n
"if (_stuckCount > 12 && _sWait < 1) then {" \n
"_callBoom = true;" \n
"call _doInterrupt;" \n
"//Call another sapper in here ?" \n
"};" \n
"" \n
"//Charge if player suddenly in view and anger at correct level" \n
"if (_lastAction!=""charge"" && _trgtDist > _detonateDist && _canSee && _sAnger > _chargeTrig) then {" \n
"call _randomGroan;" \n
"_callCharge = true;" \n
"call _doInterrupt;" \n
"};" \n
"" \n
"" \n
"//Detonate near very close player" \n
"if (_trgtDist < _detonateDist && _canSee) then {" \n
"_callBoom = true;" \n
"call _doInterrupt;" \n
"};" \n
"" \n
"//Interrupt and hide if scared and player suddenly in view" \n
"if (_lastAction!=""hide"" && _trgtDist > _detonateDist && _canSee && _sFear > _sHideTrig) then {" \n
"call _randomGroan;" \n
"_callHide = true;" \n
"call _doInterrupt;" \n
"};" \n
"" \n
"" \n
"//Change pathfinding" \n
"if (_trgtDist>25) then {" \n
"_sapper setBehaviour ""CARELESS"";" \n
"}else{" \n
"_sapper setBehaviour ""STEALTH"";" \n
"};" \n
"" \n
"//Change anger at distance" \n
"//if (_trgtDist>48) then {" \n
"//_sAnger = _sAnger + 1;" \n
"//};" \n
"" \n
"//Hiding makes him angry" \n
"if (_lastAction == ""hide"") then {" \n
"_sAnger = _sAnger + 2;" \n
"};" \n
"" \n
"//Log last seen position for stalking" \n
"if (_canSee) then {" \n
"_spottedPos = getPos _trgt;" \n
"//Reset Charge Count" \n
"_attempts = 0;" \n
"};" \n
"" \n
"//Set stalking distance based on fear." \n
"if (_sFear > 48) then {" \n
"_maxStalkDist = 68;" \n
"}else{" \n
"_maxStalkDist = 42;" \n
"};" \n
"" \n
"//Adjust Max stalk to allow player to lose sapper" \n
"//Done in stalk mode - left fo reference" \n
"//_maxStalkDist = (_maxStalkDistPerm - (_trgtDist / 2));" \n
"//_minStalkDist = (_minStalkDistPerm - (_trgtDist / 3));" \n
"" \n
"//hint format [""SAPPER (%4)\nStalk: %1 / %2\nDist To Trgt Sapper: %3 | Plyr:%6\nSee: %5"",_minStalkDist,_maxStalkDist,_moveTo distance _sapper,_debugDo, _canSee,_moveTo distance _trgt];" \n
"" \n
"_sanityCheck = 0;" \n
"" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "return">*/
class return
{
name = "return";
init = /*%FSM<STATEINIT""">*/"_u = diag_tickTime;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "to_action">*/
class to_action
{
priority = 10.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_checkEntry == ""action"");"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_checkEntry = """";" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "to_instinct">*/
class to_instinct
{
priority = 5.000000;
to="instinct";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_checkEntry == ""instinct"");"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_checkEntry = """";" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "reset">*/
class reset
{
name = "reset";
init = /*%FSM<STATEINIT""">*/"_t = diag_tickTime;" \n
"" \n
"//Check for not found safe Pos" \n
"" \n
"if (_sWait > 100) then {" \n
"_sWait = 12;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "find_nest">*/
class find_nest
{
name = "find_nest";
init = /*%FSM<STATEINIT""">*/"_arrGarr = [];" \n
"_garrCount = 0;" \n
"_noJammer = true;" \n
"" \n
"" \n
"if (damage _nrBuild != 1 && (!((typeOf _nrBuild) in _filterBuilds))) then {" \n
"" \n
"{" \n
"if(_x distance _nrBuild < 22)exitWith{_noJammer = false;};" \n
"}forEach _jammers;" \n
"" \n
"_nestFind = _nestFind + 1;" \n
"_garrisonPos = getPos _nrBuild;" \n
"while {format [""%1"", _nrBuild buildingPos (_garrCount)] != ""[0,0,0]"" } do {" \n
"_arrGarr pushBack _garrCount;" \n
"_garrCount = _garrCount + 1;" \n
"};" \n
"" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "none_found">*/
class none_found
{
priority = 30.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_nestFind > 20 || count _nrBuilds < 1;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_actionDone = true;" \n
"_sWait = 0;" \n
"_criteria = ""(true)"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "suitable">*/
class suitable
{
priority = 20.000000;
to="make_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_garrCount > 4 && _noJammer;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_arrNest pushBack _sapper;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "not_suitable">*/
class not_suitable
{
priority = 10.000000;
to="find_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_garrCount < 4 || !_noJammer;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_nrBuild = _nrBuilds call BIS_fnc_selectRandom;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "make_nest">*/
class make_nest
{
name = "make_nest";
init = /*%FSM<STATEINIT""">*/"" \n
"_garrIndex = 0;" \n
"_nestBoom = false;" \n
"_c = diag_tickTime;" \n
"_nestCount = (count _arrGarr) min 6;" \n
"" \n
"for ""_i"" from 0 to _nestCount step 1 do {" \n
"" \n
"_garrPos = (_nrBuild buildingPos (_arrGarr select _garrIndex));" \n
"" \n
"" \n
"if (_garrIndex < 1) then {" \n
"" \n
"_sapper moveTo _garrPos;" \n
"" \n
"}else{" \n
"" \n
"_nestMate = createAgent [""Epoch_Sapper_F"", _garrPos, [], 0, ""FORM""]; " \n
"_bomb = createVehicle [""Sapper_Charge_Ammo"", (getposATL _nestMate), [], 0, ""CAN_COLLIDE""] ; " \n
"_bomb attachTo [_nestMate, [0,0,0],""Pelvis""];" \n
"_nestMate setVariable [""bomb"",_bomb];" \n
"EPOCH_TEMPOBJ_PVS = _nestMate;" \n
"publicVariableServer ""EPOCH_TEMPOBJ_PVS"";" \n
"_nestMate disableAI ""TARGET"";" \n
"_nestMate disableAI ""AUTOTARGET"";" \n
"_nestMate disableAI ""FSM"";" \n
"_nestMate moveTo _garrPos;" \n
"" \n
"_arrNest pushBack _nestMate;" \n
"" \n
"};" \n
"" \n
"_garrIndex = _garrIndex + 1;" \n
"};" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="monitor_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "ba_boom">*/
class ba_boom
{
name = "ba_boom";
init = /*%FSM<STATEINIT""">*/"""Epoch_Sapper_F"" call EPOCH_unitSpawnDecrease;" \n
"" \n
"[_nrBuild, _sapper] spawn {" \n
"sleep 6;" \n
"EPOCH_SapperObjs_PVS = [_this select 0, player, Epoch_personalToken,_this select 1];" \n
"publicVariableServer ""EPOCH_SapperObjs_PVS"";" \n
"};" \n
"" \n
"{" \n
"" \n
"_sound = ""sapper_explode"";" \n
"_x say3D _sound;" \n
"EPOCH_say3D_PVS = [player,_x,(EPOCH_sounds find _sound),Epoch_personalToken];" \n
"publicVariableServer ""EPOCH_say3D_PVS"";" \n
"_x playMoveNow ""Unconscious"";" \n
"" \n
"_x spawn {" \n
"sleep floor (random 3);" \n
"_sBomb = _this getVariable [""bomb"",objNull];" \n
"" \n
"EPOCH_SapperObjs_PVS = [_sBomb, player, Epoch_personalToken,_this,_this];" \n
"publicVariableServer ""EPOCH_SapperObjs_PVS"";" \n
"" \n
"_finalPos = getPosATL _this;" \n
"_finalDir = getDir _this;" \n
"" \n
"_this setObjectTextureGlobal [0, """"]; " \n
"_this setObjectTextureGlobal [1, ""x\addons\a3_epoch_assets\textures\sapper\sapper_eco.paa""]; " \n
"" \n
"_head = createVehicle [""SapperHead_SIM_EPOCH"", _finalPos, [], 0, ""CAN_COLLIDE""];" \n
"_head setVelocity [random 2,random 2,10];" \n
"" \n
"sleep 120;" \n
"if (!isNull _x) then {" \n
"deleteVehicle _x;" \n
"};" \n
"if (!isNull _sBomb) then {" \n
"deleteVehicle _sBomb;" \n
"};" \n
"};" \n
"" \n
"" \n
"}forEach _arrNest;" \n
"" \n
"" \n
"" \n
"_t = diag_tickTime;" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Wait_to_delete">*/
class Wait_to_delete
{
priority = 10.000000;
to="end";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _t) > 480;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "end">*/
class end
{
name = "end";
init = /*%FSM<STATEINIT""">*/"if (!isNull _sapper) then {" \n
"_sapper removeAllEventHandlers ""Hit"";" \n
"_sapper removeAllEventHandlers ""FiredNear"";" \n
"" \n
"if!(_traderDispose) then {" \n
"deleteVehicle _sapper;" \n
"};" \n
"};" \n
"if (!isNull _sBomb) then {" \n
"deleteVehicle _sBomb;" \n
"};" \n
"if !(isNull _head) then {" \n
" deleteVehicle _head;" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "handle_dispose">*/
class handle_dispose
{
name = "handle_dispose";
init = /*%FSM<STATEINIT""">*/"_t = diag_tickTime;" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "not_shot">*/
class not_shot
{
priority = 10.000000;
to="finished_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"isNull _sBomb;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "shot">*/
class shot
{
priority = 5.000000;
to="smoke";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!isNull _sBomb;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_boom">*/
class do_boom
{
name = "do_boom";
init = /*%FSM<STATEINIT""">*/"EPOCH_SapperObjs_PVS = [_sBomb, player, Epoch_personalToken,_sapper,_sapper];" \n
"publicVariableServer ""EPOCH_SapperObjs_PVS"";" \n
"" \n
"_sBomb = objNull;" \n
"_finalPos = getPosATL _sapper;" \n
"_finalDir = getDir _sapper;" \n
"" \n
"_sapper setObjectTextureGlobal [0, """"]; " \n
"_sapper setObjectTextureGlobal [1, ""x\addons\a3_epoch_assets\textures\sapper\sapper_eco.paa""]; " \n
"" \n
"_head = createVehicle [""SapperHead_SIM_EPOCH"", _finalPos, [], 0, ""CAN_COLLIDE""];" \n
"_dir = [_head, _trgt] call BIS_fnc_dirTo;" \n
"_speed = (_sapper distance _trgt);" \n
"_head setVelocity [" \n
" (sin _dir * _speed), " \n
" (cos _dir * _speed), " \n
" (_speed / 2 min 8)" \n
"];" \n
"_doneBoom = true;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="finished_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_groan">*/
class do_groan
{
name = "do_groan";
init = /*%FSM<STATEINIT""">*/"" \n
"" \n
"call _randomGroan;" \n
"" \n
"_actionDone = true;" \n
"_criteria = ""(true)"";" \n
"_sWait = 1;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="reset";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_stalk">*/
class do_stalk
{
name = "do_stalk";
init = /*%FSM<STATEINIT""">*/"_jammers = nearestObjects[_trgtPos, [""PlotPole_EPOCH""], _jammerRange];" \n
"_circleDone = false;" \n
"_sWait = 0;" \n
"" \n
"if( count _jammers > 0)then{" \n
"" \n
"{" \n
"if((_sapper distance _trgt) < (_x distance _sapper))then{" \n
"_trgt = _x;" \n
"_minStalkDist = _minStalkDistPerm + _jammerRange;" \n
"_maxStalkDist = _maxStalkDistPerm + _jammerRange;" \n
"};" \n
"}forEach _jammers;" \n
"" \n
"};" \n
"" \n
"if (!_stalking) then {" \n
"" \n
"if (_spottedPos select 0 > 0) then {" \n
"_moveTo = _spottedPos;" \n
"_spottedPos=[0,0,0];" \n
"}else{" \n
"_sSide = [90,-90] call BIS_fnc_selectRandom;" \n
"_moveTo = [_maxStalkDist,_minStalkDist,0,_sapper,_sSide,_trgt] call EPOCH_fnc_findSapperStalkLocation;" \n
"};" \n
"" \n
"_sapper forceSpeed 3.5;" \n
"_sapper moveTo _moveTo;" \n
"_stalking = true;" \n
"_c = diag_tickTime;" \n
"//systemchat ""Stalk"";" \n
"};" \n
"" \n
"" \n
"_sDist = _sapper distance _moveTo;" \n
"if (_sWait < 1) then {" \n
"_sWait = _sDist;" \n
"};" \n
"" \n
"" \n
"//systemchat format[""Stalking %1"",diag_tickTime];" \n
"//deleteMarkerLocal _mkrName;" \n
"//_mkrName = format[""axeS%1"", diag_tickTime];" \n
"// _mkr = createMarkerLocal [_mkrName, _moveTo];" \n
"// _mkrName setMarkerShapeLocal ""ICON"";" \n
"//_mkrName setMarkerTypeLocal ""mil_dot"";" \n
"//_mkrName setMarkerColorLocal ""COLORYELLOW"";" \n
"// _mkrName setMarkerTypeLocal ""mil_dot"";" \n
"// _mkrName setMarkerSizeLocal [0.8,0.8];" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "circled">*/
class circled
{
priority = 10.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"moveToCompleted _sapper || diag_tickTime > _c + _sWait;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"_stalking = false;" \n
"_actionDone = true;" \n
"_sWait = 0;" \n
"_criteria = ""(true)"";" \n
"_t = diag_tickTime;" \n
"" \n
"" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "stalking">*/
class stalking
{
priority = 5.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_sDist > 6;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_loiter_big">*/
class do_loiter_big
{
name = "do_loiter_big";
init = /*%FSM<STATEINIT""">*/"_sapperPos = getPos _sapper;" \n
"_moveTo = [_sapperPos,10,28,5,0,5,0] call BIS_fnc_findSafePos;" \n
"_sapper moveTo _moveTo;" \n
"_sapper forceSpeed 2;" \n
"" \n
"" \n
"_actionDone = true;" \n
"_sWait = (_sapper distance _moveTo) max 1;" \n
"_criteria = ""(moveToCompleted _sapper)"";" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="reset";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_loiter_small">*/
class do_loiter_small
{
name = "do_loiter_small";
init = /*%FSM<STATEINIT""">*/"_dirTo = (random 360) min 10;" \n
"_moveTo = [_sapper, 12, _dirTo] call BIS_fnc_relPos;" \n
"_sapper forceSpeed 2;" \n
"_sapper moveTo _moveTo;" \n
"" \n
"" \n
"_actionDone = true;" \n
"_sWait = (_sapper distance _moveTo) max 1;" \n
"_criteria = ""(moveToCompleted _sapper)"";" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="reset";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_charge">*/
class do_charge
{
name = "do_charge";
init = /*%FSM<STATEINIT""">*/"" \n
"//At a distance sapper will weave, when close aims staright for target" \n
"if (_trgtDist > _detonateDist * 2) then {" \n
"_moveTo = [_detonateDist * 2,_detonateDist,80,_trgt] call EPOCH_fnc_findRandomPosBehind;" \n
"}else{" \n
"_moveTo = getPosATL _trgt;" \n
"};" \n
"" \n
"_sapper forceSpeed 5;" \n
"_sapper moveTo _moveTo;" \n
"_attempts = _attempts +1;" \n
"" \n
"" \n
"" \n
"//systemchat format[""Charging %1"",diag_tickTime];" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "charged">*/
class charged
{
priority = 10.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_attempts > 17 || (_sapper distance _trgt) < (_detonateDist / 2) || (!_canSee && _attempts > 6);" \n
"//Experimental stop charging if can not see and anger dropped.."/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_charging = false;" \n
"_actionDone = true;" \n
"_sWait = 0;" \n
"_criteria = ""(true)"";" \n
"" \n
"" \n
"" \n
"if (diag_tickTime - _lastAlert > 60) then {" \n
" _lastAlert = diag_tickTime;" \n
" _sound = ""sapper_groan2"";" \n
" _sapper say3D _sound;" \n
" EPOCH_say3D_PVS = [player, _sapper,(EPOCH_sounds find _sound), Epoch_personalToken];" \n
" publicVariableServer ""EPOCH_say3D_PVS"";" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "charging">*/
class charging
{
priority = 5.000000;
to="action";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(moveToCompleted _sapper && _attempts < 18) || diag_tickTime > _c + ((_trgtDist / 2) max 2) ;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_charging = true;" \n
"_lastPos = getPosATL _sapper;" \n
"_c = diag_tickTime;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "find_spot">*/
class find_spot
{
name = "find_spot";
init = /*%FSM<STATEINIT""">*/"try{" \n
"_h = diag_tickTime;" \n
"_moveTo = ATLToASL ([(getPosATL _sapper), (floor (random 30) + 12), floor random 360] call BIS_fnc_relPos);" \n
"_posSafe = true;" \n
"_nrTrgts = _sapper nearEntities [_trgtArr, _sRange];" \n
"" \n
"{" \n
" if (!lineIntersects [aimPos _x, _moveTo, _x, _sapper]) then {_posSafe = false;};" \n
"" \n
"} forEach _nrTrgts;" \n
"" \n
"_moveTo = ASLToATL _moveTo;" \n
"" \n
"}catch{" \n
"_posSafe = true;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "not_safe">*/
class not_safe
{
priority = 10.000000;
to="find_spot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_posSafe;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "is_safe">*/
class is_safe
{
priority = 5.000000;
to="do_hide";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_posSafe;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "do_hide">*/
class do_hide
{
name = "do_hide";
init = /*%FSM<STATEINIT""">*/"_sapper forceSpeed 5;" \n
"_sapper moveTo _moveTo;" \n
"_sWait = (_sapper distance _moveTo) max 1;" \n
"_actionDone = true;" \n
"_criteria = ""(moveToCompleted _sapper)"";" \n
"" \n
"if (_trgtDist<25) then {" \n
"_sapper setBehaviour ""CARELESS"";" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="reset";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "smoke">*/
class smoke
{
name = "smoke";
init = /*%FSM<STATEINIT""">*/"if!(_traderDispose) then {" \n
"_sapperSmoke = ""SmokeShellCustom"" createVehicle [(getPosATL _sapper) select 0, (getPosATL _sapper) select 1, -0.2];" \n
"_sapperSmoke attachTo [_sapper,[0,0,-0.4]];" \n
"};" \n
"" \n
"if (!isNull _sBomb) then {" \n
"deleteVehicle _sBomb;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "_">*/
class _
{
priority = 0.000000;
to="finished_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "monitor_nest">*/
class monitor_nest
{
name = "monitor_nest";
init = /*%FSM<STATEINIT""">*/"" \n
"" \n
"_nrTrgts = _nrBuild nearEntities [_trgtArr, _sRange];" \n
"" \n
"_lowDist = _sRange;" \n
"" \n
"{" \n
"_currDist = _x distance _nrBuild;" \n
" if (_currDist < _lowDist) then {" \n
" _nrstTrgt = _x;" \n
" _lowDist = _currDist;" \n
" };" \n
"}forEach _nrTrgts;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "nest_disturbed">*/
class nest_disturbed
{
priority = 30.000000;
to="ba_boom";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_nestBoom;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "shuffle">*/
class shuffle
{
priority = 25.000000;
to="monitor_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"diag_tickTime > _s + 30;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"" \n
"_moveSapper = _arrNest call BIS_fnc_selectRandom;" \n
"_moveSapper forceSpeed 2;" \n
"_moveTo = _nrBuild buildingPos (_arrGarr call BIS_fnc_selectRandom);" \n
"_moveSapper moveTo _moveTo;" \n
"_s = diag_tickTime;" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "groan">*/
class groan
{
priority = 20.000000;
to="monitor_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_trgt distance _nrBuild < 12 && diag_tickTime > _t + 28;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"call _randomGroan;" \n
"" \n
"_t = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "target_near">*/
class target_near
{
priority = 10.000000;
to="monitor_nest";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"diag_tickTime > _c + 3;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"{" \n
"if (_x distance _nrstTrgt < 1.5 || !alive _x) then {" \n
"_nestBoom = true;" \n
"};" \n
"" \n
"}forEach _arrNest;" \n
"_c = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "finished_boom">*/
class finished_boom
{
name = "finished_boom";
init = /*%FSM<STATEINIT""">*/"""Epoch_Sapper_F"" call EPOCH_unitSpawnDecrease;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Wait_to_delete">*/
class Wait_to_delete
{
priority = 10.000000;
to="end";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _t) > 480;"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="sapper";
finalStates[] =
{
"end"
};
};
/*%FSM</COMPILE>*/