class FSM { fsmName = "sapper dispose"; class States { class bomb { name = "bomb"; itemno = ; init = "//Developer code" \n "//Author: axeman (Andrew Gregory | andrew@andgregor.co.uk)" \n "//Licence:" \n "//You may not copy, reproduce, edit, move or transfer in any way without the express permission of the author." \n "//All files contained in this MPMission also folder fall under the Epoch Mod Creative Commons Licence: https://creativecommons.org/licenses/by-nc-nd/4.0/" \n "//Any files triggered, called, execVM'ed, execFSM'ed etc, by this file fall under the same agreement." \n "" \n "_unit = _this select 0;" \n "_bomb = _this select 1;" \n "_head = objNull;" \n "" \n "_trgt = _this select 2;" \n "_nrTrgts = [];" \n "" \n "_t = diag_tickTime;" \n "_trgtDist = _unit distance _trgt;" \n "" \n "if!(isNull (_unit getVariable [""sTarget"",objNull]))then{" \n "_unit setVariable [""sTarget"",objNull, false];" \n "};" \n "" \n "_canSee = false;" \n "_pos = getPosATL _unit;" \n "" \n "//systemChat ""DISPOSE"";" \n "" \n "" \n ""; precondition = ""; class Links { class _ { itemno = ; priority = 0.000000; to="check"; precondition = ""; condition="true"; action=""; }; }; }; class check { name = "check"; itemno = ; init = ""; precondition = ""; class Links { class targets { itemno = ; priority = 20.000000; to="find_target"; precondition = ""; condition="(isNull _trgt || isNil ""_trgt"") && alive _unit;"; action=""; }; class smoke { itemno = ; priority = 15.000000; to="handle_smoke"; precondition = ""; condition="!alive _unit;"; action=""; }; class boom { itemno = ; priority = 10.000000; to="pre_boom"; precondition = ""; condition="alive _unit;"; action=""; }; }; }; class pre_boom { name = "pre_boom"; itemno = ; init = "_t = diag_tickTime;" \n "" \n "_sound = ""sapper_explode"";" \n "_unit say3D _sound;" \n "EPOCH_say3D_PVS = [player,_unit,(EPOCH_sounds find _sound),Epoch_personalToken];" \n "publicVariableServer ""EPOCH_say3D_PVS"";" \n "_unit playMoveNow ""Unconscious"";" \n "" \n ""; precondition = ""; class Links { class Wait_1_5_sec { itemno = ; priority = 0.000000; to="do_boom"; precondition = ""; condition="(diag_tickTime - _t) > 1.25;"; action=""; }; }; }; class end { name = "end"; itemno = ; init = "if(!isNull _unit)then{" \n "_unit removeAllEventHandlers ""Hit"";" \n "_unit removeAllEventHandlers ""FiredNear"";" \n "deleteVehicle _unit;" \n "};" \n "" \n "if(!isNull _bomb)then{" \n "deleteVehicle _bomb;" \n "};" \n "" \n "if !(isNull _head) then {" \n "deleteVehicle _head;" \n "};" \n "" \n "if(!isNull _unit)then{" \n "deleteVehicle _unit;" \n "};" \n "" \n "Epoch_axeMigrationRunning = false;" \n ""; precondition = ""; class Links { }; }; class handle_smoke { name = "handle_smoke"; itemno = ; init = ""; precondition = ""; class Links { class not_shot { itemno = ; priority = 10.000000; to="finishing"; precondition = ""; condition="isNull _bomb;"; action=""; }; class shot { itemno = ; priority = 5.000000; to="smoke"; precondition = ""; condition="!isNull _bomb;"; action=""; }; }; }; class do_boom { name = "do_boom"; itemno = ; init = "EPOCH_SapperObjs_PVS = [_bomb, player, Epoch_personalToken,_unit,_unit];" \n "publicVariableServer ""EPOCH_SapperObjs_PVS"";" \n "" \n "_bomb = objNull;" \n "_finalPos = getPosATL _unit;" \n "_finalDir = getDir _unit;" \n "" \n "_unit setObjectTextureGlobal [0, """"]; " \n "_unit 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 = (_unit distance _trgt);" \n "_head setVelocity [" \n " (sin _dir * _speed), " \n " (cos _dir * _speed), " \n " ((_speed) / 12 min 1)" \n "];" \n "_doneBoom = true;" \n ""; precondition = ""; class Links { class _ { itemno = ; priority = 0.000000; to="finishing"; precondition = ""; condition="true"; action=""; }; }; }; class smoke { name = "smoke"; itemno = ; init = "if(!isNull _bomb)then{" \n "deleteVehicle _bomb;" \n "};" \n "" \n "_sapperSmoke = ""SmokeShellCustom"" createVehicle [(getPosATL _unit) select 0, (getPosATL _unit) select 1, -0.2];" \n "_sapperSmoke attachTo [_unit,[0,0,-0.4]];"; precondition = ""; class Links { class _ { itemno = ; priority = 0.000000; to="finishing"; precondition = ""; condition="true"; action=""; }; }; }; class finishing { name = "finishing"; itemno = ; init = ""; precondition = ""; class Links { class Wait_to_delete { itemno = ; priority = 10.000000; to="end"; precondition = ""; condition="(diag_tickTime - _t) > 480;"; action=""; }; }; }; class find_target { name = "find_target"; itemno = ; init = "_nrTrgts = nearestObjects [_pos, [""Epoch_Female_base_F"",""Epoch_Man_base_F""],42];"; precondition = ""; class Links { class not_found { itemno = ; priority = 20.000000; to="end"; precondition = ""; condition="count _nrTrgts < 1"; action=""; }; class found { itemno = ; priority = 10.000000; to="check"; precondition = ""; condition="count _nrTrgts > 0"; action="_trgt = _nrTrgts select floor (random (count _nrTrgts));"; }; }; }; }; initState="bomb"; finalStates[] = { "end" }; };