Merge branch 'master' of github.com:acemod/ACE3

This commit is contained in:
Glowbal 2016-05-21 13:26:46 +02:00
commit 7f8bfa091a
23 changed files with 118 additions and 86 deletions

View File

@ -334,6 +334,7 @@ GVAR(OldPlayerVehicle) = vehicle objNull;
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon objNull;
GVAR(OldPlayerInventory) = [];
GVAR(OldPlayerInventoryNoAmmo) = [];
GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
GVAR(OldCameraView) = "";
GVAR(OldVisibleMap) = false;
@ -385,7 +386,32 @@ GVAR(OldIsCamera) = false;
if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
// Raise ACE event locally
GVAR(OldPlayerInventory) = _data;
["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent);
// we don't want to trigger this just because your ammo counter decreased.
_data = + GVAR(OldPlayerInventory);
private _weaponInfo = _data param [0, []];
if !(_weaponInfo isEqualTo []) then {
_weaponInfo set [4, primaryWeaponMagazine ACE_player];
_weaponInfo deleteAt 5;
};
_weaponInfo = _data param [1, []];
if !(_weaponInfo isEqualTo []) then {
_weaponInfo set [4, secondaryWeaponMagazine ACE_player];
_weaponInfo deleteAt 5;
};
_weaponInfo = _data param [2, []];
if !(_weaponInfo isEqualTo []) then {
_weaponInfo set [4, handgunMagazine ACE_player];
_weaponInfo deleteAt 5;
};
if !(_data isEqualTo GVAR(OldPlayerInventoryNoAmmo)) then {
GVAR(OldPlayerInventoryNoAmmo) = _data;
["playerInventoryChanged", [ACE_player, [ACE_player, false] call FUNC(getAllGear)]] call FUNC(localEvent);
};
};
// "playerVisionModeChanged" event

View File

@ -46,6 +46,8 @@ if (isServer) then {
GVAR(statusEffect_Names) = [];
GVAR(statusEffect_isGlobal) = [];
GVAR(setHearingCapabilityMap) = [];
//////////////////////////////////////////////////
// Set up PlayerChanged eventhandler for pre init (EH is installed in postInit)
//////////////////////////////////////////////////

View File

@ -29,9 +29,9 @@ GVAR(AssignedItemsShownItems) = [
];
["playerInventoryChanged", {
params ["_unit", "_assignedItems"];
params ["_unit"];
_assignedItems = _assignedItems param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
private _assignedItems = getUnitLoadout _unit param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
GVAR(AssignedItemsShownItems) = [
!((_assignedItems select 0) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 0 >> "ACE_hideItemType") != "map"},

View File

@ -33,9 +33,11 @@
*/
#include "script_component.hpp"
ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout");
params ["_unit", ["_showDeprecated", true]];
params ["_unit"];
if (_showDeprecated) then {
ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout");
};
if (isNull _unit) exitWith {[
"",

View File

@ -5,48 +5,44 @@
* Arguments:
* 0: id <STRING>
* 1: settings <NUMBER>
* 2: add (default: true) <BOOL>
* 2: add [true] OR remove [false] (default: true) <BOOL>
*
* Return Value:
* None
*
* Public: Yes
* Example:
* ["earwax", 0.5, true] call ace_common_fnc_setHearingCapability
*
* Note: uses player
* Public: Yes
*/
#include "script_component.hpp"
params ["_id", "_settings", ["_add", true]];
private _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
params ["_id", "_setting", ["_add", true]];
private _exists = false;
{
if (_id == _x select 0) exitWith {
_exists = true;
if (_add) then {
_x set [1, _settings];
} else {
_map set [_forEachIndex, 0];
_map = _map - [0];
};
};
} forEach _map;
if (!_exists && _add) then {
_map pushBack [_id, _settings];
};
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
// find lowest volume
private _lowestVolume = 1;
{
_lowestVolume = (_x select 1) min _lowestVolume;
false
} count _map;
GVAR(setHearingCapabilityMap) = GVAR(setHearingCapabilityMap) select {
_x params ["_xID", "_xSetting"];
if (_id == _xID) then {
_exists = true;
if (_add) then {
_x set [1, _setting];
_lowestVolume = _lowestVolume min _setting;
true
} else {
false
};
} else {
_lowestVolume = _lowestVolume min _xSetting;
true
};
};
if (!_exists && _add) then {
_lowestVolume = _lowestVolume min _setting;
GVAR(setHearingCapabilityMap) pushBack [_id, _setting];
};
// in game sounds
0 fadeSound _lowestVolume;

View File

@ -22,6 +22,7 @@ private _min = getNumber (_turretConfig >> QGVAR(MinDistance));
private _max = getNumber (_turretConfig >> QGVAR(MaxDistance));
private _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];
TRACE_4("",_distance,_delta,_min,_max);
_distance = _distance + _delta;
_distance = _distance min _max;

View File

@ -15,6 +15,7 @@
*/
#include "script_component.hpp"
params ["_vehicle","_turret","_distance","_angleTarget"];
TRACE_4("params",_vehicle,_turret,_distance,_angleTarget);
private _FCSMagazines = [];
private _FCSElevation = [];

View File

@ -8,9 +8,13 @@
* Return Value:
* Boolean <BOOL>
*
* Example:
* [] call ace_fcs_fnc_canUseFCS
*
* Public: No
*/
#include "script_component.hpp"
getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1
&& {cameraView == "GUNNER"} // return
&& {cameraView == "GUNNER"}
&& {!([ACE_player] call CBA_fnc_canUseWeapon)} //Not Turned Out

View File

@ -14,6 +14,7 @@
#include "script_component.hpp"
params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", true]];
TRACE_5("params",_vehicle,_turret,_distance,_showHint,_playSound);
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
@ -23,6 +24,8 @@ if (isNil "_distance") then {
getNumber (_turretConfig >> QGVAR(MaxDistance)),
getNumber (_turretConfig >> QGVAR(MinDistance))
] call FUNC(getRange);
} else {
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
};
// MOVING TARGETS

View File

@ -45,10 +45,12 @@ GVAR(surfaceCacheIsDust) = false;
GVAR(OldGlasses) = "<null>";
["playerInventoryChanged", {
private _currentGlasses = (_this select 1) param [7, ""];
params ["_unit"];
private _currentGlasses = goggles _unit;
if (GVAR(OldGlasses) != _currentGlasses) then {
["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent);
["GlassesChanged", [_unit, _currentGlasses]] call EFUNC(common,localEvent);
GVAR(OldGlasses) = _currentGlasses;
};
}] call EFUNC(common,addEventHandler);

View File

@ -25,22 +25,6 @@ class Extended_Init_EventHandlers {
};
};
class Extended_FiredNear_EventHandlers {
class AllVehicles {
class GVAR(FiredNear) {
clientFiredNear = QUOTE(_this call FUNC(firedNear););
};
};
};
class Extended_Explosion_EventHandlers {
class CAManBase {
class GVAR(ExplosionNear) {
clientExplosion = QUOTE(_this call FUNC(explosionNear););
};
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {

View File

@ -17,6 +17,10 @@ GVAR(volumeAttenuation) = 1;
// Only run PFEH and install event handlers if combat deafness is enabled
if (!GVAR(EnableCombatDeafness)) exitWith {};
//Add XEH:
["CAManBase", "FiredNear", FUNC(firedNear)] call CBA_fnc_addClassEventHandler;
["CAManBase", "Explosion", FUNC(explosionNear)] call CBA_fnc_addClassEventHandler;
// Update hearing protection now:
[] call FUNC(updateHearingProtection);

View File

@ -16,9 +16,6 @@
*/
#include "script_component.hpp"
// Only run if combat deafness is enabled
if (!GVAR(EnableCombatDeafness)) exitWith {};
params ["_unit", "_damage"];
if (_unit != ACE_player) exitWith {};

View File

@ -22,9 +22,6 @@
*/
#include "script_component.hpp"
// Only run if combat deafness is enabled
if (!GVAR(EnableCombatDeafness)) exitWith {};
params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"];
//Only run if firedNear object is player or player's vehicle:

View File

@ -16,6 +16,12 @@
*/
#include "script_component.hpp"
if (!alive ACE_player) exitWith {
if (missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) exitWith {};
TRACE_1("dead - removing hearing effects",ACE_player);
[QUOTE(ADDON), 1, true] call EFUNC(common,setHearingCapability);
};
(_this select 0) params ["_justUpdateVolume"];
GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0;
@ -54,9 +60,4 @@ if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
_volume = _volume min GVAR(UnconsciousnessVolume);
};
private _soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1};
_soundTransitionTime fadeSound _volume;
_soundTransitionTime fadeSpeech _volume;
ACE_player setVariable ["tf_globalVolume", _volume];
if (!isNil "acre_api_fnc_setGlobalVolume") then {[_volume^(0.33)] call acre_api_fnc_setGlobalVolume;};
[QUOTE(ADDON), _volume, true] call EFUNC(common,setHearingCapability);

View File

@ -37,19 +37,15 @@ if (isServer) then {["placedInBodyBag", FUNC(serverRemoveBody)] call EFUNC(commo
params ["_unit", "_status"];
if (local _unit) then {
if (_status) then {
_unit setVariable ["tf_globalVolume", 0.4];
_unit setVariable ["tf_voiceVolume", 0, true];
_unit setVariable ["tf_unable_to_use_radio", true, true];
_unit setVariable ["acre_sys_core_isDisabled", true, true];
if (!isNil "acre_api_fnc_setGlobalVolume") then { [0.4^0.33] call acre_api_fnc_setGlobalVolume; };
} else {
_unit setVariable ["tf_globalVolume", 1];
_unit setVariable ["tf_voiceVolume", 1, true];
_unit setVariable ["tf_unable_to_use_radio", false, true];
_unit setVariable ["acre_sys_core_isDisabled", false, true];
if (!isNil "acre_api_fnc_setGlobalVolume") then { [1] call acre_api_fnc_setGlobalVolume; };
};
};
}] call EFUNC(common,addEventHandler);

View File

@ -33,8 +33,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -46,8 +48,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -59,8 +63,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -72,8 +78,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -85,8 +93,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -98,8 +108,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -111,8 +123,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -124,8 +138,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement

View File

@ -4,6 +4,4 @@ ADDON = false;
#include "XEH_PREP.hpp"
GVAR(fadeScript) = scriptNull;
ADDON = true;

View File

@ -24,6 +24,7 @@ _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
if (_weaponIndex < 0) exitWith {};
_zeroing = _adjustment select _weaponIndex;
TRACE_1("Adjusting With",_zeroing);
if (_zeroing isEqualTo [0, 0, 0]) exitWith {};

View File

@ -39,7 +39,7 @@ class CfgAmmo {
ACE_muzzleVelocities[]={700, 800, 820, 833};
ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4};
};
class rhs_B_762x54_Ball_Tracer_Green: B_762x51_Ball {
class rhs_B_762x54_Ball_Tracer_Green: rhs_B_762x54_Ball {
ACE_caliber=7.925;
ACE_bulletLength=28.956;
ACE_bulletMass=9.6552;

View File

@ -243,8 +243,8 @@ class CfgVehicles {
EGVAR(fastroping,onPrepare) = QFUNC(onPrepare);
class UserActions {
class openDoor;
class closeDoor_L: openDoor {
class openDoor_L;
class closeDoor_L: openDoor_L {
condition = QUOTE((this doorPhase 'LeftDoor' > 0.5) && {alive this} && {!(this getVariable [ARR_2(QUOTE(QEGVAR(fastroping,doorsLocked)),false)])});
};
};

View File

@ -2,7 +2,8 @@
class CfgAmmo
{
class BulletBase;
class rhsusf_B_300winmag: BulletBase {
class B_762x54_Ball;
class rhsusf_B_300winmag: B_762x54_Ball {
ACE_caliber=7.823;
ACE_bulletLength=37.821;
ACE_bulletMass=14.256;

View File

@ -111,8 +111,8 @@ class CfgWeapons
};
};
};
class rhs_weap_m4a1;
class rhs_weap_mk18: rhs_weap_m4a1 {
class rhs_weap_m4a1_blockII;
class rhs_weap_mk18: rhs_weap_m4a1_blockII {
ACE_barrelTwist = 177.8;
ACE_barrelLength = 261.62;
ACE_Overheating_dispersion = 1;