Skip to content

Commit

Permalink
Basic integration of sup_artillery with NEO_radio
Browse files Browse the repository at this point in the history
Can now request and execute arty support
  • Loading branch information
marceldev89 committed Aug 14, 2016
1 parent 8fbb12c commit 926076a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
6 changes: 5 additions & 1 deletion addons/sup_artillery/fnc_artillery.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ switch (_operation) do {
private _waypoint = _group addWaypoint [_position, 0];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointBehaviour "SAFE";
_waypoint setWaypointForceBehaviour true;
_waypoint setWaypointSpeed "NORMAL";
_waypoint setWaypointFormation "COLUMN";
_waypoint setWaypointStatements [
"true",
"(group this) setVariable ['sup_artillery_inPosition', true]"
Expand Down Expand Up @@ -206,6 +208,8 @@ switch (_operation) do {
};

ALIVE_sup_artillery_stateMachine_list pushBack _logic;

_result = _group;
};

/******************
Expand All @@ -218,7 +222,7 @@ switch (_operation) do {
};
case "onActive": {
if (!([_logic, "inRange"] call MAINCLASS)) then {
_logic setVariable ["moveToPos", [0,0,0]]; // TODO: Figure out best firing position
_logic setVariable ["moveToPos", [3451.45,5379.89,0]]; // TODO: Figure out best firing position
};
};
case "onFire": {
Expand Down
38 changes: 37 additions & 1 deletion addons/sup_combatsupport/fnc_combatSupport.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,46 @@ switch(_operation) do {
//} forEach SUP_ARTYARRAYS;
} forEach [];

// TODO: Move most of the code below to ALIVE_fnc_artillery
for "_i" from 0 to ((count synchronizedObjects _logic)-1) do {
if (typeOf ((synchronizedObjects _logic) select _i) == "ALiVE_sup_artillery") then {
private _artyLogic = (synchronizedObjects _logic) select _i;
[_artyLogic, "spawn"] call ALIVE_fnc_artillery;
private _group = [_artyLogic, "spawn"] call ALIVE_fnc_artillery;
private _vehicles = [];

{
if (vehicle _x != _x && {!(vehicle _x in _vehicles)}) then {
_vehicles pushBack (vehicle _x);
};
} forEach (units _group);

private _callsign = _artyLogic getVariable ["artillery_callsign","FOX ONE"];

private _rounds = [
["HE", parseNumber (_artyLogic getVariable ["artillery_he", "30"])],
["ILLUM", parseNumber (_artyLogic getVariable ["artillery_illum", "30"])],
["SMOKE", parseNumber (_artyLogic getVariable ["artillery_smoke", "30"])],
["SADARM", parseNumber (_artyLogic getVariable ["artillery_guided", "30"])],
["CLUSTER", parseNumber (_artyLogic getVariable ["artillery_cluster", "30"])],
["LASER", parseNumber (_artyLogic getVariable ["artillery_lg", "30"])],
["MINE", parseNumber (_artyLogic getVariable ["artillery_mine", "30"])],
["AT MINE", parseNumber (_artyLogic getVariable ["artillery_atmine", "30"])],
["ROCKETS", parseNumber (_artyLogic getVariable ["artillery_rockets", "16"])]
];

private _roundsAvailable = [];
private _roundsUnit = (typeOf (_vehicles select 0)) call ALIVE_fnc_getArtyRounds;

{
if ((_x select 0) in _roundsUnit) then {
_roundsAvailable pushBack _x;
};
} forEach _rounds;

leader _group setVariable ["NEO_radioArtyBatteryRounds", _roundsAvailable, true];
private _a = NEO_radioLogic getVariable format ["NEO_radioArtyArray_%1", side _group];
_a set [count _a, [leader _group, _group, _callsign, _vehicles, _roundsAvailable]];
NEO_radioLogic setVariable [format ["NEO_radioArtyArray_%1", side _group], _a, true];
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ if (_audio) then {
player kbTell [_battery, "ALIVE_SUPP_protocol", "Artillery_Request", "GROUP"];
};

// TODO: Cleanup obsolete bits
private _logic = _unit getVariable ["logic", objNull];
[_logic, "fireMission", [_pos, _ord, _count, _rate, _dispersion]] call ALIVE_fnc_artillery;

//NEW TASK
_battery setVariable ["NEO_radioArtyNewTask", [_type, _ordnanceType, _rate, _count, _dispersion, _pos, _unit, _ord, _callsignPlayer, player], true];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _artyRateOfFireLb = _display displayCtrl 655603;
_artyRoundCountLb = _display displayCtrl 655605;
_battery = _artyArray select (lbCurSel _artyUnitLb) select 0; if (!isNil { NEO_radioLogic getVariable "NEO_radioTalkWithArty" }) then { _battery = ((NEO_radioLogic getVariable "NEO_radioTalkWithArty") getVariable "NEO_radioArtyModule") select 0 };
_status = _battery getVariable "NEO_radioArtyUnitStatus";
_status = "NONE"; // TODO: Handle status properly

if
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _supportMarker = NEO_radioLogic getVariable "NEO_supportMarker";
_artyMarkers = NEO_radioLogic getVariable "NEO_supportArtyMarkers";
_battery = _artyArray select (lbCurSel _artyUnitLb) select 0; if (!isNil { NEO_radioLogic getVariable "NEO_radioTalkWithArty" }) then { _battery = ((NEO_radioLogic getVariable "NEO_radioTalkWithArty") getVariable "NEO_radioArtyModule") select 0 };
_status = _battery getVariable "NEO_radioArtyUnitStatus";
_status = "NONE"; // TODO: Handle status properly
_class = typeOf (((_artyArray select (lbCurSel _artyUnitLb)) select 3) select 0); if (!isNil { NEO_radioLogic getVariable "NEO_radioTalkWithArty" }) then { _class = typeOf (NEO_radioLogic getVariable "NEO_radioTalkWithArty") };
_ord = _battery getVariable "NEO_radioArtyBatteryRounds";

Expand Down

0 comments on commit 926076a

Please sign in to comment.