-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Zeus - Paradrop Cargo Waypoint * move script component * cfgpatches, localize, fix getModuleDestination call * cleanup debug
- Loading branch information
1 parent
ab4d9e0
commit 09cad56
Showing
9 changed files
with
174 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: PabstMirror | ||
* Commands the selected vehicle to paradrop all cargo at the specified location | ||
* | ||
* Arguments: | ||
* 0: Module logic <OBJECT> | ||
* 1: Synchronized units <ARRAY> | ||
* 2: Activated <BOOL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [LOGIC, [], true] call ace_zeus_fnc_moduleCargoParadrop | ||
* | ||
* Public: No | ||
*/ | ||
|
||
if (canSuspend) exitWith {[FUNC(moduleCargoParadrop), _this] call CBA_fnc_directCall;}; | ||
|
||
params ["_logic", "", "_activated"]; | ||
|
||
if ((!local _logic) || {!_activated}) exitWith {}; | ||
|
||
// Validate the module target | ||
private _vehicle = attachedTo _logic; | ||
private _pilot = driver _vehicle; | ||
TRACE_4("moduleCargoParadrop placed",_logic,typeOf _vehicle,_pilot,typeOf _pilot); | ||
|
||
deleteVehicle _logic; // cleanup logic now, we just needed it to get the attached vehicle | ||
|
||
if (!(missionNamespace getVariable [QEGVAR(cargo,enable), false])) exitWith { | ||
[LSTRING(RequiresAddon)] call FUNC(showMessage); | ||
}; | ||
if (isNull _vehicle) exitWith { | ||
[LSTRING(NothingSelected)] call FUNC(showMessage); | ||
}; | ||
if (!(_vehicle isKindOf "Air")) exitWith { | ||
[format ["%1 %2", localize "str_dn_aircraft", localize "str_msg_no_veh_select"]] call FUNC(showMessage); | ||
}; | ||
if ((!alive _vehicle) || {!alive _pilot}) exitWith { | ||
[LSTRING(OnlyAlive)] call FUNC(showMessage); | ||
}; | ||
if ([_pilot] call EFUNC(common,isPlayer)) exitWith { | ||
["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call FUNC(showMessage); | ||
}; | ||
if ((_vehicle getVariable [QEGVAR(cargo,loaded), []]) isEqualTo []) exitWith { | ||
[LSTRING(paradrop_noCargoLoaded)] call FUNC(showMessage); | ||
}; | ||
|
||
[_vehicle, { | ||
params ["_successful", "_vehicle", "_mousePosASL"]; | ||
TRACE_3("getModuleDestination return",_successful,_vehicle,_mousePosASL); | ||
|
||
if ((!_successful) || {!alive _vehicle}) exitWith {}; | ||
|
||
private _pilot = driver _vehicle; | ||
private _group = group _pilot; | ||
|
||
if ((!alive _vehicle) || {!alive _pilot} || {[_pilot] call EFUNC(common,isPlayer)}) exitWith {TRACE_2("invalid",_vehicle,_pilot);}; | ||
|
||
[_group] call CBA_fnc_clearWaypoints; | ||
|
||
private _wp = _group addWaypoint [ASLtoAGL _mousePosASL, 0]; | ||
_wp setWaypointType "SCRIPTED"; | ||
_wp setWaypointScript QPATHTOF(functions\DOUBLES(fnc,moduleCargoParadropWaypoint).sqf); | ||
|
||
TRACE_2("Waypoint Added",_wp,local _group); // Locality is handled by the waypoint | ||
|
||
}, localize LSTRING(moduleCargoParadrop_DisplayName), "\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], 45] call FUNC(getModuleDestination); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: PabstMirror | ||
* Handles the paradrop cargo scripted waypoint (Scheduled Environment) | ||
* | ||
* Arguments: | ||
* 0: Group <GROUP> | ||
* 1: Waypoint Position <ARRAY> | ||
* | ||
* Return Value: | ||
* Waypoint Finished <BOOL> | ||
* | ||
* Example: | ||
* [group, [0,0,0]] call ace_zeus_fnc_moduleCargoParadropWaypoint | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params [["_vehicleGroup", grpNull, [grpNull]], ["_wpPos", [0, 0, 0], [[]], 3]]; | ||
TRACE_2("moduleCargoParadropWaypoint",_vehicleGroup,_wpPos); | ||
|
||
private _vehicle = vehicle leader _vehicleGroup; | ||
private _commander = driver _vehicle; | ||
private _cargo = _vehicle getVariable [QEGVAR(cargo,loaded), []]; | ||
if (!(_vehicle isKindOf "Air")) exitWith {WARNING_1("not in a air vehicle",typeOf _vehicle); true}; | ||
if (_cargo isEqualTo []) exitWith {WARNING_1("no cargo",_cargo); true}; | ||
|
||
private _previousSpeedMode = speedMode _vehicleGroup; | ||
private _nextMoveUpdate = -1; | ||
private _closeEnoughTicks = 0; // should prevent aircraft from endlessly going in circles trying to hit a point | ||
|
||
// Start moving the vehicle to the drop off point | ||
waitUntil { | ||
sleep 0.1; | ||
if ((!alive _vehicle) || {!alive _commander}) exitWith {true}; | ||
|
||
if (CBA_missionTime > _nextMoveUpdate) then { | ||
private _heading = _vehicle getDir _wpPos; | ||
private _movePos = _vehicle getPos [1000, _heading]; | ||
TRACE_2("move",_vehicleGroup,_movePos); | ||
_vehicle flyInHeight 150; | ||
_vehicleGroup move _movePos; | ||
_nextMoveUpdate = CBA_missionTime + 3; | ||
}; | ||
if ((_vehicle distance2D _wpPos) < 300) then {_closeEnoughTicks = _closeEnoughTicks + 1}; | ||
private _leadDistance = _closeEnoughTicks * 3 + linearConversion [0, 300, (speed _vehicle), 50, 100, true]; | ||
(_vehicle distance2D _wpPos) < _leadDistance | ||
}; | ||
TRACE_2("Finished primary movement",_vehicle distance2D _wpPos,_closeEnoughTicks); | ||
|
||
if ((!alive _vehicle) || {!alive _commander}) exitWith {TRACE_2("died",alive _vehicle, alive _commander); true}; | ||
if (((getPos _vehicle) select 2) < 25) exitWith {TRACE_1("too low",getPos _vehicle); true}; | ||
|
||
// Fly level and straight | ||
private _unloadFlightPos = _vehicle getRelPos [1000, 0]; | ||
_vehicle flyInHeight 150; | ||
_vehicleGroup setSpeedMode "LIMITED"; | ||
_vehicleGroup move _unloadFlightPos; | ||
|
||
sleep 0.5; | ||
|
||
TRACE_2("Starting unload",_vehicle,_cargo); | ||
{ | ||
TRACE_1("cargo-paradropItem",_x); | ||
[QEGVAR(cargo,paradropItem), [_x, _vehicle, false], _vehicle] call CBA_fnc_targetEvent; | ||
sleep 1; | ||
} forEach (+_cargo); // copy because array will be modified after each drop | ||
|
||
TRACE_1("Unload finished",_vehicle); | ||
|
||
sleep 0.5; | ||
_vehicleGroup setSpeedMode _previousSpeedMode; | ||
|
||
TRACE_1("WP Done",_vehicle); | ||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.