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

Small features #321

Merged
merged 7 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -28,19 +28,29 @@ if (!isPlayer _unit) then
moveOut _unit;
unassignVehicle _unit;
[_unit] orderGetIn false;
sleep 1;

// if the unit already has a chute
if (backpack _unit != "" and {getText (configfile >> "CfgVehicles" >> backpack _unit >> "backpackSimulation") isEqualTo "ParachuteSteerable"}) then
private _backpackClass = backpack _unit;
if (_backpackClass != "") then
{
private _container = backpackContainer _unit;
private _weapon_cargo = getWeaponCargo _container;
private _magazine_cargo = getMagazineCargo _container;
private _item_cargo = getItemCargo _container;
Copy link
Member

Choose a reason for hiding this comment

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

Add some spaces, so the code isn't so cramped and more easily read

Copy link
Member Author

Choose a reason for hiding this comment

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

done

removeBackpack _unit;
waitUntil {sleep 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;
_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
{
private _chute = "Steerable_Parachute_F" createVehicle [0,0,0];
_chute setPos (getPos _unit);
_chute setDir (getDir _unit);
_chute setVelocity (velocity _unit);
_unit moveInDriver _chute;
waitUntil {sleep 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)};
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 @@ -2293,6 +2293,12 @@
<Japanese>距離</Japanese>
<Chinesesimp>距离</Chinesesimp>
</Key>
<Key ID="STR_AMAE_PRECISION">
<Original>Precision [m]</Original>
<English>Precision [m]</English>
<French>Précision [m]</French>
<German>Ungenauigkeit [m]</German>
</Key>
<Key ID="STR_AMAE_RANGE">
<Original>Range [m]</Original>
<English>Range [m]</English>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "\achilles\modules_f_ares\module_header.hpp"

private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName"];
private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName", "_precision"];
Copy link
Member

Choose a reason for hiding this comment

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

Why private

Copy link
Member Author

Choose a reason for hiding this comment

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

Required for scoping


_objects = nearestObjects [(_this select 0), ["All"], 150, true];

Expand Down Expand Up @@ -93,7 +93,8 @@ if (_mode == 0) then
[localize "STR_AMAE_NUMBER_OF_UNITS_INVOLVED", _numberOfGuns],
[localize "STR_AMAE_ROUNDS", "", "1"],
[localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName],
[format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1]
[format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1],
[localize "STR_AMAE_PRECISION", "", "0"]
]] call Ares_fnc_ShowChooseDialog;

if (_pickFireMissionResult isEqualTo []) exitWith {};
Expand All @@ -102,6 +103,7 @@ if (_mode == 0) then
_rounds = parseNumber (_pickFireMissionResult select 1);
_ammo = (_artilleryAmmo select (_pickFireMissionResult select 2));
_ammoSelectedDisplayName = (_artilleryAmmoDisplayName select (_pickFireMissionResult select 2));
_precision = parseNumber (_pickFireMissionResult select 4);
Copy link
Member

Choose a reason for hiding this comment

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

params

Copy link
Member Author

Choose a reason for hiding this comment

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

not possible here


private _targetChooseAlgorithm = _pickFireMissionResult select 3;

Expand Down Expand Up @@ -142,7 +144,8 @@ if (_mode == 0) then
[localize "STR_AMAE_ROUNDS", "", "1"],
[localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName],
[localize "STR_AMAE_GRID_EAST_WEST_XXX", "","000"],
[localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"]
[localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"],
[localize "STR_AMAE_PRECISION", "", "0"]
]] call Ares_fnc_ShowChooseDialog;

if (_pickFireMissionResult isEqualTo []) exitWith {};
Expand All @@ -154,6 +157,7 @@ if (_mode == 0) then
private _targetX = _pickFireMissionResult select 3;
private _targetY = _pickFireMissionResult select 4;
_targetPos = [_targetX,_targetY] call CBA_fnc_mapGridToPos;
_precision = parseNumber (_pickFireMissionResult select 5);
};

if (isNil "_targetPos") exitWith {[localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ares_fnc_ShowZeusMessage; playSound "FD_Start_F"};
Expand All @@ -174,7 +178,9 @@ if (_roundEta == -1) exitWith { [localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ar

// Fire the guns
{
[_x, [_targetPos, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x];
private _theta = random 360;
private _deviation = [sin _theta, cos _theta, 0] vectorMultiply (random _precision);
[_x, [_targetPos vectorAdd _deviation, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x];
} forEach _gunsToFire;
[localize "STR_AMAE_FIRE_ROUNDS_AND_ETA", _rounds, _ammoSelectedDisplayName, _roundEta] call Ares_fnc_ShowZeusMessage;

Expand Down