Merge branch 'master' into medical-rewrite

Conflicts:
	addons/medical/ACE_Medical_SelfActions.hpp
	addons/medical/CfgVehicles.hpp
	addons/medical/XEH_PREP.hpp
	addons/medical/functions/fnc_treatment.sqf
	addons/medical/functions/fnc_treatment_failure.sqf
	addons/medical/functions/fnc_treatment_success.sqf
	addons/medical_treatment/functions/fnc_actionLoadUnit.sqf
This commit is contained in:
PabstMirror 2017-10-02 22:29:30 -05:00
commit af48c6a86c
90 changed files with 1178 additions and 426 deletions

View File

@ -128,6 +128,7 @@ Tessa Elieff <Fastroping Sound - CreativeCommons Attributions 3.0>
Toaster <jonathan.pereira@gmail.com>
Tonic
Tourorist <tourorist@gmail.com>
Tuupertunut
Valentin Torikian <valentin.torikian@gmail.com>
voiper
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>

View File

@ -51,6 +51,7 @@ class CfgVehicles {
showDisabled = 0;
icon = QPATHTOF(UI\captive_ca.paa);
priority = 2.2;
insertChildren = QUOTE(call DFUNC(addLoadCaptiveActions));
};
class GVAR(UnloadCaptive) {
displayName = CSTRING(UnloadCaptive);

View File

@ -1,3 +1,4 @@
PREP(addLoadCaptiveActions);
PREP(canApplyHandcuffs);
PREP(canEscortCaptive);
PREP(canFriskPerson);

View File

@ -0,0 +1,25 @@
/*
* Author: 654wak654
* Adds child actions to the "load captive" action for near vehicles.
*
* Arguments:
* 0: Captive <OBJECT>
*
* Return Value:
* Child actions <ARRAY>
*
* Example:
* [kevin] call ace_medical_fnc_addLoadCaptiveActions
*
* Public: No
*/
#include "script_component.hpp"
params ["_target"];
private _statement = {
params ["_target", "_player", "_vehicle"];
[_player, _target, _vehicle] call FUNC(doLoadCaptive);
};
[_target call EFUNC(common,nearestVehiclesFreeSeat), _statement, _target] call EFUNC(interact_menu,createVehiclesActions)

View File

@ -4,20 +4,20 @@
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive (may be null) <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) <OBJECT>
* 1: A captive. objNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. objNull for the nearest vehicle <OBJECT>
*
* Return Value:
* The return value <BOOL>
* Can load captive <BOOL>
*
* Example:
* [player, bob, car] call ACE_captives_fnc_canLoadCaptive
* [bob, tom, car] call ace_captives_fnc_canLoadCaptive
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target","_vehicle"];
params ["_unit", "_target", "_vehicle"];
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
if (_target getVariable ["ACE_isUnconscious", false]) exitWith {false};
@ -30,20 +30,16 @@ if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
};
} forEach (attachedObjects _unit);
};
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false};
if (isNull _target || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false};
if (isNull _vehicle) then {
//Looking at a captive unit, search for nearby vehicles with valid seats:
{
if ((_x emptyPositions "cargo") > 0) exitWith {
_vehicle = _x;
};
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
// Looking at a captive unit, get nearest vehicle with valid seat:
_vehicle = (_target call EFUNC(common,nearestVehiclesFreeSeat)) param [0, objNull];
} else {
//We have a vehicle picked, make sure it has empty seats:
if ((_vehicle emptyPositions "cargo") == 0) then {
// We have a vehicle picked, make sure it has empty seats:
if (_vehicle emptyPositions "cargo" == 0 && {_vehicle emptyPositions "gunner" == 0}) then {
_vehicle = objNull;
};
};
(!isNull _vehicle)
!isNull _vehicle

View File

@ -4,42 +4,37 @@
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle <OBJECT>
* 1: A captive. objNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. objNull for the nearest vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob, tom, car] call ACE_captives_fnc_doLoadCaptive
* [bob, tom, car] call ace_captives_fnc_doLoadCaptive
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target","_vehicle"];
params ["_unit", "_target", "_vehicle"];
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
//Looking at a vehicle while escorting, get target from attached objects:
if (isNull _target && {_unit getVariable [QGVAR(isEscorting), false]}) then {
// Looking at a vehicle while escorting, get target from attached objects:
{
if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith {
_target = _x;
};
} forEach (attachedObjects _unit);
};
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {WARNING("");};
if (isNull _target || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {WARNING("");};
if (isNull _vehicle) then {
//Looking at a captive unit, search for nearby vehicles with valid seats:
{
// if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith {
if ((_x emptyPositions "cargo") > 0) exitWith {
_vehicle = _x;
};
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
// Looking at a captive unit, get nearest vehicle with valid seat:
_vehicle = (_target call EFUNC(common,nearestVehiclesFreeSeat)) param [0, objNull];
} else {
// if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then {
if ((_vehicle emptyPositions "cargo") == 0) then {
// We have a vehicle picked, make sure it has empty seats:
if (_vehicle emptyPositions "cargo" == 0 && {_vehicle emptyPositions "gunner" == 0}) then {
_vehicle = objNull;
};
};

View File

@ -18,20 +18,18 @@
params ["_vehicle"];
TRACE_1("params", _vehicle);
private _vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
scopeName "main";
{
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
if ((isNull _unit) && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then {
if (isNull _unit && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then {
[_cargoIndex, false] breakOut "main";
};
} forEach (fullCrew [_vehicle, "", true]);
{
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
if ((isNull _unit) && {_cargoIndex > -1}) then {
if (isNull _unit && {_cargoIndex > -1}) then {
[_cargoIndex, true] breakOut "main";
};
} forEach (fullCrew [_vehicle, "", true]);

View File

@ -314,7 +314,7 @@
<Hungarian>Saját oldal megbilincselhető</Hungarian>
<Russian>Связать союзника</Russian>
<Italian>Puoi ammanettare unità alleate</Italian>
<Japanese>自陣営への拘束を可能に</Japanese>
<Japanese>拘束ユニットを自陣営へ</Japanese>
<Korean>자기편에게 수갑을 채울 수 있게 합니다</Korean>
<Chinese>可以銬住同陣營隊友</Chinese>
<Chinesesimp>可以铐住同阵营队友</Chinesesimp>
@ -330,7 +330,7 @@
<Hungarian>A játékosok megkötözhetik-e a saját oldalukon lévő egységeket</Hungarian>
<Russian>Разрешить игрокам связывать юнитов своей стороны</Russian>
<Italian>I giocatori possono ammanettare unità alleate</Italian>
<Japanese>プレイヤーがユニットを拘束し、彼らの陣営に変更できます</Japanese>
<Japanese>プレイヤーが拘束したユニットの陣営を自陣営に変更させ</Japanese>
<Korean>자기편에게 케이블타이를 사용할 수 있게합니다</Korean>
<Chinese>玩家可以使用束線帶銬住同陣營隊友</Chinese>
<Chinesesimp>玩家可以使用束线带铐住同阵营队友</Chinesesimp>
@ -362,7 +362,7 @@
<Hungarian>A játékosok megadhatják magukat a fegyverük elrakása után</Hungarian>
<Russian>Игроки могут сдаться в плен после того, как уберут оружие</Russian>
<Italian>I giocatori possono arrendersi dopo aver messo via le proprie armi</Italian>
<Japanese>プレイヤーは武器を収めたあと投降できるようにします。</Japanese>
<Japanese>プレイヤーは武器を収めたあと投降できるようにします。</Japanese>
<Korean>비무장한 플레이어가 투항할 수 있게 합니다</Korean>
<Chinese>玩家能在收起自己武器後投降</Chinese>
<Chinesesimp>玩家能在收起自己武器后投降</Chinesesimp>
@ -430,6 +430,8 @@
<Key ID="STR_ACE_Captives_KeyComb_Description">
<English>Sets the unit under the cursor captive.</English>
<German>Nimmt die Einheit vor dem Cursor fest.</German>
<Japanese>カーソル先のユニットを拘束</Japanese>
<Italian>Imposta l'unità nello stato di prigioniero.</Italian>
</Key>
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrenderAi_name">
<English>Require AI surrendering</English>

View File

@ -4,42 +4,28 @@
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* Children actions <ARRAY>
* Child actions <ARRAY>
*
* Example:
* [target, player] call ace_cargo_fnc_addCargoVehiclesActions
* [cursorObject] call ace_cargo_fnc_addCargoVehiclesActions
*
* Public: No
*/
#include "script_component.hpp"
params ["_target", "_player"];
params ["_target"];
private _statement = {
params ["_target", "_player", "_params"];
_params params ["_vehicle"];
params ["_target", "_player", "_vehicle"];
[_player, _target, _vehicle] call FUNC(startLoadIn);
};
private _actions = [];
{
private _config = configFile >> "CfgVehicles" >> typeOf _x;
private _vehicles = (nearestObjects [_target, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]) select {
private _hasCargoConfig = 1 == getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(hasCargo));
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1;
if ((_hasCargoPublic || _hasCargoConfig) && {_x != _target}) then {
private _name = getText (_config >> "displayName");
private _ownerName = [_x, true] call EFUNC(common,getName);
if ("" != _ownerName) then {
_name = format ["%1 (%2)", _name, _ownerName];
};
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target];
};
} forEach (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]);
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target}
};
_actions
[_vehicles, _statement, _target] call EFUNC(interact_menu,createVehiclesActions)

View File

@ -53,7 +53,7 @@ private _condition = {
{(_target getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(canLoad))]) in [true, 1]} &&
{locked _target < 2} &&
{alive _target} &&
{[_player, _target, []] call EFUNC(common,canInteractWith)} &&
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
{0 < {
private _type = typeOf _x;
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];

View File

@ -42,7 +42,9 @@ if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
[_object,_vehicle],
{["ace_loadCargo", _this select 0] call CBA_fnc_localEvent},
{},
localize LSTRING(LoadingItem)
localize LSTRING(LoadingItem),
{true},
["isNotSwimming"]
] call EFUNC(common,progressBar);
_return = true;
} else {

View File

@ -105,6 +105,7 @@ PREP(isInBuilding);
PREP(isMedic);
PREP(isModLoaded);
PREP(isPlayer);
PREP(isSwimming);
PREP(isUnderwater);
PREP(lightIntensityFromObject);
PREP(loadPerson);
@ -117,6 +118,7 @@ PREP(moduleLSDVehicles);
PREP(muteUnit);
PREP(muteUnitHandleInitPost);
PREP(muteUnitHandleRespawn);
PREP(nearestVehiclesFreeSeat);
PREP(numberToDigits);
PREP(numberToDigitsString);
PREP(numberToString);

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Author: commy2, Jonpas
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
*
* Arguments:
@ -10,7 +9,7 @@
* None
*
* Example:
* [bob] call ace_common_fnc_fixPosition
* bob call ace_common_fnc_fixPosition
*
* Public: No
*/
@ -19,25 +18,28 @@
// setVectorUp requires local object
if (!local _this) exitWith {};
if ((getText (configFile >> "CfgVehicles" >> (typeOf _this) >> "simulation")) == "house") then {
//Houses don't have gravity/physics, so make sure they are not floating
private _posAbove = (getPos _this) select 2;
// Objects with disabled simulation and objects with simulation type "house" don't have gravity/physics, so make sure they are not floating
private _hasGravity = simulationEnabled _this && {!(getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "house")};
if (!_hasGravity) then {
private _posAbove = (getPosATL _this) select 2;
TRACE_2("house",_this,_posAbove);
if (_posAbove > 0.1) then {
private _newPosASL = (getPosASL _this) vectorDiff [0,0,_posAbove];
_this setPosASL _newPosASL;
private _newPosATL = (getPosATL _this) vectorDiff [0, 0, _posAbove];
_this setPosATL _newPosATL;
};
};
private _position = getPos _this;
private _position = getPosATL _this;
// don't place the object below the ground
// Don't place the object below the ground
if (_position select 2 < -0.1) then {
_position set [2, -0.1];
_this setPos _position;
_this setPosATL _position;
};
// adjust position to sloped terrain, if placed on ground
if (getPosATL _this select 2 == _position select 2) then {
// Adjust position to sloped terrain, if placed on ground
// Object without gravity/physics may have negative height when placed on slope, but those objects are definitely on the ground
if (!_hasGravity || {getPosATL _this select 2 == _position select 2}) then {
_this setVectorUp surfaceNormal _position;
};

View File

@ -1,6 +1,6 @@
/*
* Author: commy2
* Move unit to kneeling position (only if not yet prone).
* Move unit to kneeling position (only if not yet prone and not underwater).
*
* Arguments:
* 0: Unit <OBJECT>
@ -18,7 +18,7 @@
params ["_unit"];
// Animation changes even inside vehicle post-1.60
if (stance _unit == "PRONE" || {vehicle ACE_player != ACE_player}) exitWith {};
if (stance _unit == "PRONE" || {vehicle _unit != _unit} || {_unit call EFUNC(common,isSwimming)}) exitWith {};
[
_unit,

View File

@ -0,0 +1,20 @@
/*
* Author: das attorney, Jonpas
* Check if unit is swimming (surface swimming or diving).
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* If unit is swimming <BOOL>
*
* Example:
* [bob] call ace_common_fnc_isSwimming
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]]];
((animationState _unit) select [1, 3]) in ["bdv","bsw","dve","sdv","ssw","swm"]

View File

@ -1,13 +1,14 @@
/*
* Author: Glowbal
* Loads a specified unit into any nearby vehicle
* Loads a specified unit into any nearby vehicle, or _vehicle parameter.
*
* Arguments:
* 0: Unit that will load <OBJECT>
* 1: Unit to be loaded <OBJECT>
* 2: Vehicle that the unit will be loaded in <OBJECT> (default: objNull)
*
* Return Value:
* the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed <OBJECT>
* Vehicle that the unitToBeloaded has been loaded in. Returns objNull if function failed <OBJECT>
*
* Example:
* [bob, kevin] call ace_common_fnc_loadPerson
@ -18,20 +19,14 @@
#define GROUP_SWITCH_ID QFUNC(loadPerson)
params ["_caller", "_unit"];
params ["_caller", "_unit", ["_vehicle", objNull]];
private _vehicle = objNull;
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying", "isNotSwimming"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle};
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F","Pod_Heli_Transport_04_crewed_base_F"], 10];
{
TRACE_1("",_x);
if ((_x emptyPositions "cargo" > 0) || {_x emptyPositions "gunner" > 0}) exitWith {
_vehicle = _x;
};
} forEach _nearVehicles;
// Try to use nearest vehicle if a vehicle hasn't been supplied
if (isNull _vehicle) then {
_vehicle = ([_unit] call FUNC(nearestVehiclesFreeSeat)) param [0, objNull];
};
if (!isNull _vehicle) then {
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);

View File

@ -0,0 +1,22 @@
/*
* Author: 654wak654
* Returns a list of vehicles near given unit that the unit can be a passenger in.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Distance <NUMBER>
*
* Return Value:
* Nearest vehicles with a free seat <ARRAY>
*
* Example:
* [bob] call ace_common_fnc_nearestVehiclesFreeSeat
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", ["_distance", 10]];
private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F", "Pod_Heli_Transport_04_crewed_base_F"], _distance];
_nearVehicles select {(_x emptyPositions "cargo" > 0) || {_x emptyPositions "gunner" > 0}}

View File

@ -12,7 +12,7 @@
<Portuguese>ACE-Team</Portuguese>
<Hungarian>ACE-Team</Hungarian>
<Italian>ACE-Team</Italian>
<Japanese>ACE-Team</Japanese>
<Japanese>ACE-チーム</Japanese>
<Korean>ACE-Team</Korean>
<Chinese>ACE-製作團隊</Chinese>
<Chinesesimp>ACE-制作团队</Chinesesimp>
@ -1165,7 +1165,7 @@
<Hungarian>pecek</Hungarian>
<Czech>přep.</Czech>
<Portuguese>alternar</Portuguese>
<Japanese>トグル</Japanese>
<Japanese>切り替え</Japanese>
<Korean>토글</Korean>
<Chinese>切換</Chinese>
<Chinesesimp>切换</Chinesesimp>

View File

@ -18,7 +18,7 @@
params ["_unit", "_target"];
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging (ignore UAV AI)
if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false};

View File

@ -18,6 +18,6 @@
params ["_unit", "_target"];
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
if !([_unit, _target, ["isNotDragging", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
_unit getVariable [QGVAR(draggedObject), objNull] == _target

View File

@ -58,7 +58,7 @@ if (_inBuilding) then {
_unit setVariable [QGVAR(isDragging), false, true];
_unit setVariable [QGVAR(draggedObject), objNull, true];
// make object accesable for other units
// make object accessible for other units
[objNull, _target, true] call EFUNC(common,claim);
if !(_target isKindOf "CAManBase") then {

View File

@ -31,6 +31,7 @@ private _totalWeight = 0;
} forEach _item;
true
} count [
//IGNORE_PRIVATE_WARNING ["_x"];
[getMagazineCargo _object, {configFile >> "CfgMagazines" >> _x}],
[getBackpackCargo _object, {configFile >> "CfgVehicles" >> _x}],
[getItemCargo _object, {configFile >> "CfgWeapons" >> _x >> "ItemInfo"}],

View File

@ -30,7 +30,7 @@ if (_unit != _realUnit) exitWith {
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when not in valid animation
if !(_anim in DRAG_ANIMATIONS) then {
if (!(_anim in DRAG_ANIMATIONS) && {!(_unit call EFUNC(common,isSwimming))}) then {
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
if (!isNull _draggedObject) then {

View File

@ -39,9 +39,11 @@ _unit selectWeapon primaryWeapon _unit;
[_unit, _target, true] call EFUNC(common,claim);
// can't play action that depends on weapon if it was added the same frame
[{
[_this, "grabDrag"] call EFUNC(common,doGesture);
}, _unit] call CBA_fnc_execNextFrame;
if !(_unit call EFUNC(common,isSwimming)) then {
[{
[_this, "grabDrag"] call EFUNC(common,doGesture);
}, _unit] call CBA_fnc_execNextFrame;
};
// move a bit closer and adjust direction when trying to pick up a person
if (_target isKindOf "CAManBase") then {

View File

@ -50,7 +50,7 @@ if (CBA_missionTime > _timeOut) exitWith {
};
// unit is ready to start dragging
if (animationState _unit in DRAG_ANIMATIONS) exitWith {
if (animationState _unit in DRAG_ANIMATIONS || {_unit call EFUNC(common,isSwimming)}) exitWith {
TRACE_4("Start Dragging",_unit,_target,_timeOut,CBA_missionTime);
[_unit, _target] call FUNC(dragObject);

View File

@ -2,7 +2,7 @@
#define COMPONENT_BEAUTIFIED Dragging
#include "\z\ace\addons\main\script_mod.hpp"
//#define DEBUG_ENABLED_DRAGGING
// #define DEBUG_ENABLED_DRAGGING
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

View File

@ -1,4 +1,13 @@
class CfgWeapons {
class Default;
class Put: Default {
muzzles[] += {QGVAR(muzzle)};
class PutMuzzle: Default{};
class GVAR(muzzle): PutMuzzle {
magazines[] = {"ACE_FlareTripMine_Mag"};
};
};
class ACE_ItemCore;
class CBA_MiscItem_ItemInfo;

View File

@ -49,6 +49,7 @@
<Key ID="STR_ACE_Fastroping_Interaction_stowFRIES">
<English>Stow fast roping system</English>
<Italian>Arrotola le corde</Italian>
<Japanese>ファスト ロープのシステムを収容</Japanese>
</Key>
<Key ID="STR_ACE_Fastroping_Interaction_deployRopes">
<English>Deploy ropes</English>

View File

@ -7,6 +7,7 @@ PREP(compileMenuSelfAction);
PREP(compileMenuZeus);
PREP(collectActiveActionTree);
PREP(createAction);
PREP(createVehiclesActions);
PREP(ctrlSetParsedTextCached);
PREP(findActionNode);
PREP(handleEscapeMenu);

View File

@ -0,0 +1,33 @@
/*
* Author: Dystopian
* Creates child actions for vehicle list.
* Statement gets vehicle as action parameter.
*
* Arguments:
* 0: Vehicle list <ARRAY>
* 1: Statement <CODE>
* 2: Target <OBJECT>
*
* Return Value:
* Array of actions <ARRAY>
*
* Example:
* [nearestObjects [player, ["AllVehicles"], 10], {}, cursorObject] call ace_interact_menu_fnc_createVehiclesActions
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicles", "_statement", "_target"];
_vehicles apply {
private _config = configFile >> "CfgVehicles" >> typeOf _x;
private _name = getText (_config >> "displayName");
private _ownerName = [_x, true] call EFUNC(common,getName);
if ("" != _ownerName) then {
_name = format ["%1 (%2)", _name, _ownerName];
};
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
[_action, [], _target]
}

View File

@ -106,7 +106,7 @@ GVAR(isOpeningDoor) = false;
{false},
[20, [true, false, false]], false] call CBA_fnc_addKeybind;
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);
["isNotSwimming", {!(_this call EFUNC(common,isSwimming))}] call EFUNC(common,addCanInteractWithCondition);
["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition);
["ace_settingsInitialized", {

View File

@ -25,7 +25,7 @@ if (_unit != ACE_player) exitWith {};
_timeToCut = if ([_unit] call EFUNC(common,isEngineer)) then {7.5} else {11};
if (!underwater _unit) then {
if !(_unit call EFUNC(common,isSwimming)) then {
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
};
@ -33,7 +33,7 @@ _onCompletion = {
TRACE_1("_onCompletion",_this);
(_this select 0) params ["_fenceObject", "", "_unit"];
_fenceObject setdamage 1;
if (!underwater _unit) then {
if !(_unit call EFUNC(common,isSwimming)) then {
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
};
};
@ -41,7 +41,7 @@ _onCompletion = {
_onFail = {
TRACE_1("_onFail", _this);
(_this select 0) params ["", "", "_unit"];
if (!underwater _unit) then {
if !(_unit call EFUNC(common,isSwimming)) then {
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
};
};

View File

@ -25,7 +25,7 @@ _args params ["_magazineClassname", "_lastAmmoCount"];
private _fullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count");
// Don't show anything if player can't interact
if (!([ACE_player, objNull, ["isNotInside", "isNotSitting", "isNowSwimming"]] call EFUNC(common,canInteractWith))) exitWith {};
if (!([ACE_player, objNull, ["isNotInside", "isNotSitting", "isNotSwimming"]] call EFUNC(common,canInteractWith))) exitWith {};
// Count mags
private _fullMags = 0;

View File

@ -44,7 +44,7 @@
<Portuguese>%1 carregador(es) cheio(s) e %2 disparo(s) a mais</Portuguese>
<Hungarian>%1 teljes tár és %2 extra lőszer</Hungarian>
<Russian>%1 полных магазина(ов) и %2 патрона(ов)</Russian>
<Japanese>%1 個の満杯な弾倉と入りきらなかった %2 個の弾倉</Japanese>
<Japanese>%1 個の満杯な弾倉と入りきらなかった %2 発の弾薬</Japanese>
<Korean>%1개의 꽉찬 탄창과 %2발의 총알이 남았다</Korean>
<Chinesesimp>%1个满的弹匣与%2发额外子弹</Chinesesimp>
<Chinese>%1個滿的彈匣與%2發額外子彈</Chinese>
@ -92,7 +92,7 @@
<Hungarian>%1 teljes és %2 részleges</Hungarian>
<Italian>%1 pieno(i) e %2 parziale(i)</Italian>
<Portuguese>%1 Total e %2 Parcial </Portuguese>
<Japanese>%1 個の満杯で、 %2 の余分数</Japanese>
<Japanese>%1 個の満杯と %2 個の弾薬入り弾倉</Japanese>
<Korean>%1 꽉찼고 %2 부분참</Korean>
<Chinesesimp>%1个满的与%2个部分的</Chinesesimp>
<Chinese>%1個滿的與%2個部分的</Chinese>

View File

@ -0,0 +1,25 @@
/*
* Author: 654wak654
* Adds child actions to the "load patient" action for near vehicles.
*
* Arguments:
* 0: Patient <OBJECT>
*
* Return Value:
* Child actions <ARRAY>
*
* Example:
* [kevin] call ace_medical_fnc_addLoadPatientActions
*
* Public: No
*/
#include "script_component.hpp"
params ["_target"];
private _statement = {
params ["_target", "_player", "_vehicle"];
[_player, _target, _vehicle] call FUNC(actionLoadUnit);
};
[_target call EFUNC(common,nearestVehiclesFreeSeat), _statement, _target] call EFUNC(interact_menu,createVehiclesActions)

View File

@ -2411,7 +2411,7 @@
<Hungarian>A páciens, %1,&lt;br/&gt;%2.&lt;br/&gt;%3.&lt;br/&gt;%4</Hungarian>
<Czech>Pacient %1&lt;br/&gt;je %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Czech>
<Portuguese>Paciente %1&lt;br/&gt;é %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Portuguese>
<Japanese>痛み %1&lt;br/&gt;は %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Japanese>
<Japanese>患者 %1&lt;br/&gt;は %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Japanese>
<Korean>환자 %1&lt;br/&gt;는 %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Korean>
<Chinesesimp>伤者 %1&lt;br/&gt;is %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Chinesesimp>
<Chinese>傷者 %1&lt;br/&gt;is %2.&lt;br/&gt;%3.&lt;br/&gt;%4</Chinese>

View File

@ -341,7 +341,7 @@
<Portuguese>Alternar (Si mesmo)</Portuguese>
<Czech>Přepnout (na sebe)</Czech>
<Italian>Attiva (Te Stesso)</Italian>
<Japanese>トグル (自分)</Japanese>
<Japanese>切り替え (自分)</Japanese>
<Korean>토글 (자신)</Korean>
<Chinesesimp>切换 (自己)</Chinesesimp>
<Chinese>切換 (自己)</Chinese>
@ -761,7 +761,7 @@
<Portuguese>Sangrando</Portuguese>
<Czech>Krvácí</Czech>
<Italian>Sanguinamento</Italian>
<Japanese>出血</Japanese>
<Japanese>出血</Japanese>
<Korean>출혈</Korean>
<Chinesesimp>出血中</Chinesesimp>
<Chinese>出血中</Chinese>

View File

@ -1,10 +1,11 @@
/*
* Author: Glowbal
* Action for loading an unconscious or dead unit in the nearest vechile
* Action for loading an unconscious or dead unit in the nearest vehicle, or _vehicle if given.
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: The vehicle <OBJECT> (default: objNull)
*
* Return Value:
* Vehicle they are loaded into (objNull on failure) <OBJECT>
@ -16,20 +17,20 @@
*/
#include "script_component.hpp"
params ["_caller", "_target"];
params ["_caller", "_target", ["_vehicle", objNull]];
if (_target call EFUNC(common,isAwake)) exitWith {
if ([_target] call EFUNC(common,isAwake)) exitWith {
[QEGVAR(common,displayTextStructured), [[ELSTRING(medical,CanNotLoaded), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent;
};
if (_target call FUNC(isBeingCarried)) then {
if ([_target] call FUNC(isBeingCarried)) then {
[_caller, _target] call EFUNC(dragging,dropObject_carry);
};
if (_target call FUNC(isBeingDragged)) then {
if ([_target] call FUNC(isBeingDragged)) then {
[_caller, _target] call EFUNC(dragging,dropObject);
};
private _vehicle = [_caller, _target] call EFUNC(common,loadPerson);
private _vehicle = [_caller, _target, _vehicle] call EFUNC(common,loadPerson);
_vehicle

View File

@ -9,12 +9,14 @@ PREP(canTakeAmmo);
PREP(createDummy);
PREP(disable);
PREP(dropAmmo);
PREP(getAllRearmTurrets);
PREP(getCaliber);
PREP(getHardpointMagazines);
PREP(getMaxMagazines);
PREP(getNeedRearmMagazines);
PREP(getSupplyCount);
PREP(getVehicleMagazines);
PREP(getTurretConfigMagazines);
PREP(getTurretMagazineAmmo);
PREP(grabAmmo);
PREP(handleKilled);
PREP(handleUnconscious);
@ -32,6 +34,7 @@ PREP(rearmSuccess);
PREP(rearmSuccessLocal);
PREP(removeMagazineFromSupply);
PREP(setSupplyCount);
PREP(setTurretMagazineAmmo);
PREP(storeAmmo);
PREP(takeAmmo);
PREP(takeSuccess);

View File

@ -3,7 +3,7 @@
* Show the resupplyable ammunition of all surrounding vehicles.
*
* Arguments:
* 0: Target <OBJECT>
* 0: Ammo Truck <OBJECT>
*
* Return Value:
* ChildActions <ARRAY>
@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
params [["_truck", objNull, [objNull]]];
params ["_truck"];
private _vehicles = nearestObjects [_truck, ["AllVehicles"], 20];
_vehicles = _vehicles select {(_x != _truck) && {!(_x isKindOf "CAManBase")} && {!(_x getVariable [QGVAR(disabled), false])}};
@ -23,49 +23,12 @@ _vehicles = _vehicles select {(_x != _truck) && {!(_x isKindOf "CAManBase")} &&
private _vehicleActions = [];
{
private _vehicle = _x;
private _magazineHelper = [];
{
private _turretPath = _x;
private _magazines = [_vehicle, _turretPath] call FUNC(getVehicleMagazines);
{
private _magazine = _x;
if (!(_magazine in _magazineHelper)) then {
private _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath);
private _maxMagazines = [_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines);
if ((_currentMagazines < _maxMagazines) || {(_vehicle magazineTurretAmmo [_magazine, _turretPath]) < getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")}) then {
_magazineHelper pushBack _magazine;
};
};
false
} count _magazines;
false
} count REARM_TURRET_PATHS;
// 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];
{
private _pylonName = configName _x;
private _pylonAmmo = _vehicle ammoOnPylon _pylonName;
private _pylonMagazine = (getPylonMagazines _vehicle) select _forEachIndex;
TRACE_3("",_pylonName,_pylonAmmo,_pylonMagazine);
if (_pylonAmmo > 0) then {
// Try to refill current pylon:
private _magAmmo = getNumber (configFile >> "CfgMagazines" >> _pylonMagazine >> "count");
if ((!(_pylonMagazine in _magazineHelper)) && {_pylonAmmo < _magAmmo}) then {
_magazineHelper pushBack _pylonMagazine;
};
} else {
// See what we magazines can add to the empty pylon:
private _hardpointMags = [_x] call FUNC(getHardpointMagazines);
{
if (!(_x in _magazineHelper)) then {
_magazineHelper pushBack _x;
};
} forEach _hardpointMags;
};
} forEach _pylonConfigs;
// Array of magazines that can be rearmed in the vehicle
private _needRearmMags = ([_vehicle] call FUNC(getNeedRearmMagazines)) apply {_x select 0};
// _needRearmMags without duplicates
private _magazineHelper = _needRearmMags arrayIntersect _needRearmMags;
_magazineHelper = _magazineHelper select {[_truck, _x] call FUNC(hasEnoughSupply)};
TRACE_2("can add",_x,_magazineHelper);
@ -77,40 +40,46 @@ private _vehicleActions = [];
};
if (GVAR(level) == 0) then {
// [Level 0] adds a single action to rearm the entire vic
private _action = [_vehicle,
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"),
_icon,
{_this call FUNC(rearmEntireVehicle)},
{true},
{},
_vehicle] call EFUNC(interact_menu,createAction);
private _action = [
_vehicle,
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"),
_icon,
{_this call FUNC(rearmEntireVehicle)},
{true},
{},
_vehicle
] call EFUNC(interact_menu,createAction);
_vehicleActions pushBack [_action, [], _truck];
} else {
// [Level 1,2] - Add actions for each magazine
private _actions = [];
{
private _action = [_x,
getText(configFile >> "CfgMagazines" >> _x >> "displayName"),
getText(configFile >> "CfgMagazines" >> _x >> "picture"),
{_this call FUNC(takeAmmo)},
{true},
{},
[_x, _vehicle]] call EFUNC(interact_menu,createAction);
private _action = [
_x,
getText(configFile >> "CfgMagazines" >> _x >> "displayName"),
getText(configFile >> "CfgMagazines" >> _x >> "picture"),
{_this call FUNC(takeAmmo)},
{true},
{},
[_x, _vehicle]
] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _truck];
} forEach _magazineHelper;
private _action = [_vehicle,
private _action = [
_vehicle,
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"),
_icon,
{},
{true},
{},
[]] call EFUNC(interact_menu,createAction);
[]
] call EFUNC(interact_menu,createAction);
_vehicleActions pushBack [_action, _actions, _truck];
};
};
false
} count _vehicles;
} forEach _vehicles;
_vehicleActions

View File

@ -29,16 +29,17 @@ if (_vehicle isEqualType objNull) then {_vehicle = typeOf _vehicle};
if (_vehicle == "") exitWith {
ERROR_1("VehicleType [%1] is empty in ace_rearm_fnc_addVehicleMagazinesToSupply",_string);
};
private _turrets = [_vehicle] call FUNC(getAllRearmTurrets);
{
private _turretPath = _x;
private _magazines = [_vehicle, _turretPath] call FUNC(getVehicleMagazines);
private _magazines = [_vehicle, _turretPath] call FUNC(getTurretConfigMagazines);
TRACE_2("",_turretPath,_magazines);
{
[_truck, _x] call FUNC(addMagazineToSupply);
false
} count _magazines;
false
} count REARM_TURRET_PATHS;
} count _turrets;
// 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_truck", "_unit"];
(alive _unit)
&& {_unit isKindOf "CAManBase"}

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_vehicle", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_vehicle", "_unit"];
if (!alive _vehicle) exitWith {false};
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_vehicle distance _unit > REARM_ACTION_DISTANCE} || {_vehicle getVariable [QGVAR(disabled), false]}) exitWith {false};
@ -29,4 +26,9 @@ if (isNull _dummy) exitwith {false};
private _magazineClass = _dummy getVariable QGVAR(magazineClass);
if (isNil "_magazineClass") exitWith {false};
([_vehicle, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0
private _needRearmMags = [_vehicle] call FUNC(getNeedRearmMagazines);
// Testing if vehicle needs rearm on any magazines of class _magazineClass
private _needsRearm = ({(_x select 0) isEqualTo _magazineClass} count _needRearmMags) > 0;
_needsRearm

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_truck", "_unit"];
(alive _unit)
&& {_unit isKindOf "CAManBase"}

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_truck", "_unit"];
(alive _unit)
&& {_unit isKindOf "CAManBase"}

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_unit", objNull, [objNull]],
["_magazineClass", "", [""]]
];
params ["_unit", "_magazineClass"];
private _ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo");
private _dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy));

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params [
["_unit", objNull, [objNull]],
["_delete", false, [false]],
["_unholster", true, [true]]
"_unit",
["_delete", false],
["_unholster", true]
];
private _dummy = _unit getVariable [QGVAR(dummy), objNull];

View File

@ -0,0 +1,28 @@
/*
* Author: Tuupertunut
* Returns all turrets in a vehicle.
*
* BIS command "allTurrets" does not return the driver turret at the time of writing (2017-07-16).
* This function just adds driver turret to the array returned by "allTurrets".
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* Turret paths <ARRAY>
*
* Example:
* [vehicle] call ace_rearm_fnc_getAllRearmTurrets
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
private _turrets = allTurrets _vehicle;
// Adding the driver turret "[-1]".
_turrets pushBack [-1];
_turrets

View File

@ -18,7 +18,7 @@
#include "script_component.hpp"
params [
["_magazineClass", "", [""]]
["_magazineClass", ""]
];
if (_magazineClass isEqualTo "") exitWith {[8, 2]};

View File

@ -15,6 +15,8 @@
*/
#include "script_component.hpp"
ACE_DEPRECATED(QFUNC(getHardpointMagazines),"3.12.0","getCompatiblePylonMagazines");
params ["_pylonConfig"];
private _return = GVAR(hardpointGroupsCache) getVariable (str _pylonConfig);

View File

@ -17,13 +17,7 @@
*/
#include "script_component.hpp"
params [
["_vehicle", objNull, [objNull]],
["_turretPath", [], [[]]],
["_magazineClass", "", [""]]
];
params ["_vehicle", "_turretPath", "_magazineClass"];
if (isNull _vehicle) exitWith {0};
private _count = {_x == _magazineClass} count ([_vehicle, _turretPath] call FUNC(getVehicleMagazines));
private _count = {_x == _magazineClass} count ([_vehicle, _turretPath] call FUNC(getTurretConfigMagazines));
_count

View File

@ -1,78 +1,87 @@
/*
* Author: GitHawk, Jonpas
* Get rearm return value.
* Author: Tuupertunut
* Returns information about every magazine that can be rearmed in the vehicle. Multiple mags of
* same class in the same turret are grouped together for practical reasons.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Magazine Classname <STRING>
*
* Return Value:
* Return Value <ARRAY>
* 0: Can Rearm <BOOL>
* 1: TurretPath <ARRAY>
* 2: Number of current magazines in turret path <NUMBER>
* 3: Pylon Index (-1 if not a pylon) <NUMBER>
* Magazine info <ARRAY of ARRAYs>
* Child arrays:
* 0: Magazine class <STRING>
* 1: Turret path <ARRAY>
* 2: Is pylon magazine <BOOLEAN>
* 3: Pylon index (-1 if not pylon) <NUMBER>
* 4: Max magazines <NUMBER>
* 5: Current magazines <NUMBER>
* 6: Max rounds per magazine <NUMBER>
* 7: Current rounds in magazines <ARRAY of NUMBERs>
*
* Example:
* [tank, "500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_getNeedRearmMagazines
* [tank] call ace_rearm_fnc_getNeedRearmMagazines
*
* Public: No
*/
#include "script_component.hpp"
params [["_vehicle", objNull, [objNull]], ["_magazineClass", "", [""]]];
params ["_vehicle"];
private _return = [false, [], 0, -1];
private _magazineInfo = [];
// 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];
{
private _magazines = [_vehicle, _x] call FUNC(getVehicleMagazines);
private _pylonConfig = _x;
// Strangely, a 1-based index.
private _pylonIndex = _forEachIndex + 1;
// Retrieving pylon magazine by index. If the pylon is empty, it is marked with "".
private _pylonMagazine = (getPylonMagazines _vehicle) select (_pylonIndex - 1);
// Only care about pylons that have a magazine.
if (!(_pylonMagazine isEqualTo "")) then {
private _maxRounds = getNumber (configFile >> "CfgMagazines" >> _pylonMagazine >> "count");
private _currentRounds = _vehicle ammoOnPylon _pylonIndex;
if (_currentRounds < _maxRounds) then {
// getPylonTurret expects 0 based index, and returns driver turret as [-1]
private _pylonTurret = [_vehicle, (_pylonIndex - 1)] call EFUNC(common,getPylonTurret);
if (_magazineClass in _magazines) then {
private _currentMagazines = {_x == _magazineClass} count (_vehicle magazinesTurret _x);
if ((_vehicle magazineTurretAmmo [_magazineClass, _x]) < getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count")) exitWith {
_return = [true, _x, _currentMagazines, -1];
};
if (_currentMagazines < ([_vehicle, _x, _magazineClass] call FUNC(getMaxMagazines))) exitWith {
_return = [true, _x, _currentMagazines, -1];
_magazineInfo pushBack [_pylonMagazine, _pylonTurret, true, _pylonIndex, 1, 1, _maxRounds, [_currentRounds]];
};
};
} forEach _pylonConfigs;
if (_return select 0) exitWith {};
false
} count REARM_TURRET_PATHS;
private _turrets = [_vehicle] call FUNC(getAllRearmTurrets);
{
private _turretPath = _x;
private _magazines = [_vehicle, _turretPath] call FUNC(getTurretConfigMagazines);
if (!(_return select 0)) then {
// 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];
// _magazines without duplicates
private _magazineClasses = _magazines arrayIntersect _magazines;
{
private _pylonName = configName _x;
private _pylonIndex = _forEachIndex + 1; // WTF BIS
private _pylonAmmo = _vehicle ammoOnPylon _pylonName;
private _pylonMagazine = (getPylonMagazines _vehicle) select _forEachIndex;
private _pylonTurret = getArray (_x >> "turret");
if (_pylonTurret isEqualTo []) then {_pylonTurret = [-1];}; // convert to expected array for driver
TRACE_4("",_pylonName,_pylonAmmo,_pylonMagazine,_pylonTurret);
private _magazineClass = _x;
private _maxMagazines = [_vehicle, _turretPath, _magazineClass] call FUNC(getMaxMagazines);
private _maxRoundsPerMag = getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count");
/* Array of ammo counts in every magazine. Example: [200, 200, 152] means 2 mags with 200
* rounds and 1 mag with 152 rounds. */
private _currentRounds = [_vehicle, _turretPath, _magazineClass] call FUNC(getTurretMagazineAmmo);
private _currentMagazines = count _currentRounds;
if (_pylonAmmo > 0) then {
if (_magazineClass == _pylonMagazine) then { // Try to refill current pylon:
private _magAmmo = getNumber (configFile >> "CfgMagazines" >> _pylonMagazine >> "count");
if (_pylonAmmo < _magAmmo) then {
_return = [true, _pylonTurret, 0, _pylonIndex];
};
};
} else {
// See what we magazines can add to the empty pylon:
private _hardpointMags = [_x] call FUNC(getHardpointMagazines);
{
if (_x == _magazineClass) then {
_return = [true, _pylonTurret, 0, _pylonIndex];
};
} forEach _hardpointMags;
/* If there is space for new magazines or if some magazines are not full, add the magazine
* type to _magazineInfo. */
if ((_currentMagazines < _maxMagazines) || {({_x < _maxRoundsPerMag} count _currentRounds) > 0}) then {
_magazineInfo pushBack [_magazineClass, _turretPath, false, -1, _maxMagazines, _currentMagazines, _maxRoundsPerMag, _currentRounds];
};
if (_return select 0) exitWith {};
} forEach _pylonConfigs;
};
} forEach _magazineClasses;
} forEach _turrets;
TRACE_3("getNeedRearmMagazines",_vehicle,_magazineClass,_return);
_return
TRACE_2("getNeedRearmMagazines",_vehicle,_magazineInfo);
_magazineInfo

View File

@ -10,7 +10,7 @@
* Magazine classes in TurretPath <ARRAY>
*
* Example:
* [vehicle, [0]] call ace_rearm_fnc_getVehicleMagazines
* [vehicle, [0]] call ace_rearm_fnc_getTurretConfigMagazines
*
* Public: No
*/

View File

@ -0,0 +1,27 @@
/*
* Author: Tuupertunut
* Returns the current ammo counts in all magazines of given class in turret.
*
* BIS command "magazineTurretAmmo" is broken at the time of writing (2017-06-24)
* (https://feedback.bistudio.com/T79689). This function is intended as a workaround for it,
* extracting the data from the array returned by "magazinesAllTurrets".
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Magazine Classname <STRING>
*
* Return Value:
* Current ammo counts in magazines. <ARRAY of NUMBERs>
*
* Example:
* [vehicle, [0], "200Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_getTurretMagazineAmmo
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle", "_turretPath", "_magazineClass"];
private _ammo = magazinesAllTurrets _vehicle select {(_x select 0) isEqualTo _magazineClass && {(_x select 1) isEqualTo _turretPath}} apply {_x select 2};
_ammo

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_dummy", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_dummy", "_unit"];
REARM_HOLSTER_WEAPON;
[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set);

View File

@ -15,9 +15,7 @@
*/
#include "script_component.hpp"
params [
["_unit", objNull, [objNull]]
];
params ["_unit"];
if (!local _unit) exitWith {};

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_unit", objNull, [objNull]],
["_isUnconscious", false, [false]]
];
params ["_unit", "_isUnconscious"];
if (!local _unit || {!_isUnconscious}) exitWith {};

View File

@ -16,9 +16,7 @@
*/
#include "script_component.hpp"
params [["_truck", objNull, [objNull]], ["_magazineClass", "", [""]]];
if (isNull _truck || {_magazineClass isEqualTo ""}) exitWith {false};
params ["_truck", "_magazineClass"];
// With infinite supply, there is always enough
if (GVAR(supply) == 0) exitWith {true};

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_obj", objNull, [objNull]],
["_dirAndUp", [[1,0,0],[0,0,1]], [[]]]
];
params ["_obj", "_dirAndUp"];
_obj setVectorDirAndUp _dirAndUp;
_obj allowDamage false;

View File

@ -1,6 +1,6 @@
/*
* Author: GitHawk
* Module for adjusting the refuel settings.
* Module for adjusting the rearm settings.
*
* Arguments:
* 0: The module logic <OBJECT>
@ -28,4 +28,4 @@ if (!_activated) exitWith {};
[_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(supply), "supply"] call EFUNC(common,readSettingFromModule);
INFO_2("Module Initialized [level: %1][supply: %2]", GVAR(level), GVAR(supply));
INFO_2("Module Initialized [level: %1][supply: %2]",GVAR(level),GVAR(supply));

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_dummy", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_dummy", "_unit"];
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
if !(isNull _attachedDummy) exitWith {};

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params [["_truck", objNull, [objNull]],["_unit", objNull, [objNull]]];
params ["_truck", "_unit"];
TRACE_2("readSupplyCounter",_truck,_unit);
if (GVAR(supply) == 0) exitWith {WARNING("Supply is unlimited");};
@ -31,7 +31,7 @@ if (GVAR(supply) == 1) then {
if (_supplyCount > 0 ) then {
[[LSTRING(Hint_RemainingSupplyPoints), _supplyCount], 2, _unit] call EFUNC(common,displayTextStructured);
} else {
[LSTRING(Hint_EmptySupplyPoints), 2, _unit] call EFUNC(common,displayTextStructured);
[LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured);
};
true
},

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params [["_target", objNull, [objNull]],["_unit", objNull, [objNull]]];
params ["_target", "_unit"];
TRACE_2("rearm",_target,_unit);
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
@ -27,21 +27,24 @@ if (isNil "_magazineClass") exitWith {ERROR_1("magazineClass nil",_attachedDummy
([_magazineClass] call FUNC(getCaliber)) params ["_cal", "_idx"];
// Get magazines that can be rearmed
private _needRearmMags = [_target, _magazineClass] call FUNC(getNeedRearmMagazines);
_needRearmMags params ["_needRearm", "_turretPath", "_cnt", "_pylon"];
private _needRearmMags = [_target] call FUNC(getNeedRearmMagazines);
private _needRearmMagsOfClass = _needRearmMags select {(_x select 0) isEqualTo _magazineClass};
// Exit if no magazines need rearming
if (!_needRearm) exitWith {ERROR_2("Could not find turret for %1 in %2", _magazineClass, typeOf _target);};
if ((count _needRearmMagsOfClass) == 0) exitWith {ERROR_2("Could not find turret for %1 in %2",_magazineClass,typeOf _target);};
private _currentRearmableMag = _needRearmMagsOfClass select 0;
_currentRearmableMag params ["", "_turretPath", "", "_pylon", "", "_magazineCount"];
private _magazineDisplayName = getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName");
if (_magazineDisplayName == "") then {
_magazineDisplayName = _magazineClass;
ERROR_1("Magazine is missing display name [%1]", _magazineClass);
ERROR_1("Magazine is missing display name [%1]",_magazineClass);
};
[
TIME_PROGRESSBAR(REARM_DURATION_REARM select _idx),
[_target, _unit, _turretPath, _cnt, _magazineClass, (REARM_COUNT select _idx), _pylon],
[_target, _unit, _turretPath, _magazineCount, _magazineClass, (REARM_COUNT select _idx), _pylon],
{(_this select 0) call FUNC(rearmSuccess)},
"",
format [localize LSTRING(RearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName"), _magazineDisplayName],

View File

@ -17,11 +17,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
"",
["_vehicle", objNull, [objNull]]
];
params ["_truck", "", "_vehicle"];
[
TIME_PROGRESSBAR(10),

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: Rearm information <ARRAY>
* 0: Ammo Truck <OBJECT>
* 1: Vehicle <OBJECT
* 1: Vehicle <OBJECT>
*
* Return Value:
* None
@ -18,10 +18,11 @@
#include "script_component.hpp"
params ["_args"];
_args params [["_truck", objNull, [objNull]], ["_vehicle", objNull, [objNull]]];
_args params ["_truck", "_vehicle"];
TRACE_2("rearmEntireVehicleSuccess",_truck,_vehicle);
if (isServer) then {
private _turrets = [_vehicle] call FUNC(getAllRearmTurrets);
{
private _turretOwnerID = _vehicle turretOwner _x;
if (_turretOwnerID == 0) then {
@ -30,7 +31,7 @@ if (isServer) then {
[QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _turretOwnerID] call CBA_fnc_ownerEvent;
};
false
} count REARM_TURRET_PATHS;
} count _turrets;
} else {
[QGVAR(rearmEntireVehicleSuccessEH), _this] call CBA_fnc_serverEvent;
};

View File

@ -1,5 +1,5 @@
/*
* Author: GitHawk
* Author: Tuupertunut
* Rearm an entire turret locally.
*
* Arguments:
@ -17,60 +17,42 @@
*/
#include "script_component.hpp"
params [["_truck", objNull, [objNull]], ["_vehicle", objNull, [objNull]], ["_turretPath", [], [[]]]];
params ["_truck", "_vehicle", "_turretPath"];
TRACE_3("rearmEntireVehicleSuccessLocal",_truck,_vehicle,_turretPath);
// 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];
// Fetching all rearmable magazines in this turret
private _magazines = ([_vehicle] call FUNC(getNeedRearmMagazines)) select {(_x select 1) isEqualTo _turretPath};
{
private _pylonTurret = getArray (_x >> "turret");
if (_pylonTurret isEqualTo []) then {_pylonTurret = [-1];}; // convert to expected array for driver
if (_pylonTurret isEqualTo _turretPath) then {
private _pylonIndex = _forEachIndex + 1; // GJ BIS
private _pylonAmmo = _vehicle ammoOnPylon _pylonIndex;
private _pylonMagazine = (getPylonMagazines _vehicle) select _forEachIndex;
private _maxRounds = getNumber (configFile >> "CfgMagazines" >> _pylonMagazine >> "count");
TRACE_4("",_pylonIndex,_pylonAmmo,_maxRounds,_pylonMagazine);
if (_pylonAmmo < _maxRounds) then {
if ((GVAR(supply) == 0) || {[_truck, _pylonMagazine, (_maxRounds - _pylonAmmo)] call FUNC(removeMagazineFromSupply)}) then {
TRACE_3("Adding Rounds",_vehicle,_pylonIndex,_maxRounds);
_vehicle setAmmoOnPylon [_pylonIndex, _maxRounds];
_x params ["_magazineClass", "_magTurretPath", "_isPylonMag", "_pylonIndex", "_maxMagazines", "_currentMagazines", "_maxRoundsPerMag", "_currentRounds"];
// Array of planned ammo counts in every magazine after the rearm is complete
private _plannedRounds = +_currentRounds;
// Trying to fill all existing magazines.
{
if (_x < _maxRoundsPerMag) then {
if ((GVAR(supply) == 0) || {[_truck, _magazineClass, (_maxRoundsPerMag - _x)] call FUNC(removeMagazineFromSupply)}) then {
_plannedRounds set [_forEachIndex, _maxRoundsPerMag];
};
};
};
} forEach _pylonConfigs;
private _magazines = [_vehicle, _turretPath] call FUNC(getVehicleMagazines);
if (isNil "_magazines") exitWith {};
{
private _magazine = _x;
private _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath);
private _maxMagazines = [_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines);
private _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
private _currentRounds = _vehicle magazineTurretAmmo [_magazine, _turretPath];
TRACE_7("Rearmed Turret",_vehicle,_turretPath,_currentMagazines,_maxMagazines,_currentRounds,_maxRounds,_magazine);
if (_turretPath isEqualTo [-1] && _currentMagazines == 0) then {
// On driver, the empty magazine is still there, but is not returned by magazinesTurret
_currentMagazines = _currentMagazines + 1;
};
} forEach _currentRounds;
// Trying to add new full magazines, if there is space left.
if (_currentMagazines < _maxMagazines) then {
private _success = true;
if ((GVAR(supply) == 0) || {[_truck, _magazine, (_maxRounds - _currentRounds)] call FUNC(removeMagazineFromSupply)}) then {
_vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath];
};
for "_idx" from 1 to (_maxMagazines - _currentMagazines) do {
if ((GVAR(supply) == 0) || {[_truck, _magazine, _maxRounds] call FUNC(removeMagazineFromSupply)}) then {
_vehicle addMagazineTurret [_magazine, _turretPath];
if ((GVAR(supply) == 0) || {[_truck, _magazineClass, _maxRoundsPerMag] call FUNC(removeMagazineFromSupply)}) then {
_plannedRounds pushBack _maxRoundsPerMag;
};
};
} else {
if ((GVAR(supply) == 0) || {[_truck, _magazine, (_maxRounds - _currentRounds)] call FUNC(removeMagazineFromSupply)}) then {
_vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath];
};
};
false
} count _magazines;
TRACE_2("rearming",_x,_plannedRounds);
// Updating new ammo counts to vehicle.
if (_isPylonMag) then {
_vehicle setAmmoOnPylon [_pylonIndex, (_plannedRounds select 0)];
} else {
[_vehicle, _magTurretPath, _magazineClass, _plannedRounds] call FUNC(setTurretMagazineAmmo);
};
} forEach _magazines;

View File

@ -21,7 +21,7 @@
*/
#include "script_component.hpp"
params [["_vehicle", objNull, [objNull]], ["_unit", objNull, [objNull]], "_turretPath", "_numMagazines", "_magazineClass", "_numRounds", "_pylon"];
params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds", "_pylon"];
TRACE_7("rearmSuccess",_vehicle,_unit,_turretPath,_numMagazines,_magazineClass,_numRounds,_pylon);
if (local _unit) then {

View File

@ -23,6 +23,6 @@ if !(EGVAR(common,settingsInitFinished)) exitWith { // only run this after the s
params [["_truck", objNull, [objNull]], ["_supply", 0, [0]]];
if (GVAR(supply) != 1) exitWith {WARNING("supply setting is not set to limited");};
if (isNull _truck) exitWith {WARNING_1("Truck is null [%1]", _truck);};
if (isNull _truck) exitWith {WARNING_1("Truck is null [%1]",_truck);};
_truck setVariable [QGVAR(currentSupply), (_supply max 0), true];

View File

@ -0,0 +1,89 @@
/*
* Author: Tuupertunut
* Sets the ammo counts of all magazines of given class in turret.
*
* BIS command "setMagazineTurretAmmo" is broken at the time of writing (2017-06-24)
* (https://feedback.bistudio.com/T79689). This function is intended as a workaround for it. All
* magazines are removed and then added again with updated ammo counts.
* Note: As an unintended side effect, the turret reloads after running this function.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Magazine Classname <STRING>
* 3: Ammo Counts in Magazines <ARRAY of NUMBERs>
*
* Return Value:
* None
*
* Example:
* [vehicle, [0], "200Rnd_127x99_mag_Tracer_Red", [200, 152]] call ace_rearm_fnc_setTurretMagazineAmmo
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle", "_turretPath", "_magazineClass", "_ammoCounts"];
// Checking if a magazine of given class is currently loaded in any weapon.
private _magLoadedInWeapon = false;
private _loadedWeapon = "";
{
private _currentlyLoadedMag = (weaponState [_vehicle, _turretPath, _x]) select 3;
if (_currentlyLoadedMag isEqualTo _magazineClass) exitWith {
_magLoadedInWeapon = true;
_loadedWeapon = _x;
};
} forEach (_vehicle weaponsTurret _turretPath);
if (!_magLoadedInWeapon) then {
/* The easy case:
* The magazine class was not loaded, so we can just remove those magazines and
* add them back with updated ammo counts. */
_vehicle removeMagazinesTurret [_magazineClass, _turretPath];
{
_vehicle addMagazineTurret [_magazineClass, _turretPath, _x];
} forEach _ammoCounts;
} else {
/* Special hack case:
* The magazine class was loaded into a weapon. If the weapon has more than one type of
* magazine (e.g. AP and HEAT in a cannon), then removing all magazines would trigger the
* weapon to load a different magazine type. For example, removing the HEAT shells while HEAT
* is loaded makes the cannon switch to AP.
*
* To prevent that, we must remove all magazines that would fit into the weapon and then add
* them back with the magazine-to-be-loaded being the first. */
private _allowedMagClassesInWeapon = getArray (configFile >> "CfgWeapons" >> _loadedWeapon >> "magazines");
/* Current ammo counts of all allowed magazine classes in weapon.
* Example: [["8Rnd_82mm_Mo_shells", [8, 8, 2]], ["8Rnd_82mm_Mo_Flare_white", [7]]] */
private _ammoCountsByMagClass = _allowedMagClassesInWeapon apply {[_x, ([_vehicle, _turretPath, _x] call FUNC(getTurretMagazineAmmo))]};
// Removing all magazines that fit into the weapon.
{
_vehicle removeMagazinesTurret [_x, _turretPath];
} forEach _allowedMagClassesInWeapon;
// Adding the mags of the given class first with updated ammo counts.
{
_vehicle addMagazineTurret [_magazineClass, _turretPath, _x];
} forEach _ammoCounts;
// Adding back all other magazines with their original ammo counts.
{
_x params ["_loopMagClass", "_loopAmmoCounts"];
if (!(_loopMagClass isEqualTo _magazineClass)) then {
{
_vehicle addMagazineTurret [_loopMagClass, _turretPath, _x];
} forEach _loopAmmoCounts;
};
} forEach _ammoCountsByMagClass;
};
TRACE_5("setTurretMagazineAmmo",_vehicle,_turretPath,_magazineClass,_ammoCounts,_loadedWeapon);

View File

@ -16,10 +16,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
params ["_truck", "_unit"];
private _attachedDummy = _unit getVariable [QGVAR(dummy), objNull];
if (isNull _attachedDummy) exitwith {};

View File

@ -19,11 +19,7 @@
*/
#include "script_component.hpp"
params [
["_truck", objNull, [objNull]],
["_unit", objNull, [objNull]],
["_args", ["", objNull], [[]]]
];
params ["_truck", "_unit", "_args"];
_args params ["_magazineClass", "_vehicle"];
TRACE_5("takeAmmo",_truck,_unit,_args,_magazineClass,_vehicle);

View File

@ -18,7 +18,7 @@
*/
#include "script_component.hpp"
params [["_args", [objNull, "", objNull], [[]], 3]];
params ["_args"];
_args params ["_unit", "_magazineClass", "_truck"];
TRACE_3("takeSuccess",_unit,_magazineClass,_truck);

View File

@ -19,7 +19,6 @@
#define REARM_ACTION_DISTANCE 7
#define REARM_TURRET_PATHS [[-1], [0], [0,0], [0,1], [1], [2], [0,2]]
#define REARM_CALIBERS [ 6, 7, 8, 13, 19, 20, 25, 30, 35, 39, 40, 60, 70, 80, 82, 100, 105, 120, 122, 125, 155, 230, 250]
#define REARM_DURATION_TAKE [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 13, 10]

View File

@ -14,7 +14,7 @@
displayName = CSTRING(TakeNozzle); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(takeNozzle)); \
exceptions[] = {"isNotInside", "isNotOnLadder"}; \
exceptions[] = {INTERACT_EXCEPTIONS_REFUELING}; \
icon = QPATHTOF(ui\icon_refuel_interact.paa); \
}; \
class GVAR(TurnOn) { \
@ -35,7 +35,7 @@
displayName = CSTRING(Disconnect); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \
exceptions[] = {"isNotInside", "isNotOnLadder"}; \
exceptions[] = {INTERACT_EXCEPTIONS_REFUELING}; \
icon = QPATHTOF(ui\icon_refuel_interact.paa); \
}; \
}; \

View File

@ -44,7 +44,7 @@ private _action = [QGVAR(Refuel),
_action = [QGVAR(PickUpNozzle),
localize LSTRING(TakeNozzle),
QPATHTOF(ui\icon_refuel_interact.paa),
{[_player, _target] call FUNC(TakeNozzle)},
{[_player, _target] call FUNC(takeNozzle)},
{[_player, _target] call FUNC(canTakeNozzle)},
{},
[],

View File

@ -35,7 +35,7 @@ TRACE_2("start",_unit,_nozzle);
if !(
alive _unit
&& {"" isEqualTo currentWeapon _unit}
&& {"" isEqualTo currentWeapon _unit || {_unit call EFUNC(common,isSwimming)}}
&& {[_unit, objNull, [INTERACT_EXCEPTIONS, "notOnMap"]] call EFUNC(common,canInteractWith)}
&& {!("unconscious" isEqualTo toLower animationState _unit)}
&& {!(_unit getVariable ["ACE_isUnconscious", false])}

View File

@ -94,5 +94,5 @@ params [
{},
localize LSTRING(TakeNozzleAction),
{true},
["isNotInside", "isNotOnLadder"]
[INTERACT_EXCEPTIONS_REFUELING]
] call EFUNC(common,progressBar);

View File

@ -30,4 +30,5 @@
#define TIME_PROGRESSBAR(X) (X)
#endif
#define INTERACT_EXCEPTIONS "isNotInside", "isNotOnLadder", "isNotRefueling"
#define INTERACT_EXCEPTIONS_REFUELING "isNotInside", "isNotOnLadder", "isNotSwimming"
#define INTERACT_EXCEPTIONS INTERACT_EXCEPTIONS_REFUELING, "isNotRefueling"

View File

@ -274,6 +274,7 @@
<Key ID="STR_ACE_Refuel_CouldNotTurnOn">
<English>Couldn't turn on fuel nozzle</English>
<Italian>Impossibile iniziare il rifornimento</Italian>
<Japanese>給油を始められなかった</Japanese>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English>

View File

@ -76,7 +76,7 @@
<Hungarian>Töltényheveder összekötése</Hungarian>
<Italian>Attacca la tracolla</Italian>
<Portuguese>Ligar cintos de munição</Portuguese>
<Japanese>ベルト リンク</Japanese>
<Japanese>ベルトをつなげる</Japanese>
<Korean>벨트 연결</Korean>
<Chinesesimp>连接弹链</Chinesesimp>
<Chinese>連接彈鏈</Chinese>

View File

@ -169,7 +169,7 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
_caller selectWeapon (primaryWeapon _caller); // unit always has a primary weapon here
};
if (!underwater _caller) then {
if !(_caller call EFUNC(common,isSwimming)) then {
if (stance _caller == "STAND") then {
_caller setVariable [QGVAR(repairPrevAnimCaller), "amovpknlmstpsraswrfldnon"];
} else {

View File

@ -31,7 +31,7 @@ private ["_config","_callback", "_usersOfItems", "_weaponSelect"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
};
if (vehicle _caller == _caller && {!underwater _caller}) then {
if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) then {
[_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation);
};
_caller setVariable [QGVAR(repairPrevAnimCaller), nil];

View File

@ -31,7 +31,7 @@ private ["_config","_callback", "_weaponSelect"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
};
if (vehicle _caller == _caller && {!underwater _caller}) then {
if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) then {
[_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation);
};
_caller setVariable [QGVAR(repairPrevAnimCaller), nil];

View File

@ -439,7 +439,7 @@
<Spanish>Parte totalmente reparado</Spanish>
<Italian>Parte riparata completamente</Italian>
<French>Pièce entièrement réparée</French>
<Japanese>部分的な完全な修理</Japanese>
<Japanese>完全に修理された部品</Japanese>
<Korean>부분 완벽히 수리됨</Korean>
<Chinesesimp>完整维修部分</Chinesesimp>
<Chinese>完整維修部分</Chinese>
@ -577,7 +577,7 @@
<Italian>Stabilizzatore Verticale</Italian>
<French>Stabilisateur vertical</French>
<German>Seitenleitwerk</German>
<Japanese>車両安定器</Japanese>
<Japanese>車両スタビライザ</Japanese>
<Korean>수직 안정판</Korean>
<Chinesesimp>垂直稳定</Chinesesimp>
<Chinese>垂直穩定</Chinese>
@ -905,7 +905,7 @@
<Italian>Ruota posteriore destra</Italian>
<Hungarian>Jobb hátsó kerék</Hungarian>
<Russian>Правое заднее колесо</Russian>
<Japanese>右の後</Japanese>
<Japanese>右の後</Japanese>
<Korean>오른쪽 뒤쪽 바퀴</Korean>
<Chinesesimp>右后轮</Chinesesimp>
<Chinese>右後輪</Chinese>
@ -1031,7 +1031,7 @@
<French>ERA</French>
<Portuguese>ERA</Portuguese>
<Russian>ДЗ</Russian>
<Japanese>爆発反応装甲</Japanese>
<Japanese>ERA</Japanese>
<Korean>폭발반응장갑</Korean>
<Chinesesimp>爆炸式反应装甲</Chinesesimp>
<Chinese>爆炸式反應裝甲</Chinese>
@ -1399,7 +1399,7 @@
<Spanish>Ningún</Spanish>
<Italian>Nessuna</Italian>
<French>Aucun</French>
<Japanese>工兵</Japanese>
<Japanese>なし</Japanese>
<Korean>없음</Korean>
<Chinesesimp></Chinesesimp>
<Chinese></Chinese>
@ -1414,7 +1414,7 @@
<Spanish>Ingeniero</Spanish>
<Italian>Geniere</Italian>
<French>Ingénieur</French>
<Japanese>専門</Japanese>
<Japanese></Japanese>
<Korean>정비공</Korean>
<Chinesesimp>工兵</Chinesesimp>
<Chinese>工兵</Chinese>

View File

@ -108,7 +108,7 @@
<Hungarian>Gyülekezőpont, Nyugat (Bázis)</Hungarian>
<Czech>Rallypoint Západ (Základna)</Czech>
<Portuguese>Ponto de encontro Oeste (Base)</Portuguese>
<Japanese>ラリーポイント ウエスト (ベース)</Japanese>
<Japanese>ラリーポイント 同盟軍 (ベース)</Japanese>
<Chinesesimp>蓝方集合点 (基地)</Chinesesimp>
<Chinese>藍方集合點 (基地)</Chinese>
<Korean>청군 집결지 (기지)</Korean>
@ -124,7 +124,7 @@
<Hungarian>Gyülekezőpont, Kelet (Bázis)</Hungarian>
<Czech>Ralllypoint Východ (Základna)</Czech>
<Portuguese>Ponto de encontro Lest (Base)</Portuguese>
<Japanese>ラリーポイント イースト (ベース)</Japanese>
<Japanese>ラリーポイント OPFOR軍 (ベース)</Japanese>
<Chinesesimp>红方集合点 (基地)</Chinesesimp>
<Chinese>紅方集合點 (基地)</Chinese>
<Korean>대항군 집결지 (기지)</Korean>
@ -140,7 +140,7 @@
<Hungarian>Gyülekezőpont, Független (Bázis)</Hungarian>
<Czech>Rallypoint Nezávislý (Základna)</Czech>
<Portuguese>Ponto de encontro Independente (Base)</Portuguese>
<Japanese>ラリーポイント インデペンデント (ベース)</Japanese>
<Japanese>ラリーポイント 独立軍 (ベース)</Japanese>
<Chinesesimp>独立方集合点 (基地)</Chinesesimp>
<Chinese>獨立方集合點 (基地)</Chinese>
<Korean>독립군 집결지 (기지)</Korean>
@ -156,7 +156,7 @@
<Hungarian>Gyülekezőpont, Nyugat</Hungarian>
<Czech>Rallypoint Západ</Czech>
<Portuguese>Ponto de encontro Oeste</Portuguese>
<Japanese>ラリーポイント ウエスト</Japanese>
<Japanese>ラリーポイント 同盟軍</Japanese>
<Chinesesimp>蓝方集合点</Chinesesimp>
<Chinese>藍方集合點</Chinese>
<Korean>청군 집결지</Korean>
@ -172,7 +172,7 @@
<Hungarian>Gyülekezőpont, Kelet</Hungarian>
<Czech>Rallypoint Východ</Czech>
<Portuguese>Ponto de encontro Leste</Portuguese>
<Japanese>ラリーポイント イースト</Japanese>
<Japanese>ラリーポイント OPFOR軍</Japanese>
<Chinesesimp>红方集合点</Chinesesimp>
<Chinese>紅方集合點</Chinese>
<Korean>대항군 집결지</Korean>
@ -188,7 +188,7 @@
<Hungarian>Gyülekezőpont, Független</Hungarian>
<Czech>Rallypoint Nezávislý</Czech>
<Portuguese>Ponto de encontro Independente</Portuguese>
<Japanese>ラリーポイント インデペンデント</Japanese>
<Japanese>ラリーポイント 独立軍</Japanese>
<Chinesesimp>独立方集合点</Chinesesimp>
<Chinese>獨立方集合點</Chinese>
<Korean>독립군 집결지</Korean>

View File

@ -75,7 +75,7 @@
<Hungarian>Átváltás BLUFOR-ra?</Hungarian>
<Russian>На синих?</Russian>
<Italian>Cambia per BLUFOR?</Italian>
<Japanese>ウエストへ切り替えますか?</Japanese>
<Japanese>同盟軍へ切り替えますか?</Japanese>
<Chinesesimp>切换至蓝方?</Chinesesimp>
<Chinese>切換至藍方?</Chinese>
<Korean>청군으로 전환합니까?</Korean>
@ -91,7 +91,7 @@
<Hungarian>Nyugat-fakciós egységekre való váltás engedélyezése?</Hungarian>
<Russian>Разрешить переключаться на синих юнитов?</Russian>
<Italian>Consenti passaggio ad unità BLUFOR?</Italian>
<Japanese>ウエスト側ユニットへ切り替えられるようにしますか?</Japanese>
<Japanese>同盟軍側ユニットへ切り替えられるようにしますか?</Japanese>
<Chinesesimp>允许切换至蓝方?</Chinesesimp>
<Chinese>允許切換至藍方?</Chinese>
<Korean>청군 인원으로 전환합니까?</Korean>
@ -107,7 +107,7 @@
<Hungarian>Átváltás OPFOR-ra?</Hungarian>
<Russian>На красных?</Russian>
<Italian>Cambia per OPFOR?</Italian>
<Japanese>イースト側へ切り替えますか?</Japanese>
<Japanese>OPFOR軍側へ切り替えますか?</Japanese>
<Chinesesimp>切换至红方?</Chinesesimp>
<Chinese>切換至紅方?</Chinese>
<Korean>대항군으로 전환합니까?</Korean>
@ -123,7 +123,7 @@
<Hungarian>Kelet-fakciós egységekre való váltás engedélyezése?</Hungarian>
<Russian>Разрешить переключаться на красных юнитов?</Russian>
<Italian>Consenti passaggio ad unità OPFOR?</Italian>
<Japanese>イースト側ユニットへ切り替えられるようにしますか?</Japanese>
<Japanese>OPFOR軍側ユニットへ切り替えられるようにしますか?</Japanese>
<Chinesesimp>允许切换至红方?</Chinesesimp>
<Chinese>允許切換至紅方?</Chinese>
<Korean>대항군 인원으로 전환합니까?</Korean>
@ -139,7 +139,7 @@
<Hungarian>Átváltás INDFOR-ra?</Hungarian>
<Russian>На независимых?</Russian>
<Italian>Cambia per INDFOR?</Italian>
<Japanese>インデペンデントへ切り替えますか?</Japanese>
<Japanese>独立軍へ切り替えますか?</Japanese>
<Chinesesimp>切换至独立方?</Chinesesimp>
<Chinese>切換至獨立方?</Chinese>
<Korean>독립군 으로 전환합니까?</Korean>
@ -155,7 +155,7 @@
<Hungarian>Független egységekre való váltás engedélyezése?</Hungarian>
<Russian>Разрешить переключаться на независимых юнитов?</Russian>
<Italian>Consenti passaggio ad unità INDFOR?</Italian>
<Japanese>インデペンデント側ユニットへ切り替えられるようにしますか?</Japanese>
<Japanese>独立軍側ユニットへ切り替えられるようにしますか?</Japanese>
<Chinesesimp>允许切换至独立方?</Chinesesimp>
<Chinese>允許切換至獨立方?</Chinese>
<Korean>독립군 인원으로 전환합니까?</Korean>
@ -171,7 +171,7 @@
<Hungarian>Átváltás civilre?</Hungarian>
<Russian>На гражданских?</Russian>
<Italian>Cambia per Civili?</Italian>
<Japanese>シビリアンへ切り替えますか?</Japanese>
<Japanese>市民へ切り替えますか?</Japanese>
<Korean>민간인으로 전환합니까?</Korean>
<Chinesesimp>切换至平民方?</Chinesesimp>
<Chinese>切換至平民方?</Chinese>
@ -187,7 +187,7 @@
<Hungarian>Civil egységekre való váltás engedélyezése?</Hungarian>
<Russian>Разрешить переключаться на гражданских юнитов?</Russian>
<Italian>Consenti passaggio ad unità civili?</Italian>
<Japanese>シビリアン側ユニットへ切り替えられるようにしますか?</Japanese>
<Japanese>市民側ユニットへ切り替えられるようにしますか?</Japanese>
<Korean>민간인으로 전환하는걸 허가합니까?</Korean>
<Chinesesimp>允许切换至平民方?</Chinesesimp>
<Chinese>允許切換至平民方?</Chinese>
@ -251,7 +251,7 @@
<Hungarian>A biztonságos zóna más csapatból lévő játékosok körül. Alapértelmezett: 200</Hungarian>
<Russian>Радиус безопасной зоны вокруг ироков из противоположной команды. По-умолчанию: 200</Russian>
<Italian>La zona sicura attorno ai giocatori di un team diverso. Default: 200</Italian>
<Japanese>別のチームへのプレイヤーの周囲にある安全地帯の範囲。標準200</Japanese>
<Japanese>別のチームへのプレイヤーの周囲にある安全地帯の範囲。標準: 200</Japanese>
<Korean>다른 진영으로 부터의 플레이어 안전 지대. 기본설정: 200</Korean>
<Chinesesimp>安全区的范围. 预设值200</Chinesesimp>
<Chinese>安全區的範圍. 預設值200</Chinese>

View File

@ -28,7 +28,7 @@
<Hungarian>Különböző beállítási lehetőségeket biztosít a Zeus részeihez.</Hungarian>
<Russian>Позволяет контролировать различные аспекты Зевса.</Russian>
<Italian>Fornisce controllo su vari aspetti di Zeus.</Italian>
<Japanese>Zeus のさまざまな側面を強化します。</Japanese>
<Japanese>Zeus の操作性をさまざまな側面から強化します。</Japanese>
<Korean>Zeus에게 다양한 방면의 조작을 제공해줍니다</Korean>
<Chinesesimp>提供宙斯各个方面的控制权</Chinesesimp>
<Chinese>提供宙斯各個方面的控制權</Chinese>
@ -236,7 +236,7 @@
<Hungarian>Elfogott állapot váltása</Hungarian>
<Russian>Пленный (вкл./выкл.)</Russian>
<Italian>Attivatore Prigioniero</Italian>
<Japanese>捕虜としてトグル</Japanese>
<Japanese>捕虜として切り替え</Japanese>
<Korean>포로 토글</Korean>
<Chinesesimp>切换俘虏</Chinesesimp>
<Chinese>切換俘虜</Chinese>
@ -335,7 +335,7 @@
<French>Change: general, commanding, courage</French>
<Russian>Изменяет: general, commanding, courage</Russian>
<Czech>Upravuje: general, commanding, courage</Czech>
<Japanese>変更general, commanding, courage</Japanese>
<Japanese>変更: general, commanding, courage</Japanese>
<Polish>Zmienia: ogólne, dowodzenie, odwaga</Polish>
<German>Ändert: general, commanding, courage</German>
<Korean>변화: 전반적, 지휘, 사기</Korean>
@ -361,7 +361,7 @@
<French>Change : aimingAccuracy</French>
<Russian>Изменяет: aimingAccuracy</Russian>
<Czech>Upravuje: aimingAccuracy</Czech>
<Japanese>変更aimingAccuracy</Japanese>
<Japanese>変更: aimingAccuracy</Japanese>
<Polish>Zmienia: precyzję celowania</Polish>
<German>Ändert: aimingAccuracy</German>
<Korean>변화: 조준 명중률</Korean>
@ -387,7 +387,7 @@
<French>Change : aimingShake, aimingSpeed, reloadSpeed</French>
<Russian>Изменяет: aimingShake, aimingSpeed, reloadSpeed</Russian>
<Czech>Upravuje: aimingShake, aimingSpeed, reloadSpeed</Czech>
<Japanese>変更aimingShake, aimingSpeed, reloadSpeed</Japanese>
<Japanese>変更: aimingShake, aimingSpeed, reloadSpeed</Japanese>
<Polish>Zmienia: drżenie broni, szybkość celowania, szybkość przeładowania</Polish>
<German>Ändert: aimingShake, aimingSpeed, reloadSpeed</German>
<Korean>변화: 조준시 흔들림, 조준 속도, 재장전 속도</Korean>
@ -413,7 +413,7 @@
<French>Change : spotDistance, spotTime</French>
<Russian>Изменяет: spotDistance, spotTime</Russian>
<Czech>Upravuje: spotDistance, spotTime</Czech>
<Japanese>変更spotDistance, spotTime</Japanese>
<Japanese>変更: spotDistance, spotTime</Japanese>
<Polish>Zmienia: zasięg rozpoznawania, czas rozpoznawania</Polish>
<German>Ändert: spotDistance, spotTime</German>
<Korean>변화: 탐지 거리, 탐지까지의 시간</Korean>
@ -510,14 +510,14 @@
<Hungarian>Kapituláló állapot váltása</Hungarian>
<Russian>Сдавшийся (вкл./выкл.)</Russian>
<Italian>Attivatore Resa</Italian>
<Japanese>捕虜としてトグル</Japanese>
<Japanese>投降として切り替え</Japanese>
<Korean>항복 토글</Korean>
<Chinesesimp>切换投降</Chinesesimp>
<Chinese>切換投降</Chinese>
</Key>
<Key ID="STR_ACE_Zeus_ModuleAddOrRemoveFRIES_DisplayName">
<English>Add/Remove FRIES</English>
<Japanese>FRUES の追加と削除</Japanese>
<Japanese>FRIES の追加と削除</Japanese>
<Korean>패스트로프 추가/제거</Korean>
<Polish>Dodaj/usuń FRIES</Polish>
<French>Aj./Enlève FRIES</French>
@ -576,7 +576,7 @@
<French>Téléporter le joueur sélectionné à la position du module</French>
<Russian>Телепортирует выбранного игрока к местоположению модуля</Russian>
<Czech>Teleportuje vybraného hráče na pozici modulu</Czech>
<Japanese>選択したプレイヤーをプレイヤーをモジュール位置へ移動します</Japanese>
<Japanese>選択したプレイヤーをモジュール位置へ移動します</Japanese>
<Polish>Teleportuje wybranego gracza na pozycję modułu</Polish>
<German>Teleportiert ausgewählten Spieler zur Position des Moduls</German>
<Korean>모듈의 위치로 플레이어 순간이동</Korean>
@ -621,7 +621,7 @@
<Hungarian>Eszméletlen állapot váltása</Hungarian>
<Russian>Без сознания (вкл./выкл.)</Russian>
<Italian>Attivatore Incoscienza</Italian>
<Japanese>気絶をトグル</Japanese>
<Japanese>気絶を切り替え</Japanese>
<Korean>기절 토글</Korean>
<Chinesesimp>切换昏迷</Chinesesimp>
<Chinese>切換昏迷</Chinese>
@ -644,7 +644,7 @@
<French>Chercher le bâtiment proche</French>
<Russian>Обыскать ближайшие здания</Russian>
<Czech>Prohledat nejbližší budovu</Czech>
<Japanese>近くの建物を創作します</Japanese>
<Japanese>近くの建物を捜索します</Japanese>
<Polish>Przeszukaj najbliższy budynek</Polish>
<German>Durchsuche nahegelegenes Gebäude</German>
<Korean>근처 건물 수색</Korean>
@ -700,7 +700,7 @@
<Key ID="STR_ACE_Zeus_ModuleSimulation_DisplayName">
<English>Toggle Simulation</English>
<Polish>Przełącz symulację</Polish>
<Japanese>シミュレーションをトグル</Japanese>
<Japanese>シミュレーションを切り替え</Japanese>
<Korean>재현 토글</Korean>
<French>Bascule Simulation</French>
<Italian>Attivatore Simulazione</Italian>
@ -938,7 +938,7 @@
<French>Cargo :</French>
<Russian>Груз:</Russian>
<Czech>Náklad:</Czech>
<Japanese>カーゴ</Japanese>
<Japanese>カーゴ: </Japanese>
<Polish>Ładunek:</Polish>
<German>Ladung:</German>
<Korean>화물:</Korean>
@ -951,7 +951,7 @@
<French>Position de la tâche</French>
<Russian>Местоположение задания</Russian>
<Czech>Pozice úkolu</Czech>
<Japanese>タスク位置</Japanese>
<Japanese>タスク位置</Japanese>
<Polish>Pozycja zadania</Polish>
<German>Position der Aufgabe</German>
<Korean>작업 위치</Korean>
@ -1038,51 +1038,61 @@
<Key ID="STR_ACE_Zeus_ModuleLoadIntoCargo_DisplayName">
<English>Load into Cargo</English>
<Italian>Carica nel Cargo</Italian>
<Japanese>カーゴに積み込み</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleNVG_DisplayName">
<English>Toggle NVGs</English>
<French>Basculer JVN</French>
<Italian>Attiva NVGs</Italian>
<Japanese>暗視装置の切り替え</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgTitle">
<English>NVG equipment</English>
<French>Equipment de vision nocturne</French>
<Italian>Attrezzatura NVG</Italian>
<Japanese>暗視装置</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgTitleTooltip">
<English>Add or remove NVGs from units</English>
<French>Ajouter ou retirer JVN des unités</French>
<Italian>Aggiunge o rimuove NVGs alle unità</Italian>
<Japanese>ユニットから暗視装置の追加と削除</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleNVG_ToggleNvgSide">
<English>Toggle NVG target</English>
<French>Cible du basculement</French>
<Italian>Attiva obiettivo NVG</Italian>
<Japanese>選択先の暗視装置の切り替え</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleNVG_SelectedGroup">
<English>Selected group</English>
<French>Groupe sélectionné</French>
<Italian>Gruppo selezionato</Italian>
<Japanese>選択されたグループ</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_DisplayName">
<English>Toggle flashlights</English>
<French>Basculer lampes torches</French>
<Italian>Attiva torce</Italian>
<Japanese>フラッシュライトの切り替え</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightSide">
<English>Toggle flashlight target</English>
<French>Cible du basculement</French>
<Italian>Attiva obiettivo torcia</Italian>
<Japanese>選択先のフラッシュライトの切り替え</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightTitle">
<English>Flashlight</English>
<French>Lampe torche</French>
<Italian>Torcia</Italian>
<Japanese>フラッシュライト</Japanese>
</Key>
<Key ID="STR_ACE_Zeus_moduleToggleFlashlight_ToggleFlashlightGear">
<English>Add gear</English>
<French>Ajouter équipement</French>
<Italian>Aggiungi equipaggiamento</Italian>
<Japanese>装備を追加</Japanese>
</Key>
</Package>
</Project>

View File

@ -192,8 +192,8 @@ class CfgAmmo {
ACE_barrelLengths[] = {101.6, 127.0, 228.6};
};
class M_Titan_AT;
class rhs_ammo_M_fgm148_AT: M_Titan_AT {
class MissileBase;
class rhs_ammo_M_fgm148_AT: MissileBase {
irLock = 1;
laserLock = 0;
airLock = 0;

View File

@ -371,12 +371,7 @@ class CfgWeapons {
};
class H_PilotHelmetHeli_B;
class H_CrewHelmetHeli_B;
class rhsusf_hgu56p: H_PilotHelmetHeli_B {
HEARING_PROTECTION_VICCREW
};
class rhsusf_hgu56p_mask: H_CrewHelmetHeli_B {
class rhsusf_hgu56p: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW
};

View File

@ -0,0 +1,554 @@
import math
def retard(dm, bc, v):
mach = v / 340.276
CDs = []
Ms = []
if (dm) == 1:
CDs = [0.2629, 0.2558, 0.2487, 0.2413, 0.2344, 0.2278, 0.2214, 0.2155, 0.2104, 0.2061, 0.2032, 0.2020, 0.2034, 0.2165, 0.2230, 0.2313, 0.2417, 0.2546, 0.2706, 0.2901, 0.3136, 0.3415, 0.3734, 0.4084, 0.4448, 0.4805, 0.5136, 0.5427, 0.5677, 0.5883, 0.6053, 0.6191, 0.6393, 0.6518, 0.6589, 0.6621, 0.6625, 0.6607, 0.6573, 0.6528, 0.6474, 0.6413, 0.6347, 0.6280, 0.6210, 0.6141, 0.6072, 0.6003, 0.5934, 0.5867, 0.5804, 0.5743, 0.5685, 0.5630, 0.5577, 0.5527, 0.5481, 0.5438, 0.5397, 0.5325, 0.5264, 0.5211, 0.5168, 0.5133, 0.5105, 0.5084, 0.5067, 0.5054, 0.5040, 0.5030, 0.5022, 0.5016, 0.5010, 0.5006, 0.4998, 0.4995, 0.4992, 0.4990, 0.4988]
Ms = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.70, 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
elif (dm) == 2:
CDs = [0.2303, 0.2298, 0.2287, 0.2271, 0.2251, 0.2227, 0.2196, 0.2156, 0.2107, 0.2048, 0.1980, 0.1905, 0.1828, 0.1758, 0.1702, 0.1669, 0.1664, 0.1667, 0.1682, 0.1711, 0.1761, 0.1831, 0.2004, 0.2589, 0.3492, 0.3983, 0.4075, 0.4103, 0.4114, 0.4106, 0.4089, 0.4068, 0.4046, 0.4021, 0.3966, 0.3904, 0.3835, 0.3759, 0.3678, 0.3594, 0.3512, 0.3432, 0.3356, 0.3282, 0.3213, 0.3149, 0.3089, 0.3033, 0.2982, 0.2933, 0.2889, 0.2846, 0.2806, 0.2768, 0.2731, 0.2696, 0.2663, 0.2632, 0.2602, 0.2572, 0.2543, 0.2515, 0.2487, 0.2460, 0.2433, 0.2408, 0.2382, 0.2357, 0.2333, 0.2309, 0.2262, 0.2217, 0.2173, 0.2132, 0.2091, 0.2052, 0.2014, 0.1978, 0.1944, 0.1912, 0.1851, 0.1794, 0.1741, 0.1693, 0.1648]
Ms = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.175, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
elif (dm) == 5:
CDs = [0.1710, 0.1719, 0.1727, 0.1732, 0.1734, 0.1730, 0.1718, 0.1696, 0.1668, 0.1637, 0.1603, 0.1566, 0.1529, 0.1497, 0.1473, 0.1463, 0.1489, 0.1583, 0.1672, 0.1815, 0.2051, 0.2413, 0.2884, 0.3379, 0.3785, 0.4032, 0.4147, 0.4201, 0.4278, 0.4338, 0.4373, 0.4392, 0.4403, 0.4406, 0.4401, 0.4386, 0.4362, 0.4328, 0.4286, 0.4237, 0.4182, 0.4121, 0.4057, 0.3991, 0.3926, 0.3861, 0.3800, 0.3741, 0.3684, 0.3630, 0.3578, 0.3529, 0.3481, 0.3435, 0.3391, 0.3349, 0.3269, 0.3194, 0.3125, 0.3060, 0.2999, 0.2942, 0.2889, 0.2838, 0.2790, 0.2745, 0.2703, 0.2662, 0.2624, 0.2588, 0.2553, 0.2488, 0.2429, 0.2376, 0.2326, 0.2280]
Ms = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
elif (dm) == 6:
CDs = [0.2617, 0.2553, 0.2491, 0.2432, 0.2376, 0.2324, 0.2278, 0.2238, 0.2205, 0.2177, 0.2155, 0.2138, 0.2126, 0.2121, 0.2122, 0.2132, 0.2154, 0.2194, 0.2229, 0.2297, 0.2449, 0.2732, 0.3141, 0.3597, 0.3994, 0.4261, 0.4402, 0.4465, 0.4490, 0.4497, 0.4494, 0.4482, 0.4464, 0.4441, 0.4390, 0.4336, 0.4279, 0.4221, 0.4162, 0.4102, 0.4042, 0.3981, 0.3919, 0.3855, 0.3788, 0.3721, 0.3652, 0.3583, 0.3515, 0.3447, 0.3381, 0.3314, 0.3249, 0.3185, 0.3122, 0.3060, 0.3000, 0.2941, 0.2883, 0.2772, 0.2668, 0.2574, 0.2487, 0.2407, 0.2333, 0.2265, 0.2202, 0.2144, 0.2089, 0.2039, 0.1991, 0.1947, 0.1905, 0.1866, 0.1794, 0.1730, 0.1673, 0.1621, 0.1574]
Ms = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.175, 1.20, 1.225, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
elif (dm) == 7:
CDs = [0.1198, 0.1197, 0.1196, 0.1194, 0.1193, 0.1194, 0.1194, 0.1194, 0.1193, 0.1193, 0.1194, 0.1193, 0.1194, 0.1197, 0.1202, 0.1207, 0.1215, 0.1226, 0.1242, 0.1266, 0.1306, 0.1368, 0.1464, 0.1660, 0.2054, 0.2993, 0.3803, 0.4015, 0.4043, 0.4034, 0.4014, 0.3987, 0.3955, 0.3884, 0.3810, 0.3732, 0.3657, 0.3580, 0.3440, 0.3376, 0.3315, 0.3260, 0.3209, 0.3160, 0.3117, 0.3078, 0.3042, 0.3010, 0.2980, 0.2951, 0.2922, 0.2892, 0.2864, 0.2835, 0.2807, 0.2779, 0.2752, 0.2725, 0.2697, 0.2670, 0.2643, 0.2615, 0.2588, 0.2561, 0.2533, 0.2506, 0.2479, 0.2451, 0.2424, 0.2368, 0.2313, 0.2258, 0.2205, 0.2154, 0.2106, 0.2060, 0.2017, 0.1975, 0.1935, 0.1861, 0.1793, 0.1730, 0.1672, 0.1618]
Ms = [0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
elif (dm) == 8:
CDs = [0.2105, 0.2105, 0.2104, 0.2104, 0.2103, 0.2103, 0.2103, 0.2103, 0.2103, 0.2102, 0.2102, 0.2102, 0.2102, 0.2102, 0.2103, 0.2103, 0.2104, 0.2104, 0.2105, 0.2106, 0.2109, 0.2183, 0.2571, 0.3358, 0.4068, 0.4378, 0.4476, 0.4493, 0.4477, 0.4450, 0.4419, 0.4353, 0.4283, 0.4208, 0.4133, 0.4059, 0.3986, 0.3915, 0.3845, 0.3777, 0.3710, 0.3645, 0.3581, 0.3519, 0.3458, 0.3400, 0.3343, 0.3288, 0.3234, 0.3182, 0.3131, 0.3081, 0.3032, 0.2983, 0.2937, 0.2891, 0.2845, 0.2802, 0.2720, 0.2642, 0.2569, 0.2499, 0.2432, 0.2368, 0.2308, 0.2251, 0.2197, 0.2147, 0.2101, 0.2058, 0.2019, 0.1983, 0.1950, 0.1890, 0.1837, 0.1791, 0.1750, 0.1713]
Ms = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00]
for i in range(len(Ms)):
if Ms[i] >= mach:
previousIdx = max(0, i - 1);
lc = CDs[previousIdx];
lm = Ms[previousIdx];
tc = lc + (CDs[i] - lc) * (mach - lm) / (Ms[i] - lm)
return 0.00068418 * (tc / bc) * pow(v, 2)
return 0
def distanceAtTOF2(tof, v, dM, bc):
lx = 0
lt = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
t = 0
while t <= tof:
lx = dx
lt = t
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
t = t+1/2
return lx + (tof - lt) * (dx - lx) / (t - lt)
def velocityAtM(m, v, a):
lx = 0
lv = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
lx = dx
lv = v
drag = a*pow(v,2)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return lv + (m - lx) * (v - lv) / (dx - lx)
def velocityAtM2(m, v, dM, bc):
lx = 0
lv = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
lx = dx
lv = v
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return lv + (m - lx) * (v - lv) / (dx - lx)
def velocityTillM(m, v, a, g):
velocities = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
velocities[round(dx)] = v
drag = a*pow(v,2)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * g
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return velocities
def velocityTillM2(m, v, dM, bc):
velocities = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
velocities[round(dx)] = v
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return velocities
def tofAtM(m, v, a):
lx = 0
lt = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
t = 0
while dx <= m:
lx = dx
lt = t
drag = a*pow(v,2)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
t = t+1/2
return lt + (m - lx) * (t - lt) / (dx - lx)
def tofAtM2(m, v, dM, bc):
lx = 0
lt = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
t = 0
while dx <= m:
lx = dx
lt = t
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
t = t+1/2
return lt + (m - lx) * (t - lt) / (dx - lx)
def tofTillM(m, v, a, g):
times = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
t = 0
while dx <= m:
times[round(dx)] = t
drag = a*pow(v,2)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * g
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
t = t+1/2
return times
def tofTillM2(m, v, dM, bc):
times = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
t = 0
while dx <= m:
times[round(dx)] = t
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
t = t+1/2
return times
def dropAtM(m, v, a):
lx = 0
cly = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
lx = dx
ly = dy
drag = a*pow(v,2)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return ly + (m - lx) * (dy - ly) / (dx - lx)
def dropAtM2(m, v, dM, bc):
lx = 0
cly = 0
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx <= m:
lx = dx
ly = dy
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return ly + (m - lx) * (dy - ly) / (dx - lx)
def dropTillM(m, v, a, g):
drops = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx < m:
drops[round(dx)] = dy
drag = a*v*v
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * g
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return drops
def dropTillM2(m, v, dM, bc):
drops = [0] * round(m + 1)
dx = 0
dy = 0
vx = v
vy = 0
drag = 0
while dx < m:
drops[round(dx)] = dy
drag = retard(dM, bc, v)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
vx = vx - (1/2000) * (vx/v) * drag
vy = vy - (1/2000) * (vy/v) * drag
vy = vy + (1/2000) * 9.8066
v = math.sqrt(vx*vx+vy*vy)
dx = dx+(1/2000)*vx*0.5
dy = dy+(1/2000)*vy*0.5
return drops
def tofAtMDiff(m, v, a, d, bc):
return tofAtM2(m, v, d, bc)-tofAtM(m, v, a)
def tofAtMDiffBC(m, v, dM1, bc1, dM2, bc2):
return tofAtM2(m, v, dM1, bc1)-tofAtM2(m, v, dM2, bc2)
def velocityAtMDiff(m, v, a, d, bc):
return velocityAtM2(m, v, d, bc)-velocityAtM(m, v, a)
def velocityAtMDiffBC(m, v, dM1, bc1, dM2, bc2):
return velocityAtM2(m, v, dM1, bc1)-velocityAtM2(m, v, dM2, bc2)
def dragAtV(v, a):
return a*v^2
def dragAtV2(v, d, bc):
return retard(d, bc, v)
def dragAtVDiff(v, a, d, bc):
return retard(d, bc, v)-a*pow(v,2)
def dropAtMDiff(m, v, a, d, bc):
return dropAtM2(m, v, d, bc)-dropAtM(m, v, a)
def dropAtMDiffBC(m, v, dM1, bc1, dM2, bc2):
return dropAtM2(m, v, dM1, bc1)-dropAtM2(m, v, dM2, bc2)
def airFrictionAtV(v, d, bc):
return retard(d, bc, v)/pow(v,2)
def maxDropDiff(m, v, a, dM, bc):
maxDiff = 0
drops1 = dropTillM(m, v, a, 9.8066)
drops2 = dropTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(drops2[d] - drops1[d]))
return maxDiff
def maxDropDiffG(m, v, a, dM, bc, g):
maxDiff = 0
drops1 = dropTillM(m, v, a, g)
drops2 = dropTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(drops2[d] - drops1[d]))
return maxDiff
def maxDropDiffV(distances, velocities, a, dM, bc):
maxDiff = 0
for m, v in zip(distances, velocities):
drops1 = dropTillM(m, v, a, 9.8066)
drops2 = dropTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(drops2[d] - drops1[d]))
return maxDiff
def maxDropDiffBC(m, v, dM1, bc1, dM2, bc2):
maxDiff = 0
drops1 = dropTillM2(m, v, dM1, bc1)
drops2 = dropTillM2(m, v, dM2, bc2)
for d in range(0, m):
maxDiff = max(maxDiff, abs(drops2[d] - drops1[d]))
return maxDiff
def maxVelocityDiff(m, v, a, dM, bc):
maxDiff = 0
velocities1 = velocityTillM(m, v, a, 9.8066)
velocities2 = velocityTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(velocities2[d] - velocities1[d]))
return maxDiff
def maxVelocityDiffG(m, v, a, dM, bc, g):
maxDiff = 0
velocities1 = velocityTillM(m, v, a, g)
velocities2 = velocityTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(velocities2[d] - velocities1[d]))
return maxDiff
def maxVelocityDiffV(distances, velocities, a, dM, bc):
maxDiff = 0
for m, v in zip(distances, velocities):
velocities1 = velocityTillM(m, v, a, 9.8066)
velocities2 = velocityTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(velocities2[d] - velocities1[d]))
return maxDiff
def maxVelocityDiffBC(m, v, dM1, bc1, dM2, bc2):
maxDiff = 0
velocities1 = velocityTillM2(m, v, dM1, bc1)
velocities2 = velocityTillM2(m, v, dM2, bc2)
for d in range(0, m):
maxDiff = max(maxDiff, abs(velocities2[d] - velocities1[d]))
return maxDiff
def maxTOFDiff(m, v, a, dM, bc):
maxDiff = 0
times1 = tofTillM(m, v, a, 9.8066)
times2 = tofTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(times2[d] - times1[d]))
return maxDiff
def maxTOFDiffG(m, v, a, dM, bc, g):
maxDiff = 0
times1 = tofTillM(m, v, a, g)
times2 = tofTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(times2[d] - times1[d]))
return maxDiff
def maxTOFDiffV(distances, velocities, a, dM, bc):
maxDiff = 0
for m, v in zip(distances, velocities):
times1 = tofTillM(m, v, a, 9.8066)
times2 = tofTillM2(m, v, dM, bc)
for d in range(0, m):
maxDiff = max(maxDiff, abs(times2[d] - times1[d]))
return maxDiff
def maxTOFDiffBC(m, v, dM1, bc1, dM2, bc2):
maxDiff = 0
times1 = tofTillM2(m, v, dM1, bc1)
times2 = tofTillM2(m, v, dM2, bc2)
for d in range(0, m):
maxDiff = max(maxDiff, abs(times2[d] - times1[d]))
return maxDiff
def predictAirFriction(mv, thresholdVelocity, dragModel, bc):
airFrictions = []
for v in range(1,1000):
airFrictions.append(retard(dragModel, bc, v) / pow(v, 2))
arr = airFrictions[thresholdVelocity:mv]
return sum(arr)/len(arr)
def calculateAirFriction(v, dragModel, bc):
return retard(dragModel, bc, v) / pow(v, 2)
# Each list entry needs to be in the following form:
# [ammo name, list of engagement ranges, list of muzzle velocities, drag model, ballistic coefficient]
ammoList = [["B_556x45_Ball", [300, 500, 500], [750, 870, 910], 7, 0.151],
["ACE_556x45_Ball_Mk262", [600, 600], [810, 840], 1, 0.361],
["ACE_556x45_Ball_Mk318", [300, 500, 500], [780, 880, 950], 1, 0.307],
["ACE_556x45_Ball_M995_AP", [400, 500], [820, 880], 1, 0.310],
["B_545x39_Ball_F", [400, 500], [735, 892], 7, 0.168],
["B_580x42_Ball_F", [500, 500], [930, 970], 7, 0.156],
["B_65x39_Caseless", [400, 800, 800], [730, 800, 830], 7, 0.263],
["ACE_65x47_Ball_Scenar", [500, 800], [730, 830], 7, 0.290],
["ACE_65_Creedmor_Ball", [600, 1000], [750, 860], 7, 0.317],
["B_762x51_Ball", [500, 800], [700, 833], 7, 0.2],
["ACE_762x51_Ball_M118LR", [600, 800], [750, 795], 7, 0.243],
["ACE_762x51_Ball_Mk316_Mod_0", [600, 800], [780, 810], 7, 0.243],
["ACE_762x51_Ball_Mk319_Mod_0", [600, 800], [840, 910], 1, 0.377],
["ACE_762x51_Ball_M993_AP", [600, 800], [875, 930], 1, 0.359],
["ACE_30_06_M1_Ball", [600, 800, 900], [700, 800, 840], 1, 0.494],
["ACE_7_Remington_Magnum_Ball", [600, 800, 1000], [720, 812, 830], 7, 0.345],
["ACE_243_Winchester_Ball", [700, 900, 900], [830, 900, 920], 7, 0.278],
["ACE_762x67_Ball_Mk248_Mod_0", [800, 900, 900], [865, 900, 924], 7, 0.268],
["ACE_762x67_Ball_Mk248_Mod_1", [800, 900, 900], [847, 867, 877], 7, 0.310],
["ACE_762x67_Ball_Berger_Hybrid_OTM", [900, 1000, 1000], [800, 853, 884], 7, 0.358],
["B_762x54_Ball", [500, 800, 800], [700, 820, 833], 1, 0.4],
["ACE_762x35_Ball", [400, 500], [620, 675], 1, 0.330],
["ACE_762x39_Ball", [400, 600], [650, 750], 1, 0.275],
["ACE_762x54_Ball_7T2", [500, 800, 800], [680, 750, 800], 1, 0.395],
["ACE_303_Ball", [900, 1000], [748, 765], 1, 0.493],
["B_93x64_Ball", [900, 1000], [850, 880], 1, 0.368],
["B_408_Ball", [1600,1600], [862, 872], 7, 0.434],
["ACE_408_Ball", [1200,1200], [1057, 1067], 7, 0.279],
["ACE_106x83mm_Ball", [1500, 1500], [955, 965], 1, 0.72],
["B_338_Ball", [1100, 1300], [880, 925], 7, 0.322],
["B_338_NM_Ball", [1100, 1300], [790, 820], 7, 0.381],
["ACE_338_Ball", [1200, 1300], [800, 830], 7, 0.381],
["ACE_338_Ball_API526", [1200, 1300], [880, 920], 7, 0.29],
["B_50BW_Ball_F", [300, 400], [510, 596], 1, 0.21],
["B_127x99_Ball", [1300, 1300], [895, 905], 1, 0.67],
["ACE_127x99_Ball_AMAX", [1600, 1600], [855, 865], 1, 1.05],
["B_127x108_Ball", [1300, 1300], [815, 825], 1, 0.63],
["ACE_762x51_Ball_Subsonic", [200, 300], [305, 340], 7, 0.235],
["B_9x21_Ball", [200, 300], [380, 420], 1, 0.165],
["ACE_9x18_Ball_57N181S", [100, 200, 200], [298, 330, 350], 1, 0.125],
["ACE_9x19_Ball", [100, 200, 200], [340, 370, 400], 1, 0.165],
["ACE_10x25_Ball", [200, 300, 300], [360, 400, 430], 1, 0.189],
["ACE_765x17_Ball", [100, 200, 200], [282, 300, 320], 1, 0.118],
["B_127x54_Ball", [500, 500], [295, 305], 1, 1.050],
["B_45ACP_Ball", [100, 200, 200], [230, 250, 285], 1, 0.195]]
print ("Calculating ...")
print ("")
open('../extras/airFrictionAnalysis.txt', 'w').close()
for ammo in ammoList:
name = ammo[0]
maxRanges = ammo[1]
mvs = ammo[2]
dragModel = ammo[3]
BC = ammo[4]
mv = round(sum(mvs) / len(mvs))
bestA = calculateAirFriction(mv, dragModel, BC)
if (mv < 360):
bestA = predictAirFriction(mv, mv - 20, dragModel, BC)
else:
bestA = predictAirFriction(mv, 340, dragModel, BC)
minDropDiff = 100
interval = 0.0003
while interval > 0.0000001:
low = bestA - interval
high = bestA + interval
a = low
while a < high:
dropDiff = maxDropDiffV(maxRanges, mvs, a, dragModel, BC)
if dropDiff < minDropDiff:
minDropDiff = dropDiff
bestA = a
a = a + interval / 10
interval = interval / 2
print (str(name) + " -> " + str(round(bestA, 8)))
with open('../extras/airFrictionAnalysis.txt', 'a') as f:
print ("##########################################", file=f)
print ("Ammo Class: " + name, file=f)
print ("MaxRanges (m): " + str(maxRanges), file=f)
print ("MuzzleVelocities (m/s): " + str(mvs), file=f)
print ("Max. Velocity diff (m/s): " + str(round(maxVelocityDiffV(maxRanges, mvs, bestA, dragModel, BC), 2)), file=f)
print ("Max. Drop diff (cm): " + str(round(minDropDiff * 100, 2)), file=f)
print ("Max. Tof diff (ms): " + str(maxTOFDiffV(maxRanges, mvs, bestA, dragModel, BC)), file=f)
print ("Optimal airFriction: " + str(round(bestA, 8)), file=f)