Merge branch 'master' into deterministicOverheatingX

This commit is contained in:
PabstMirror 2016-02-02 17:11:00 -06:00
commit 397a12056a
201 changed files with 1281 additions and 430 deletions

View File

@ -63,6 +63,7 @@ Falke75
Ferenczi
Ferenzi
Filip Basara <filip.basara93@googlemail.com>
fr89k <kaschitoku@web.de>
FreeZbe <freeseb@gmail.com>
geraldbolso1899
Ghost

View File

@ -1,5 +1,5 @@
<p align="center">
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
<img src="https://github.com/acemod/ACE3/raw/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
</p>
<p align="center">

View File

@ -28,7 +28,7 @@ if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false };
2 cutText ["", "PLAIN"];
EGVAR(weather,WindInfo) = false;
0 cutText ["", "PLAIN"];
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
GVAR(Protractor) = true;
[{

View File

@ -1,6 +1,11 @@
#define COMPONENT advanced_ballistics
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT ai
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_AI
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT aircraft
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_AIRCRAFT
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT APL
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_APL
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT atragmx
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ATRAGMX
#define DEBUG_MODE_FULL
#endif

View File

@ -49,7 +49,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
} else {
GVAR(placeAction) = PLACE_WAITING;
[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus);
[_unit, "forceWalk", "ACE_Attach", true] call EFUNC(common,statusEffect_set);
[{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame);
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
@ -88,7 +88,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
{!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) then {
[_idPFH] call CBA_fnc_removePerFrameHandler;
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
[_unit, "forceWalk", "ACE_Attach", false] call EFUNC(common,statusEffect_set);
[] call EFUNC(interaction,hideMouseHint);
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
_unit removeAction _actionID;

View File

@ -1,6 +1,11 @@
#define COMPONENT attach
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ATTACH
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT backpacks
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_BACKPACKS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT ballistics
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_BALLISTICS
#define DEBUG_MODE_FULL
#endif

View File

@ -40,12 +40,12 @@ if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
[_unit, false] call FUNC(setHandcuffed);
};
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set);
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
[_unit, false] call FUNC(setSurrendered);
};
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set);
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];

View File

@ -28,7 +28,7 @@ if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith
if (_state) then {
_unit setVariable [QGVAR(isHandcuffed), true, true];
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Handcuffed), true] call EFUNC(common,statusEffect_set);
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
[_unit, false] call FUNC(setSurrendered);
@ -89,7 +89,7 @@ if (_state) then {
}, [_unit], 0.01] call EFUNC(common,waitAndExecute);
} else {
_unit setVariable [QGVAR(isHandcuffed), false, true];
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set);
//remove AnimChanged EH
private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];

View File

@ -33,7 +33,7 @@ if (_state) then {
_unit setVariable [QGVAR(isSurrendering), true, true];
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set);
if (_unit == ACE_player) then {
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
@ -65,7 +65,7 @@ if (_state) then {
}, [_unit], 0.01] call EFUNC(common,waitAndExecute);
} else {
_unit setVariable [QGVAR(isSurrendering), false, true];
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set);
//remove AnimChanged EH
private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_CAPTIVES
#define DEBUG_MODE_FULL

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_CARGO
#define DEBUG_MODE_FULL

View File

@ -23,9 +23,6 @@ class Extended_InitPost_EventHandlers {
class GVAR(setName) {
init = QUOTE(if (local (_this select 0)) then {_this call FUNC(setName)};);
};
class GVAR(forceWalk) {
init = QUOTE(_this call FUNC(applyForceWalkStatus));
};
class GVAR(muteUnit) {
init = QUOTE(_this call FUNC(muteUnitHandleInitPost));
};
@ -43,6 +40,9 @@ class Extended_Respawn_EventHandlers {
class GVAR(RESETDefaults) {
respawn = QUOTE(_this call FUNC(resetAllDefaults));
};
class GVAR(statusEffect) {
respawn = QUOTE(_this call FUNC(statusEffect_respawnEH));
};
};
class CAManBase {
class GVAR(muteUnit) {
@ -50,3 +50,12 @@ class Extended_Respawn_EventHandlers {
};
};
};
class Extended_Local_EventHandlers {
class All {
class GVAR(statusEffect) {
local = QUOTE(_this call FUNC(statusEffect_localEH));
};
};
};

View File

@ -1,5 +1,6 @@
// ACE - Common
// #define ENABLE_PERFORMANCE_COUNTERS
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
@ -57,6 +58,39 @@
// Eventhandlers
//////////////////////////////////////////////////
//Status Effect EHs:
["setStatusEffect", {_this call FUNC(statusEffect_set)}] call FUNC(addEventHandler);
["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType);
["blockSprint", false, []] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), QEGVAR(medical,unconscious)]] call FUNC(statusEffect_addType);
["blockDamage", false, ["fixCollision"]] call FUNC(statusEffect_addType);
["forceWalk", {
params ["_object", "_set"];
TRACE_2("forceWalk EH",_object,_set);
_object forceWalk (_set > 0);
}] call FUNC(addEventHandler);
["blockSprint", { //Name reversed from `allowSprint` because we want NOR logic
params ["_object", "_set"];
TRACE_2("blockSprint EH",_object,_set);
_object allowSprint (_set == 0);
}] call FUNC(addEventHandler);
["setCaptive", {
params ["_object", "_set"];
TRACE_2("setCaptive EH",_object,_set);
_object setCaptive (_set > 0);
}] call FUNC(addEventHandler);
["blockDamage", { //Name reversed from `allowDamage` because we want NOR logic
params ["_object", "_set"];
if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then {
TRACE_2("blockDamage EH (using medical)",_object,_set);
_object setvariable [QEGVAR(medical,allowDamage), (_set == 0), true];
} else {
TRACE_2("blockDamage EH (using allowDamage)",_object,_set);
_object allowDamage (_set == 0);
};
}] call FUNC(addEventHandler);
//Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit
//This variable is used for isPlayer checks
if (isServer) then {
@ -431,9 +465,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
// Eventhandlers for player controlled machines
//////////////////////////////////////////////////
// @todo still needed?
[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler);
["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler);

View File

@ -10,7 +10,6 @@ PREP(addToInventory);
PREP(assignedItemFix);
PREP(assignObjectsInList);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
PREP(ASLToPosition);
PREP(binarizeNumber);
PREP(blurScreen);
@ -53,8 +52,8 @@ PREP(fixLoweredRifleAnimation);
PREP(fixPosition);
PREP(getAllDefinedSetVariables);
PREP(getAllGear);
PREP(getCaptivityStatus);
PREP(getDeathAnim);
PREP(getCaptivityStatus);
PREP(getDefaultAnim);
PREP(getDefinedVariable);
PREP(getDefinedVariableDefault);
@ -171,6 +170,13 @@ PREP(setVariablePublic);
PREP(setVolume);
PREP(sortAlphabeticallyBy);
PREP(showHud);
PREP(statusEffect_addType);
PREP(statusEffect_get);
PREP(statusEffect_localEH);
PREP(statusEffect_resetVariables);
PREP(statusEffect_respawnEH);
PREP(statusEffect_sendEffects);
PREP(statusEffect_set);
PREP(stringCompare);
PREP(stringToColoredText);
PREP(stringRemoveWhiteSpace);
@ -317,6 +323,8 @@ if (isServer) then {
call FUNC(loadSettingsOnServer);
};
GVAR(statusEffect_Names) = [];
GVAR(statusEffect_isGlobal) = [];
//////////////////////////////////////////////////
// Set up PlayerChanged eventhandler for pre init

View File

@ -5,7 +5,7 @@
* Arguments [Client] :
* 0: eventName <STRING>
* 1: arguments <ARRAY>
* 2: ttl <SCALAR>
* 2: ttl <NUMBER>
*
* Return Value:
* Boolean of success <BOOL>

View File

@ -1,22 +0,0 @@
/*
* Author: Pabst Mirror
* Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_Player] call ace_common_fnc_applyForceWalkStatus
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unit forceWalk (_forceWalkNumber > 0);

View File

@ -15,8 +15,8 @@
// allowDamage requires local object
if (!local _this) exitWith {};
// prevent collision damage, @todo allowDamage API
_this allowDamage false;
// prevent collision damage
[_this, "blockDamage", "fixCollision", true] call FUNC(statusEffect_set);
// re-allow damage after 2 seconds
[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute);
[{[_this, "blockDamage", "fixCollision", false] call FUNC(statusEffect_set);}, _this, 2] call EFUNC(common,waitAndExecute);

View File

@ -1,6 +1,7 @@
/*
* Author: commy2
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
* Handles the "fixFloating" event
*
* Arguments:
* PhysX object <OBJECT>
@ -16,6 +17,11 @@ params ["_object"];
// setHitPointDamage requires local object
if (!local _object) exitWith {};
//Ignore mans
if (_object isKindOf "CAManBase") exitWith {};
//We need to manually set allowDamage to true for setHitIndex to function
["blockDamage", [_object, 0]] call FUNC(localEvent);
// save and restore hitpoints, see below why
private _hitPointDamages = getAllHitPointsDamage _object;
@ -31,3 +37,8 @@ _object setDamage damage _object;
{
_object setHitIndex [_forEachIndex, _x];
} forEach (_hitPointDamages select 2);
//manually re-enable allowDamage to previous setting (ref statusEffect_funcs)
private _effectVarName = format [QGVAR(effect_%1), "blockDamage"];
private _effectNumber = _object getVariable [_effectVarName, 0];
["blockDamage", [_object, _effectNumber]] call FUNC(localEvent);

View File

@ -14,15 +14,7 @@
params ["_unit"];
private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
private _unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5]
ACE_DEPRECATED("ace_common_fnc_getCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_get");
private _unitCaptivityReasons = [];
{
if (_unitCaptivityStatus select _forEachIndex) then {
_unitCaptivityReasons pushBack _x;
};
} forEach _captivityReasons;
_unitCaptivityReasons
([_unit, "setCaptive"] call FUNC(statusEffect_get)) select 1

View File

@ -17,16 +17,7 @@
params ["_unit"];
private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
private _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
private _unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5]
ACE_DEPRECATED("ace_common_fnc_getForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_get");
private _unitForceWalkReasons = [];
{
if (_unitForceWalkStatus select _forEachIndex) then {
_unitForceWalkReasons pushBack _x;
};
} forEach _forceWalkReasons;
_unitForceWalkReasons
([_unit, "forceWalk"] call FUNC(statusEffect_get)) select 1

View File

@ -19,11 +19,6 @@ _unit setVariable ["ACE_isUnconscious", nil, true];
if (isPlayer _unit) then {
[true] call FUNC(setVolume);
// [false] call FUNC(disableKeyInput); //func does not exist
if (["ace_medical"] call FUNC(isModLoaded)) then {
// [false] call EFUNC(medical,effectBlackOut); //func does not exist
};
if !(isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
// clear all disable user input
@ -40,5 +35,3 @@ if (isPlayer _unit) then {
};
false
} count ([_unit] call FUNC(getAllDefinedSetVariables));
_unit setVariable ["ACE_forceWalkStatusNumber", 0, true];

View File

@ -16,28 +16,7 @@
params ["_unit", "_reason", "_status"];
private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5]
ACE_DEPRECATED("ace_common_fnc_setCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_set");
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status)
if !(_reason in _captivityReasons) then {
_captivityReasons pushBack _reason;
ACE_captivityReasons = _captivityReasons;
publicVariable "ACE_captivityReasons";
};
// get reasons why the unit is captive already and update to the new status
private _unitCaptivityReasons = _unit call FUNC(getCaptivityStatus);
private _captivityReasonsBooleans = [];
{
_captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons];
} forEach _captivityReasons;
_captivityReasonsBooleans set [_captivityReasons find _reason, _status];
private _bitmask = _captivityReasonsBooleans call FUNC(toBitmask);
// actually apply the setCaptive command globaly
[[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc);
[_unit, "setCaptive", _reason, _status] call FUNC(statusEffect_set);

View File

@ -20,29 +20,7 @@
params ["_unit", "_reason", "_status"];
private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5]
ACE_DEPRECATED("ace_common_fnc_setForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_set");
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status)
if !(_reason in _forceWalkReasons) then {
_forceWalkReasons pushBack _reason;
ACE_forceWalkReasons = _forceWalkReasons;
publicVariable "ACE_forceWalkReasons";
};
// get reasons why the unit is forceWalking already and update to the new status
private _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus);
private _forceWalkReasonsBooleans = [];
{
_forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons];
} forEach _forceWalkReasons;
_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status];
private _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask);
_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true];
// actually apply the forceWalk command globaly
[[_unit], QFUNC(applyForceWalkStatus), 2] call FUNC(execRemoteFnc);
[_unit, "forceWalk", _reason, _status] call FUNC(statusEffect_set);

View File

@ -0,0 +1,37 @@
/*
* Author: PabstMirror
* Adds a status effect that will be handled.
*
* Arguments:
* 0: Status Effect Name, this should match a corisponding event name <STRING>
* 1: Send event globaly <BOOL>
* 2: Common Effect Reaons to pre-seed durring init <ARRAY>
*
* Return Value:
* Nothing
*
* Example:
* ["setCaptive", true, []] call ace_common_fnc_statusEffect_addType
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]]];
TRACE_3("params",_name,_isGlobal,_commonReasonsArray);
if (_name == "") exitWith {ACE_LOGERROR_1("addStatusEffect - Bad Name %1", _this)};
if (_name in GVAR(statusEffect_Names)) exitWith {ACE_LOGWARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1", _this)};
GVAR(statusEffect_Names) pushBack _name;
GVAR(statusEffect_isGlobal) pushBack _isGlobal;
//We add reasons at any time, but more efficenet to add all common ones at one time during init
if (isServer && {!(_commonReasonsArray isEqualTo [])}) then {
//Switch case to lower:
{
_commonReasonsArray set [_forEachIndex, toLower _x];
} forEach _commonReasonsArray;
missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _name]), _commonReasonsArray, true];
};

View File

@ -0,0 +1,63 @@
/*
* Author: PabstMirror
* Retrives list of current status effects
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
*
* Return Value:
* Effect status <ARRAY>
* 0: is activly set (if false, the effect is ignored and never modified) <BOOL>
* 1: reasons why it is set true (list of strings, count of 0 = false, 1+ = true) <ARRAY>
*
* Example:
* [player, "forceWalk"] call ace_common_fnc_statusEffect_get
*
* Public: Yes
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_object", objNull, [objNull]], ["_effectName", "", [""]]];
TRACE_2("params",_object,_effectName);
if (isNull _object) exitWith {
TRACE_1("null",_object);
[false, []]
};
[_object, false] call FUNC(statusEffect_resetVariables); //Check for mismatch
//List of reasons
private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []];
if (_statusReasons isEqualTo []) exitWith {
TRACE_1("no reasons - bad effect?",_statusReasons);
[false, []]
};
//Get Effect Number
private _effectVarName = format [QGVAR(effect_%1), _effectName];
private _effectNumber = _object getVariable [_effectVarName, -1];
TRACE_2("current",_effectVarName,_effectNumber);
if (_effectNumber == -1) exitWith { //Nil array - no effect
[false, []]
};
if (_effectNumber == 0) exitWith { //empty array - false effect
[true, []]
};
//if no change: skip sending publicVar and events
private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber);
TRACE_2("bitArray",_statusIndex,_effectBoolArray);
private _activeEffects = [];
{
if (_x) then {
_activeEffects pushBack (_statusReasons select _forEachIndex);
};
} forEach _effectBoolArray;
//non-empty array - true effect
[true, _activeEffects]

View File

@ -0,0 +1,36 @@
/*
* Author: PabstMirror
* Handles locality switch, runs a respawn check and then reapplies all effect events.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, true] call ace_common_fnc_statusEffect_localEH
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_object", "_isLocal"];
TRACE_2("params",_object,_isLocal);
//Only run this after the settings are initialized
//Need to wait for all EH to be installed (local event will happen between pre and post init)
if !(GVAR(settingsInitFinished)) exitWith {
TRACE_1("pushing to runAtSettingsInitialized", _this);
GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_localEH), _this];
};
if (!_isLocal) exitWith {TRACE_1("object no longer local", _this)};
if (isNull _object) exitWith {TRACE_1("object null", _this)};
//Reset any variables because of respawn
[_object, false] call FUNC(statusEffect_resetVariables);
//Send all Variables to client
[_object, ""] call FUNC(statusEffect_sendEffects);

View File

@ -0,0 +1,45 @@
/*
* Author: PabstMirror
* Resets all effect numbers to 0 when an object respawns (but does not apply the effect event).
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, true] call ace_common_fnc_statusEffect_resetVariables
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_object", objNull, [objNull]], ["_setObjectRef", false, [false]]];
TRACE_2("params",_object,_setObjectRef);
if (isNull _object) exitWith {};
private _objectRef = _object getVariable QGVAR(statusEffect_object);
TRACE_2("testing",_object,_objectRef);
// If nothing was ever set, or objects match, exit (always true unless respawned)
if (isNil "_objectRef") exitWith {
if (_setObjectRef) then {
_object setVariable [QGVAR(statusEffect_object), _object, true]; //explicitly set new object ref
};
};
if (_object == _objectRef) exitWith {};
//Mismatch, so if effect has ever been defined, reset to 0
{
private _effectVarName = format [QGVAR(effect_%1), _x];
private _effectNumber = _object getVariable [_effectVarName, -1];
if (_effectNumber != -1) then {
TRACE_2("forced reset defined array on object mismatch",_x,_effectNumber);
_object setVariable [_effectVarName, 0, true]; //This always resets to 0 (not -1/nil)!
};
} forEach GVAR(statusEffect_Names);
_object setVariable [QGVAR(statusEffect_object), _object, true];

View File

@ -0,0 +1,36 @@
/*
* Author: PabstMirror
* Handles the Respawn Event Handler to reset effects.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, objNull] call ace_common_fnc_statusEffect_respawnEH
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_object"];
TRACE_1("params",_object);
//Only run this after the settings are initialized
//Need to wait for all EH to be installed (local event will happen between pre and post init)
if !(GVAR(settingsInitFinished)) exitWith {
TRACE_1("pushing to runAtSettingsInitialized", _this);
GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_respawnEH), _this];
};
if (!local _object) exitWith {TRACE_1("object no longer local", _this)};
if (isNull _object) exitWith {TRACE_1("object null", _this)};
//Reset any variables on "real" respawn
[_object, false] call FUNC(statusEffect_resetVariables);
//Send all Variables to client
[_object, ""] call FUNC(statusEffect_sendEffects);

View File

@ -0,0 +1,48 @@
/*
* Author: PabstMirror
* Sends all status effects for an object (can be run on non-local objects)
*
* Arguments:
* 0: Object <OBJECT>
* 1: Effect name (or "" or send all) <STRING>
*
* Return Value:
* Nothing
*
* Example:
* [player, ""] call ace_common_fnc_statusEffect_sendEffects
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_object", objNull, [objNull]], ["_effectName", "", [""]]];
TRACE_2("params",_object,_effectName);
if (isNull _object) exitWith {};
{
if ((_effectName == "") || {_effectName == _x}) then {
private _effectVarName = format [QGVAR(effect_%1), _x];
private _effectNumber = _object getVariable [_effectVarName, -1];
//We only do anything if the effect has been defined at some point in the game for this unit
TRACE_2("checking if event is nil",_x,_effectNumber);
if (_effectNumber != -1) then {
if (GVAR(statusEffect_isGlobal) select _forEachIndex) then {
TRACE_2("Sending Global Event", _object, _effectNumber);
[_x, [_object, _effectNumber]] call FUNC(globalEvent);
} else {
if (local _object) then {
//If local, send directly to bypass network delay of targetEvent call
TRACE_2("Sending Target Local Event", _object, _effectNumber);
[_x, [_object, _effectNumber]] call FUNC(localEvent);
} else {
TRACE_2("Sending Target Non-Local Event", _object, _effectNumber);
[_x, [_object], [_object, _effectNumber]] call FUNC(targetEvent);
};
};
};
};
} forEach GVAR(statusEffect_Names);

View File

@ -0,0 +1,70 @@
/*
* Author: PabstMirror
* Adds or removes an id to a status effect and will send an event to apply.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
* 2: Unique Reason ID <STRING>
* 3: Is Set (true adds/false removes) <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* [player, "setCaptive", "reason1", true] call ace_common_fnc_statusEffect_set
*
* Public: Yes
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_object", objNull, [objNull]], ["_effectName", "", [""]], ["_ID", "", [""]], ["_set", true, [false]]];
TRACE_4("params",_object,_effectName,_ID,_set);
//Only run this after the settings are initialized
if !(GVAR(settingsInitFinished)) exitWith {
TRACE_1("pushing to runAtSettingsInitialized", _this);
GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_set), _this];
};
if (isNull _object) exitWith {TRACE_1("null",_object);};
[_object, true] call FUNC(statusEffect_resetVariables); //Check for mismatch, and set object ref
//check ID case and set globaly if not already set:
_ID = toLower _ID;
private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []];
private _statusIndex = _statusReasons find _ID;
if (_statusIndex == -1) then {
TRACE_2("ID not in global reasons, adding",_statusReasons,_ID);
_statusIndex = _statusReasons pushBack _ID;
missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _effectName]), _statusReasons, true];
};
private _effectVarName = format [QGVAR(effect_%1), _effectName];
private _effectNumber = _object getVariable [_effectVarName, -1];
TRACE_2("current",_effectVarName,_effectNumber);
if ((_effectNumber == -1) && {!_set}) exitWith {
//Optimization for modules that always set an ID to false even if never set true
TRACE_2("Set False on nil array, exiting",_set,_effectNumber);
};
if (_effectNumber == -1) then {_effectNumber = 0}; //reset (-1/nil) to 0
//if no change: skip sending publicVar and events
private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber);
TRACE_2("bitArray",_statusIndex,_effectBoolArray);
if (_set isEqualTo (_effectBoolArray select _statusIndex)) exitWith {
TRACE_2("No Change, exiting",_set,_effectBoolArray select _statusIndex);
};
TRACE_2("Setting to new value",_set,_effectBoolArray select _statusIndex);
_effectBoolArray set [_statusIndex, _set];
_effectNumber = _effectBoolArray call FUNC(toBitmask); //Convert array back to number
TRACE_2("Saving globaly",_effectVarName,_effectNumber);
_object setVariable [_effectVarName, _effectNumber, true];
[_object, _effectName] call FUNC(statusEffect_sendEffects);

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_COMMON
#define DEBUG_MODE_FULL

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_CONCERTINA_WIRE
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT dagr
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_DAGR
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT difficulties
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_DIFFICULTIES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT disarming
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_DISARMING
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ATTACH
#define DEBUG_MODE_FULL

View File

@ -48,7 +48,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon";
// reselect weapon and re-enable sprint
_unit selectWeapon primaryWeapon _unit;
[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus);
[_unit, "forceWalk", "ACE_dragging", false] call EFUNC(common,statusEffect_set);
// prevent object from flipping inside buildings
if (_inBuilding) then {

View File

@ -53,7 +53,7 @@ if (_target isKindOf "CAManBase") then {
_unit action ["SwitchWeapon", _unit, _unit, 99];
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
[_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
};

View File

@ -2,6 +2,10 @@
#include "\z\ace\addons\main\script_mod.hpp"
//#define DEBUG_ENABLED_DRAGGING
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_MODE_FULL

View File

@ -32,7 +32,7 @@ if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR
_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model");
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!
[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
[_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set);
//Show mouse buttons:
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
@ -152,7 +152,7 @@ GVAR(TweakedAngle) = 0;
[_pfID] call CBA_fnc_removePerFrameHandler;
GVAR(pfeh_running) = false;
[_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus);
[_unit, "forceWalk", "ACE_Explosives", false] call EFUNC(common,statusEffect_set);
[] call EFUNC(interaction,hideMouseHint);
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
[_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler);

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_EXPLOSIVES
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT fcs
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FCS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT finger
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FINGER
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT flashlights
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FLASHLIGHTS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT flashsuppressors
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FLASHSUPPRESSORS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT fonts
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FONTS
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,10 @@
#include "\z\ace\addons\main\script_mod.hpp"
//#define DEBUG_ENABLED_FRAG
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_FRAG
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT Gestures
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_GESTURES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT gforces
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_GFORCES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT goggles
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_GOGGLES
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_GRENADES
#define DEBUG_MODE_FULL

View File

@ -2,6 +2,9 @@
if (!hasInterface) exitWith {};
GVAR(cacheAmmoLoudness) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0];
GVAR(cacheAmmoLoudness) setText QGVAR(cacheAmmoLoudness);
GVAR(deafnessDV) = 0;
GVAR(deafnessPrior) = 0;
GVAR(volume) = 1;

View File

@ -28,11 +28,12 @@ if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
//headgear hearing protection
if(headgear _unit != "") then {
private ["_protection"];
_protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1;
private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1;
if(_protection > 0) then {
_strength = _strength * (1 - _protection);
};
};
TRACE_2("adding",_strength,GVAR(deafnessDV));
GVAR(deafnessDV) = GVAR(deafnessDV) + _strength;

View File

@ -32,31 +32,28 @@ if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {};
if (_weapon in ["Throw", "Put"]) exitWith {};
if (_distance > 50) exitWith {};
private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation", "_magazine", "_muzzles", "_weaponMagazines", "_muzzleMagazines", "_ammoType", "_initSpeed", "_ammoConfig", "_caliber"];
private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)};
private _distance = 1 max _distance;
_vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)};
_distance = 1 max _distance;
_silencer = switch (_weapon) do {
private _silencer = switch (_weapon) do {
case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0};
case (secondaryWeapon _firer) : {(secondaryWeaponItems _firer) select 0};
case (handgunWeapon _firer) : {(handgunItems _firer) select 0};
default {""};
};
_audibleFireCoef = 1;
private _audibleFireCoef = 1;
if (_silencer != "") then {
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
};
_weaponMagazines = missionNamespace getVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], []];
if (count _weaponMagazines == 0) then {
_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
_weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
private _loudness = GVAR(cacheAmmoLoudness) getVariable (format ["%1%2",_weapon,_ammo]);
if (isNil "_loudness") then {
private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
{
if (_x != "this") then {
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
private _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
_weaponMagazines append _muzzleMagazines;
};
} count _muzzles;
@ -64,34 +61,39 @@ if (count _weaponMagazines == 0) then {
_ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
_weaponMagazines set [_forEachIndex, [_x, _ammoType]];
} forEach _weaponMagazines;
missionNamespace setVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], _weaponMagazines];
};
_magazine = "";
{
_x params ["_magazineType", "_ammoType"];
if (_ammoType == _ammo) exitWith {
_magazine = _magazineType;
private _magazine = "";
{
_x params ["_magazineType", "_ammoType"];
if (_ammoType == _ammo) exitWith {
_magazine = _magazineType;
};
} count _weaponMagazines;
if (_magazine == "") then {
_loudness = 0;
TRACE_2("No mag for Weapon/Ammo??",_weapon,_ammo);
} else {
private _initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
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 };
};
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;
TRACE_6("building cache",_weapon,_ammo,_magazine,_initSpeed,_caliber,_loudness);
};
} count _weaponMagazines;
if (_magazine == "") exitWith {};
_initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
_ammoConfig = (configFile >> "CfgAmmo" >> _ammo);
_caliber = getNumber(_ammoConfig >> "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 };
GVAR(cacheAmmoLoudness) setVariable [(format ["%1%2",_weapon,_ammo]), _loudness];
};
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5;
_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off
//systemChat format["%1 : %2", _strength, _initSpeed];
//systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed];
_loudness = _loudness * _audibleFireCoef;
private _strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off
TRACE_1("result",_strength);
if (_strength < 0.01) exitWith {};

View File

@ -1,6 +1,6 @@
/*
* Author: commy2 and esteldunedain and Ruthberg
* Updates and applys the current deafness. Called every 0.1 sec from a PFEH.
* Updates and applys the current deafness. Called every 1 sec from a PFEH.
*
* Arguments:
* 0: Args <ARRAY>
@ -19,7 +19,6 @@
//Only run if deafness or ear ringing is enabled:
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
private["_volume", "_soundTransitionTime"];
(_this select 0) params ["_justUpdateVolume"];
@ -71,7 +70,7 @@ if (!_justUpdateVolume) then {
if ((missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) || {!GVAR(enableCombatDeafness)}) exitWith {};
_volume = GVAR(volume);
private _volume = GVAR(volume);
// Earplugs reduce hearing 50%
if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
@ -92,7 +91,7 @@ if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
_volume = _volume min GVAR(UnconsciousnessVolume);
};
_soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1};
private _soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1};
_soundTransitionTime fadeSound _volume;
_soundTransitionTime fadeSpeech _volume;

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_HEARING
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT hitreactions
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_HITREACTIONS
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_HUNTIR
#define DEBUG_MODE_FULL

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_INTERACT_MENU
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT interaction
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_INTERACTION
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT inventory
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_INVENTORY
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT javelin
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_JAVELIN
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT kestrel4500
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_KESTREL4500
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT laser
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_LASER
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT laser_selfdesignate
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT laserpointer
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_LASERPOINTER
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT logistics_uavbattery
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_LOGISTICS_UAVBATTERY
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT magazinerepack
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAGAZINEREPACK
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT map
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAP
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT map_gestures
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAP_GESTURES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT maptools
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAPTOOLS
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT markers
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MARKERS
#define DEBUG_MODE_FULL
#endif

View File

@ -7,7 +7,7 @@ params ["_unit"];
// Reset captive status for respawning unit
if (!(_unit getVariable ["ACE_isUnconscious", false])) then {
[_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set);
};
// Remove maximum unconsciousness time handler

View File

@ -95,7 +95,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
};
[_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set);
_anim = [_unit] call EFUNC(common,getDeathAnim);
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
[{

View File

@ -6,7 +6,7 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: selection name <STRING>
* 2: HitPoint Index/True to get hitpoint <SCALAR><BOOL>
* 2: HitPoint Index/True to get hitpoint <NUMBER><BOOL>
*
* Return Value:
* translated selection/hitpoint name <STRING>

View File

@ -33,7 +33,7 @@ if (!alive _unit) exitWith {
if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
[_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide);
};
[_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set);
[_unit, false] call EFUNC(common,disableAI);
//_unit setUnitPos _originalPos;
_unit setUnconscious false;
@ -102,7 +102,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
};
if (!_hasMovedOut) then {
// Reset the unit back to the previous captive state.
[_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus);
[_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set);
// Swhich the unit back to its original group
//Unconscious units shouldn't be put in another group #527:

View File

@ -1,6 +1,11 @@
#define COMPONENT medical
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MEDICAL
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT medical_menu
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MEDICAL_MENU
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT microdagr
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MICRODAGR
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT missileguidance
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MISSILEGUIDANCE
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT missionModules
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MISSIONMODULES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT mk6mortar
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MK6MORTAR
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT modules
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MODULES
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT movement
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MOVEMENT
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT mx2a
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MX2A
#define DEBUG_MODE_FULL
#endif

View File

@ -1,12 +1,17 @@
#define COMPONENT nametags
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_NAMETAGS
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_NAMETAGS
#define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS
#define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Change in brightness (1 or -1) <SCALAR>
* 1: Change in brightness (1 or -1) <NUMBER>
*
* Return Value:
* Nothing

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_NIGHTVISION
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT noidle
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_NOIDLE
#define DEBUG_MODE_FULL
#endif

View File

@ -2,6 +2,9 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_NORADIO
#define DEBUG_MODE_FULL

View File

@ -1,6 +1,11 @@
#define COMPONENT norearm
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_NOREARM
#define DEBUG_MODE_FULL
#endif

View File

@ -1,6 +1,11 @@
#define COMPONENT optics
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_OPTICS
#define DEBUG_MODE_FULL
#endif

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