add conditions on post init

This commit is contained in:
commy2 2015-03-15 09:26:16 +01:00
parent 876424695e
commit 4dab0b73d5
8 changed files with 15 additions and 47 deletions

View File

@ -36,3 +36,9 @@ if (isServer) then {
// [_unit, "wokeUp", {
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp};
// }] call ACE_Core_fnc_addCustomEventhandler;
if (!hasInterface) exitWith {};
["isNotEscorting", {!(GETVAR(_this select 0,GVAR(isEscorting),false))}] call EFUNC(common,addCanInteractWithConditon);
["isNotHandcuffed", {!(GETVAR(_this select 0,GVAR(isHandcuffed),false))}] call EFUNC(common,addCanInteractWithConditon);
["isNotSurrendering", {!(GETVAR(_this select 0,GVAR(isSurrendering),false))}] call EFUNC(common,addCanInteractWithConditon);

View File

@ -16,16 +16,3 @@ class CfgPatches {
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
class ACE_canInteractConditions {
class GVAR(isNotEscorting) {
condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
};
class GVAR(isNotHandcuffed) {
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
};
class GVAR(isNotSurrendering) {
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
};
};

View File

@ -55,8 +55,6 @@ if (_currentVersion != _previousVersion) then {
if (!hasInterface) exitWith {};
call COMPILE_FILE(scripts\assignedItemFix);
call COMPILE_FILE(scripts\initCanInteractFunction);
call COMPILE_FILE(scripts\initScrollWheel);
0 spawn {
@ -161,3 +159,8 @@ _vehicle setFuel _fuelLevel;
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithConditon);
//@todo remove obsolete
GVAR(canInteract) = {true};

View File

@ -51,12 +51,6 @@ class ACE_Rsc_Control_Base {
h = 0;
};
class ACE_canInteractConditions {
class GVAR(notOnMap) {
condition = "!visibleMap";
};
};
class ACE_Settings {
/*
*class GVAR(sampleSetting) {

View File

@ -20,6 +20,8 @@ _unit = _this select 0;
_target = _this select 1;
_exceptions = _this select 2;
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
// exit if the target is not free to interact
private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull];

View File

@ -1,20 +0,0 @@
// by commy2
#include "script_component.hpp"
private ["_function", "_configFile", "_count", "_index", "_config", "_configName", "_condition"];
_function = "private '_exceptions'; _exceptions = _this; alive ACE_player";
_configFile = configFile >> "ACE_canInteractConditions";
_count = count _configFile;
for "_index" from 0 to (_count -1) do {
_config = _configFile select _index;
_configName = configName _config;
_condition = getText (_config >> "condition");
_function = _function + format ["&& {%1 || {'%2' in _exceptions}}", _condition, _configName];
};
GVAR(canInteract) = compileFinal _function;

View File

@ -69,3 +69,5 @@ GVAR(isOpeningDoor) = false;
false;
},
[29, [false, false, false]], false] call cba_fnc_addKeybind;
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithConditon);

View File

@ -24,9 +24,3 @@ class ACE_Settings {
typeName = "BOOL";
};
};
class ACE_canInteractConditions {
class GVAR(isNotSwimming) {
condition = QUOTE( !underwater ACE_player );
};
};