mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #217 from KoffeinFlummi/clearCacheOnEvents
Call uncached contitions before statements
This commit is contained in:
commit
41fcab5b3e
@ -30,7 +30,6 @@ GVAR(lastTime) = diag_tickTime;
|
||||
GVAR(rotationAngle) = 0;
|
||||
|
||||
GVAR(selectedAction) = [[],[]];
|
||||
GVAR(selectedStatement) = {};
|
||||
GVAR(actionSelected) = false;
|
||||
GVAR(selectedTarget) = objNull;
|
||||
|
||||
|
@ -14,9 +14,23 @@
|
||||
|
||||
if(GVAR(actionSelected)) then {
|
||||
this = GVAR(selectedTarget);
|
||||
|
||||
private ["_player","_target","_actionData"];
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player, (GVAR(selectedAction) select 0) select 6] call GVAR(selectedStatement);
|
||||
|
||||
// Clear the conditions caches
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
|
||||
// Check the action conditions
|
||||
_actionData = GVAR(selectedAction) select 0;
|
||||
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||
// Call the statement
|
||||
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||
|
||||
// Clear the conditions caches again if the action was performed
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(keyDown)) then {
|
||||
|
@ -18,9 +18,23 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
|
||||
|
||||
if(GVAR(actionSelected)) then {
|
||||
this = GVAR(selectedTarget);
|
||||
|
||||
private ["_player","_target","_actionData"];
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player, (GVAR(selectedAction) select 0) select 6] call GVAR(selectedStatement);
|
||||
|
||||
// Clear the conditions caches
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
|
||||
// Check the action conditions
|
||||
_actionData = GVAR(selectedAction) select 0;
|
||||
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||
// Call the statement
|
||||
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||
|
||||
// Clear the conditions caches again if the action was performed
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(keyDownSelfAction)) then {
|
||||
|
@ -144,7 +144,6 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
GVAR(actionSelected) = true;
|
||||
GVAR(selectedAction) = (_closest select 0) select 1;
|
||||
GVAR(selectedTarget) = (GVAR(selectedAction)) select 2;
|
||||
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
|
||||
|
||||
_misMatch = false;
|
||||
_hoverPath = (_closest select 2);
|
||||
@ -180,7 +179,19 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
this = GVAR(selectedTarget);
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player, (GVAR(selectedAction) select 0) select 6] call GVAR(selectedStatement);
|
||||
|
||||
// Clear the conditions caches
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
|
||||
// Check the action conditions
|
||||
_actionData = GVAR(selectedAction) select 0;
|
||||
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||
// Call the statement
|
||||
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||
|
||||
// Clear the conditions caches again if the action was performed
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -19,4 +19,4 @@
|
||||
#define MAX_DURATION_CACHE 2
|
||||
|
||||
// parameters, function, namespace, uid
|
||||
[_this, DFUNC(canTreat), _this select 0, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE] call EFUNC(common,cachedCall);
|
||||
[_this, DFUNC(canTreat), _this select 0, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall);
|
||||
|
Loading…
Reference in New Issue
Block a user