mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* 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:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, true] call ace_common_fnc_statusEffect_resetVariables
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
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];
|