-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HALO #324
HALO #324
Changes from 9 commits
60764be
d0309f2
d2910d3
a2b6559
fc56fd9
e9e1566
21d9365
9679e05
b322950
65d1111
2514583
8ff61bb
07fb08c
9ad691d
d4cafda
7afbeeb
1283c03
67168aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,8 @@ private _vehsType = ""; | |
// Kex: prevent pilot from being stupid | ||
_group allowFleeing 0; | ||
|
||
_vehsType = typeOf (_vehsGroup select 0); | ||
_vehsGroup params ["_firstVeh"]; | ||
_vehsType = typeOf _firstVeh; | ||
private _radius = 0; | ||
private _vector = []; | ||
// displace effective target position for flyby | ||
|
@@ -65,30 +66,51 @@ if (_vehsType isKindOf "Helicopter") then | |
_vector set [2,0]; | ||
_vector = vectorNormalized _vector; | ||
_vector = _vector vectorMultiply 1000; | ||
_radius = 1200; | ||
_radius = 1000; | ||
} else | ||
{ | ||
_vector = [0,0,0]; | ||
_radius = 100; | ||
_radius = 0; | ||
}; | ||
private _wp_pos = _end_pos vectorAdd _vector; | ||
|
||
// adjust distance for deployment according to crew count and velocity | ||
private _speed = getNumber (configfile >> "CfgVehicles" >> _vehsType >> "maxSpeed"); | ||
private _coefName = ["normalSpeedForwardCoef", "limitedSpeedCoef"] select (speedMode _group == "LIMITED"); | ||
_speed = _speed * getNumber (configfile >> "CfgVehicles" >> _vehsType >> _coefName); | ||
// every second a unit ejects. We want the middle unit right above the location | ||
private _crew = crew _firstVeh; | ||
private _passengerCount = {(assignedVehicleRole _x) select 0 == "CARGO"} count _crew; | ||
_radius = _radius + _passengerCount/2 * _speed/3.6; | ||
// account for speed displacement | ||
if (getPos _firstVeh select 2 > 150) then | ||
{ | ||
// fitted function for HALO | ||
_radius = _radius + 4.2e-4 * _speed^3 * (1 - 1/(1 + (75/_speed)^2.2)); | ||
} | ||
else | ||
{ | ||
// fitted function for HAHO | ||
_radius = _radius + 0.338 * _speed; | ||
}; | ||
|
||
[_vehsGroup,_wp_pos,_radius] spawn | ||
{ | ||
params ["_vehsGroup", "_wp_pos", "_radius"]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. camelCase |
||
private _vehsRdy = false; | ||
waituntil | ||
{ | ||
params ["_vehsGroup","_wp_pos","_radius"]; | ||
private "_veh"; | ||
private _vehsRdy = false; | ||
private _aliveCount = 0; | ||
{ | ||
_veh = _x; | ||
if ((position _veh) distance2D _wp_pos < _radius and !_vehsRdy) then | ||
private _veh = _x; | ||
_aliveCount = _aliveCount + 1; | ||
if ((position _veh) distance2D _wp_pos < _radius) exitWith | ||
{ | ||
[_vehsGroup] call Achilles_fnc_eject_passengers; | ||
_vehsRdy = true; | ||
}; | ||
} forEach (_vehsGroup select {alive _x}); | ||
|
||
if (_aliveCount == 0) then {_vehsRdy = true}; | ||
sleep 1; | ||
_vehsRdy; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
params[["_playersToTeleport", [objNull]], ["_teleportLocation", [0,0,0]], ["_showTeleportMessage", true], ["_includeVehicles", true]]; | ||
params[["_playersToTeleport", [objNull]], ["_teleportLocation", [0,0,0]], ["_showTeleportMessage", true], ["_additionalOption", 0]]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make it into multiple lines so it can be read |
||
|
||
// Show some text to the players that are going to be teleported. | ||
if (_showTeleportMessage) then | ||
|
@@ -9,19 +9,29 @@ if (_showTeleportMessage) then | |
[[], {if (player in Ares_playersToShowMessageTo) then { titleText [localize "STR_AMAE_YOU_ARE_BEING_TELEPORTED", "BLACK", 1]; sleep 1; titleFadeOut 2}}] remoteExec ["spawn", -2]; | ||
}; | ||
|
||
private _includeVehicles = (_additionalOption == 1); | ||
private _doHALO = (_additionalOption == 2); | ||
|
||
if (_doHALO) then | ||
{ | ||
_teleportLocation set [2, 3000]; | ||
}; | ||
|
||
while {!(_playersToTeleport isEqualto [])} do | ||
{ | ||
private _unit_to_tp = [_playersToTeleport select 0, vehicle (_playersToTeleport select 0)] select _includeVehicles; | ||
|
||
[_unit_to_tp, _teleportLocation, _showTeleportMessage] spawn | ||
[_unit_to_tp, _teleportLocation, _showTeleportMessage, _doHALO] spawn | ||
{ | ||
params ["_unit", "_teleportLocation", "_showTeleportMessage"]; | ||
params ["_unit", "_teleportLocation", "_showTeleportMessage", "_doHALO"]; | ||
if (_showTeleportMessage) then | ||
{ | ||
sleep 1; | ||
}; | ||
|
||
_unit setVehiclePosition [_teleportLocation, [], 0, "FORM"]; | ||
_unit setPos [getPos _unit select 0, getPos _unit select 1, _teleportLocation select 2]; | ||
if (_doHALO) then {[_unit] call Achilles_fnc_chute}; | ||
}; | ||
|
||
_playersToTeleport = [_playersToTeleport - [_unit_to_tp], _playersToTeleport - crew _unit_to_tp] select _includeVehicles; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,46 +162,15 @@ private _rpSize = 20; // TODO make this a dialog parameters? | |
private _lzLogic = [_spawn_position, _allLzLogics, _lzdz_algorithm] call Achilles_fnc_logicSelector; | ||
private _lzPos = position _lzLogic; | ||
|
||
// Adjust spawn position for HALO | ||
if (_lzdz_type isEqualTo 3) then {_spawn_position set [2, 3000]}; | ||
|
||
// create the transport vehicle | ||
private _vehicleInfo = [_spawn_position, _spawn_position getDir _lzPos, _vehicle_type, _side] call BIS_fnc_spawnVehicle; | ||
_vehicleInfo params ["_vehicle", "_", "_vehicleGroup"]; | ||
private _vehicleUnloadWp = _vehicleGroup addWaypoint [_lzPos, _lzSize]; | ||
if (_vehicle isKindOf "Air" and (_dialogResult select 6 > 0)) then | ||
{ | ||
_vehicleUnloadWp setWaypointType "SCRIPTED"; | ||
private _script = ["\achilles\functions_f_achilles\scripts\fn_wpParadrop.sqf", "\achilles\functions_f_achilles\scripts\fn_wpFastrope.sqf"] select (_dialogResult select 6 == 1); | ||
_vehicleUnloadWp setWaypointScript _script; | ||
} else | ||
{ | ||
_vehicleUnloadWp setWaypointType "TR UNLOAD"; | ||
}; | ||
|
||
// Make the driver full skill. This makes him less likely to do dumb things | ||
// when they take contact. | ||
(driver (vehicle (leader _vehicleGroup))) setSkill 1; | ||
|
||
if (_vehicle_type isKindOf "Air") then | ||
{ | ||
// Special settings for helicopters. Otherwise they tend to run away instead of land | ||
// if the LZ is hot. | ||
{ | ||
_x allowFleeing 0; // Especially for helos... They're very cowardly. | ||
} forEach (crew (vehicle (leader _vehicleGroup))); | ||
_vehicleUnloadWp setWaypointTimeout [0,0,0]; | ||
} | ||
else | ||
{ | ||
_vehicleUnloadWp setWaypointTimeout [5,10,20]; // Give the units some time to get away from truck | ||
}; | ||
_vehicleInfo params ["_vehicle", "", "_vehicleGroup"]; | ||
|
||
// Generate the waypoints for after the transport drops off the troops. | ||
if (_vehicle_behaviour == 0) then | ||
{ | ||
// RTB and despawn. | ||
private _vehicleReturnWp = _vehicleGroup addWaypoint [_spawn_position, 0]; | ||
_vehicleReturnWp setWaypointTimeout [2,2,2]; // Let the unit stop before being despawned. | ||
_vehicleReturnWp setWaypointStatements ["true", "deleteVehicle (vehicle this); {deleteVehicle _x} foreach thisList;"]; | ||
}; | ||
// Adjust altitude for HALO | ||
if (_lzdz_type isEqualTo 3) then {_vehicle flyInHeight 3000}; | ||
|
||
// Add vehicle to curator | ||
[[_vehicle]] call Ares_fnc_AddUnitsToCurator; | ||
|
@@ -248,7 +217,7 @@ _infantry_group addWaypoint [_rpPos, _rpSize]; | |
|
||
// Load the units into the vehicle. | ||
{ | ||
_x moveInCargo (vehicle (leader _vehicleGroup)); | ||
_x moveInCargo _vehicle; | ||
} forEach _infantry_list; | ||
|
||
// Add infantry to curator | ||
|
@@ -260,6 +229,47 @@ if (_vehicle getVariable ["Achilles_var_noFastrope", false]) exitWith | |
{deleteVehicle _x} forEach _infantry_list; | ||
}; | ||
|
||
// create a waypoint for deploying the units | ||
private _vehicleUnloadWp = _vehicleGroup addWaypoint [_lzPos, _lzSize]; | ||
if (_vehicle isKindOf "Air" and (_lzdz_type > 0)) then | ||
{ | ||
_vehicleUnloadWp setWaypointType "SCRIPTED"; | ||
private _script = ["\achilles\functions_f_achilles\scripts\fn_wpParadrop.sqf", "\achilles\functions_f_achilles\scripts\fn_wpFastrope.sqf"] select (_lzdz_type isEqualTo 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multiple lines |
||
_vehicleUnloadWp setWaypointScript _script; | ||
} else | ||
{ | ||
_vehicleUnloadWp setWaypointType "TR UNLOAD"; | ||
}; | ||
|
||
// Make the driver full skill. This makes him less likely to do dumb things | ||
// when they take contact. | ||
(driver _vehicle) setSkill 1; | ||
|
||
if (_vehicle_type isKindOf "Air") then | ||
{ | ||
// Special settings for helicopters. Otherwise they tend to run away instead of land | ||
// if the LZ is hot. | ||
{ | ||
_x allowFleeing 0; // Especially for helos... They're very cowardly. | ||
} forEach (crew _vehicle); | ||
// armed aircrafts are unreliable when they are not CARELESS | ||
_vehicleGroup setBehaviour "CARELESS"; | ||
_vehicleUnloadWp setWaypointTimeout [0,0,0]; | ||
} | ||
else | ||
{ | ||
_vehicleUnloadWp setWaypointTimeout [5,10,20]; // Give the units some time to get away from truck | ||
}; | ||
|
||
// Generate the waypoints for after the transport drops off the troops. | ||
if (_vehicle_behaviour == 0) then | ||
{ | ||
// RTB and despawn. | ||
private _vehicleReturnWp = _vehicleGroup addWaypoint [_spawn_position, 0]; | ||
_vehicleReturnWp setWaypointTimeout [2,2,2]; // Let the unit stop before being despawned. | ||
_vehicleReturnWp setWaypointStatements ["true", "deleteVehicle (vehicle this); {deleteVehicle _x} foreach thisList;"]; | ||
}; | ||
|
||
// print a confirmation | ||
[localize "STR_AMAE_REINFORCEMENT_DISPATCHED"] call Ares_fnc_showZeusMessage; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,28 +103,39 @@ switch (_mode) do | |
}; | ||
case "VEHICLE": | ||
{ | ||
if ((_ctrl lbData _comboIndex) isKindOf "Air") then | ||
private _vehicleClass = _ctrl lbData _comboIndex; | ||
if (_vehicleClass isKindOf "Air") then | ||
{ | ||
_ctrl = _dialog displayCtrl IDC_COMBO_WP_TYPE; | ||
_ctrl ctrlSetFade 0; | ||
_ctrl ctrlEnable true; | ||
_ctrl ctrlCommit 0; | ||
|
||
_ctrl = _dialog displayCtrl IDC_COMBO_WP_TYPE_LABEL; | ||
_ctrl ctrlSetFade 0; | ||
_ctrl ctrlCommit 0; | ||
private _ctrl_wpTypeLabel = _dialog displayCtrl IDC_COMBO_WP_TYPE_LABEL; | ||
_ctrl_wpTypeLabel ctrlSetFade 0; | ||
_ctrl_wpTypeLabel ctrlCommit 0; | ||
|
||
private _ctrl_wpType = _dialog displayCtrl IDC_COMBO_WP_TYPE; | ||
_ctrl_wpType ctrlSetFade 0; | ||
_ctrl_wpType ctrlEnable true; | ||
_ctrl_wpType ctrlCommit 0; | ||
|
||
// Add/remove HALO option | ||
if (_vehicleClass isKindOf "Plane") then | ||
{ | ||
if (lbSize _ctrl_wpType == 3) then {_ctrl_wpType lbAdd localize "STR_AMAE_HALO"}; | ||
} | ||
else | ||
{ | ||
if (lbSize _ctrl_wpType == 4) then {_ctrl_wpType lbDelete 3}; | ||
}; | ||
|
||
_last_choice = uiNamespace getVariable ["Ares_ChooseDialog_ReturnValue_6", 0]; | ||
_last_choice = [0, _last_choice] select (_last_choice isEqualType 0); | ||
_last_choice = [(lbSize _ctrl) - 1, _last_choice] select (_last_choice < lbSize _ctrl); | ||
_ctrl lbSetCurSel _last_choice; | ||
_last_choice = [(lbSize _ctrl_wpType) - 1, _last_choice] select (_last_choice < lbSize _ctrl_wpType); | ||
_ctrl_wpType lbSetCurSel _last_choice; | ||
} else | ||
{ | ||
{ | ||
_ctrl = _dialog displayCtrl _x; | ||
_ctrl ctrlSetFade 0.8; | ||
_ctrl ctrlEnable false; | ||
_ctrl ctrlCommit 0; | ||
private _ctrl_wpType = _dialog displayCtrl _x; | ||
_ctrl_wpType ctrlSetFade 0.8; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. camelCase |
||
_ctrl_wpType ctrlEnable false; | ||
_ctrl_wpType ctrlCommit 0; | ||
} forEach [IDC_COMBO_WP_TYPE,IDC_COMBO_WP_TYPE_LABEL]; | ||
}; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing