Skip to content

Commit

Permalink
don't use 'apply retroactively' for non init events
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 committed May 10, 2016
1 parent f3cf6ab commit 0ffe360
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
36 changes: 36 additions & 0 deletions addons/common/fnc_itemType.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_itemType
Description:
A function used to return the kind of an item.
Parameters:
_item - Any kind of item, weapon or magazine class name <STRING>
Returns:
_type - Description of the item. <STRING>
Example:
(begin example)
currentWeapon player call CBA_fnc_itemType; // pistol
(end)
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(getItemConfig);

params [["_weapon", "", [""]]];

private _result = configNull;

{
private _config = configFile >> _x >> _weapon;

if (isClass _config) exitWith {
_result = _config;
};
} forEach ["CfgWeapons", "CfgMagazines", "CfgGlasses"];

_result
5 changes: 5 additions & 0 deletions addons/xeh/fnc_addClassEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ if (_eventName == "FiredBIS") exitWith {
};
if !(_eventName in GVAR(EventsLowercase)) exitWith {false};

// don't use "apply retroactively" for non init events
if (_applyInitRetroactivly && {!(_eventName in ["init", "initpost"])}) then {
_applyInitRetroactivly = false;
};

// add events to already existing objects
private _entities = entities "" + allUnits;
private _eventVarName = format [QGVAR(%1), _eventName];
Expand Down

0 comments on commit 0ffe360

Please sign in to comment.