Skip to content

Commit

Permalink
Add disembark all/cargo options
Browse files Browse the repository at this point in the history
Tweak order of commands
  • Loading branch information
James Kingsley committed Nov 25, 2016
1 parent 44d0d61 commit 4b0ef0e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
27 changes: 23 additions & 4 deletions addons/ai/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class GVARMAIN(context) {
displayName = "Infantry";
condition = QUOTE(_this isKindOf 'Man');
exceptions[] = {"isNotPlayer"};
order = 1;
class Stance {
displayName = "Stance";
order = 1;
Expand Down Expand Up @@ -76,6 +77,7 @@ class GVARMAIN(context) {
condition = "(true)";
exceptions[] = {"isNotPlayer"};
only[] = {Groups};
order = 4;
class Column {
displayName = "Column";
action = QUOTE([ARR_3('COLUMN', _this, true)] call FUNC(setFormation));
Expand Down Expand Up @@ -118,25 +120,41 @@ class GVARMAIN(context) {
displayName = "Vehicle";
condition = "!(_this call CBA_fnc_isPerson)";
exceptions[] = {"isNotPlayer"};
class Disembark {
displayName = "Disembark";
action = QUOTE([ARR_2(_this, true)] call FUNC(disembark));
};
order = 3;
class Suppress {
displayName = "Suppress";
requiresPosition = 1;
action = QUOTE([ARR_2(_this, true)] call FUNC(suppress));
order = 1;
};
class Patrol {
displayName = "Patrol";
requiresPosition = 1;
action = QUOTE([ARR_2(_this, true)] call FUNC(taskPatrol));
order = 2;
};
class DisembarkCargo {
displayName = "Disembark Cargo";
action = QUOTE([ARR_3(_this, 'cargo', true)] call FUNC(disembark));
order = 3;
};
class DisembarkAll {
displayName = "Disembark All";
action = QUOTE([ARR_3(_this, 'all', true)] call FUNC(disembark));
order = 4;
};
};

class Air {
displayName = "Air";
condition = QUOTE(_this isKindOf 'Air');
exceptions[] = {"isNotPlayer"};
order = 2;
class Attack {
displayName = "Attack";
requiresPosition = 1;
action = QUOTE([ARR_2(_this, true)] call FUNC(taskAttack));
order = 1;
};
/*class Land {
displayName = "Land";
Expand All @@ -149,6 +167,7 @@ class GVARMAIN(context) {
};*/
class Orbit {
displayName = "Orbit";
order = 2;
class Low {
displayName = "Low (250m)";
requiresPosition = 1;
Expand Down
23 changes: 16 additions & 7 deletions addons/ai/functions/fnc_disembark.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,30 @@

#include "script_component.hpp"

params [["_args", []], ["_broadcast", false]];

if (_vehicles isEqualTo []) exitWith {};
params [["_args", []], ["_type", "all"], ["_broadcast", false]];

if (_broadcast) then {
_args params [["_vehicles", []]];
{[QGVAR(disembark), [_x], _x] call CBA_fnc_targetEvent;false} count _vehicles;
if (_vehicles isEqualTo []) exitWith {};
{[QGVAR(disembark), [_x, _type], _x] call CBA_fnc_targetEvent;false} count _vehicles;
} else {
_args params [["_vehicle", objNull]];
_args params [["_vehicle", objNull], ["_type", "all"]];

private _crew = fullCrew _vehicle;

if (_type == "cargo") then {
_crew = _crew select {
_x params ["_obj", "_role"];
!((toLower _role) in ["driver", "gunner", "turret", "commander"])
};
};

_crew = _crew apply {_x select 0};

{
unassignVehicle _x;
_x leaveVehicle _vehicle;
_x action ["Eject", _vehicle];

false
} count crew _vehicle;
} count _crew;
};
1 change: 1 addition & 0 deletions addons/editor/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class GVARMAIN(context) {
class Teleport {
displayName = "Teleport";
requiresPosition = 1;
order = 99;
action = QUOTE(\
params [ARR_2('_units', '_pos')];\
{(vehicle _x) setPosASL _pos} forEach _units;\
Expand Down

0 comments on commit 4b0ef0e

Please sign in to comment.