mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge remote-tracking branch 'origin' into pl-translation
Conflicts: addons/captives/stringtable.xml addons/map_gestures/stringtable.xml addons/zeus/stringtable.xml
This commit is contained in:
commit
7eecff4296
@ -18,7 +18,8 @@ private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
|
||||
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
|
||||
params["_muzzleVelocityShiftTable", "_temperature"];
|
||||
|
||||
// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
|
||||
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
|
||||
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
|
||||
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
|
||||
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
|
||||
|
||||
|
@ -26,11 +26,9 @@ _aceTimeSecond = floor ACE_time;
|
||||
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
|
||||
if (!alive _bullet || _bulletSpeed < 100) exitWith {
|
||||
GVAR(allBullets) deleteAt (_forEachIndex - _deleted);
|
||||
_deleted = _deleted + 1;
|
||||
};
|
||||
|
||||
if (!alive _bullet || _bulletSpeed < 100) then {
|
||||
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
|
||||
} else {
|
||||
_bulletPosition = getPosASL _bullet;
|
||||
|
||||
if (_bulletTraceVisible && _bulletSpeed > 500) then {
|
||||
@ -38,7 +36,9 @@ _aceTimeSecond = floor ACE_time;
|
||||
};
|
||||
|
||||
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
|
||||
} forEach GVAR(allBullets);
|
||||
};
|
||||
nil
|
||||
} count +GVAR(allBullets);
|
||||
|
||||
if (GVAR(allBullets) isEqualTo []) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
@ -24,12 +24,12 @@ if (!hasInterface) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
// Parameterization
|
||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
|
||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
|
||||
|
||||
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
|
||||
|
||||
_abort = false;
|
||||
|
||||
|
||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||
if (!alive _bullet) exitWith {};
|
||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||
@ -75,22 +75,22 @@ _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_muzzleVelocity = vectorMagnitude _bulletVelocity;
|
||||
|
||||
_barrelVelocityShift = 0;
|
||||
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
|
||||
if (isNil "_barrelVelocityShift") then {
|
||||
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
|
||||
};
|
||||
};
|
||||
|
||||
_ammoTemperatureVelocityShift = 0;
|
||||
if (GVAR(ammoTemperatureEnabled)) then {
|
||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||
_temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||
_ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||
};
|
||||
|
||||
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift;
|
||||
TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift);
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
};
|
||||
|
@ -20,9 +20,11 @@ _weaponConfig = (configFile >> "CfgWeapons" >> _this);
|
||||
|
||||
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
|
||||
_twistDirection = 1;
|
||||
_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection");
|
||||
if !(_twistDirection in [-1, 0, 1]) then {
|
||||
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
|
||||
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
|
||||
if !(_twistDirection in [-1, 0, 1]) then {
|
||||
_twistDirection = 1;
|
||||
};
|
||||
};
|
||||
|
||||
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
|
||||
|
@ -192,6 +192,7 @@ class CfgVehicles {
|
||||
scope = 2;
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa));
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
class Arguments {
|
||||
class allowHandcuffOwnSide {
|
||||
displayName = CSTRING(ModuleSettings_handcuffSide_name);
|
||||
|
@ -21,10 +21,10 @@ params ["_newUnit","_oldUnit"];
|
||||
//set showHUD based on new unit status:
|
||||
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||
TRACE_1("Player Change (showHUD false)",_newUnit);
|
||||
showHUD false;
|
||||
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
|
||||
} else {
|
||||
TRACE_1("Player Change (showHUD true)",_newUnit);
|
||||
showHUD true;
|
||||
["captive", []] call EFUNC(common,showHud); //same as showHud true;
|
||||
};
|
||||
|
||||
//If old player was escorting, stop
|
||||
|
@ -23,9 +23,9 @@ params ["_unit","_zeusIsOpen"];
|
||||
if (!_zeusIsOpen) then {
|
||||
if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||
TRACE_1("Player Change (showHUD false)",_unit);
|
||||
showHUD false;
|
||||
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
|
||||
} else {
|
||||
TRACE_1("Player Change (showHUD true)",_unit);
|
||||
showHUD true;
|
||||
["captive", []] call EFUNC(common,showHud); //same as showHud true;
|
||||
};
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ if (_state) then {
|
||||
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
|
||||
};
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
@ -56,7 +56,7 @@ if (_state) then {
|
||||
|
||||
//Adds an animation changed eh
|
||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||
local _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
if (_animChangedEHID != -1) then {
|
||||
TRACE_1("removing animChanged EH",_animChangedEHID);
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
@ -92,7 +92,7 @@ if (_state) then {
|
||||
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
//remove AnimChanged EH
|
||||
local _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
TRACE_1("removing animChanged EH",_animChangedEHID);
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
@ -107,7 +107,7 @@ if (_state) then {
|
||||
};
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD true;
|
||||
["captive", []] call EFUNC(common,showHud); //same as showHud true;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ if (_state) then {
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
@ -48,7 +48,7 @@ if (_state) then {
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then {
|
||||
//Adds an animation changed eh
|
||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||
local _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
if (_animChangedEHID != -1) then {
|
||||
TRACE_1("removing animChanged EH",_animChangedEHID);
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
@ -68,14 +68,14 @@ if (_state) then {
|
||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
//remove AnimChanged EH
|
||||
local _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
_unit setVariable [QGVAR(surrenderAnimEHID), -1];
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
//only re-enable HUD if not handcuffed
|
||||
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
||||
showHUD true;
|
||||
["captive", []] call EFUNC(common,showHud); //same as showHud true;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Captives">
|
||||
<Key ID="STR_ACE_Captives_SetCaptive">
|
||||
@ -166,7 +166,7 @@
|
||||
<Portuguese>Fazer unidade se render</Portuguese>
|
||||
<French>Faire capituler l'unité</French>
|
||||
<Hungarian>Egység kapitulálása</Hungarian>
|
||||
<Russian>Сделать юнита пленным</Russian>
|
||||
<Russian>Заставить юнита сдаться</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleSurrender_Description">
|
||||
<English>Sync a unit to make them surrender.<br />Source: ace_captives</English>
|
||||
@ -177,15 +177,19 @@
|
||||
<Portuguese>Sincroniza uma unidade para fazer com que ela se renda. <br/>Fonte: ace_captives</Portuguese>
|
||||
<French>Synchronise une unité pour la rendre captive. <br/>Source: ace_captives</French>
|
||||
<Hungarian>Egység szinkronizálása, hogy kapituláljon.<br />Forrás: ace_captives</Hungarian>
|
||||
<Russian>Синхронизируйте с юнитами, чтобы сделать их пленными.<br />Источник: ace_captives</Russian>
|
||||
<Russian>Синхронизируйте с юнитами, чтобы заставить их сдаться в плен.<br />Источник: ace_captives</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleHandcuffed_DisplayName">
|
||||
<English>Make Unit Handcuffed</English>
|
||||
<Polish>Skuj jednostkę</Polish>
|
||||
<Portuguese>Fazer unidade algemada</Portuguese>
|
||||
<Russian>Связать юнита</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleHandcuffed_Description">
|
||||
<English>Sync a unit to make them handcuffed.<br />Source: ace_captives</English>
|
||||
<Polish>Zsynchronizuj z jednostką, aby została skuta.<br />Źródło: ace_captives</Polish>
|
||||
<Portuguese>Sincronizar uma unidade para deixá-la algemada.<br/>Source: ace_captives</Portuguese>
|
||||
<Russian>Синхронизируйте с юнитами, чтобы сделать их связанными.<br />Источник: ace_captives</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleSettings_DisplayName">
|
||||
<English>Captives Settings</English>
|
||||
|
@ -8,6 +8,7 @@ class CfgVehicles {
|
||||
function = QFUNC(moduleSettings);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
isTriggerActivated = 0;
|
||||
author = ECSTRING(common,ACETeam);
|
||||
|
||||
|
@ -1,5 +1,45 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["LoadCargo", {_this call FUNC(loadItem)}] call EFUNC(common,addEventHandler);
|
||||
["UnloadCargo", {_this call FUNC(unloadItem)}] call EFUNC(common,addEventHandler);
|
||||
["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["LoadCargo", {
|
||||
(_this select 0) params ["_item","_vehicle"];
|
||||
private ["_loaded", "_hint", "_itemName", "_vehicleName"];
|
||||
|
||||
_loaded = [_item, _vehicle] call FUNC(loadItem);
|
||||
|
||||
// Show hint as feedback
|
||||
_hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
if (_loaded) then {
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["UnloadCargo", {
|
||||
(_this select 0) params ["_item","_vehicle"];
|
||||
private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"];
|
||||
|
||||
_unloaded = [_item, _vehicle] call FUNC(unloadItem);
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
// Show hint as feedback
|
||||
_hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
if (_unloaded) then {
|
||||
// Invoke listenable event
|
||||
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
|
||||
// TOOO maybe drag/carry the unloaded item?
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -18,24 +18,12 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_position", "_item", "_i"];
|
||||
params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
|
||||
TRACE_3("params",_itemClass,_vehicle,_amount);
|
||||
|
||||
_position = getPos _vehicle;
|
||||
_position set [1, (_position select 1) + 1];
|
||||
_position set [2, (_position select 2) + 7.5];
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Load item or delete it if no space left
|
||||
if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith {
|
||||
TRACE_1("no room to load item - deleting",_item);
|
||||
deleteVehicle _item;
|
||||
};
|
||||
TRACE_1("Item Loaded",_item);
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
[_itemClass, _vehicle] call FUNC(loadItem);
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Check if item can be loaded into other Object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Holder Object (Vehicle) <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
@ -16,14 +16,24 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
params [["_item", "", [objNull,""]], "_vehicle"];
|
||||
|
||||
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
|
||||
|
||||
private "_itemSize";
|
||||
_itemSize = ([_item] call FUNC(getSizeItem));
|
||||
private ["_itemSize", "_validItem"];
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
|
||||
(_itemSize > 0) &&
|
||||
{alive _item && alive _vehicle} &&
|
||||
{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} &&
|
||||
if (typeName _item == "STRING") then {
|
||||
_validItem =
|
||||
isClass (configFile >> "CfgVehicles" >> _item) &&
|
||||
{getNumber (configFile >> "CfgVehicles" >> _item >> QGVAR(canLoad)) == 1};
|
||||
} else {
|
||||
_validItem =
|
||||
(alive _item) &&
|
||||
{(_item distance _vehicle) <= MAX_LOAD_DISTANCE};
|
||||
};
|
||||
|
||||
_validItem &&
|
||||
{_itemSize > 0} &&
|
||||
{alive _vehicle} &&
|
||||
{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}
|
||||
|
@ -16,18 +16,19 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_validVehiclestate", "_emptyPos"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"];
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if !(_item in _loaded) exitWith {false};
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
_validVehiclestate = true;
|
||||
_emptyPos = [];
|
||||
if (_vehicle isKindOf "Ship" ) then {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
|
||||
} else {
|
||||
if (_vehicle isKindOf "Air" ) then {
|
||||
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||
@ -35,7 +36,7 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
|
||||
} else {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Get the cargo size of an object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Cargo size <NUMBER> (default: -1)
|
||||
@ -15,14 +15,24 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_config";
|
||||
|
||||
params ["_item"];
|
||||
private ["_isVirtual","_itemClass","_config"];
|
||||
scopeName "return";
|
||||
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
|
||||
_isVirtual = (typeName _item == "STRING");
|
||||
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
|
||||
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
|
||||
|
||||
if (isNumber (_config)) exitWith {
|
||||
_item getVariable [QGVAR(size), getNumber (_config)]
|
||||
if (_isVirtual) then {
|
||||
if (isNumber _config) then {
|
||||
(getNumber _config) breakOut "return";
|
||||
};
|
||||
} else {
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
|
||||
|
||||
if (isNumber _config) then {
|
||||
(_item getVariable [QGVAR(size), getNumber _config]) breakOut "return";
|
||||
};
|
||||
};
|
||||
|
||||
-1
|
||||
|
@ -20,12 +20,13 @@ params ["_vehicle"];
|
||||
private["_loaded"];
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
if (_loaded isEqualTo []) exitWith {};
|
||||
|
||||
{
|
||||
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment?
|
||||
// TODO Do we want to be able to recover destroyed equipment?
|
||||
if (typeName _x == "OBJECT") then {
|
||||
deleteVehicle _x;
|
||||
//_x setDamage 1;
|
||||
};
|
||||
} count _loaded;
|
||||
|
||||
[_vehicle] call FUNC(validateCargoSpace);
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Load object into vehicle.
|
||||
* Objects loaded via classname remain virtual until unloaded.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 2: Show Hint <BOOL> (default: true)
|
||||
*
|
||||
@ -17,15 +18,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]];
|
||||
private ["_loaded", "_space", "_itemSize"];
|
||||
|
||||
params ["_item", "_vehicle", ["_showHint", true, [true]] ];
|
||||
TRACE_2("params",_item,_vehicle);
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
|
||||
TRACE_2("canLoadItemIn failed",_item,_vehicle);
|
||||
false
|
||||
};
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded pushback _item;
|
||||
@ -37,21 +33,10 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
||||
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,100]];
|
||||
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
|
||||
|
||||
// show hint
|
||||
private ["_itemName", "_vehicleName"];
|
||||
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
if (_showHint) then {
|
||||
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
if (typeName _item == "OBJECT") then {
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,-100]];
|
||||
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
|
||||
true
|
||||
|
@ -22,7 +22,7 @@ params ["_display"];
|
||||
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
||||
|
||||
[{
|
||||
private ["_display","_loaded", "_ctrl", "_label"];
|
||||
private ["_display","_loaded", "_ctrl", "_class", "_label"];
|
||||
disableSerialization;
|
||||
_display = uiNamespace getVariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitWith {
|
||||
@ -40,7 +40,8 @@ uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
||||
|
||||
lbClear _ctrl;
|
||||
{
|
||||
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName"));
|
||||
_class = if (typeName _x == "STRING") then {_x} else {typeOf _x};
|
||||
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName"));
|
||||
true
|
||||
} count _loaded;
|
||||
|
||||
|
@ -16,16 +16,25 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player", "_object"];
|
||||
private ["_vehicle", "_size", "_displayName"];
|
||||
|
||||
private ["_nearestVehicle"];
|
||||
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
|
||||
_vehicle = [_player] call FUNC(findNearestVehicle);
|
||||
|
||||
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then {
|
||||
if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then {
|
||||
{
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x};
|
||||
} foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
};
|
||||
|
||||
if (isNull _nearestVehicle) exitWith {false};
|
||||
if (isNull _vehicle) exitWith {false};
|
||||
|
||||
[_object, _nearestVehicle] call FUNC(loadItem)
|
||||
// Start progress bar
|
||||
if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
|
||||
_size = [_object] call FUNC(getSizeItem);
|
||||
|
||||
[5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar);
|
||||
} else {
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");
|
||||
|
||||
["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
|
||||
disableSerialization;
|
||||
|
||||
_display = uiNamespace getVariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitWith {};
|
||||
if (isNil "_display") exitWith {};
|
||||
|
||||
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
@ -32,4 +32,17 @@ _selected = (lbCurSel _ctrl) max 0;
|
||||
if (count _loaded <= _selected) exitWith {};
|
||||
_item = _loaded select _selected;
|
||||
|
||||
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);
|
||||
|
||||
// Start progress bar
|
||||
private ["_size", "_itemClass", "_displayName"];
|
||||
|
||||
if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then {
|
||||
_size = [_item] call FUNC(getSizeItem);
|
||||
|
||||
[5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar);
|
||||
} else {
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
||||
|
||||
["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Unload object from vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
@ -16,20 +16,21 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
_validVehiclestate = true;
|
||||
_emptyPos = [];
|
||||
if (_vehicle isKindOf "Ship" ) then {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
|
||||
} else {
|
||||
if (_vehicle isKindOf "Air" ) then {
|
||||
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||
@ -39,38 +40,29 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
} else {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, _itemClass]);
|
||||
};
|
||||
};
|
||||
|
||||
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
|
||||
if (!_validVehiclestate) exitWith {false};
|
||||
|
||||
if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||
if (count _emptyPos == 0) exitWith {false};
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded = _loaded - [_item];
|
||||
_loaded deleteAt (_loaded find _item);
|
||||
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
||||
|
||||
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
|
||||
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
|
||||
|
||||
// show hint
|
||||
private ["_itemName", "_vehicleName"];
|
||||
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[localize LSTRING(UnloadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
// TOOO maybe drag/carry the unloaded item?
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
if (typeName _item == "OBJECT") then {
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
|
||||
} else {
|
||||
createVehicle [_item, _emptyPos, [], 0, ""];
|
||||
};
|
||||
|
||||
true
|
||||
|
@ -24,7 +24,7 @@ _loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_newLoaded = [];
|
||||
_totalSpaceOccupied = 0;
|
||||
{
|
||||
if !(isNull _x) then {
|
||||
if ((typeName _x == "STRING") || {!isNull _x}) then {
|
||||
_newLoaded pushback _x;
|
||||
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
|
||||
};
|
||||
@ -35,4 +35,4 @@ if (count _loaded != count _newLoaded) then {
|
||||
_vehicle setVariable [QGVAR(loaded), _newLoaded, true];
|
||||
};
|
||||
|
||||
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
|
@ -95,5 +95,21 @@
|
||||
<Hungarian>1%<br/>kirakodva ebből:<br/>%2</Hungarian>
|
||||
<Russian>%1<br/>разгружен из<br/>%2</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_LoadingItem">
|
||||
<English>Loading Cargo</English>
|
||||
<Portuguese>Carregando carga</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_UnloadingItem">
|
||||
<English>Unloading Cargo</English>
|
||||
<Portuguese>Descarregando carga</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_LoadingFailed">
|
||||
<English>%1<br/>could not be loaded</English>
|
||||
<Portuguese>%1<br/>não pode ser carregado</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_UnloadingFailed">
|
||||
<English>%1<br/>could not be unloaded</English>
|
||||
<Portuguese>%1<br/>não pode ser descarregado</Portuguese>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -35,6 +35,7 @@ class CfgVehicles {
|
||||
function = QFUNC(moduleCheckPBOs);
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa));
|
||||
class Arguments {
|
||||
class Action {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
//Handle the waitAndExec array:
|
||||
while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do {
|
||||
local _entry = GVAR(waitAndExecArray) deleteAt 0;
|
||||
private _entry = GVAR(waitAndExecArray) deleteAt 0;
|
||||
(_entry select 2) call (_entry select 1);
|
||||
};
|
||||
|
||||
@ -29,16 +29,15 @@
|
||||
GVAR(nextFrameNo) = diag_frameno + 1;
|
||||
|
||||
//Handle the waitUntilAndExec array:
|
||||
local _deleted = 0;
|
||||
{
|
||||
// if condition is satisifed call statement
|
||||
if ((_x select 2) call (_x select 0)) then {
|
||||
// make sure to delete the correct handle when multiple conditions are met in one frame
|
||||
GVAR(waitUntilAndExecArray) deleteAt (_forEachIndex - _deleted);
|
||||
_deleted = _deleted + 1;
|
||||
GVAR(waitUntilAndExecArray) deleteAt (GVAR(waitUntilAndExecArray) find _x);
|
||||
(_x select 2) call (_x select 1);
|
||||
};
|
||||
} forEach GVAR(waitUntilAndExecArray);
|
||||
nil
|
||||
} count +GVAR(waitUntilAndExecArray);
|
||||
|
||||
END_COUNTER(waitAndExec);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
@ -98,7 +97,6 @@
|
||||
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
|
||||
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
|
||||
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
|
||||
["assignTeam", {(_this select 0) assignTeam (_this select 1)}] call FUNC(addEventHandler);
|
||||
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
|
||||
|
||||
if (isServer) then {
|
||||
@ -194,9 +192,17 @@ call FUNC(checkFiles);
|
||||
|
||||
ACE_LOGINFO("Settings received from server.");
|
||||
|
||||
if (isServer) then { //read settings from paramsArray
|
||||
[] call FUNC(readSettingsFromParamsArray);
|
||||
};
|
||||
// Event so that ACE_Modules have their settings loaded:
|
||||
["InitSettingsFromModules", []] call FUNC(localEvent);
|
||||
|
||||
if (isServer) then {
|
||||
// Publish all settings data after all configs and modules are read
|
||||
publicVariable QGVAR(settings);
|
||||
};
|
||||
|
||||
// Load user settings from profile
|
||||
if (hasInterface) then {
|
||||
call FUNC(loadSettingsFromProfile);
|
||||
|
@ -115,6 +115,7 @@ PREP(isInBuilding);
|
||||
PREP(isModLoaded);
|
||||
PREP(isPlayer);
|
||||
PREP(isTurnedOut);
|
||||
PREP(isUnderwater);
|
||||
PREP(letterToCode);
|
||||
PREP(lightIntensityFromObject);
|
||||
PREP(loadPerson);
|
||||
@ -139,6 +140,7 @@ PREP(playerSide);
|
||||
PREP(positionToASL);
|
||||
PREP(progressBar);
|
||||
PREP(readSettingFromModule);
|
||||
PREP(readSettingsFromParamsArray);
|
||||
PREP(receiveRequest);
|
||||
PREP(removeCanInteractWithCondition);
|
||||
PREP(removeSpecificMagazine);
|
||||
@ -166,6 +168,7 @@ PREP(setVariableJIP);
|
||||
PREP(setVariablePublic);
|
||||
PREP(setVolume);
|
||||
PREP(sortAlphabeticallyBy);
|
||||
PREP(showHud);
|
||||
PREP(stringCompare);
|
||||
PREP(stringToColoredText);
|
||||
PREP(stringRemoveWhiteSpace);
|
||||
@ -290,6 +293,7 @@ PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
GVAR(syncedEvents) = HASH_CREATE;
|
||||
GVAR(showHudHash) = [] call FUNC(hashCreate);
|
||||
|
||||
//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute
|
||||
GVAR(waitAndExecArray) = [];
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
params ["_var", ["_depth", 0, [0]]];
|
||||
|
||||
local _pad = "";
|
||||
private _pad = "";
|
||||
|
||||
for "_i" from 0 to _depth do {
|
||||
_pad = _pad + toString [9];
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
local _vehicle = vehicle _unit;
|
||||
private _vehicle = vehicle _unit;
|
||||
if (_unit == _vehicle) exitWith {[]};
|
||||
|
||||
scopeName "main";
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
local _vehicle = vehicle _unit;
|
||||
private _vehicle = vehicle _unit;
|
||||
|
||||
if (_unit == _vehicle) exitWith {false};
|
||||
|
||||
local _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
if (getNumber (_config >> "hideProxyInCombat") != 1) exitWith {false};
|
||||
|
||||
@ -26,10 +26,10 @@ if (_unit == driver _vehicle) exitWith {
|
||||
getNumber (_config >> "forceHideDriver") == 0; // return
|
||||
};
|
||||
|
||||
local _turret = [_unit] call FUNC(getTurretIndex);
|
||||
private _turret = [_unit] call FUNC(getTurretIndex);
|
||||
|
||||
if (_turret isEqualTo []) exitWith {false};
|
||||
|
||||
local _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
|
||||
private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath);
|
||||
|
||||
getNumber (_turretConfig >> "forceHideGunner") == 0; // return
|
||||
|
@ -1,29 +1,19 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if unit is underwater
|
||||
* Check if unit's head is underwater
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* if unit is in the water (BOOLEAN)
|
||||
* If unit's head is underwater <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Deprecated
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
ACE_DEPRECATED("ace_common_fnc_inWater","3.5.0","ace_common_fnc_isUnderwater");
|
||||
|
||||
private "_return";
|
||||
_return = false;
|
||||
|
||||
if (surfaceIsWater getPosASL _unit) then {
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
||||
|
||||
if (_pos select 2 < 0) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
|
||||
_return
|
||||
_this call FUNC(isUnderwater)
|
||||
|
@ -8,10 +8,17 @@
|
||||
* Return Value:
|
||||
* is the unit an engineer <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_common_fnc_isEngineer
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
_unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1] // return
|
||||
private _isEngineer = _unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1];
|
||||
//Handle ace_repair modules setting this to a number
|
||||
if ((typeName _isEngineer) == "SCALAR") then {_isEngineer = _isEngineer > 0};
|
||||
|
||||
_isEngineer
|
||||
|
29
addons/common/functions/fnc_isUnderwater.sqf
Normal file
29
addons/common/functions/fnc_isUnderwater.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if unit's head is underwater
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* If unit's head is underwater <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private "_return";
|
||||
_return = false;
|
||||
|
||||
if (surfaceIsWater getPosASL _unit) then {
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
||||
|
||||
if (_pos select 2 < 0) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
|
||||
_return
|
@ -35,12 +35,23 @@ _fnc_parseConfigForDisplayNames = {
|
||||
_values set [_forEachIndex, _text];
|
||||
};
|
||||
} forEach _values;
|
||||
|
||||
if (!(_values isEqualTo [])) then {
|
||||
if (_typeOf != "SCALAR") then {
|
||||
ACE_LOGWARNING_2("Setting [%1] has values[] but is not SCALAR (%2)", _name, _typeOf);
|
||||
} else {
|
||||
private _value = missionNamespace getVariable [_name, -1];
|
||||
if ((_value < 0) || {_value >= (count _values)}) then {
|
||||
ACE_LOGWARNING_3("Setting [%1] out of bounds %2 (values[] count is %3)(", _name, _value, count _values);
|
||||
};
|
||||
};
|
||||
};
|
||||
true
|
||||
};
|
||||
|
||||
// Iterate through settings
|
||||
{
|
||||
_x params ["_name"];
|
||||
_x params ["_name", "_typeOf"];
|
||||
|
||||
if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
|
||||
if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then {
|
||||
|
@ -51,8 +51,6 @@ _fnc_parseConfigForSettings = {
|
||||
// mission side settings
|
||||
[missionConfigFile >> "ACE_Settings"] call _fnc_parseConfigForSettings;
|
||||
|
||||
// Publish all settings data
|
||||
publicVariable QGVAR(settings);
|
||||
// Publish all setting values
|
||||
{
|
||||
publicVariable (_x select 0);
|
||||
|
63
addons/common/functions/fnc_readSettingsFromParamsArray.sqf
Normal file
63
addons/common/functions/fnc_readSettingsFromParamsArray.sqf
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Read settins from paramsArray that have a ACE_setting = 1.
|
||||
* Happens before modules but after all other configs (for force priority)
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_common_fnc_readSettingsFromParamsArray
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
//paramsArray is a normal variable not a command
|
||||
private _paramsArray = missionnamespace getvariable ["paramsArray", []];
|
||||
|
||||
TRACE_1("Reading missionConfigFile params",_paramsArray);
|
||||
|
||||
{
|
||||
private _config = (missionConfigFile >> "params") select _forEachIndex;
|
||||
if ((getNumber (_config >> "ACE_setting")) > 0) then {
|
||||
private _settingName = configName _config;
|
||||
private _settingValue = _x;
|
||||
private _title = getText (_config >> "title");
|
||||
|
||||
TRACE_3("ace_setting",_title,_settingName,_settingValue);
|
||||
|
||||
// Check if the variable is already defined
|
||||
if (isNil _settingName) exitWith {
|
||||
ACE_LOGERROR_1("readSettingsFromParamsArray - param [%1] is not an ace_setting", _settingName);
|
||||
};
|
||||
|
||||
private _settingData = [_settingName] call FUNC(getSettingData);
|
||||
_settingData params ["", "_typeName", "", "", "", "", "_isForced"];
|
||||
|
||||
// Check if it's already forced and quit
|
||||
if (_isForced) exitWith {ACE_LOGWARNING_1("readSettingsFromParamsArray - param [%1] is already set and forced", _settingName);};
|
||||
|
||||
// The setting is not forced, so update the value
|
||||
// Read entry and cast it to the correct type from the existing variable
|
||||
private _validValue = false;
|
||||
switch (true) do {
|
||||
case (_typeName == "SCALAR"): {_validValue = true;};
|
||||
case (_typeName == "BOOL"): {
|
||||
_settingValue = _settingValue > 0;
|
||||
_validValue = true;
|
||||
};
|
||||
//TODO: Handle ARRAY,COLOR,STRING??? (bool/scalar covers most important settings)
|
||||
};
|
||||
|
||||
if (!_validValue) exitWith {
|
||||
ACE_LOGWARNING_3("readSettingsFromParamsArray - param [%1] type not valid [%2] - expected type [%3]", _settingName,_settingValue,_typeName);
|
||||
};
|
||||
|
||||
// Update the variable globaly and Force
|
||||
[_settingName, _settingValue, true, true] call FUNC(setSetting);
|
||||
};
|
||||
} foreach _paramsArray;
|
@ -19,7 +19,7 @@
|
||||
|
||||
params ["_unit", "_muzzle", "_mode"];
|
||||
|
||||
local _index = 0;
|
||||
private _index = 0;
|
||||
|
||||
while {
|
||||
_index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}}
|
||||
|
@ -148,7 +148,7 @@ if (_backpack != "") then {
|
||||
_unit addBackpack _backpack;
|
||||
|
||||
if (_clearBackpack) then {
|
||||
local _backpackObject = unitBackpack _unit;
|
||||
private _backpackObject = unitBackpack _unit;
|
||||
|
||||
clearMagazineCargoGlobal _backpackObject;
|
||||
clearWeaponCargoGlobal _backpackObject;
|
||||
|
@ -13,27 +13,39 @@
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["ace_map_gestures_enabled", true, false, true] call ace_common_fnc_setSetting
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_name", "_value", ["_force", false], ["_broadcastChanges", false]];
|
||||
|
||||
private ["_settingData", "_failed"];
|
||||
|
||||
_settingData = [_name] call FUNC(getSettingData);
|
||||
private _settingData = [_name] call FUNC(getSettingData);
|
||||
|
||||
// Exit if the setting does not exist
|
||||
if (count _settingData == 0) exitWith {};
|
||||
if (_settingData isEqualTo []) exitWith {
|
||||
ACE_LOGERROR_1("SetSetting [%1] setting does not exist", _name);
|
||||
};
|
||||
|
||||
_settingData params ["", "_typeName", "_isClientSetable", "", "", "", "_isForced"];
|
||||
|
||||
// Exit if the setting is already forced
|
||||
if (_settingData select 6) exitWith {};
|
||||
if (_isForced) exitWith {
|
||||
ACE_LOGINFO_1("SetSetting [%1] Trying to set forced setting", _name);
|
||||
};
|
||||
|
||||
//This does NOT broadcast changes to GVAR(settings), so clients would not get updated force status
|
||||
if ((missionNamespace getVariable [QEGVAR(modules,serverModulesRead), false]) && {!(_isForced isEqualTo _force)}) then {
|
||||
ACE_LOGWARNING_3("SetSetting [%1] attempting to broadcast a change to force (%2 to %3)", _name, _isForced, _force);
|
||||
};
|
||||
|
||||
// If the type is not equal, try to cast it
|
||||
_failed = false;
|
||||
private _failed = false;
|
||||
if (typeName _value != _settingData select 1) then {
|
||||
_failed = true;
|
||||
if (_settingData select 1 == "BOOL" && typeName _value == "SCALAR") then {
|
||||
if ((_typeName == "BOOL") && {typeName _value == "SCALAR"}) then {
|
||||
// If value is not 0 or 1 consider it invalid and don't set anything
|
||||
if (_value isEqualTo 0) then {
|
||||
_value = false;
|
||||
@ -44,12 +56,12 @@ if (typeName _value != _settingData select 1) then {
|
||||
_failed = false;
|
||||
};
|
||||
};
|
||||
if (_settingData select 1 == "COLOR" && typeName _value == "ARRAY") then {
|
||||
if ((_typeName == "COLOR") && {typeName _value == "ARRAY"}) then {
|
||||
_failed = false;
|
||||
};
|
||||
};
|
||||
|
||||
if (_failed) exitWith {};
|
||||
if (_failed) exitWith {ACE_LOGERROR_3("SetSetting [%1] bad data type expected %2 got %3", _name, _typeName, typeName _value);};
|
||||
|
||||
// Force it if it was required
|
||||
_settingData set [6, _force];
|
||||
|
@ -38,19 +38,16 @@ GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName];
|
||||
if (isNil QGVAR(setVariablePublicPFH)) exitWith {};
|
||||
|
||||
GVAR(setVariablePublicPFH) = [{
|
||||
private "_delete";
|
||||
_delete = 0;
|
||||
|
||||
{
|
||||
_x params ["_object", "_varName", "_syncTime", "_idName"];
|
||||
if (ACE_diagTime > _syncTime) then {
|
||||
// set value public
|
||||
_object setVariable [_varName, _object getVariable _varName, true];
|
||||
GVAR(setVariablePublicArray) deleteAt _forEachIndex - _delete;
|
||||
GVAR(setVariableNames) deleteAt _forEachIndex - _delete;
|
||||
_delete = _delete + 1;
|
||||
GVAR(setVariablePublicArray) deleteAt (GVAR(setVariablePublicArray) find _x);
|
||||
GVAR(setVariableNames) deleteAt (GVAR(setVariableNames) find _x);
|
||||
};
|
||||
} forEach GVAR(setVariablePublicArray);
|
||||
nil
|
||||
} count +GVAR(setVariablePublicArray);
|
||||
|
||||
if (GVAR(setVariablePublicArray) isEqualTo []) then {
|
||||
[GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
|
66
addons/common/functions/fnc_showHud.sqf
Normal file
66
addons/common/functions/fnc_showHud.sqf
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Allows multiple sources to not overwrite showHud command
|
||||
* Bitwise AND Logic (a single false in a mask will make it false)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Source ID <STRING><OPTIONAL>
|
||||
* 1: Show Hud Bool Array (8 to set, empty to remove) <ARRAY><OPTIONAL>
|
||||
* - [hud, info, radar, compass, direction, menu, group, cursors]
|
||||
* - hud: Boolean - show scripted HUD (same as normal showHUD true/false)
|
||||
* - info: Boolean - show vehicle + soldier info (hides weapon info from the HUD as well)
|
||||
* - radar: Boolean - show vehicle radar
|
||||
* - compass: Boolean - show vehicle compass
|
||||
* - direction: Boolean - show tank direction indicator (not present in vanilla Arma 3)
|
||||
* - menu: Boolean - show commanding menu (hides HC related menus)
|
||||
* - group: Boolean - show group info bar (hides squad leader info bar)
|
||||
* - cursors: Boolean - show HUD weapon cursors (connected with scripted HUD)
|
||||
*
|
||||
* Return Value:
|
||||
* Resulting ShowHud Array <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* ["hideHud", [false, true, true, true, true, true, true, false]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false
|
||||
* [] call ace_common_fnc_showHud; //sets `showHud` and returns the result array used
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {[-1]};
|
||||
|
||||
params [["_reason", "", [""]], ["_mask", [], [[]], [0,8]]];
|
||||
|
||||
if (isArray (missionConfigFile >> "showHUD")) then {
|
||||
//(showHud = 0;) is fine - the array is the problem
|
||||
ACE_LOGWARNING("showHUD[] in Description.ext breaks the showHud command");
|
||||
};
|
||||
|
||||
if (_reason != "") then {
|
||||
_reason = toLower _reason;
|
||||
if (_mask isEqualTo []) then {
|
||||
TRACE_2("Setting", _reason, _mask);
|
||||
[GVAR(showHudHash), _reason] call FUNC(hashRem);
|
||||
} else {
|
||||
TRACE_2("Removing", _reason, _mask);
|
||||
[GVAR(showHudHash), _reason, _mask] call FUNC(hashSet);
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(showHudHash) params ["_reasons", "_masks"];
|
||||
private _resultMask = [];
|
||||
|
||||
for "_index" from 0 to 7 do {
|
||||
private _set = true; //Default to true
|
||||
{
|
||||
if (!(_x select _index)) exitWith {
|
||||
_set = false; //Any false will make it false
|
||||
};
|
||||
} forEach _masks;
|
||||
_resultMask pushBack _set;
|
||||
};
|
||||
|
||||
TRACE_2("showHud", _resultMask, _reasons);
|
||||
showHud _resultMask;
|
||||
|
||||
_resultMask
|
@ -14,13 +14,13 @@
|
||||
|
||||
BEGIN_COUNTER(timePFH);
|
||||
|
||||
local _lastTickTime = ACE_diagTime;
|
||||
local _lastGameTime = ACE_gameTime;
|
||||
private _lastTickTime = ACE_diagTime;
|
||||
private _lastGameTime = ACE_gameTime;
|
||||
|
||||
ACE_gameTime = time;
|
||||
ACE_diagTime = diag_tickTime;
|
||||
|
||||
local _delta = ACE_diagTime - _lastTickTime;
|
||||
private _delta = ACE_diagTime - _lastTickTime;
|
||||
|
||||
if (ACE_gameTime <= _lastGameTime) then {
|
||||
TRACE_1("paused",_delta);
|
||||
|
@ -30,4 +30,4 @@ GVAR(vectorConnected) = false;
|
||||
GVAR(noVectorData) = true;
|
||||
GVAR(vectorGrid) = "00000000";
|
||||
|
||||
["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler);
|
||||
["RangerfinderData", FUNC(handleRangeFinderData)] call EFUNC(common,addEventHandler);
|
||||
|
@ -41,7 +41,8 @@ GVAR(outputPFH) = [{
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
|
||||
|
||||
// SPEED
|
||||
_speed = speed (vehicle ACE_player);
|
||||
@ -68,7 +69,7 @@ GVAR(outputPFH) = [{
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrSpeed];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 <EFBFBD>", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Author: Rosuto
|
||||
* DAGR vector output loop
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
|
||||
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
|
||||
|
||||
@ -30,15 +30,14 @@ private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dag
|
||||
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
|
||||
|
||||
if (GVAR(noVectorData)) exitwith {};
|
||||
|
||||
_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1];
|
||||
GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"];
|
||||
|
||||
// Incase grids go neg due to 99-00 boundry
|
||||
if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];};
|
||||
if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];};
|
||||
if (_lazPosX < 0) then { _lazPosX = _lazPosX + 99999;};
|
||||
if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;};
|
||||
|
||||
// Find laser position
|
||||
_xGrid = toArray Str(round(_pos select 0));
|
||||
_xGrid = toArray Str(round _lazPosX);
|
||||
|
||||
while {count _xGrid < 5} do {
|
||||
_xGrid = [48] + _xGrid;
|
||||
@ -47,7 +46,7 @@ _xGrid resize 4;
|
||||
_xGrid = toString _xGrid;
|
||||
_xGrid = parseNumber _xGrid;
|
||||
|
||||
_yGrid = toArray Str(round(_pos select 1));
|
||||
_yGrid = toArray Str(round _lazPosY);
|
||||
while {count _yGrid < 5} do {
|
||||
_yGrid = [48] + _yGrid;
|
||||
};
|
||||
@ -72,7 +71,7 @@ _yCoord = switch true do {
|
||||
_dagrGrid = _xCoord + " " + _yCoord;
|
||||
|
||||
// Find target elevation
|
||||
_elevation = floor ((GVAR(LAZPOS) select 2) + EGVAR(common,mapAltitude));
|
||||
_elevation = floor ((_lazPosZ) + EGVAR(common,mapAltitude));
|
||||
_dagrElevation = str _elevation + "m";
|
||||
|
||||
// Time
|
||||
@ -94,5 +93,5 @@ GVAR(vectorGrid) = _dagrGrid;
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrDist];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Author: Rosuto
|
||||
* DAGR waypoint output loop
|
||||
*
|
||||
@ -41,7 +41,8 @@ GVAR(outputPFH) = [{
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", (_gridArrayX select [0,4]), (_gridArrayY select [0,4])];
|
||||
|
||||
// WP Grid
|
||||
_xGrid2 = floor (DAGR_WP_INFO / 10000);
|
||||
@ -84,7 +85,7 @@ GVAR(outputPFH) = [{
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _bearing];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrGrid2];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrDistance];
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -23,11 +23,12 @@ if (GVAR(run)) then {
|
||||
};
|
||||
GVAR(hidden) = true;
|
||||
[{
|
||||
EXPLODE_1_PVT(_this select 0,_vehicle);
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_vehicle"];
|
||||
if (!GVAR(run) || (!alive ACE_player) || (vehicle ACE_player != _vehicle)) exitWith {
|
||||
GVAR(run) = false;
|
||||
135471 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (cameraView == "GUNNER") then {
|
||||
if (!GVAR(hidden)) then {
|
||||
|
@ -54,6 +54,7 @@
|
||||
<German>Heben/Senken</German>
|
||||
<Polish>Wyżej/Niżej</Polish>
|
||||
<Portuguese>Levantar/Abaixar</Portuguese>
|
||||
<Russian>Поднять/Опустить</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -6,6 +6,7 @@ class ACE_ModuleExplosive: ACE_Module {
|
||||
function = QUOTE(FUNC(module));
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
icon = PATHTOF(UI\Icon_Module_Explosives_ca.paa);
|
||||
class Arguments {
|
||||
class RequireSpecialist {
|
||||
|
@ -210,3 +210,11 @@ if(_playSound) then {
|
||||
if(_showHint) then {
|
||||
[format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
//Update the hud's distance display to the new value or "----" if out of range
|
||||
//(10m fudge because of EFUNC(common,getTargetDistance))
|
||||
if ((_distance + 10) >= (getNumber (_turretConfig >> QGVAR(MaxDistance)))) then {
|
||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----";
|
||||
} else {
|
||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
|
||||
};
|
||||
|
@ -1,12 +1 @@
|
||||
#define COMPONENT fcs
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_FCS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_FCS
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_FCS
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
#include "\z\ace\addons\fcs\script_component.hpp"
|
@ -7,6 +7,7 @@ class CfgVehicles {
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_finger_ca.paa));
|
||||
function = QFUNC(moduleSettings);
|
||||
isGlobal = 0;
|
||||
isSingular = 1;
|
||||
author = ECSTRING(common,ACETeam);
|
||||
class Arguments {
|
||||
class enabled {
|
||||
|
File diff suppressed because it is too large
Load Diff
1
addons/gestures/$PBOPREFIX$
Normal file
1
addons/gestures/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\gestures
|
11
addons/gestures/CfgEventHandlers.hpp
Normal file
11
addons/gestures/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
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));
|
||||
};
|
||||
};
|
145
addons/gestures/CfgVehicles.hpp
Normal file
145
addons/gestures/CfgVehicles.hpp
Normal file
@ -0,0 +1,145 @@
|
||||
class CfgVehicles {
|
||||
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ADDON {
|
||||
displayName = CSTRING(Gestures);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = "";
|
||||
showDisabled = 1;
|
||||
priority = 3.5;
|
||||
icon = PATHTOF(UI\gestures_ca.paa);
|
||||
|
||||
class GVAR(Advance) {
|
||||
displayName = CSTRING(BIgestureAdvance);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureAdvance';);
|
||||
showDisabled = 1;
|
||||
priority = 1.9;
|
||||
};
|
||||
class GVAR(Go) {
|
||||
displayName = CSTRING(BIgestureGo);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow ([ARR_2('gestureGo','gestureGoB')] select floor random 2););
|
||||
showDisabled = 1;
|
||||
priority = 1.8;
|
||||
};
|
||||
class GVAR(Follow) {
|
||||
displayName = CSTRING(BIgestureFollow);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureFollow';);
|
||||
showDisabled = 1;
|
||||
priority = 1.7;
|
||||
};
|
||||
class GVAR(Up) {
|
||||
displayName = CSTRING(BIgestureUp);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureUp';);
|
||||
showDisabled = 1;
|
||||
priority = 1.5;
|
||||
};
|
||||
class GVAR(CeaseFire) {
|
||||
displayName = CSTRING(BIgestureCeaseFire);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureCeaseFire';);
|
||||
showDisabled = 1;
|
||||
priority = 1.3;
|
||||
};
|
||||
class GVAR(Freeze) {
|
||||
displayName = CSTRING(BIgestureFreeze);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureFreeze';);
|
||||
showDisabled = 1;
|
||||
priority = 1.2;
|
||||
};
|
||||
class GVAR(Forward) {
|
||||
displayName = CSTRING(forward);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(forward)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.9;
|
||||
};
|
||||
class GVAR(Regroup) {
|
||||
displayName = CSTRING(regroup);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(regroup)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.8;
|
||||
};
|
||||
class GVAR(Stop) {
|
||||
displayName = CSTRING(stop);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(stop)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.7;
|
||||
};
|
||||
class GVAR(Cover) {
|
||||
displayName = CSTRING(cover);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(cover)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.6;
|
||||
};
|
||||
class GVAR(Point) {
|
||||
displayName = CSTRING(point);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(point)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.5;
|
||||
};
|
||||
class GVAR(Engage) {
|
||||
displayName = CSTRING(engage);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(engage)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.4;
|
||||
};
|
||||
class GVAR(Hold) {
|
||||
displayName = CSTRING(hold);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(hold)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.3;
|
||||
};
|
||||
class GVAR(Warning) {
|
||||
displayName = CSTRING(warning);
|
||||
condition = QUOTE(canStand _target && GVAR(ReloadMutex));
|
||||
statement = QUOTE(QUOTE(QGVAR(warning)) call FUNC(playSignal));
|
||||
showDisabled = 1;
|
||||
priority = 1.2;
|
||||
};
|
||||
/*
|
||||
class class GVAR(Yes) {
|
||||
displayName = ECSTRING(common,Yes);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2););
|
||||
showDisabled = 1;
|
||||
priority = 1.1;
|
||||
hotkey = "8";
|
||||
};
|
||||
|
||||
class class GVAR(No) {
|
||||
displayName = ECSTRING(common,No);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow 'gestureNo';);
|
||||
showDisabled = 1;
|
||||
priority = 1.0;
|
||||
hotkey = "9";
|
||||
};
|
||||
|
||||
class class GVAR(Hi) {
|
||||
displayName = CSTRING(Gestures_Hi);
|
||||
condition = QUOTE(canStand _target);
|
||||
statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3););
|
||||
showDisabled = 1;
|
||||
priority = 0.9;
|
||||
hotkey = "0";
|
||||
};
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
38
addons/gestures/XEH_postInit.sqf
Normal file
38
addons/gestures/XEH_postInit.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
#include "key.sqf"
|
||||
|
||||
// reload mutex, you can't play signal while reloading
|
||||
GVAR(ReloadMutex) = true;
|
||||
|
||||
// Event for main display to be loaded:
|
||||
["mainDisplayLoaded", {
|
||||
// handle reloading
|
||||
(findDisplay 46) displayAddEventHandler ["KeyDown", {
|
||||
if ((_this select 1) in actionKeys "ReloadMagazine") then {
|
||||
if ((isNull ACE_player) || {!alive ACE_player}) exitWith {false};
|
||||
private _weapon = currentWeapon ACE_player;
|
||||
|
||||
if (_weapon != "") then {
|
||||
GVAR(ReloadMutex) = false;
|
||||
|
||||
private _gesture = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction");
|
||||
private _isLauncher = _weapon isKindOf ["Launcher", (configFile >> "CfgWeapons")];
|
||||
private _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher;
|
||||
private _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed");
|
||||
|
||||
if (_duration != 0) then {
|
||||
_duration = if (_duration < 0) then { abs _duration } else { 1 / _duration };
|
||||
} else {
|
||||
_duration = 3;
|
||||
};
|
||||
|
||||
TRACE_2("Reloading, blocking gestures",_weapon,_duration);
|
||||
[{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute);
|
||||
};
|
||||
};
|
||||
false
|
||||
}];
|
||||
}] call EFUNC(common,addEventHandler);
|
7
addons/gestures/XEH_preInit.sqf
Normal file
7
addons/gestures/XEH_preInit.sqf
Normal file
@ -0,0 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(playSignal);
|
||||
|
||||
ADDON = true;
|
BIN
addons/gestures/anim/ace_cover.rtm
Normal file
BIN
addons/gestures/anim/ace_cover.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_cover_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_cover_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_engage.rtm
Normal file
BIN
addons/gestures/anim/ace_engage.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_engage_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_engage_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_forward.rtm
Normal file
BIN
addons/gestures/anim/ace_forward.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_forward_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_forward_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_hold.rtm
Normal file
BIN
addons/gestures/anim/ace_hold.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_hold_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_hold_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_point.rtm
Normal file
BIN
addons/gestures/anim/ace_point.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_point_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_point_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_regroup.rtm
Normal file
BIN
addons/gestures/anim/ace_regroup.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_regroup_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_regroup_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_stop.rtm
Normal file
BIN
addons/gestures/anim/ace_stop.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_stop_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_stop_stand_lowered.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_warning.rtm
Normal file
BIN
addons/gestures/anim/ace_warning.rtm
Normal file
Binary file not shown.
BIN
addons/gestures/anim/ace_warning_stand_lowered.rtm
Normal file
BIN
addons/gestures/anim/ace_warning_stand_lowered.rtm
Normal file
Binary file not shown.
200
addons/gestures/cfgMovesBasic.hpp
Normal file
200
addons/gestures/cfgMovesBasic.hpp
Normal file
@ -0,0 +1,200 @@
|
||||
class CfgMovesBasic {
|
||||
class ManActions {
|
||||
GVAR(forward) = QGVAR(forward);
|
||||
GVAR(stop) = QGVAR(stop);
|
||||
GVAR(cover) = QGVAR(cover);
|
||||
GVAR(regroup) = QGVAR(regroup);
|
||||
GVAR(engage) = QGVAR(engage);
|
||||
GVAR(point) = QGVAR(point);
|
||||
GVAR(hold) = QGVAR(hold);
|
||||
GVAR(warning) = QGVAR(warningS);
|
||||
|
||||
GVAR(forwardStandLowered) = QGVAR(forwardStandLowered);
|
||||
GVAR(stopStandLowered) = QGVAR(stopStandLowered);
|
||||
GVAR(coverStandLowered) = QGVAR(coverStandLowered);
|
||||
GVAR(regroupStandLowered) = QGVAR(regroupStandLowered);
|
||||
GVAR(engageStandLowered) = QGVAR(engageStandLowered);
|
||||
GVAR(pointStandLowered) = QGVAR(pointStandLowered);
|
||||
GVAR(holdStandLowered) = QGVAR(holdStandLowered);
|
||||
GVAR(warningStandLowered) = QGVAR(warningStandLowered);
|
||||
};
|
||||
|
||||
class Actions {
|
||||
class NoActions: ManActions {
|
||||
GVAR(forward)[] = {QGVAR(forward), "Gesture"};
|
||||
GVAR(stop)[] = {QGVAR(stop), "Gesture"};
|
||||
GVAR(cover)[] = {QGVAR(cover), "Gesture"};
|
||||
GVAR(regroup)[] = {QGVAR(regroup), "Gesture"};
|
||||
GVAR(engage)[] = {QGVAR(engage), "Gesture"};
|
||||
GVAR(point)[] = {QGVAR(point), "Gesture"};
|
||||
GVAR(hold)[] = {QGVAR(hold), "Gesture"};
|
||||
GVAR(warning)[] = {QGVAR(warning), "Gesture"};
|
||||
|
||||
GVAR(forwardStandLowered)[] = {QGVAR(forwardStandLowered), "Gesture"};
|
||||
GVAR(stopStandLowered)[] = {QGVAR(stopStandLowered), "Gesture"};
|
||||
GVAR(coverStandLowered)[] = {QGVAR(coverStandLowered), "Gesture"};
|
||||
GVAR(regroupStandLowered)[] = {QGVAR(regroupStandLowered), "Gesture"};
|
||||
GVAR(engageStandLowered)[] = {QGVAR(engageStandLowered), "Gesture"};
|
||||
GVAR(pointStandLowered)[] = {QGVAR(pointStandLowered), "Gesture"};
|
||||
GVAR(holdStandLowered)[] = {QGVAR(holdStandLowered), "Gesture"};
|
||||
GVAR(warningStandLowered)[] = {QGVAR(warningStandLowered), "Gesture"};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class CfgGesturesMale {
|
||||
class Default;
|
||||
|
||||
class BlendAnims {
|
||||
GVAR(LeftArm)[] = {
|
||||
"LeftShoulder", 1,
|
||||
"LeftArm", 1,
|
||||
"LeftArmRoll", 1,
|
||||
"LeftForeArm", 1,
|
||||
"LeftForeArmRoll", 1,
|
||||
"LeftHand", 1,
|
||||
"LeftHandIndex1", 1,
|
||||
"LeftHandIndex2", 1,
|
||||
"LeftHandIndex3", 1,
|
||||
"LeftHandMiddle1", 1,
|
||||
"LeftHandMiddle2", 1,
|
||||
"LeftHandMiddle3", 1,
|
||||
"LeftHandPinky1", 1,
|
||||
"LeftHandMiddle2", 1,
|
||||
"LeftHandMiddle3", 1,
|
||||
"LeftHandPinky1", 1,
|
||||
"LeftHandPinky2", 1,
|
||||
"LeftHandPinky3", 1,
|
||||
"LeftHandRing", 1,
|
||||
"LeftHandRing1", 1,
|
||||
"LeftHandRing2", 1,
|
||||
"LeftHandRing3", 1,
|
||||
"LeftHandThumb1", 1,
|
||||
"LeftHandThumb2", 1,
|
||||
"LeftHandThumb3", 1
|
||||
};
|
||||
};
|
||||
|
||||
class States {
|
||||
class GVAR(Base): Default {
|
||||
actions = "NoActions";
|
||||
canPullTrigger = 0;
|
||||
connectAs = "";
|
||||
connectFrom[] = {};
|
||||
connectTo[] = {};
|
||||
disableWeapons = 0;
|
||||
enableBinocular = 1;
|
||||
enableMissile = 1;
|
||||
enableOptics = 0;
|
||||
equivalentTo = "";
|
||||
file = "\A3\anims_f\Data\anim\Sdr\gst\GestureHi.rtm";
|
||||
forceAim = 0;
|
||||
headBobMode = 0;
|
||||
headBobStrength = 0;
|
||||
interpolateFrom[] = {};
|
||||
interpolateTo[] = {};
|
||||
interpolateWith[] = {};
|
||||
interpolationRestart = 0;
|
||||
interpolationSpeed = 6;
|
||||
looped = 0;
|
||||
mask = QGVAR(LeftArm);
|
||||
minPlayTime = 0.5;
|
||||
preload = 0;
|
||||
ragdoll = 0;
|
||||
relSpeedMax = 1;
|
||||
relSpeedMin = 1;
|
||||
showHandGun = 0;
|
||||
showItemInHand = 0;
|
||||
showItemInRightHand = 0;
|
||||
showWeaponAim = 1;
|
||||
soundEdge[] = {0.5,1};
|
||||
soundEnabled = 1;
|
||||
soundOverride = "";
|
||||
speed = -2;
|
||||
static = 0;
|
||||
terminal = 0;
|
||||
Walkcycles = 1;
|
||||
weaponIK = 1;
|
||||
|
||||
leftHandIKBeg = 1;
|
||||
leftHandIKCurve[] = {0, 1, 0.1, 0, 0.8, 0, 1, 1};
|
||||
leftHandIKEnd = 1;
|
||||
|
||||
rightHandIKBeg = 1;
|
||||
rightHandIKCurve[] = {1};
|
||||
rightHandIKEnd = 1;
|
||||
};
|
||||
|
||||
class GVAR(forward): GVAR(Base) {
|
||||
file = QUOTE(PATHTOF(anim\ace_forward.rtm));
|
||||
speed = 1;
|
||||
};
|
||||
|
||||
class GVAR(forwardStandLowered): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_forward_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(stop): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_stop.rtm));
|
||||
speed = 0.6;
|
||||
};
|
||||
|
||||
class GVAR(stopStandLowered): GVAR(stop) {
|
||||
file = QUOTE(PATHTOF(anim\ace_stop_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(cover): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_cover.rtm));
|
||||
speed = 0.8;
|
||||
};
|
||||
|
||||
class GVAR(coverStandLowered): GVAR(cover) {
|
||||
file = QUOTE(PATHTOF(anim\ace_cover_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(regroup): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_regroup.rtm));
|
||||
speed = 0.8;
|
||||
};
|
||||
|
||||
class GVAR(regroupStandLowered): GVAR(regroup) {
|
||||
file = QUOTE(PATHTOF(anim\ace_regroup_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(engage): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_engage.rtm));
|
||||
speed = 0.9;
|
||||
};
|
||||
|
||||
class GVAR(engageStandLowered): GVAR(engage) {
|
||||
file = QUOTE(PATHTOF(anim\ace_engage_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(point): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_point.rtm));
|
||||
speed = 0.8;
|
||||
};
|
||||
|
||||
class GVAR(pointStandLowered): GVAR(point) {
|
||||
file = QUOTE(PATHTOF(anim\ace_point_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(hold): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_hold.rtm));
|
||||
speed = 0.8;
|
||||
};
|
||||
|
||||
class GVAR(holdStandLowered): GVAR(hold) {
|
||||
file = QUOTE(PATHTOF(anim\ace_hold_stand_lowered.rtm));
|
||||
};
|
||||
|
||||
class GVAR(warning): GVAR(forward) {
|
||||
file = QUOTE(PATHTOF(anim\ace_warning.rtm));
|
||||
speed = 0.8;
|
||||
};
|
||||
|
||||
class GVAR(warningStandLowered): GVAR(warning) {
|
||||
file = QUOTE(PATHTOF(anim\ace_warning_stand_lowered.rtm));
|
||||
};
|
||||
};
|
||||
};
|
17
addons/gestures/config.cpp
Normal file
17
addons/gestures/config.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_interact_menu"};
|
||||
author[] = {"joko // Jonas", "Emperias", "Zigomarvin"};
|
||||
authorUrl = "https://github.com/commy2/";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgMovesBasic.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
33
addons/gestures/functions/fnc_playSignal.sqf
Normal file
33
addons/gestures/functions/fnc_playSignal.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: joko // Jonas, Emperias, Zigomarvin
|
||||
* Detect if the player and play the Gesture Animation
|
||||
*
|
||||
* Arguments:
|
||||
* Animation <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* "GeniusAnimation" call ace_gestures_fnc_playSignal
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
TRACE_1("params",_this);
|
||||
|
||||
if (!GVAR(ReloadMutex)) exitWith {false};
|
||||
|
||||
private _gesture = if (_this select [0,2] == "BI") then {
|
||||
_this select [2]
|
||||
} else {
|
||||
if (((animationState ACE_player) select [0, 12]) in ["amovpercmstp", "amovpercmwlk", "amovpercmtac"] && weaponLowered ACE_player) then {
|
||||
format ["%1StandLowered", _this]
|
||||
} else {
|
||||
_this
|
||||
};
|
||||
};
|
||||
|
||||
ACE_player playAction _gesture;
|
||||
true
|
1
addons/gestures/functions/script_component.hpp
Normal file
1
addons/gestures/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\gestures\script_component.hpp"
|
38
addons/gestures/key.sqf
Normal file
38
addons/gestures/key.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
|
||||
|
||||
{
|
||||
_x params ["_currentName","_key"];
|
||||
|
||||
if (_currentName select [0,1] == "BI") then {
|
||||
_currentName = _currentName select [2];
|
||||
};
|
||||
|
||||
private _code = (compile format [QUOTE(QUOTE(QGVAR(%1)) call FUNC(playSignal);), _currentName]);
|
||||
|
||||
[
|
||||
"ACE3 Gestures",
|
||||
_currentName,
|
||||
localize format[LSTRING(%1), _currentName],
|
||||
_code,
|
||||
{false},
|
||||
[_key, [false, (_key != -1), false]],
|
||||
false
|
||||
] call CBA_fnc_addKeybind;
|
||||
|
||||
false
|
||||
} count [
|
||||
["stop", DIK_NUMPAD2],
|
||||
["cover", DIK_NUMPAD3],
|
||||
["forward", DIK_NUMPAD4],
|
||||
["regroup", DIK_NUMPAD5],
|
||||
["engage", DIK_NUMPAD6],
|
||||
["point", DIK_NUMPAD7],
|
||||
["hold", DIK_NUMPAD8],
|
||||
["warning", DIK_NUMPAD9],
|
||||
["BIgestureGo", -1],
|
||||
["BIgestureAdvance", -1],
|
||||
["BIgestureFollow", -1],
|
||||
["BIgestureUp", -1],
|
||||
["BIgestureFreeze", -1],
|
||||
["BIgestureCeaseFire", -1]
|
||||
];
|
12
addons/gestures/script_component.hpp
Normal file
12
addons/gestures/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT Gestures
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_GESTURES
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_GESTURES
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_GESTURES
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
198
addons/gestures/stringtable.xml
Normal file
198
addons/gestures/stringtable.xml
Normal file
@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Gestures">
|
||||
<Key ID="STR_ACE_Gestures_Name">
|
||||
<English>ACE Gestures</English>
|
||||
<German>ACE Gesten</German>
|
||||
<Polish>ACE Gesty</Polish>
|
||||
<Czech>ACE Posunky</Czech>
|
||||
<French>ACE Signaux</French>
|
||||
<Hungarian>ACE Kézjelek</Hungarian>
|
||||
<Italian>ACE Gesti</Italian>
|
||||
<Portuguese>ACE Gestos</Portuguese>
|
||||
<Russian>ACE Жесты</Russian>
|
||||
<Spanish>ACE Gestos</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_Gestures">
|
||||
<English>Gestures</English>
|
||||
<German>Gesten</German>
|
||||
<Spanish>Gestos</Spanish>
|
||||
<Polish>Gesty</Polish>
|
||||
<Czech>Posunky</Czech>
|
||||
<French>Signaux</French>
|
||||
<Russian>Жесты</Russian>
|
||||
<Hungarian>Kézjelek</Hungarian>
|
||||
<Portuguese>Gestos</Portuguese>
|
||||
<Italian>Gesti</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureAdvance">
|
||||
<English>Advance</English>
|
||||
<German>Vordringen</German>
|
||||
<Spanish>Avanzar</Spanish>
|
||||
<Polish>Naprzód</Polish>
|
||||
<Czech>Postoupit</Czech>
|
||||
<French>Avancer</French>
|
||||
<Russian>Продвигаться</Russian>
|
||||
<Hungarian>Előre</Hungarian>
|
||||
<Portuguese>Avançar</Portuguese>
|
||||
<Italian>Avanzare</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureGo">
|
||||
<English>Go</English>
|
||||
<German>Los</German>
|
||||
<Spanish>Adelante</Spanish>
|
||||
<Polish>Szybko</Polish>
|
||||
<Czech>Jít</Czech>
|
||||
<French>Aller</French>
|
||||
<Russian>Идти</Russian>
|
||||
<Hungarian>Mozgás</Hungarian>
|
||||
<Portuguese>Mover-se</Portuguese>
|
||||
<Italian>Muoversi</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureFollow">
|
||||
<English>Follow</English>
|
||||
<German>Folgen</German>
|
||||
<Spanish>Seguirme</Spanish>
|
||||
<Polish>Za mną</Polish>
|
||||
<Czech>Následovat</Czech>
|
||||
<French>Suivre</French>
|
||||
<Russian>Следовать</Russian>
|
||||
<Hungarian>Utánam</Hungarian>
|
||||
<Portuguese>Seguir</Portuguese>
|
||||
<Italian>Seguire</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureUp">
|
||||
<English>Up</English>
|
||||
<German>Aufstehen</German>
|
||||
<Spanish>Arriba</Spanish>
|
||||
<Polish>Do góry</Polish>
|
||||
<Czech>Vztyk</Czech>
|
||||
<French>Debout</French>
|
||||
<Russian>Вверх</Russian>
|
||||
<Hungarian>Fel</Hungarian>
|
||||
<Portuguese>Acima</Portuguese>
|
||||
<Italian>Alzarsi</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureCeaseFire">
|
||||
<English>Cease Fire</English>
|
||||
<German>Feuer einstellen</German>
|
||||
<Spanish>Alto el fuego</Spanish>
|
||||
<Polish>Wstrzymać ogień</Polish>
|
||||
<Czech>Zastavit palbu</Czech>
|
||||
<French>Halte au feu</French>
|
||||
<Russian>Прекратить огонь</Russian>
|
||||
<Hungarian>Tüzet szüntess</Hungarian>
|
||||
<Portuguese>Cessar Fogo</Portuguese>
|
||||
<Italian>Cessare il Fuoco</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIGesturesPoint">
|
||||
<English>Point</English>
|
||||
<German>Zeigen</German>
|
||||
<Spanish>Señalar</Spanish>
|
||||
<Polish>Wskazać</Polish>
|
||||
<Czech>Ukázat</Czech>
|
||||
<French>Pointer</French>
|
||||
<Russian>Точка</Russian>
|
||||
<Hungarian>Mutat</Hungarian>
|
||||
<Portuguese>Apontar</Portuguese>
|
||||
<Italian>Puntare a</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_BIgestureFreeze">
|
||||
<English>Freeze</English>
|
||||
<German>Keine Bewegung</German>
|
||||
<Spanish>Alto</Spanish>
|
||||
<Polish>Stać</Polish>
|
||||
<Czech>Stát</Czech>
|
||||
<French>Halte</French>
|
||||
<Russian>Замереть</Russian>
|
||||
<Hungarian>Állj</Hungarian>
|
||||
<Portuguese>Alto</Portuguese>
|
||||
<Italian>Fermi</Italian>
|
||||
</Key>
|
||||
<!-- STOP -->
|
||||
<Key ID="STR_ACE_Gestures_stop">
|
||||
<English>Stop</English>
|
||||
<French>Stop</French>
|
||||
<German>Stop</German>
|
||||
<Polish>Stop</Polish>
|
||||
</Key>
|
||||
<!-- COVER -->
|
||||
<Key ID="STR_ACE_Gestures_cover">
|
||||
<English>Cover</English>
|
||||
<German>Deckung</German>
|
||||
<Spanish>Cubrirse</Spanish>
|
||||
<Polish>Do osłony</Polish>
|
||||
<Czech>Krýt se</Czech>
|
||||
<French>A couvert</French>
|
||||
<Russian>Укрыться</Russian>
|
||||
<Hungarian>Fedezékbe</Hungarian>
|
||||
<Portuguese>Proteger-se</Portuguese>
|
||||
<Italian>Copertura</Italian>
|
||||
</Key>
|
||||
<!-- REGROUP -->
|
||||
<Key ID="STR_ACE_Gestures_regroup">
|
||||
<English>Rally up</English>
|
||||
<French>Regroupement</French>
|
||||
<German>Sammeln</German>
|
||||
<Polish>Zbiórka</Polish>
|
||||
</Key>
|
||||
<!-- FORWARD -->
|
||||
<Key ID="STR_ACE_Gestures_forward">
|
||||
<English>Move forward</English>
|
||||
<French>En avant</French>
|
||||
<German>Vorwärts Bewegen</German>
|
||||
<Polish>Naprzód</Polish>
|
||||
</Key>
|
||||
<!-- ENGAGE -->
|
||||
<Key ID="STR_ACE_Gestures_engage">
|
||||
<English>Engage</English>
|
||||
<French>Engager</French>
|
||||
<Polish>Atak</Polish>
|
||||
</Key>
|
||||
<!-- POINT -->
|
||||
<Key ID="STR_ACE_Gestures_point">
|
||||
<English>Point</English>
|
||||
<French>Pointer</French>
|
||||
<German>Zeigen</German>
|
||||
<Polish>Wskaż</Polish>
|
||||
</Key>
|
||||
<!-- HOLD -->
|
||||
<Key ID="STR_ACE_Gestures_hold">
|
||||
<English>Hold</English>
|
||||
<French>Tenir</French>
|
||||
<German>Anhalten</German>
|
||||
<Polish>Wstrzymać</Polish>
|
||||
</Key>
|
||||
<!-- WARNING -->
|
||||
<Key ID="STR_ACE_Gestures_warning">
|
||||
<English>Warning</English>
|
||||
<French>Attention</French>
|
||||
<German>Achtung</German>
|
||||
<Polish>Uwaga</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_Hi">
|
||||
<English>Hi</English>
|
||||
<German>Hallo</German>
|
||||
<Spanish>Hola</Spanish>
|
||||
<Polish>Witaj</Polish>
|
||||
<Czech>Ahoj</Czech>
|
||||
<French>Salut</French>
|
||||
<Russian>Привет</Russian>
|
||||
<Hungarian>Helló</Hungarian>
|
||||
<Portuguese>Olá</Portuguese>
|
||||
<Italian>Ciao</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Gestures_Attack">
|
||||
<English>Attack</English>
|
||||
<German>Angreifen</German>
|
||||
<Spanish>Atacar</Spanish>
|
||||
<Polish>Do ataku</Polish>
|
||||
<Czech>Zaútočit</Czech>
|
||||
<French>Attaquer</French>
|
||||
<Russian>Атаковать</Russian>
|
||||
<Hungarian>Támadás</Hungarian>
|
||||
<Portuguese>Atacar</Portuguese>
|
||||
<Italian>Attaccare</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -95,7 +95,7 @@ GVAR(OldGlasses) = "#NULLSTRING";
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
// check goggles
|
||||
local _fnc_checkGoggles = {
|
||||
private _fnc_checkGoggles = {
|
||||
params ["_unit"];
|
||||
|
||||
if (GVAR(EffectsActive)) then {
|
||||
|
@ -183,13 +183,13 @@ class CfgGlasses {
|
||||
ACE_Resistance = 1;
|
||||
ACE_Protection = 1;
|
||||
};
|
||||
class G_Bandanna_sport:G_Bandanna_blk {
|
||||
class G_Bandanna_sport: G_Bandanna_shades {
|
||||
ACE_Color[] = {1,0,0};
|
||||
ACE_TintAmount=COLOUR;
|
||||
ACE_Resistance = 1;
|
||||
ACE_Protection = 1;
|
||||
};
|
||||
class G_Bandanna_aviator:G_Bandanna_blk {
|
||||
class G_Bandanna_aviator: G_Bandanna_shades {
|
||||
ACE_Color[] = {0,0,-1};
|
||||
ACE_TintAmount=COLOUR;
|
||||
ACE_Resistance = 1;
|
||||
|
@ -28,7 +28,7 @@ _effects set [DIRT, true];
|
||||
SETGLASSES(_unit,_effects);
|
||||
|
||||
if ([_unit] call FUNC(isGogglesVisible)) then {
|
||||
local _dirtImage = getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_OverlayDirt");
|
||||
private _dirtImage = getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_OverlayDirt");
|
||||
|
||||
if (_dirtImage != "") then {
|
||||
GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 0.1, false];
|
||||
|
@ -54,7 +54,7 @@ GVAR(DustHandler) = [{
|
||||
if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then {
|
||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
||||
|
||||
local _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
||||
private _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
||||
|
||||
if !(_unit getVariable ["ACE_EyesDamaged", false]) then {
|
||||
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]];
|
||||
|
@ -27,7 +27,7 @@ _fnc_underCover = {
|
||||
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true};
|
||||
|
||||
// looking up and no roof over head
|
||||
local _position = eyePos _unit;
|
||||
private _position = eyePos _unit;
|
||||
positionCameraToWorld [0, 0, 1] select 2 < (positionCameraToWorld [0, 0, 0] select 2) - 0.4 || {(lineIntersects [_position, _position vectorAdd [0, 0, 15], _unit])} // return
|
||||
};
|
||||
|
||||
|
@ -86,7 +86,7 @@ if (_safe) exitWith {};
|
||||
|
||||
// apply rotor wash effect
|
||||
if (_rotorWash select 1 > 0) then {
|
||||
local _scale = 0.7;
|
||||
private _scale = 0.7;
|
||||
|
||||
if (_rotorWash select 1 > 0) then {
|
||||
_scale = CLAMP(0.3 * (_rotorWash select 1),0.1,0.3);
|
||||
|
@ -73,7 +73,7 @@ SETDUST(DTIME,ACE_diagTime);
|
||||
|
||||
// apply dust effect if the amount of fired bullets is over the threshold
|
||||
if (GETDUSTT(DAMOUNT) < 2) then {
|
||||
local _bulletsRequired = 100;
|
||||
private _bulletsRequired = 100;
|
||||
|
||||
if (isNumber (configFile >> _cloudType >> QGVAR(BulletCount))) then {
|
||||
_bulletsRequired = getNumber (configFile >> _cloudType >> QGVAR(BulletCount));
|
||||
|
@ -26,7 +26,9 @@ GVAR(EffectsActive) = false;
|
||||
|
||||
_unit setVariable ["ACE_EyesDamaged", false];
|
||||
|
||||
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||
if (GVAR(DustHandler) != -1) then {
|
||||
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
GVAR(DustHandler) = -1;
|
||||
|
||||
true
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
params ["_glasses"];
|
||||
|
||||
local _config = configFile >> "CfgGlasses" >> _glasses;
|
||||
private _config = configFile >> "CfgGlasses" >> _glasses;
|
||||
|
||||
if (!isClass _config) exitWith {false};
|
||||
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
params ["_unit", ["_radius", 15]];
|
||||
|
||||
local _rotorWash = [false, 0];
|
||||
private _rotorWash = [false, 0];
|
||||
|
||||
{
|
||||
if (isEngineOn _x) then {
|
||||
local _distance = _unit distance _x;
|
||||
private _distance = _unit distance _x;
|
||||
|
||||
// convert distance to 0...1 range, where 0 is the maximum radius
|
||||
_distance = 1 - _distance / _radius;
|
||||
|
@ -25,4 +25,10 @@ class ACE_Settings {
|
||||
displayName = CSTRING(enabledForZeusUnits_DisplayName);
|
||||
description = CSTRING(enabledForZeusUnits_Description);
|
||||
};
|
||||
class GVAR(autoAddEarplugsToUnits) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
displayName = CSTRING(autoAddEarplugsToUnits_DisplayName);
|
||||
description = CSTRING(autoAddEarplugsToUnits_Description);
|
||||
};
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers {
|
||||
class Extended_Init_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(AddEarPlugs) {
|
||||
init = QUOTE( if (local (_this select 0)) then {_this call FUNC(addEarPlugs)}; );
|
||||
serverInit = QUOTE( _this call FUNC(addEarPlugs) );
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -33,3 +33,11 @@ class Extended_Explosion_EventHandlers {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Respawn_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
respawn = QUOTE(_this call FUNC(handleRespawn));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -101,6 +101,7 @@ class CfgVehicles {
|
||||
function = QFUNC(moduleHearing);
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
isSingular = 1;
|
||||
icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa);
|
||||
class Arguments {
|
||||
class EnableCombatDeafness {
|
||||
@ -136,6 +137,12 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class autoAddEarplugsToUnits {
|
||||
displayName = CSTRING(autoAddEarplugsToUnits_DisplayName);
|
||||
description = CSTRING(autoAddEarplugsToUnits_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
class ModuleDescription {
|
||||
description = CSTRING(Module_Description);
|
||||
|
@ -42,7 +42,8 @@ class CfgWeapons {
|
||||
class H_PilotHelmetFighter_O: H_PilotHelmetFighter_B {};
|
||||
class H_PilotHelmetFighter_I: H_PilotHelmetFighter_B {};
|
||||
|
||||
class H_Cap_headphones: H_HelmetB {
|
||||
class HelmetBase;
|
||||
class H_Cap_headphones: HelmetBase {
|
||||
GVAR(protection) = 0.5;
|
||||
GVAR(lowerVolume) = 0.60;
|
||||
};
|
||||
|
@ -6,6 +6,7 @@ PREP(addEarPlugs);
|
||||
PREP(earRinging);
|
||||
PREP(explosionNear);
|
||||
PREP(firedNear);
|
||||
PREP(handleRespawn);
|
||||
PREP(hasEarPlugsIn);
|
||||
PREP(moduleHearing);
|
||||
PREP(putInEarPlugs);
|
||||
|
@ -14,29 +14,50 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
TRACE_2("params",_unit,typeOf _unit);
|
||||
|
||||
// Exit if hearing is disabled or soldier has earplugs already in (persistence scenarios)
|
||||
if (!GVAR(enableCombatDeafness) || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
||||
// only run this after the settings are initialized
|
||||
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addEarPlugs), _this];
|
||||
};
|
||||
|
||||
private ["_launcher"];
|
||||
// Exit if hearing is disabled OR autoAdd is disabled OR soldier has earplugs already in (persistence scenarios)
|
||||
if (!GVAR(enableCombatDeafness) || {!GVAR(autoAddEarplugsToUnits)} || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
||||
|
||||
// add earplugs if the soldier has a rocket launcher
|
||||
_launcher = secondaryWeapon _unit;
|
||||
|
||||
if (_launcher != "") exitWith {
|
||||
if ((secondaryWeapon _unit) != "") exitWith {
|
||||
TRACE_1("has launcher - adding",_unit);
|
||||
_unit addItem "ACE_EarPlugs";
|
||||
};
|
||||
|
||||
// otherwise add earplugs if the soldier has a big rifle
|
||||
private ["_magazine", "_ammo"];
|
||||
if ((primaryWeapon _unit) == "") exitWith {};
|
||||
|
||||
_magazine = primaryWeaponMagazine _unit select 0;
|
||||
(primaryWeaponMagazine _unit) params [["_magazine", ""]];
|
||||
if (_magazine == "") exitWith {};
|
||||
|
||||
if (isNil "_magazine") exitWith {};
|
||||
private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
private _count = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
|
||||
|
||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber");
|
||||
_caliber = call {
|
||||
if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
|
||||
if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 };
|
||||
if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 };
|
||||
if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
|
||||
if (_caliber <= 0) then { 6.5 } else { _caliber };
|
||||
};
|
||||
private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;
|
||||
|
||||
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then {
|
||||
//If unit has a machine gun boost effective loudness 50%
|
||||
if (_count >= 50) then {_loudness = _loudness * 1.5};
|
||||
|
||||
TRACE_2("primaryWeapon",_unit,_loudness);
|
||||
|
||||
if (_loudness > 0.2) then {
|
||||
TRACE_1("loud gun - adding",_unit);
|
||||
_unit addItem "ACE_EarPlugs";
|
||||
};
|
||||
|
35
addons/hearing/functions/fnc_handleRespawn.sqf
Normal file
35
addons/hearing/functions/fnc_handleRespawn.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Reset earplugs on respawn, and then re-add if appropriate
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [player] call ACE_hearing_fnc_handleRespawn;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
TRACE_2("params",_unit,typeOf _unit);
|
||||
|
||||
if (!local _unit) exitWith {}; //XEH should only be called on local units
|
||||
|
||||
private _respawn = [0] call BIS_fnc_missionRespawnType;
|
||||
|
||||
//if respawn is not Group or side:
|
||||
if (_respawn <= 3) then {
|
||||
//Remove earplugs if they have them:
|
||||
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
|
||||
TRACE_1("had EarPlugs in - removing",_unit);
|
||||
_unit setVariable ["ACE_hasEarPlugsin", false, true];
|
||||
};
|
||||
};
|
||||
|
||||
//Re-add if they need them:
|
||||
[_unit] call FUNC(addEarPlugs);
|
@ -20,4 +20,5 @@ if ((_logic getVariable "DisableEarRinging") != -1) then {
|
||||
};
|
||||
|
||||
[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] call EFUNC(common,readSettingFromModule);
|
||||
ACE_LOGINFO("Hearing Module Initialized.");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user