Skip to content
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

Merged
merged 18 commits into from
Jun 20, 2018
Merged

HALO #324

Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,24 @@ if (!isPlayer _unit) then
private _item_cargo = getItemCargo _container;

removeBackpack _unit;
waitUntil {sleep 1; !alive _unit || getPos _unit select 2 < 150};
waitUntil {sleep 0.1; !alive _unit || getPos _unit select 2 < 150};
private _chuteClass = ["b_parachute", _backpackClass] select (getText (configfile >> "CfgVehicles" >> _backpackClass >> "backpackSimulation") isEqualTo "ParachuteSteerable");
_unit addBackpack _chuteClass;
_unit action ["openParachute"];
_unit addBackpack _backpackClass;
clearAllItemsFromBackpack _unit;
_container = backpackContainer _unit;
{_container addWeaponCargo [_x, (_weapon_cargo select 1) select _forEachIndex]} forEach (_weapon_cargo select 0);
{_container addMagazineCargo [_x, (_magazine_cargo select 1) select _forEachIndex]} forEach (_magazine_cargo select 0);
{_container addItemCargo [_x, (_item_cargo select 1) select _forEachIndex]} forEach (_item_cargo select 0);
} else
{
waitUntil {sleep 1; !alive _unit || getPos _unit select 2 < 150};
waitUntil {sleep 0.1; !alive _unit || getPos _unit select 2 < 150};
_unit addBackpack "b_parachute";
_unit action ["openParachute"];
};
// prevent AI to be killed by fall damage
waitUntil {isTouchingGround _unit or (!alive _unit)};
waitUntil {sleep 0.1; isTouchingGround _unit or (!alive _unit)};
_unit removeEventHandler ["HandleDamage",_id];

} else
Expand Down Expand Up @@ -87,6 +88,7 @@ if (!isPlayer _unit) then
waitUntil {isTouchingGround _unit or (getPos _unit select 2) < 1 or (!alive _unit)};
deleteVehicle _packHolder;
_unit addBackpack _backpack_class;
clearAllItemsFromBackpack _unit;
_container = backpackContainer _unit;
{_container addWeaponCargo [_x, (_weapon_cargo select 1) select _forEachIndex]} forEach (_weapon_cargo select 0);
{_container addMagazineCargo [_x, (_magazine_cargo select 1) select _forEachIndex]} forEach (_magazine_cargo select 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing

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"];
Copy link
Member

Choose a reason for hiding this comment

The 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;
};
Expand Down
6 changes: 6 additions & 0 deletions @AresModAchillesExpansion/addons/language_f/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5168,6 +5168,12 @@
<Japanese>空挺</Japanese>
<Chinesesimp>空投</Chinesesimp>
</Key>
<Key ID="STR_AMAE_HALO">
<Original>HALO</Original>
<English>HALO</English>
<French>HALO</French>
<German>HALO</German>
</Key>
<Key ID="STR_AMAE_WP_SEARCH_BUILDING">
<Original>SEARCH BUILDING</Original>
<English>SEARCH BUILDING</English>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private _dialogResult =
["COMBOBOX", localize "STR_AMAE_VEHICLE", [], 0, false, [["LBSelChanged","VEHICLE"]]],
["COMBOBOX", localize "STR_AMAE_VEHICLE_BEHAVIOUR", [localize "STR_AMAE_RTB_DESPAWN", localize "STR_AMAE_STAY_AT_LZ"]],
["COMBOBOX", localize "STR_AMAE_LZ_DZ", _lzOptions],
["COMBOBOX", localize "STR_AMAE_TYPE",[localize "STR_A3_CfgWaypoints_Land",localize "STR_AMAE_FASTROPING",localize "STR_AMAE_PARADROP"]],
["COMBOBOX", localize "STR_AMAE_TYPE",[localize "STR_A3_CfgWaypoints_Land",localize "STR_AMAE_FASTROPING",localize "STR_AMAE_PARADROP",localize "STR_AMAE_HALO"]],
["COMBOBOX", [localize "STR_AMAE_GROUP", localize "STR_AMAE_FACTION"] joinString " ", [], 0, false, [["LBSelChanged","GROUP_FACTION"]]],
["COMBOBOX", localize "STR_AMAE_INFANTRY_GROUP", [], 0, false, [["LBSelChanged","GROUP"]]],
["COMBOBOX", localize "STR_AMAE_UNIT_RP", _rpOptions],
Expand All @@ -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;
Expand Down Expand Up @@ -260,6 +229,45 @@ 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);
Copy link
Member

Choose a reason for hiding this comment

The 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 (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
};

// 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;

Expand Down