From 1b0e1fce9680ca9e98a66eb14453fd402f93722b Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Tue, 21 Jun 2016 16:44:02 +0200 Subject: [PATCH] Removed diag_logs, used isEqualType, add support for inherition, use deleteNamespace --- addons/statemachine/fnc_addState.sqf | 3 --- addons/statemachine/fnc_create.sqf | 2 +- addons/statemachine/fnc_createFromConfig.sqf | 6 +++--- addons/statemachine/fnc_delete.sqf | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/statemachine/fnc_addState.sqf b/addons/statemachine/fnc_addState.sqf index a5d588cdb..1311d78e8 100644 --- a/addons/statemachine/fnc_addState.sqf +++ b/addons/statemachine/fnc_addState.sqf @@ -58,12 +58,9 @@ _stateMachine setVariable [ONSTATEENTERED(_name), _onStateEntered]; _stateMachine setVariable [ONSTATELEAVING(_name), _onStateLeaving]; _stateMachine setVariable [TRANSITIONS(_name), []]; -diag_log "derp"; - // First state added is always the intial state if (isNil {_stateMachine getVariable QGVAR(initialState)}) then { _stateMachine setVariable [QGVAR(initialState), _name]; - diag_log "initial state set"; }; _name diff --git a/addons/statemachine/fnc_create.sqf b/addons/statemachine/fnc_create.sqf index 6e4c6349b..f3e2f6fb9 100644 --- a/addons/statemachine/fnc_create.sqf +++ b/addons/statemachine/fnc_create.sqf @@ -32,7 +32,7 @@ if (isNil QGVAR(stateMachines)) then { }; private _updateCode = {}; -if (typeName _list == "CODE") then { +if (_list isEqualType {}) then { _updateCode = _list; _list = [] call _updateCode; }; diff --git a/addons/statemachine/fnc_createFromConfig.sqf b/addons/statemachine/fnc_createFromConfig.sqf index 8d355e94a..5621c5d95 100644 --- a/addons/statemachine/fnc_createFromConfig.sqf +++ b/addons/statemachine/fnc_createFromConfig.sqf @@ -37,7 +37,7 @@ private _stateMachine = [_list] call FUNC(create); [_stateMachine, _onState, _onStateEntered, _onStateLeaving, _state] call FUNC(addState); false -} count ("true" configClasses _config); +} count (configProperties [_x, "isClass _x", true]); // We need to add the transitions in a second loop to make sure the states exist already { @@ -51,9 +51,9 @@ private _stateMachine = [_list] call FUNC(create); [_stateMachine, _state, _targetState, _condition, _onTransition, _transition] call FUNC(addTransition); false - } count ("true" configClasses _x); + } count (configProperties [_x, "isClass _x", true]); false -} count ("true" configClasses _config); +} count (configProperties [_x, "isClass _x", true]); _stateMachine diff --git a/addons/statemachine/fnc_delete.sqf b/addons/statemachine/fnc_delete.sqf index ae11434b1..03a007df3 100644 --- a/addons/statemachine/fnc_delete.sqf +++ b/addons/statemachine/fnc_delete.sqf @@ -27,5 +27,5 @@ if (isNil QGVAR(stateMachines)) exitWith {}; private _index = GVAR(stateMachines) find _stateMachine; if (_index != -1) then { GVAR(stateMachines) deleteAt _index; - deleteLocation _stateMachine; + [_stateMachine] call CBA_fnc_deleteNamespace; };