Merge remote-tracking branch 'refs/remotes/origin/master' into cba-log-macros

This commit is contained in:
PabstMirror 2016-09-22 15:10:30 -05:00
commit 3c53a314d4
677 changed files with 8681 additions and 2929 deletions

View File

@ -1,4 +1,5 @@
**When merged this pull request will:**
- Describe what this pull request will do
- Each change in a separate line
- Include documentation if applicable
- Respect the [Development Guidelines](http://ace3mod.com/wiki/development/)

View File

@ -4,7 +4,7 @@
<p align="center">
<a href="https://github.com/acemod/ACE3/releases/latest">
<img src="https://img.shields.io/badge/Version-3.6.2-blue.svg?style=flat-square" alt="ACE3 Version">
<img src="https://img.shields.io/badge/Version-3.7.0-blue.svg?style=flat-square" alt="ACE3 Version">
</a>
<a href="https://github.com/acemod/ACE3/issues">
<img src="https://img.shields.io/github/issues-raw/acemod/ACE3.svg?style=flat-square&label=Issues" alt="ACE3 Issues">

View File

@ -14,24 +14,22 @@
*/
#include "script_component.hpp"
private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
params["_muzzleVelocityShiftTable", "_temperature"];
params ["_muzzleVelocityShiftTable", "_temperature"];
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
private _muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
// Find exact data index required for given temperature
_temperatureIndexFunction = (_temperature + 15) / 5;
private _temperatureIndexFunction = (_temperature + 15) / 5;
// lower and upper data index used for interpolation
_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
private _temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
private _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
// Interpolation ratio
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
private _interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
// Interpolation
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return

View File

@ -17,11 +17,9 @@
*/
#include "script_component.hpp"
private "_airDensity";
params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
private _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
if (_atmosphereModel == "ICAO") then {
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient

View File

@ -19,14 +19,13 @@
*/
#include "script_component.hpp"
private ["_twist", "_length", "_stabilityFactor"];
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_twist = _barrelTwist / _caliber;
_length = _bulletLength / _caliber;
private _twist = _barrelTwist / _caliber;
private _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
private _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then {
(_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure

View File

@ -15,17 +15,16 @@
private _aceTimeSecond = floor CBA_missionTime;
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
_x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
_bulletVelocity = velocity _bullet;
private _bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
private _bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
} else {
_bulletPosition = getPosASL _bullet;
private _bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];

View File

@ -22,6 +22,7 @@ _initStartTime = CBA_missionTime;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
ACE_LOGINFO_1("Terrain already initialized [world: %1]", worldName);
#ifdef DEBUG_MODE_FULL
systemChat "AdvancedBallistics: Terrain already initialized";
#endif
@ -32,11 +33,14 @@ _gridCells = _mapGrids * _mapGrids;
GVAR(currentGrid) = 0;
ACE_LOGINFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldName);
[{
params ["_args","_idPFH"];
_args params ["_mapGrids", "_gridCells", "_initStartTime"];
if (GVAR(currentGrid) >= _gridCells) exitWith {
ACE_LOGINFO_2("Finished terrain initialization in %1 seconds [world: %2]", ceil(CBA_missionTime - _initStartTime), worldName);
#ifdef DEBUG_MODE_FULL
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(CBA_missionTime - _initStartTime)];
#endif

View File

@ -15,11 +15,10 @@
*/
#include "script_component.hpp"
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1;
private _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
private _twistDirection = 1;
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then {
@ -27,9 +26,9 @@ if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
};
};
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
private _barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength];
private _result = [_barrelTwist, _twistDirection, _barrelLength];
uiNamespace setVariable [format[QGVAR(%1), _weapon], _result];

View File

@ -0,0 +1 @@
z\ace\addons\advanced_fatigue

View File

@ -0,0 +1,45 @@
class ACE_Settings {
class GVAR(enabled) {
category = "Advanced Fatigue";
displayName = CSTRING(Enabled);
description = CSTRING(Enabled_Description);
typeName = "BOOL";
value = 1;
};
class GVAR(enableStaminaBar) {
category = "Advanced Fatigue";
displayName = CSTRING(EnableStaminaBar);
description = CSTRING(EnableStaminaBar_Description);
typeName = "BOOL";
value = 1;
isClientSettable = 1;
};
class GVAR(performanceFactor) {
category = "Advanced Fatigue";
displayName = CSTRING(PerformanceFactor);
description = CSTRING(PerformanceFactor_Description);
typeName = "SCALAR";
value = 1;
};
class GVAR(recoveryFactor) {
category = "Advanced Fatigue";
displayName = CSTRING(RecoveryFactor);
description = CSTRING(RecoveryFactor_Description);
typeName = "SCALAR";
value = 1;
};
class GVAR(loadFactor) {
category = "Advanced Fatigue";
displayName = CSTRING(LoadFactor);
description = CSTRING(LoadFactor_Description);
typeName = "SCALAR";
value = 1;
};
class GVAR(terrainGradientFactor) {
category = "Advanced Fatigue";
displayName = CSTRING(TerrainGradientFactor);
description = CSTRING(TerrainGradientFactor_Description);
typeName = "SCALAR";
value = 1;
};
};

View File

@ -0,0 +1,28 @@
class Cfg3DEN {
class Attributes {
class Slider;
class GVAR(slider): Slider {
attributeLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetPosition _value; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); ";
attributeSave = "params [""_ctrlGroup""]; sliderPosition (_ctrlGroup controlsGroupCtrl 100); ";
onLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetRange [0, 2]; _slider ctrlAddEventHandler [""SliderPosChanged"", { params [""_slider""]; private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101; private _value = sliderPosition _slider; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); }]; _edit ctrlAddEventHandler [""KillFocus"", { params [""_edit""]; private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100; private _value = ((parseNumber ctrlText _edit) min 2) max 0; _slider sliderSetPosition _value; _edit ctrlSetText str _value; }];";
};
};
class Object {
class AttributeCategories {
class ace_attributes {
class Attributes {
class GVAR(performanceFactor) {
property = QGVAR(performanceFactor);
control = QGVAR(slider);
displayName = CSTRING(PerformanceFactor);
tooltip = CSTRING(PerformanceFactor_EdenDescription);
expression = QUOTE(_this setVariable [ARR_3(QQGVAR(performanceFactor),_value,true)]);
typeName = "NUMBER";
condition = "objectControllable";
defaultValue = 1;
};
};
};
};
};
};

View File

@ -0,0 +1,23 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_DisplayLoad_EventHandlers {
class RscDisplayMission {
ADDON = QUOTE(call FUNC(createStaminaBar));
};
};

View File

@ -0,0 +1,62 @@
class CfgMovesBasic;
class CfgMovesMaleSdr: CfgMovesBasic {
class States {
// Jog speed adjustment: 12km/h
class AmovPercMstpSlowWrflDnon;
class AmovPercMrunSlowWrflDf: AmovPercMstpSlowWrflDnon {
speed = 0.634570;
};
class AmovPercMrunSlowWrflDfl: AmovPercMrunSlowWrflDf {
speed = 0.634570;
};
class AmovPercMrunSlowWrflDl: AmovPercMrunSlowWrflDfl {
speed = 0.691626;
};
class AmovPercMrunSlowWrflDr: AmovPercMrunSlowWrflDfl {
speed = 0.727404;
};
// Jog + raised weapon speed adjustment: 13km/h
class AmovPercMstpSrasWrflDnon;
class AmovPercMrunSrasWrflDf: AmovPercMstpSrasWrflDnon {
speed = 0.677068;
};
// Tactical Jog animation replacement and speed adjustment: 10km/h
class AmovPercMwlkSlowWrflDf_ver2;
class AmovPercMwlkSlowWrflDfl_ver2;
class AmovPercMtacSlowWrflDf_ver2: AmovPercMwlkSlowWrflDf_ver2 {
speed = 0.528808;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDf";
};
class AmovPercMtacSlowWrflDfl_ver2: AmovPercMwlkSlowWrflDfl_ver2 {
speed = 0.528808;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDfl";
};
class AmovPercMtacSlowWrflDfr_ver2: AmovPercMtacSlowWrflDf_ver2 {
speed = 0.528808;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDfr";
};
class AmovPercMtacSlowWrflDr_ver2: AmovPercMtacSlowWrflDf_ver2 {
speed = 0.528808;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDr";
};
class AmovPercMtacSlowWrflDl_ver2: AmovPercMtacSlowWrflDf_ver2 {
speed = 0.528808;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDl";
};
class AmovPercMtacSlowWrflDb_ver2: AmovPercMtacSlowWrflDf_ver2 {
speed = 0.684541;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDb";
soundEdge[] = {0.25,0.5,0.75,1};
};
class AmovPercMtacSlowWrflDbl_ver2: AmovPercMtacSlowWrflDb_ver2 {
speed = 0.684541;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDbl";
};
class AmovPercMtacSlowWrflDbr_ver2: AmovPercMtacSlowWrflDb_ver2 {
speed = 0.684541;
file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\run\low\Rfl\AmovPercMrunSlowWrflDbr";
};
};
};

View File

@ -0,0 +1,76 @@
class CfgSounds {
class GVAR(breathLow0) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_1", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathLow1) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_2", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathLow2) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_3", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathLow3) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_4", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathLow4) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_5", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathLow5) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Low_6", 0.6, 1, 7};
titles[] = {};
};
class GVAR(breathMid0) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_1", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMid1) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_2", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMid2) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_3", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMid3) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_4", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMid4) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_5", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMid5) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Mid_6", 0.8, 1, 13};
titles[] = {};
};
class GVAR(breathMax0) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_1", 1, 1, 17};
titles[] = {};
};
class GVAR(breathMax1) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_2", 1, 1, 17};
titles[] = {};
};
class GVAR(breathMax2) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_3", 1, 1, 17};
titles[] = {};
};
class GVAR(breathMax3) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_4", 1, 1, 17};
titles[] = {};
};
class GVAR(breathMax4) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_5", 1, 1, 17};
titles[] = {};
};
class GVAR(breathMax5) {
sound[] = {"A3\sounds_f\characters\human-sfx\P04\Breath_Max_6", 1, 1, 17};
titles[] = {};
};
};

View File

@ -0,0 +1,45 @@
class CfgVehicles {
class ACE_Module;
class GVAR(moduleSettings): ACE_Module {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = "Advanced Fatigue";
function = QFUNC(moduleSettings);
scope = 2;
isGlobal = 1;
isTriggerActivated = 0;
icon = QPATHTOF(UI\Icon_Module.paa);
class Arguments {
class Enabled {
displayName = CSTRING(Enabled);
description = CSTRING(Enabled_Description);
typeName = "BOOL";
defaultValue = 1;
};
class PerformanceFactor {
displayName = CSTRING(PerformanceFactor);
description = CSTRING(PerformanceFactor_Description);
typeName = "NUMBER";
defaultValue = 1;
};
class RecoveryFactor {
displayName = CSTRING(RecoveryFactor);
description = CSTRING(RecoveryFactor_Description);
typeName = "NUMBER";
defaultValue = 1;
};
class LoadFactor {
displayName = CSTRING(LoadFactor);
description = CSTRING(LoadFactor_Description);
typeName = "NUMBER";
defaultValue = 1;
};
class TerrainGradientFactor {
displayName = CSTRING(TerrainGradientFactor);
description = CSTRING(TerrainGradientFactor_Description);
typeName = "NUMBER";
defaultValue = 1;
};
};
};
};

View File

@ -0,0 +1,20 @@
class RscControlsGroupNoScrollbars;
class RscPicture;
class GVAR(StaminaBarContainer): RscControlsGroupNoScrollbars {
x = "(profilenamespace getvariable [""IGUI_GRID_STAMINA_X"", ((safezoneX + safezoneW) - (10 * (((safezoneW / safezoneH) min 1.2) / 40)) - 4.3 * (((safezoneW / safezoneH) min 1.2) / 40))])";
y = "(profilenamespace getvariable [""IGUI_GRID_STAMINA_Y"", (safezoneY + 4.05 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])";
w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "0.15 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
class Controls {
class StaminaBar: RscPicture {
idc = 10;
x = 0;
y = 0;
w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "0.15 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "\A3\Ui_f\data\IGUI\RscIngameUI\RscUnitInfo\stamina_ca.paa";
};
};
};

View File

@ -0,0 +1,10 @@
ace_advanced_fatigue
==========
An in depth stamina and fatigue simulation.
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [BaerMitUmlaut](https://github.com/BaerMitUmlaut)

Binary file not shown.

View File

@ -0,0 +1,10 @@
PREP(addDutyFactor);
PREP(createStaminaBar);
PREP(getAnimDuty);
PREP(getMetabolicCosts);
PREP(handleEffects);
PREP(handlePlayerChanged);
PREP(handleStaminaBar);
PREP(moduleSettings);
PREP(pfhMain);
PREP(removeDutyFactor);

View File

@ -0,0 +1,52 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
["ace_settingsInitialized", {
if (!GVAR(enabled)) exitWith {};
// - Post process effect ------------------------------------------------------
GVAR(ppeBlackout) = ppEffectCreate ["ColorCorrections", 4220];
GVAR(ppeBlackout) ppEffectEnable true;
GVAR(ppeBlackout) ppEffectForceInNVG true;
GVAR(ppeBlackout) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
GVAR(ppeBlackout) ppEffectCommit 0.4;
// - GVAR updating and initialization -----------------------------------------
if !(isNull ACE_player) then {
[ACE_player, objNull] call FUNC(handlePlayerChanged);
};
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
// - Duty factors -------------------------------------------------------------
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(medical,pain), { // 0->1.0, 0.5->1.05, 1->1.1
linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true];
}] call FUNC(addDutyFactor);
[QEGVAR(medical,bloodVolume), { // 100->1.0, 90->1.1, 80->1.2
linearConversion [100, 0, (_this getVariable [QEGVAR(medical,bloodVolume), 100]), 1, 2, true];
}] call FUNC(addDutyFactor);
};
if (["ACE_Dragging"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(dragging,isCarrying), {
[1, 3] select (_this getVariable [QEGVAR(dragging,isCarrying), false]);
}] call FUNC(addDutyFactor);
};
if (["ACE_Weather"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(weather,temperature), { // 35->1, 45->2
linearConversion [35, 45, (missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]), 1, 2, true];
}] call FUNC(addDutyFactor);
};
// - Add main PFH -------------------------------------------------------------
[FUNC(pfhMain), 1, []] call CBA_fnc_addPerFrameHandler;
}] call CBA_fnc_addEventHandler;
["ace_settingChanged", {
params ["_name", "_value"];
if (_name == QGVAR(enableStaminaBar) && {!_value}) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 0;
};
}] call CBA_fnc_addEventHandler;

View File

@ -0,0 +1,11 @@
#include "script_component.hpp"
ADDON = false;
#include "XEH_PREP.hpp"
//#include "initSettings.sqf"
GVAR(staminaBarWidth) = 10 * (((safezoneW / safezoneH) min 1.2) / 40);
GVAR(dutyList) = [[], []];
ADDON = true;

View File

@ -0,0 +1,23 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam);
authors[] = {"BaerMitUmlaut"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "ACE_Settings.hpp"
#include "CfgEden.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgMovesMaleSdr.hpp"
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"
#include "Dialog.hpp"

View File

@ -0,0 +1,18 @@
/*
* Author: BaerMitUmlaut
* Adds a duty factor.
*
* Arguments:
* 0: Factor ID <STRING>
* 1: Factor <NUMBER> or <CODE>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params [["_id", "", [""]], ["_factor", 1, [0, {}]]];
if (_id == "" || {_factor isEqualTo 1}) exitWith {};
GVAR(dutyList) params ["_idList", "_factorList"];
_idList pushBack _id;
_factorList pushBack _factor,

View File

@ -0,0 +1,18 @@
/*
* Author: BaerMitUmlaut
* Creates the stamina bar.
*
* Arguments:
* 0: Display <DISPLAY>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_display"];
private _staminaBar = _display ctrlCreate [QGVAR(StaminaBarContainer), -1];
uiNamespace setVariable [QGVAR(staminaBarContainer), _staminaBar];
_staminaBar ctrlSetFade 1;
_staminaBar ctrlCommit 0;

View File

@ -0,0 +1,56 @@
/*
* Author: BaerMitUmlaut
* Calculates the duty of the current animation.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Animation name <STRING>
*
* Return Value:
* Duty <NUMBER>
*
* Example:
* [player, "AidlPercMstpSlowWrflDnon_G05"] call ace_advanced_fatigue_fnc_getAnimDuty
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_animName"];
private _duty = 1;
private _animType = _animName select [1, 3];
GVAR(isSwimming) = false;
if (_animType in ["idl", "mov"]) then {
switch (_animName select [5, 3]) do {
case ("knl"): {
_duty = 1.5;
};
case ("pne"): {
_duty = 12;
};
default {
_duty = 1;
};
};
if (currentWeapon _unit != handgunWeapon _unit) then {
if (_animName select [13, 3] == "ras") then {
// low ready jog
_duty = _duty * 1.2;
if (_animName select [9, 3] == "tac") then {
// high ready jog/walk
_duty = _duty * 1.5;
};
};
};
} else {
// swimming and diving
if (_animType in ["swm", "ssw", "bsw", "dve", "sdv", "bdv"]) then {
_duty = 5;
GVAR(isSwimming) = true;
};
};
_duty

View File

@ -0,0 +1,61 @@
/*
* Author: BaerMitUmlaut
* Calculates the current metabolic costs for a unit.
* Calculation is done according to the Pandolf/Wojtowicz formulas.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Speed <NUMBER>
*
* Return Value:
* Metabolic cost <NUMBER>
*
* Example:
* [player, 3.3] call ace_advanced_fatigue_fnc_getMetabolicCosts
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_velocity"];
private _virtualLoad = 0;
{
_virtualLoad = _virtualLoad + (_x getVariable [QEGVAR(movement,vLoad), 0]);
} forEach [
_unit,
uniformContainer _unit,
vestContainer _unit,
backpackContainer _unit
];
private _gearMass = ((loadAbs _unit + _virtualLoad) * 0.1 / 2.2046) * GVAR(loadFactor);
private _terrainFactor = 1;
private _terrainAngle = asin (1 - ((surfaceNormal getPosASL _unit) select 2));
private _terrainGradient = (_terrainAngle / 45 min 1) * 5 * GVAR(terrainGradientFactor);
private _duty = GVAR(animDuty);
{
if (_x isEqualType 0) then {
_duty = _duty * _x;
} else {
_duty = _duty * (_unit call _x);
};
} forEach (GVAR(dutyList) select 1);
if (GVAR(isSwimming)) then {
_terrainGradient = 0;
};
if (_velocity > 2) then {
(
2.10 * SIM_BODYMASS
+ 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.90 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient)
) * 0.23 * _duty
} else {
(
1.05 * SIM_BODYMASS
+ 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient)
) * 0.23 * _duty
};

View File

@ -0,0 +1,90 @@
/*
* Author: BaerMitUmlaut
* Handles any audible, visual and physical effects of fatigue.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fatigue <NUMBER>
* 2: Speed <NUMBER>
* 3: Overexhausted <BOOL>
*
* Return Value:
* None
*
* Example:
* [_player, 0.5, 3.3, true] call ace_advanced_fatigue_fnc_handleEffects
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_fatigue", "_speed", "_overexhausted"];
#ifdef DEBUG_MODE_FULL
systemChat str _fatigue;
systemChat str vectorMagnitude velocity _unit;
#endif
// - Audible effects ----------------------------------------------------------
GVAR(lastBreath) = GVAR(lastBreath) + 1;
if (_fatigue > 0.4 && {GVAR(lastBreath) > (_fatigue * -10 + 9)} && {!underwater _unit}) then {
switch (true) do {
case (_fatigue < 0.6): {
playSound (QGVAR(breathLow) + str(floor random 6));
};
case (_fatigue < 0.85): {
playSound (QGVAR(breathMid) + str(floor random 6));
};
default {
playSound (QGVAR(breathMax) + str(floor random 6));
};
};
GVAR(lastBreath) = 0;
};
// - Visual effects -----------------------------------------------------------
GVAR(ppeBlackoutLast) = GVAR(ppeBlackoutLast) + 1;
if (GVAR(ppeBlackoutLast) == 1) then {
GVAR(ppeBlackout) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
GVAR(ppeBlackout) ppEffectCommit 1;
} else {
if (_fatigue > 0.85) then {
if (GVAR(ppeBlackoutLast) > (100 - _fatigue * 100) / 3) then {
GVAR(ppeBlackout) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2,2,0,0,0,0.1,0.5]];
GVAR(ppeBlackout) ppEffectCommit 1;
GVAR(ppeBlackoutLast) = 0;
};
};
};
// - Physical effects ---------------------------------------------------------
if (GVAR(isSwimming)) exitWith {
_unit setAnimSpeedCoef (1 - _fatigue / 3);
};
if (_overexhausted) then {
[_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
} else {
if (isForcedWalk _unit && {_fatigue < 0.7}) then {
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
} else {
if ((isSprintAllowed _unit) && {_fatigue > 0.7}) then {
[_unit, "blockSprint", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
} else {
if ((!isSprintAllowed _unit) && {_fatigue < 0.6}) then {
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
};
};
};
};
switch (stance _unit) do {
case ("CROUCH"): {
_unit setCustomAimCoef (1.0 + _fatigue ^ 2 * 0.1);
};
case ("PRONE"): {
_unit setCustomAimCoef (1.0 + _fatigue ^ 2 * 2.0);
};
default {
_unit setCustomAimCoef (1.5 + _fatigue ^ 2 * 3.0);
};
};

View File

@ -0,0 +1,57 @@
/*
* Author: BaerMitUmlaut
* Handles switching units (once on init and afterwards via Zeus).
*
* Arguments:
* 0: New Unit <OBJECT>
* 1: Old Unit <OBJECT>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_newUnit", "_oldUnit"];
if !(isNull _oldUnit) then {
_oldUnit enableStamina true;
_oldUnit removeEventHandler ["AnimChanged", _oldUnit getVariable [QGVAR(animHandler), -1]];
_oldUnit setVariable [QGVAR(ae1Reserve), GVAR(ae1Reserve)];
_oldUnit setVariable [QGVAR(ae2Reserve), GVAR(ae2Reserve)];
_oldUnit setVariable [QGVAR(anReserve), GVAR(anReserve)];
_oldUnit setVariable [QGVAR(anFatigue), GVAR(anFatigue)];
_oldUnit setVariable [QGVAR(muscleDamage), GVAR(muscleDamage)];
};
_newUnit enableStamina false;
// Don't add a new EH if the unit respawned
if (_newUnit getVariable [QGVAR(animHandler), -1] == -1) then {
private _animHandler = _newUnit addEventHandler ["AnimChanged", {
GVAR(animDuty) = _this call FUNC(getAnimDuty);
}];
_newUnit setVariable [QGVAR(animHandler), _animHandler];
};
GVAR(ae1Reserve) = _newUnit getVariable [QGVAR(ae1Reserve), AE1_MAXRESERVE];
GVAR(ae2Reserve) = _newUnit getVariable [QGVAR(ae2Reserve), AE2_MAXRESERVE];
GVAR(anReserve) = _newUnit getVariable [QGVAR(anReserve), AN_MAXRESERVE];
GVAR(anFatigue) = _newUnit getVariable [QGVAR(anFatigue), 0];
GVAR(muscleDamage) = _newUnit getVariable [QGVAR(muscleDamage), 0];
// Clean variables for respawning units
{
_newUnit setVariable [_x, nil];
} forEach [QGVAR(ae1Reserve), QGVAR(ae2Reserve), QGVAR(anReserve), QGVAR(anFatigue), QGVAR(muscleDamage)];
GVAR(VO2Max) = 35 + 20 * (_newUnit getVariable [QGVAR(performanceFactor), GVAR(performanceFactor)]);
GVAR(VO2MaxPower) = GVAR(VO2Max) * SIM_BODYMASS * 0.23 * JOULES_PER_ML_O2 / 60;
GVAR(peakPower) = VO2MAX_STRENGTH * GVAR(VO2MaxPower);
GVAR(ae1PathwayPower) = GVAR(peakPower) / (13.3 + 16.7 + 113.3) * 13.3 * ANTPERCENT ^ 1.28 * 1.362;
GVAR(ae2PathwayPower) = GVAR(peakPower) / (13.3 + 16.7 + 113.3) * 16.7 * ANTPERCENT ^ 1.28 * 1.362;
GVAR(anPathwayPower) = GVAR(peakPower) - _ae1PathwayPower - _ae2PathwayPower;
GVAR(ppeBlackoutLast) = 100;
GVAR(lastBreath) = 0;
GVAR(animDuty) = [_newUnit, animationState _newUnit] call FUNC(getAnimDuty);

View File

@ -0,0 +1,44 @@
/*
* Author: BaerMitUmlaut
* Handles visual changes of the stamina bar.
*
* Arguments:
* Percent of stamina remaining <NUMBER>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_stamina"];
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
// - Size ---------------------------------------------------------------------
// Shrink the container to cut off the image (other wise it would just get stretched)
private _posAndSize = ctrlPosition _staminaBarContainer;
_posAndSize set [2, _stamina * GVAR(staminaBarWidth)];
_staminaBarContainer ctrlSetPosition _posAndSize;
// - Opacity ------------------------------------------------------------------
if (_stamina >= 0.8) then {
_staminaBarContainer ctrlSetFade (0.9 + 0.1 * (_stamina - 0.8) / 0.2);
} else {
_staminaBarContainer ctrlSetFade (0.9 * _stamina / 0.8);
};
// - Color --------------------------------------------------------------------
// 1.0 - 0.8: White
// 0.6 - 0.4: Orange
// 0.4 - 0.2: Red
private _color = [1, 1, 1];
if (_stamina < 0.6) then {
if (_stamina < 0.4) then {
_color = [1, 0, 0] vectorAdd ([0, 0.65, 0] vectorMultiply ((_stamina - 0.2) / 0.2));
} else {
_color = [1, 0.65, 0] vectorAdd ([0, 0.35, 1] vectorMultiply ((_stamina - 0.4) / 0.2));
};
};
_color pushBack 1;
(_staminaBarContainer controlsGroupCtrl 10) ctrlSetTextColor _color;
_staminaBarContainer ctrlCommit 1;

View File

@ -0,0 +1,18 @@
/*
* Author: BaerMitUmlaut
* Initializes the module settings.
*
* Arguments:
* 0: Module <OBJECT>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_logic"];
[_logic, QGVAR(enabled), "Enabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(performanceFactor), "PerformanceFactor"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(recoveryFactor), "RecoveryFactor"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(loadFactor), "LoadFactor"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(terrainGradientFactor), "TerrainGradientFactor"] call EFUNC(common,readSettingFromModule);

View File

@ -0,0 +1,63 @@
/*
* Author: BaerMitUmlaut
* Main perFrameHandler that updates fatigue values.
*
* Arguments:
* None
*
* Return Value:
* None
*/
#include "script_component.hpp"
if (!alive ACE_player) exitWith {}; // Dead people don't breath, Will also handle null (Map intros)
private _currentWork = REE;
private _currentSpeed = (vectorMagnitude (velocity ACE_player)) min 6;
if ((vehicle ACE_player == ACE_player) && {_currentSpeed > 0.1} && {isTouchingGround ACE_player || {underwater ACE_player}}) then {
_currentWork = [ACE_player, _currentSpeed] call FUNC(getMetabolicCosts);
_currentWork = _currentWork max REE;
};
// Calculate muscle damage increase
// Note: Muscle damage recovery is ignored as it takes multiple days
GVAR(muscleDamage) = GVAR(muscleDamage) + (_currentWork / GVAR(peakPower)) ^ 3.2 * 0.00004;
private _muscleIntegrity = 1 - GVAR(muscleDamage);
// Calculate available power
private _ae1PathwayPowerFatigued = GVAR(ae1PathwayPower) * sqrt (GVAR(ae1Reserve) / AE1_MAXRESERVE) * OXYGEN * sqrt _muscleIntegrity;
private _ae2PathwayPowerFatigued = GVAR(ae2PathwayPower) * sqrt (GVAR(ae2Reserve) / AE2_MAXRESERVE) * OXYGEN * sqrt _muscleIntegrity;
// Calculate how much power is consumed from each reserve
private _ae1Power = _currentWork min _ae1PathwayPowerFatigued;
private _ae2Power = ((_currentWork - _ae1Power) max 0) min _ae2PathwayPowerFatigued;
private _anPower = (_currentWork - _ae1Power - _ae2Power) max 0;
// Remove ATP from reserves for current work
GVAR(ae1Reserve) = GVAR(ae1Reserve) - _ae1Power / WATTSPERATP;
GVAR(ae2Reserve) = GVAR(ae2Reserve) - _ae2Power / WATTSPERATP;
GVAR(anReserve) = GVAR(anReserve) - _anPower / WATTSPERATP;
// Increase anearobic fatigue
GVAR(anFatigue) = GVAR(anFatigue) + _anPower * (0.057 / GVAR(peakPower)) * 1.1;
// Aerobic ATP reserve recovery
GVAR(ae1Reserve) = ((GVAR(ae1Reserve) + OXYGEN * 6.60 * (GVAR(ae1PathwayPower) - _ae1Power) / GVAR(ae1PathwayPower) * GVAR(recoveryFactor)) min AE1_MAXRESERVE) max 0;
GVAR(ae2Reserve) = ((GVAR(ae2Reserve) + OXYGEN * 5.83 * (GVAR(ae2PathwayPower) - _ae2Power) / GVAR(ae2PathwayPower) * GVAR(recoveryFactor)) min AE2_MAXRESERVE) max 0;
// Anaerobic ATP reserver and fatigue recovery
GVAR(anReserve) = ((GVAR(anReserve)
+ (_ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power) / GVAR(VO2MaxPower) * 56.7 * GVAR(anFatigue) ^ 2 * GVAR(recoveryFactor)
) min AN_MAXRESERVE) max 0;
GVAR(anFatigue) = ((GVAR(anFatigue)
- (_ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power) * (0.057 / GVAR(peakPower)) * GVAR(anFatigue) ^ 2 * GVAR(recoveryFactor)
) min 1) max 0;
private _aeReservePercentage = (GVAR(ae1Reserve) / AE1_MAXRESERVE + GVAR(ae2Reserve) / AE2_MAXRESERVE) / 2;
private _anReservePercentage = GVAR(anReserve) / AN_MAXRESERVE;
private _perceivedFatigue = 1 - (_anReservePercentage min _aeReservePercentage);
[ACE_player, _perceivedFatigue, _currentSpeed, GVAR(anReserve) == 0] call FUNC(handleEffects);
if (GVAR(enableStaminaBar)) then {
[GVAR(anReserve) / AN_MAXRESERVE] call FUNC(handleStaminaBar);
};

View File

@ -0,0 +1,20 @@
/*
* Author: BaerMitUmlaut
* Removes a duty factor.
*
* Arguments:
* 0: Factor ID <STRING>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params [["_id", "", [""]]];
GVAR(dutyList) params ["_idList", "_factorList"];
private _index = _idList find _id;
if (_index != -1) then {
_idList deleteAt _index;
_factorList deleteAt _index;
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\advanced_fatigue\script_component.hpp"

View File

@ -0,0 +1,59 @@
[
QGVAR(enabled),
"CHECKBOX",
[LSTRING(Enabled), LSTRING(Enabled_Description)],
"ACE3 Advanced Fatigue",
true,
true
] call CBA_Settings_fnc_init;
[
QGVAR(enableStaminaBar),
"CHECKBOX",
[LSTRING(EnableStaminaBar), LSTRING(EnableStaminaBar_Description)],
"ACE3 Advanced Fatigue",
true,
true, {
if (!_this) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 0;
};
}
] call CBA_Settings_fnc_init;
[
QGVAR(performanceFactor),
"SLIDER",
[LSTRING(PerformanceFactor), LSTRING(PerformanceFactor_Description)],
"ACE3 Advanced Fatigue",
[0, 2, 1, 1],
true
] call CBA_Settings_fnc_init;
[
QGVAR(recoveryFactor),
"SLIDER",
[LSTRING(RecoveryFactor), LSTRING(RecoveryFactor_Description)],
"ACE3 Advanced Fatigue",
[0, 2, 1, 1],
true
] call CBA_Settings_fnc_init;
[
QGVAR(loadFactor),
"SLIDER",
[LSTRING(LoadFactor), LSTRING(LoadFactor_Description)],
"ACE3 Advanced Fatigue",
[0, 2, 1, 1],
true
] call CBA_Settings_fnc_init;
[
QGVAR(terrainGradientFactor),
"SLIDER",
[LSTRING(TerrainGradientFactor), LSTRING(TerrainGradientFactor_Description)],
"ACE3 Advanced Fatigue",
[0, 2, 1, 1],
true
] call CBA_Settings_fnc_init;

View File

@ -0,0 +1,30 @@
#define COMPONENT advanced_fatigue
#define COMPONENT_BEAUTIFIED Advanced Fatigue
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ADVANCED_FATIGUE
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_ADVANCED_FATIGUE
#define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCED_FATIGUE
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define ANTPERCENT 0.8
#define SIM_BODYMASS 70
#define JOULES_PER_ML_O2 20.9
#define VO2MAX_STRENGTH 4.1
#define REE 18.83 //((0.5617 * SIM_BODYMASS + 42.57) * 0.23)
#define OXYGEN 0.9
#define WATTSPERATP 7
#define AE1_MAXRESERVE 4000000
#define AE2_MAXRESERVE 84000
#define AN_MAXRESERVE 2300

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Advanced_Fatigue">
<Key ID="STR_ACE_Advanced_Fatigue_PerformanceFactor">
<English>Performance Factor</English>
<German>Leistungsfaktor</German>
<Polish>Współczynnik wydolności</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_PerformanceFactor_Description">
<English>Influences the overall performance of all players with no custom factor. Higher means better.</English>
<German>Beinflusst die Leistungsfähigkeit aller Spieler ohne eigenen Leistungsfaktor. Ein höherer Wert bedeutet bessere Leistung.</German>
<Polish>Wpływa na ogólną wydolność organizmu u wszystkich graczy bez ustawionego niestandardowego współczynnika. Więcej znaczy lepiej.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_PerformanceFactor_EdenDescription">
<English>Influences the overall performance of this unit. Higher means better.</English>
<German>Beinflusst die Leistungsfähigkeit dieser Einheit. Ein höherer Wert bedeutet bessere Leistung.</German>
<Polish>Wpływa na ogólną wydolność tej jednostki. Więcej znaczy lepiej.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_RecoveryFactor">
<English>Recovery Factor</English>
<German>Erholungsfaktor</German>
<Polish>Współczynnik regeneracji</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_RecoveryFactor_Description">
<English>Changes how fast the player recovers when resting. Higher is faster.</English>
<German>Ändert, wie schnell ein Spieler Ausdauer regeneriert. Ein höherer Wert bedeutet eine schnellere Regeneration.</German>
<Polish>Wpływa na czas regeneracji podczas postoju. Więcej znaczy szybciej.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_LoadFactor">
<English>Load Factor</English>
<German>Gewichtsfaktor</German>
<Polish>Współczynnik masy ekwipunku</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_LoadFactor_Description">
<English>Increases or decreases how much weight influences the players performance. Zero means equipment weight has no performance influence.</English>
<German>Erhöht oder verringert, wie viel Einfluss das Ausrüstungsgewicht auf die Leistung hat. Null heißt, dass es keinen Einfluss hat.</German>
<Polish>Zmniejsza lub zwiększa wpływ ciężaru ekwipunku na wydolność gracza. Zero oznacza kompletny brak wpływu na wydolność.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_TerrainGradientFactor">
<English>Terrain Gradient Factor</English>
<German>Terrainsteigungsfaktor</German>
<Polish>Współczynnik terenu</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_TerrainGradientFactor_Description">
<English>Sets how much steep terrain increases stamina loss. Higher means higher stamina loss.</English>
<German>Beeinflusst, wie stark Steigungen den Ausdauerverbrauch erhöhen. Ein höherer Wert erhöht den Ausdauerverbrauch.</German>
<Polish>Wpływa na to w jakim stopniu stromy teren wpływa na utratę wytrzymałości. Więcej oznacza szybszą utratę wytrzymałości.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_Enabled">
<English>Enabled</English>
<German>Aktiv</German>
<Polish>Włączone</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_Enabled_Description">
<English>Enables/disables Advanced Fatigue.</English>
<German>Aktiviert/deaktiviert Advanced Fatigue.</German>
<Polish>Włącza/wyłącza zaawansowaną wytrzymałość</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_EnableStaminaBar">
<English>Show stamina bar</English>
<German>Zeige Ausdauerleiste</German>
<Polish>Pokaż pasek wytrzymałości</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_EnableStaminaBar_Description">
<English>Shows the stamina bar.</English>
<German>Zeigt die Ausdauerleiste an.</German>
<Polish>Pokazuje pasek wytrzymałości.</Polish>
</Key>
</Package>
</Project>

View File

@ -0,0 +1 @@
z\ace\addons\advanced_throwing

View File

@ -58,7 +58,7 @@ class CfgVehicles {
class ACE_Actions {
class GVAR(pickUp) {
displayName = CSTRING(PickUp);
condition = QUOTE(_player call FUNC(canPrepare));
condition = QUOTE([ARR_2(_player,true)] call FUNC(canPrepare));
statement = QUOTE(_this call FUNC(pickUp));
distance = 1.8; // Requires >1.7 to work when standing with weapon on back
icon = "\a3\ui_f\data\igui\cfg\actions\obsolete\ui_action_takemine_ca.paa";

View File

@ -1,4 +1,4 @@
ace_advancedthrowing
ace_advanced_throwing
===================
Integrates advanced throwing by [Dslyecxi](https://github.com/dslyecxi).

View File

@ -83,6 +83,13 @@ GVAR(ammoMagLookup) = call CBA_fnc_createNamespace;
// Fired XEH
[QGVAR(throwFiredXEH), FUNC(throwFiredXEH)] call CBA_fnc_addEventHandler;
// Set last thrown time on Vanilla Throwing and Advanced Throwing
["ace_firedPlayer", {
if (_weapon == "Throw") then {
_unit setVariable [QGVAR(lastThrownTime), CBA_missionTime];
};
}] call CBA_fnc_addEventHandler;
// Display handlers
["KeyDown", {_this call FUNC(onKeyDown)}] call CBA_fnc_addDisplayHandler;

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

View File

@ -4,25 +4,31 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Ignore Last Thrown Time <BOOL> (default: false)
*
* Return Value:
* Can Prepare <BOOL>
*
* Example:
* [unit] call ace_advancedthrowing_fnc_canPrepare
* [unit] call ace_advanced_throwing_fnc_canPrepare
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
params ["_unit", ["_ignoreLastThrownTime", false]];
// Don't delay when picking up
if (_ignoreLastThrownTime) then {
_unit setVariable [QGVAR(lastThrownTime), -1];
};
GVAR(enabled) &&
#ifndef DEBUG_MODE_FULL
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
#else
#ifdef ALLOW_QUICK_THROW
{true} &&
#else
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
#endif
{!(call EFUNC(common,isFeatureCameraActive))} &&

View File

@ -9,7 +9,7 @@
* Can Throw <BOOL>
*
* Example:
* [unit] call ace_advancedthrowing_fnc_canThrow
* [unit] call ace_advanced_throwing_fnc_canThrow
*
* Public: No
*/

View File

@ -9,7 +9,7 @@
* Flight path (just for debug) <ARRAY>
*
* Example:
* call ace_advancedthrowing_fnc_drawArc
* call ace_advanced_throwing_fnc_drawArc
*
* Public: No
*/
@ -79,7 +79,8 @@ reverse _pathData;
{
_x params ["_col", "_newTrajAGL", "_iDim"];
drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\icon_text\group_1_ca.paa", _col, _newTrajAGL, _iDim, _iDim, 0, "", 2];
#ifdef DEBUG_MODE_FULL
#ifdef DRAW_THROW_PATH
drawIcon3D ["", _col, _newTrajAGL, _iDim, _iDim, 0, str (ACE_player distance _newTrajAGL), 2, 0.05, "RobotoCondensed"];
#endif
} forEach _pathData;

View File

@ -9,13 +9,13 @@
* None
*
* Example:
* call ace_advancedthrowing_fnc_drawThrowable
* call ace_advanced_throwing_fnc_drawThrowable
*
* Public: No
*/
#include "script_component.hpp"
if (dialog || {!(ACE_player getVariable [QGVAR(inHand), false])} || {!([ACE_player] call FUNC(canPrepare))}) exitWith {
if (dialog || {!(ACE_player getVariable [QGVAR(inHand), false])} || {!([ACE_player, true] call FUNC(canPrepare))}) exitWith {
[ACE_player, "In dialog or no throwable in hand or cannot prepare throwable"] call FUNC(exitThrowMode);
};
@ -63,7 +63,7 @@ private _power = linearConversion [0, 180, _phi - 30, 1, 0.3, true];
ACE_player setVariable [QGVAR(throwSpeed), _throwSpeed * _power];
#ifdef DEBUG_MODE_FULL
hintSilent format ["Heading: %1\nPower: %2\nSpeed: %3\nThrowMag: %4", _phi, _power, _throwSpeed * _power, _throwableMag];
hintSilent format ["Heading: %1\nPower: %2\nSpeed: %3\nThrowMag: %4\nMuzzle: %5", _phi, _power, _throwSpeed * _power, _throwableMag, ACE_player getVariable [QGVAR(activeMuzzle), ""]];
#endif
private _throwableType = getText (configFile >> "CfgMagazines" >> _throwableMag >> "ammo");
@ -71,16 +71,25 @@ private _throwableType = getText (configFile >> "CfgMagazines" >> _throwableMag
if (!([ACE_player] call FUNC(canThrow)) && {!_primed}) exitWith {
if (!isNull _activeThrowable) then {
deleteVehicle _activeThrowable;
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
};
};
if (isNull _activeThrowable || {(_throwableType != typeOf _activeThrowable) && {!_primed}}) then {
if (!isNull _activeThrowable) then {
deleteVehicle _activeThrowable;
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
};
_activeThrowable = _throwableType createVehicleLocal [0, 0, 0];
_activeThrowable enableSimulation false;
ACE_player setVariable [QGVAR(activeThrowable), _activeThrowable];
// Set muzzle ammo to 0 to block vanilla throwing (can only be 0 or 1)
private _muzzle = _throwableMag call FUNC(getMuzzle);
ACE_player setAmmo [_muzzle, 0];
ACE_player setVariable [QGVAR(activeMuzzle), _muzzle];
};
// Exit in case of explosion in hand
@ -88,6 +97,11 @@ if (isNull _activeThrowable) exitWith {
[ACE_player, "No active throwable (explosion in hand)"] call FUNC(exitThrowMode);
};
// Exit if locality changed (someone took the throwable from hand)
if (!local _activeThrowable && {ACE_player getVariable [QGVAR(localityChanged), true]}) exitWith {
[ACE_player, "Throwable locality changed"] call FUNC(exitThrowMode);
};
// Set position
private _posHeadRel = ACE_player selectionPosition "head";

View File

@ -10,7 +10,7 @@
* None
*
* Example:
* [unit, "reason"] call ace_advancedthrowing_fnc_exitThrowMode
* [unit, "reason"] call ace_advanced_throwing_fnc_exitThrowMode
*
* Public: No
*/
@ -25,13 +25,22 @@ if !(_unit getVariable [QGVAR(inHand), false]) exitWith {};
systemChat format ["Exit Throw Mode: %1", _reason];
#endif
private _activeThrowable = _unit getVariable [QGVAR(activeThrowable), objNull];
if !(_unit getVariable [QGVAR(primed), false]) then {
deleteVehicle (_unit getVariable [QGVAR(activeThrowable), objNull]);
deleteVehicle _activeThrowable;
} else {
_unit setVariable [QGVAR(lastThrownTime), CBA_missionTime];
// Fix floating for throwables without proper physics (eg. IR Grenade)
_activeThrowable setVelocity [0, 0, -0.1];
};
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
_unit setAmmo [_unit getVariable [QGVAR(activeMuzzle), ""], 1];
_unit setVariable [QGVAR(inHand), false];
_unit setVariable [QGVAR(primed), false];
_unit setVariable [QGVAR(activeThrowable), objNull];
_unit setVariable [QGVAR(activeMuzzle), ""];
_unit setVariable [QGVAR(throwType), THROW_TYPE_DEFAULT];
_unit setVariable [QGVAR(throwSpeed), THROW_SPEED_DEFAULT];
_unit setVariable [QGVAR(dropMode), false];

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* "magazine" call ace_advancedthrowing_fnc_getMuzzle
* "magazine" call ace_advanced_throwing_fnc_getMuzzle
*
* Public: No
*/

View File

@ -11,7 +11,7 @@
* None
*
* Example:
* [logic, [unit1, unit2], true] call ace_advancedthrowing_fnc_moduleInit
* [logic, [unit1, unit2], true] call ace_advanced_throwing_fnc_moduleInit
*
* Public:
* No

View File

@ -13,7 +13,7 @@
* None
*
* Example:
* [control, 5, false, true, false] call ace_advancedthrowing_fnc_onKeyDown
* [control, 5, false, true, false] call ace_advanced_throwing_fnc_onKeyDown
*
* Public: No
*/

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* [] call ace_advancedthrowing_fnc_onMouseButtonDown
* [] call ace_advanced_throwing_fnc_onMouseButtonDown
*
* Public: No
*/

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* [] call ace_advancedthrowing_fnc_onMouseScroll
* [] call ace_advanced_throwing_fnc_onMouseScroll
*
* Public: No
*/

View File

@ -10,7 +10,7 @@
* None
*
* Example:
* [helper, player] call ace_advancedthrowing_fnc_pickUp
* [helper, player] call ace_advanced_throwing_fnc_pickUp
*
* Public: No
*/
@ -41,6 +41,15 @@ if (!isNull _attachedTo) then {
// Change locality for manipulation (some commands require local object, such as setVelocity)
if (!local _activeThrowable) then {
["ace_setOwner", [_activeThrowable, CBA_clientID]] call CBA_fnc_serverEvent;
// Mark when it's safe to exit throw mode (locality change has delay)
_unit setVariable [QGVAR(localityChanged), false];
[{
// Becomes local or times out
local (_this select 0) || {(_this select 1) + 5 < CBA_missionTime}
}, {
(_this select 2) setVariable [QGVAR(localityChanged), true];
}, [_activeThrowable, CBA_missionTime, _unit]] call CBA_fnc_waitUntilAndExecute;
};
// Invoke listenable event

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* [unit] call ace_advancedthrowing_fnc_prepare
* [unit] call ace_advanced_throwing_fnc_prepare
*
* Public: No
*/
@ -23,12 +23,15 @@ if (_unit getVariable [QGVAR(inHand), false]) exitWith {
TRACE_1("inHand",_unit);
if (!(_unit getVariable [QGVAR(primed), false])) then {
TRACE_1("not primed",_unit);
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
// selectNextGrenade relies on muzzles array (setAmmo 0 removes the muzzle from the array and current can't be found, cycles between 0 and 1 muzzles)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
[_unit] call EFUNC(weaponselect,selectNextGrenade);
};
};
// Try selecting next throwable if none currently selected
if ((isNull (_unit getVariable [QGVAR(activeThrowable), objNull])) && {(currentThrowable _unit) isEqualTo []} && {!([_unit] call EFUNC(weaponselect,selectNextGrenade))}) exitWith {
if (isNull (_unit getVariable [QGVAR(activeThrowable), objNull]) && {(currentThrowable _unit) isEqualTo []} && {!([_unit] call EFUNC(weaponselect,selectNextGrenade))}) exitWith {
TRACE_1("no throwables",_unit);
};

View File

@ -10,7 +10,7 @@
* None
*
* Example:
* [unit] call ace_advancedthrowing_fnc_prime
* [unit] call ace_advanced_throwing_fnc_prime
*
* Public: No
*/
@ -26,7 +26,10 @@ private _throwableMag = (currentThrowable _unit) select 0;
_unit removeItem _throwableMag;
private _throwableType = getText (configFile >> "CfgMagazines" >> _throwableMag >> "ammo");
private _muzzle = _throwableMag call FUNC(getMuzzle);
private _muzzle = _unit getVariable [QGVAR(activeMuzzle), ""];
// Set muzzle ammo to 0 to block vanilla throwing (can only be 0 or 1), removeItem above resets it
_unit setAmmo [_muzzle, 0];
// Create actual throwable globally
private _activeThrowableOld = _unit getVariable [QGVAR(activeThrowable), objNull];

View File

@ -10,7 +10,7 @@
* Nothing
*
* Example:
* call ace_advancedthrowing_fnc_renderPickUpInteraction
* call ace_advanced_throwing_fnc_renderPickUpInteraction
*
* Public: No
*/
@ -22,36 +22,41 @@
// isNull is necessarry to prevent rare error when ending mission with interact key down
if (EGVAR(interact_menu,keyDown) && {!isNull ACE_player}) then {
// Rescan when player moved >5 meters from last pos, nearObjects is costly
// Rescan when player moved >5 meters from last pos, nearObjects can be costly with a lot of objects around
if ((getPosASL ACE_player) distance _setPosition > 5) then {
// IR throwbles inherit from GrenadeCore, others from GrenadeHand
_nearThrowables = ACE_player nearObjects ["GrenadeHand", 10];
_nearThrowables append (ACE_player nearObjects ["GrenadeCore", 10]);
// Grenades inherit from GrenadeHand, IR throwbles from IRStrobeBase, IR Chemlights are special snowflakes
// nearEntities does not see throwables
_nearThrowables = ACE_player nearObjects ["GrenadeHand", PICK_UP_DISTANCE];
_nearThrowables append (ACE_player nearObjects ["IRStrobeBase", PICK_UP_DISTANCE]);
_nearThrowables append (ACE_player nearObjects ["ACE_Chemlight_IR_Dummy", PICK_UP_DISTANCE]);
{
if (_x in _throwablesHelped) exitWith {};
if (!(_x in _throwablesHelped) &&
{!(_x isKindOf "SmokeShellArty")} && {!(_x isKindOf "G_40mm_Smoke")} && // All smokes inherit from "GrenadeHand" >> "SmokeShell"
{GVAR(enablePickUpAttached) || {!GVAR(enablePickUpAttached) && {isNull (attachedTo _x)}}}
) then {
TRACE_2("Making PickUp Helper",_x,typeOf _x);
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
TRACE_2("Making PickUp Helper",_x,typeOf _x);
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
_pickUpHelper attachTo [_x, [0, 0, 0]];
_pickUpHelper setVariable [QGVAR(throwable), _x];
_pickUpHelper attachTo [_x, [0, 0, 0]];
_pickUpHelper setVariable [QGVAR(throwable), _x];
_addedPickUpHelpers pushBack _pickUpHelper;
_throwablesHelped pushBack _x;
true
_addedPickUpHelpers pushBack _pickUpHelper;
_throwablesHelped pushBack _x;
};
nil
} count _nearThrowables;
_args set [0, getPosASL ACE_player];
_args set [3, _nearThrowables];
};
// Make sure helper is on correct location as it will not automatically move
// attachTo is not supported with CfgAmmo, it is only used to get location
{
if (!GVAR(enablePickUpAttached) && {!isNull (attachedTo _x)}) exitWith {};
// Only handling with attachTo works nicely
_x attachTo [_x getVariable [QGVAR(throwable), objNull], [0, 0, 0]];
true
nil
} count _addedPickUpHelpers;
} else {
TRACE_1("Cleaning Pick Up Helpers",count _addedPickUpHelpers);

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* unit call ace_advancedthrowing_fnc_throw
* unit call ace_advanced_throwing_fnc_throw
*
* Public: No
*/
@ -54,8 +54,6 @@ if (!(_unit getVariable [QGVAR(primed), false])) then {
_activeThrowable setVelocity _newVelocity;
};
_unit setVariable [QGVAR(lastThrownTime), CBA_missionTime];
// Invoke listenable event
["ace_throwableThrown", [_unit, _activeThrowable]] call CBA_fnc_localEvent;
}, [

View File

@ -15,7 +15,7 @@
* None
*
* Example:
* [unit, "weapon", "muzle", "mode", "ammo", "magazine", projectile] call ace_advancedthrowing_fnc_throwFiredXEH
* [unit, "weapon", "muzle", "mode", "ammo", "magazine", projectile] call ace_advanced_throwing_fnc_throwFiredXEH
*
* Public: No
*/

View File

@ -9,7 +9,7 @@
* None
*
* Example:
* call ace_advancedthrowing_fnc_updateControlsHint
* call ace_advanced_throwing_fnc_updateControlsHint
*
* Public: No
*/

View File

@ -0,0 +1 @@
#include "\z\ace\addons\advanced_throwing\script_component.hpp"

View File

@ -1,18 +1,19 @@
#define COMPONENT advancedthrowing
#define COMPONENT advanced_throwing
#define COMPONENT_BEAUTIFIED Advanced Throwing
#include "\z\ace\addons\main\script_mod.hpp"
// #define DRAW_THROW_PATH
// #define ALLOW_QUICK_THROW
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ADVANCEDTHROWING
#ifdef DEBUG_ENABLED_ADVANCED_THROWING
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_ADVANCEDTHROWING
#define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCEDTHROWING
#ifdef DEBUG_SETTINGS_ADVANCED_THROWING
#define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCED_THROWING
#endif
#include "\z\ace\addons\main\script_macros.hpp"
@ -26,3 +27,5 @@
#define THROW_TYPE_DEFAULT "normal"
#define THROW_SPEED_DEFAULT 18
#define DROP_DISTANCE_DEFAULT 0.2
#define PICK_UP_DISTANCE 10

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Advanced_Throwing">
<Key ID="STR_ACE_Advanced_Throwing_Category">
<English>Advanced Throwing</English>
<Russian>Улучшенный бросок гранат</Russian>
<Polish>Zaawansowane rzucanie</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Module_Description">
<English>Allows changing advanced throwing behaviour.</English>
<Russian>Позволяет настраивать поведение улучшенного броска гранат.</Russian>
<Polish>Zezwala na zmianę zachowania zaawansowanego trybu rzucania.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Enable_DisplayName">
<English>Enable Advanced Throwing</English>
<Russian>Включить улучшенный бросок</Russian>
<Polish>Aktywuj zaawansowane rzucanie</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Enable_Description">
<English>Enables advanced throwing system.</English>
<Russian>Включает систему улучшенного броска.</Russian>
<Polish>Aktywuje system zaawansowanego rzucania.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_ShowThrowArc_DisplayName">
<English>Show Throw Arc</English>
<Russian>Показать траекторию броска</Russian>
<Polish>Pokaż trasę lotu</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_ShowThrowArc_Description">
<English>Enables visualization of the throw arc (where throwable will fly).</English>
<Russian>Включает визуализацию траектории броска (как полетит граната).</Russian>
<Polish>Wyświetla wizualizację trasy przelotu granatu.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_ShowMouseControls_DisplayName">
<English>Show Throwing Mouse Controls</English>
<Russian>Показывать управление мышью</Russian>
<Polish>Pokaż podpowiedzi sterowania myszą</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_ShowMouseControls_Description">
<English>Enables visual cues for mouse controls when throwable is prepared.</English>
<Russian>Включает отображение подсказок по управлению мышью, когда граната подготовлена.</Russian>
<Polish>Wyświetla podpowiedzi sterowania myszą kiedy obiekt miotany jest w ręku.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnablePickUp_DisplayName">
<English>Enable Throwables Pick Up</English>
<Russian>Включить подбор гранат</Russian>
<Polish>Zezwól na podnoszenie obiektów miotanych</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnablePickUp_Description">
<English>Enables ability to pick up throwables from the ground.</English>
<Russian>Включает возможность подбирать гранаты с земли.</Russian>
<Polish>Umożliwia podnoszenie obiektów miotanych z ziemi.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnablePickUpAttached_DisplayName">
<English>Enable Attached Throwables Pick Up</English>
<Russian>Включить подбор прикрепленных гранат</Russian>
<Polish>Zezwól na podnoszenie przyczepionych obiektów miotanych</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnablePickUpAttached_Description">
<English>Enables ability to pick up throwables from attached objects.</English>
<Russian>Включает возможность подбирать гранаты, прикрепленные к объектам.</Russian>
<Polish>Umożliwia podnoszenie obiektów miotanych przyczepionych do innych obiektów.</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Prepare">
<English>Prepare/Change Throwable</English>
<Russian>Подготовить/заменить гранату</Russian>
<Polish>Przygotuj/zmień ob. miotany</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_dropModeHold">
<English>Throwable Drop Mode (Hold)</English>
<Russian>Режим броска гранаты (удерживать)</Russian>
<Polish>Tryb upuszczania ob. miotanego (przytrzymaj)</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_DropModeToggle">
<English>Throwable Drop Mode (Toggle)</English>
<Russian>Режим броска гранаты (переключить)</Russian>
<Polish>Tryb upuszczania ob. miotanego (przełącz)</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Primed">
<English>Primed</English>
<Russian>Подготовлена</Russian>
<Polish>Odbezpieczony</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Throw">
<English>Throw</English>
<Russian>Бросить</Russian>
<Polish>Rzuć</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_ChangeMode">
<English>(Scroll) Change Mode</English>
<Russian>(Скролл) Изменить режим</Russian>
<Polish>(Kółko m.) zmień tryb</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Extend">
<English>(Scroll) Extend</English>
<Russian>(Скролл) Увеличить</Russian>
<Polish>(Kółko m.) przedłuż</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Cook">
<English>(Click) Cook</English>
<Russian>(Клик) Подготовить</Russian>
<Polish>(Kliknięcie) Odbezpiecz</Polish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_PickUp">
<English>Pick Up</English>
<Russian>Подобрать</Russian>
<Polish>Podnieś</Polish>
</Key>
</Package>
</Project>

View File

@ -1 +0,0 @@
z\ace\addons\advancedthrowing

View File

@ -1 +0,0 @@
#include "\z\ace\addons\advancedthrowing\script_component.hpp"

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="AdvancedThrowing">
<Key ID="STR_ACE_AdvancedThrowing_Category">
<English>Advanced Throwing</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Module_Description">
<English>Allows changing advanced throwing behaviour.</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Enable_DisplayName">
<English>Enable Advanced Throwing</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Enable_Description">
<English>Enables advanced throwing system.</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_ShowThrowArc_DisplayName">
<English>Show Throw Arc</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_ShowThrowArc_Description">
<English>Enables visualization of the throw arc (where throwable will fly).</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_ShowMouseControls_DisplayName">
<English>Show Throwing Mouse Controls</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_ShowMouseControls_Description">
<English>Enables visual cues for mouse controls when throwable is prepared.</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_EnablePickUp_DisplayName">
<English>Enable Throwables Pick Up</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_EnablePickUp_Description">
<English>Enables ability to pick up throwables from the ground.</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_EnablePickUpAttached_DisplayName">
<English>Enable Attached Throwables Pick Up</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_EnablePickUpAttached_Description">
<English>Enables ability to pick up throwables from attached objects.</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Prepare">
<English>Prepare/Change Throwable</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_dropModeHold">
<English>Throwable Drop Mode (Hold)</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_DropModeToggle">
<English>Throwable Drop Mode (Toggle)</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Primed">
<English>Primed</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Throw">
<English>Throw</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_ChangeMode">
<English>(Scroll) Change Mode</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Extend">
<English>(Scroll) Extend</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_Cook">
<English>(Click) Cook</English>
</Key>
<Key ID="STR_ACE_AdvancedThrowing_PickUp">
<English>Pick Up</English>
</Key>
</Package>
</Project>

20
addons/apl/model.cfg Normal file
View File

@ -0,0 +1,20 @@
class CfgSkeletons {
class Default {
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};
};
class CfgModels {
class Default {
sectionsInherit="";
sections[] = {""};
skeletonName = "";
};
class ace_bodybag: Default {
sectionsInherit = "";
sections[] = {"camo"};
skeletonName = "";
};
};

View File

@ -10,10 +10,11 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) ==
["12.7x99mm AMAX" , 860, 100, 0.0611565, -0.00036645, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ],
["12.7x99mm" , 900, 100, 0.0582418, -0.00057503, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ],
["12.7x99mm API" , 900, 100, 0.0582418, -0.00057503, 3.81, 0, 2, 10, 120, 0, 0, 41.99, 12.9, 38.10, 0.670, 1, "ASM" ],
["12.7x54mm" , 300, 100, 0.3394630, -0.00019268, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ],
[".408 Chey Tac" , 910, 100, 0.0569400, -0.00038944, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ],
[".408 Chey Tac" , 910, 100, 0.0569400, -0.00038944, 3.81, 0, 2, 10, 120, 0, 0, 26.57, 10.4, 33.02, 0.970, 1, "ASM" ],
["9.3×64mm" , 870, 100, 0.0619295, -0.00108571, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ],
@ -21,14 +22,15 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) ==
[".338LM 300gr" , 800, 100, 0.0677343, -0.00052190, 3.81, 0, 2, 10, 120, 0, 0, 19.44, 8.58, 25.40, 0.381, 7, "ICAO"],
[".338LM API526" , 895, 100, 0.0588865, -0.00069611, 3.81, 0, 2, 10, 120, 0, 0, 16.39, 8.58, 25.40, 0.560, 1, "ASM" ],
[".300WM Mk248 Mod 0", 900, 100, 0.0584442, -0.00070530, 3.81, 0, 2, 10, 120, 0, 0, 13.31, 7.80, 25.40, 0.268, 7, "ICAO"],
[".300WM Mk248 Mod 1", 867, 100, 0.0610738, -0.00061188, 3.81, 0, 2, 10, 120, 0, 0, 14.26, 7.80, 25.40, 0.310, 7, "ICAO"],
[".300WM Mk248 Mod0" , 900, 100, 0.0584442, -0.00070530, 3.81, 0, 2, 10, 120, 0, 0, 12.31, 7.80, 25.40, 0.268, 7, "ICAO"],
[".300WM Mk248 Mod1" , 867, 100, 0.0610738, -0.00061188, 3.81, 0, 2, 10, 120, 0, 0, 14.26, 7.80, 25.40, 0.310, 7, "ICAO"],
[".300WM Berger OTM" , 853, 100, 0.0622179, -0.00053733, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 7.80, 25.40, 0.368, 7, "ICAO"],
["7.62x54mmR" , 800, 100, 0.0691878, -0.00100023, 3.81, 0, 2, 10, 120, 0, 0, 9.849, 7.92, 24.13, 0.400, 1, "ICAO"],
["7.62x51mm M80" , 810, 100, 0.0679374, -0.00100957, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.200, 7, "ICAO"],
["7.62x51mm M80" , 810, 100, 0.0679374, -0.00100957, 3.81, 0, 2, 10, 120, 0, 0, 9.461, 7.82, 25.40, 0.200, 7, "ICAO"],
["7.62x51mm M118LR" , 780, 100, 0.0710319, -0.00082828, 3.81, 0, 2, 10, 120, 0, 0, 11.34, 7.82, 25.40, 0.243, 7, "ICAO"],
["7.62x51mm Mk316" , 780, 100, 0.0710319, -0.00082029, 3.81, 0, 2, 10, 120, 0, 0, 11.34, 7.82, 25.40, 0.243, 7, "ICAO"],
["7.62x51mm Mk319" , 910, 100, 0.0584524, -0.00102338, 3.81, 0, 2, 10, 120, 0, 0, 8.424, 7.82, 25.40, 0.377, 1, "ICAO"],
["7.62x51mm M993" , 930, 100, 0.0570316, -0.00107148, 3.81, 0, 2, 10, 120, 0, 0, 8.230, 7.82, 25.40, 0.359, 1, "ICAO"],
["7.62x51mm Subsonic", 320, 100, 0.3059680, -0.00049899, 3.81, 0, 2, 10, 120, 0, 0, 12.96, 7.82, 25.40, 0.235, 7, "ICAO"],

View File

@ -15,11 +15,9 @@
*/
#include "script_component.hpp"
private ["_gunName", "_gunProfileEntry"];
_gunName = ctrlText 11001;
private _gunName = ctrlText 11001;
if (_gunName != "") then {
_gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
private _gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];

View File

@ -17,21 +17,20 @@
[] call FUNC(parse_input);
private ["_scopeBaseAngle"];
_scopeBaseAngle = (GVAR(workingMemory) select 3);
GVAR(workingMemory) params ["",
"_muzzleVelocity", "",
"_scopeBaseAngle",
"_airFriction",
"_boreHeight", "", "", "", "", "", "",
"_bulletMass",
"_bulletDiameter",
"_barrelTwist",
"_bc",
"_dragModel",
"_atmosphereModel"
];
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
_bulletMass = GVAR(workingMemory) select 12;
_bulletDiameter = GVAR(workingMemory) select 13;
_boreHeight = GVAR(workingMemory) select 5;
_airFriction = GVAR(workingMemory) select 4;
_barrelTwist = GVAR(workingMemory) select 14;
_muzzleVelocity = GVAR(workingMemory) select 1;
_bc = GVAR(workingMemory) select 15;
_dragModel = GVAR(workingMemory) select 16;
_atmosphereModel = GVAR(workingMemory) select 17;
_twistDirection = 0;
private _twistDirection = 0;
if (_barrelTwist > 0) then {
_twistDirection = 1;
} else {
@ -39,42 +38,38 @@ if (_barrelTwist > 0) then {
_twistDirection = -1;
};
};
_barrelTwist = abs(_barrelTwist);
_barrelTwist = abs _barrelTwist;
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
_altitude = GVAR(altitude);
_temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity);
private _altitude = GVAR(altitude);
private _temperature = GVAR(temperature);
private _barometricPressure = GVAR(barometricPressure);
private _relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50;
};
private ["_bulletLength", "_stabilityFactor"];
_bulletLength = 45.72;
_stabilityFactor = 1.5;
private _bulletLength = 45.72;
private _stabilityFactor = 1.5;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
_stabilityFactor = [_bulletDiameter, _bulletLength, _bulletMass, _barrelTwist * 10, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
};
};
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_latitude = GVAR(latitude) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
_targetRange = GVAR(rangeCardEndRange);
private _latitude = GVAR(latitude) select GVAR(currentTarget);
private _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
private _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
private _windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
private _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
private _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
private _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
private _targetRange = GVAR(rangeCardEndRange);
if (GVAR(currentUnit) == 1) then {
_targetRange = _targetRange / 1.0936133;
};
GVAR(rangeCardData) = [];
private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
private _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);

View File

@ -15,10 +15,8 @@
*/
#include "script_component.hpp"
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
_angle = parseNumber(ctrlText 7012);
_targetSize = parseNumber(ctrlText 7010);
private _angle = parseNumber(ctrlText 7012);
private _targetSize = parseNumber(ctrlText 7010);
if (GVAR(rangeAssistUseTargetHeight)) then {
_targetSize = _targetSize * cos(_angle);
};
@ -33,7 +31,7 @@ switch (GVAR(rangeAssistTargetSizeUnit)) do {
_targetSize = _targetSize * 0.01;
};
};
_imageSize = parseNumber(ctrlText 7011);
private _imageSize = parseNumber(ctrlText 7011);
switch (GVAR(rangeAssistImageSizeUnit)) do {
case 0: {
_imageSize = _imageSize / 6400 * 360;
@ -45,7 +43,7 @@ switch (GVAR(rangeAssistImageSizeUnit)) do {
_imageSize = _imageSize / 60 / 1.047;
};
};
_estRange = parseNumber(ctrlText 7013);
private _estRange = parseNumber(ctrlText 7013);
if (GVAR(currentUnit) == 1) then {
_estRange = _estRange / 1.0936133;
};

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_target"];
_target = 0 max _this min 3;
private _target = 0 max _this min 3;
call FUNC(parse_input);

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_index"];
_index = lbCurSel 6000;
private _index = lbCurSel 6000;
if (_index == -1) exitWith {};

View File

@ -23,9 +23,8 @@ if !(ctrlVisible 9000) then {
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 9002);
[{
private ["_args", "_startTime"];
_args = _this select 0;
_startTime = _args select 0;
params ["_args"];
_args params ["_startTime"];
if (!(GVAR(speedAssistTimer))) exitWith {
GVAR(speedAssistTimer) = true;

View File

@ -68,7 +68,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model;
[{
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
private ["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_idPFH"];
_args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"];

View File

@ -64,6 +64,12 @@ if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then
// Delete attached item after 0.5 seconds
[{deleteVehicle (_this select 0)}, [_attachedObject], 2] call CBA_fnc_waitAndExecute;
} else {
//handle any objects that may be attached to the object
{
detach _x;
deleteVehicle _x;
} forEach (attachedObjects _attachedObject);
// Delete attached item
detach _attachedObject;
deleteVehicle _attachedObject;

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then {

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject", "_xItemName"];
if (isNull _xObject) then {

View File

@ -19,11 +19,9 @@
params ["_deadUnit"];
TRACE_1("params",_deadUnit);
private ["_attachedList"];
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
_attachedList = _deadUnit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
if (_attachedList isEqualTo []) exitWith {};
{
_x params ["_xObject"];

View File

@ -127,6 +127,33 @@ class CfgWeapons {
/* Katiba */
class arifle_katiba_Base_F: Rifle_Base_F {};
/* SPAR */
class arifle_SPAR_01_base_F: Rifle_Base_F {
magazines[] = {
"30Rnd_556x45_Stanag",
"30Rnd_556x45_Stanag_green",
"30Rnd_556x45_Stanag_red",
"30Rnd_556x45_Stanag_Tracer_Red",
"30Rnd_556x45_Stanag_Tracer_Green",
"30Rnd_556x45_Stanag_Tracer_Yellow",
"ACE_30Rnd_556x45_Stanag_M995_AP_mag",
"ACE_30Rnd_556x45_Stanag_Mk262_mag",
"ACE_30Rnd_556x45_Stanag_Mk318_mag",
"ACE_30Rnd_556x45_Stanag_Tracer_Dim"
};
};
class arifle_SPAR_03_base_F: Rifle_Base_F {
magazines[] = {
"20Rnd_762x51_Mag",
"ACE_20Rnd_762x51_Mag_Tracer",
"ACE_20Rnd_762x51_Mag_Tracer_Dim",
"ACE_20Rnd_762x51_Mk316_Mod_0_Mag",
"ACE_20Rnd_762x51_M118LR_Mag",
"ACE_20Rnd_762x51_Mk319_Mod_0_Mag",
"ACE_20Rnd_762x51_M993_AP_Mag",
"ACE_20Rnd_762x51_Mag_SD"
};
};
/* Other */
class LMG_Mk200_F: Rifle_Long_Base_F {

View File

@ -1,12 +1,10 @@
// by commy2
#include "script_component.hpp"
private "_paper";
params ["_wall"];
if (local _wall) then {
_paper = "UserTexture_1x2_F" createVehicle position _wall;
private _paper = "UserTexture_1x2_F" createVehicle position _wall;
_paper attachTo [_wall, [0,-0.02,0.6]];
_paper setDir getDir _wall;

View File

@ -13,8 +13,7 @@
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {
params ["_disconnectedPlayer"];
private "_escortedUnit";
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
private _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
detach _escortedUnit;
};

View File

@ -16,11 +16,9 @@
*/
#include "script_component.hpp"
private "_returnValue";
params ["_unit", "_newSurrenderState"];
_returnValue = if (_newSurrenderState) then {
private _returnValue = if (_newSurrenderState) then {
//no weapon equiped AND not currently surrendering and
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
} else {

View File

@ -16,8 +16,6 @@
*/
#include "script_component.hpp"
private ["_cargo"];
params ["_player", "_unit"];
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}

View File

@ -16,20 +16,18 @@
*/
#include "script_component.hpp"
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
params ["_player", "_unit"];
_weapon = currentWeapon _player;
private _weapon = currentWeapon _player;
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
[_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation);
};
_listedItemClasses = [];
private _listedItemClasses = [];
_actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
private _actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
_allGear = [];
private _allGear = [];
if ((handgunWeapon _unit) != "") then {
_allGear pushBack (handgunWeapon _unit);
@ -54,8 +52,7 @@ if (count (assignedItems _unit) > 0) then {
// Assigned Items
{
if (!(_x in _listedItemClasses)) then {
private "_item";
_item = configFile >> "CfgMagazines" >> _x;
private _item = configFile >> "CfgMagazines" >> _x;
if (isNil "_item" || str _item == "") then { //str _item ?
_item = configFile >> "CfgWeapons" >> _x;
};

View File

@ -27,7 +27,7 @@ if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
};
} forEach (attachedObjects _unit);
};
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {ERROR("");};
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:
@ -44,7 +44,7 @@ if (isNull _vehicle) then {
};
};
if (isNull _vehicle) exitWith {ERROR("");};
if (isNull _vehicle) exitWith {WARNING("Could not find vehicle to load captive");};
_unit setVariable [QGVAR(isEscorting), false, true];
[QGVAR(moveInCaptive), [_target, _vehicle], [_target]] call CBA_fnc_targetEvent;

View File

@ -18,50 +18,22 @@
params ["_vehicle"];
TRACE_1("params", _vehicle);
_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
private _vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
_proxyOrder = getArray (_vehicleConfig >> "getInProxyOrder");
_transportSoldier = getNumber (_vehicleConfig >> "transportSoldier");
_realCargoCount = if (isArray (_vehicleConfig >> "getInProxyOrder")) then {count _proxyOrder} else {_transportSoldier};
scopeName "main";
//Find FFV turrets:
_ffvCargoIndexes = [];
{
_turretConfig = [_vehicleConfig, _x] call EFUNC(common,getTurretConfigPath);
_isCargoProxy = ((getText (_turretConfig >> "proxyType")) == "CPCargo") && {isNumber (_turretConfig >> "proxyIndex")};
if (_isCargoProxy) then {
_proxyCargoIndex = getNumber (_turretConfig >> "proxyIndex");
_cargoIndex = _proxyOrder find _proxyCargoIndex;
_ffvCargoIndexes pushBack _cargoIndex;
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
if ((isNull _unit) && {_role == "cargo"} && {_cargoIndex > -1} && {!_isPersonTurret}) then {
[_cargoIndex, false] breakOut "main";
};
} forEach (allTurrets [_vehicle, true]);
} forEach (fullCrew [_vehicle, "", true]);
//Find Empty Seats:
_occupiedSeats = [];
{
_x params ["", "", "_xIndex"];
if (_xIndex > -1) then {_occupiedSeats pushBack _xIndex;};
} forEach (fullCrew _vehicle);
TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats);
_emptyCargoSeatReturn = [-1, false];
//First seach for non-ffv seats:
for "_index" from 0 to (_realCargoCount - 1) do {
if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith {
_emptyCargoSeatReturn = [_index, false];
_x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
if ((isNull _unit) && {_cargoIndex > -1}) then {
[_cargoIndex, true] breakOut "main";
};
};
} forEach (fullCrew [_vehicle, "", true]);
//Only use FFV if none found:
if (_emptyCargoSeatReturn isEqualTo [-1, false]) then {
for "_index" from 0 to (_realCargoCount - 1) do {
if (!(_index in _occupiedSeats)) exitWith {
_emptyCargoSeatReturn = [_index, true];
};
};
};
_emptyCargoSeatReturn
[-1, false]

View File

@ -21,9 +21,7 @@ params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
private _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
if (_cargoIndex != -1) then {
//If captive was not "unloaded", then move them back into the vehicle.

View File

@ -23,8 +23,7 @@ if (!local _unit) exitWith {};
// Group and side respawn can potentially respawn you as a captive unit
// Base and instant respawn cannot, so captive should be entirely reset
// So we explicity account for the respawn type
private ["_respawn"];
_respawn = [0] call BIS_fnc_missionRespawnType;
private _respawn = [0] call BIS_fnc_missionRespawnType;
if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {

View File

@ -20,7 +20,7 @@ params ["_unit","_state"];
TRACE_2("params",_unit,_state);
if (!local _unit) exitWith {
ERROR("running setHandcuffed on remote unit");
WARNING("running setHandcuffed on remote unit");
};
if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
@ -35,7 +35,7 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
};
if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith {
ERROR("setHandcuffed: current state same as new");
WARNING("setHandcuffed: current state same as new");
};
if (_state) then {

View File

@ -20,7 +20,7 @@ params ["_unit","_state"];
TRACE_2("params",_unit,_state);
if (!local _unit) exitWith {
ERROR("running surrender on remote unit");
WARNING("running surrender on remote unit");
};
if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
@ -35,12 +35,12 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
};
if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith {
ERROR("Surrender: current state same as new");
WARNING("Surrender: current state same as new");
};
if (_state) then {
if ((vehicle _unit) != _unit) exitWith {ERROR("Cannot surrender while mounted");};
if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {ERROR("Cannot surrender while handcuffed");};
if ((vehicle _unit) != _unit) exitWith {WARNING("Cannot surrender while mounted");};
if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {WARNING("Cannot surrender while handcuffed");};
_unit setVariable [QGVAR(isSurrendering), true, true];

View File

@ -19,12 +19,10 @@
params ["_target","_vehicle"];
TRACE_2("params",_target,_vehicle);
private ["_cargoIndex"];
_getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
private _getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
TRACE_1("free cargo seat",_getSeat);
_cargoIndex = _getSeat select 0;
if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");};
_getSeat params ["_cargoIndex"];
if (_cargoIndex == -1) exitWith {WARNING("cargo index -1");};
_target moveInCargo [_vehicle, _cargoIndex];
_target assignAsCargoIndex [_vehicle, _cargoIndex];

View File

@ -222,6 +222,8 @@ class CfgVehicles {
};
class Heli_Transport_04_base_F: Helicopter_Base_H {
// note the double brackets are because loadmasterTurrets is an array of arrays / turret paths
GVAR(loadmasterTurrets)[] = {{1}};
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
@ -263,6 +265,16 @@ class CfgVehicles {
GVAR(hasCargo) = 0;
};
class VTOL_Base_F;
class VTOL_01_base_F: VTOL_Base_F {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class VTOL_02_base_F: VTOL_Base_F {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
// autonomus
class UAV_01_base_F: Helicopter_Base_F {
GVAR(space) = 0;

View File

@ -14,6 +14,7 @@ PREP(makeLoadable);
PREP(moduleMakeLoadable);
PREP(moduleSettings);
PREP(onMenuOpen);
PREP(paradropItem);
PREP(startLoadIn);
PREP(startUnload);
PREP(unloadItem);

Some files were not shown because too many files have changed in this diff Show More