-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init code, when it depends on CBA settings, now executes when the CBA_SettingsInitialized event is triggered.
- Loading branch information
1 parent
3533132
commit c80c9a7
Showing
15 changed files
with
317 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
[] call FUNC(initCommonEventhandlers); | ||
[] call FUNC(initCommonEventhandlers); | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
["lifecycle", ["lfc_life"], FUNC(sm_emotions)] call EFUNC(common,augmentStateMachine); | ||
["lifecycle", ["lfc_life"], FUNC(sm_activities)] call EFUNC(common,augmentStateMachine); | ||
[ | ||
QEGVAR(lifecycle,civ_added), | ||
{ | ||
if (isServer || CBA_isHeadlessClient) then { | ||
["lifecycle", ["lfc_life"], FUNC(sm_emotions)] call EFUNC(common,augmentStateMachine); | ||
["lifecycle", ["lfc_life"], FUNC(sm_activities)] call EFUNC(common,augmentStateMachine); | ||
[ | ||
QEGVAR(lifecycle,civ_added), | ||
{ | ||
[_x] call FUNC(onCivAdded); | ||
} forEach _this; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
}; | ||
{ | ||
[_x] call FUNC(onCivAdded); | ||
} forEach _this; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
}; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
["business", ["bus_rally"], FUNC(sm_business)] call EFUNC(common,augmentStateMachine); | ||
}; | ||
if (isServer || CBA_isHeadlessClient) then { | ||
["business", ["bus_rally"], FUNC(sm_business)] call EFUNC(common,augmentStateMachine); | ||
}; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
[QGVAR(switchMove), { | ||
params ["_unit", "_animation"]; | ||
_unit switchMove _animation; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
[QGVAR(switchMove), { | ||
params ["_unit", "_animation"]; | ||
_unit switchMove _animation; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,50 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
if (hasInterface) then { | ||
call FUNC(showOnMap); | ||
call FUNC(showPointingHints); | ||
call FUNC(showInfoLine); | ||
call FUNC(showFps); | ||
}; | ||
if (hasInterface) then { | ||
call FUNC(showOnMap); | ||
call FUNC(showPointingHints); | ||
call FUNC(showInfoLine); | ||
call FUNC(showFps); | ||
}; | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
GVAR(debugLoopHandle) = [{ | ||
params ["", "_handle"]; | ||
if (hasInterface && (!isGameFocused || isGamePaused)) exitWith {}; | ||
if (call EGVAR(lifecycle,EXITON)) exitWith {[_handle] call CBA_fnc_removePerFrameHandler}; | ||
if (GVAR(showInfoLine)) then { | ||
{ _x call FUNC(updateInfoLine); } forEach EGVAR(lifecycle,localCivs); | ||
}; | ||
}, 1, []] call CBA_fnc_addPerFrameHandler; | ||
|
||
[ | ||
{ | ||
if (GVAR(showFps)) then { | ||
[QGVAR(fps), [clientOwner, diag_fps, count EGVAR(lifecycle,localCivs)]] call CBA_fnc_globalEvent; | ||
if (isServer || CBA_isHeadlessClient) then { | ||
GVAR(debugLoopHandle) = [{ | ||
params ["", "_handle"]; | ||
if (hasInterface && (!isGameFocused || isGamePaused)) exitWith {}; | ||
if (call EGVAR(lifecycle,EXITON)) exitWith {[_handle] call CBA_fnc_removePerFrameHandler}; | ||
if (GVAR(showInfoLine)) then { | ||
{ _x call FUNC(updateInfoLine); } forEach EGVAR(lifecycle,localCivs); | ||
}; | ||
}, | ||
2, | ||
[] | ||
] call CBA_fnc_addPerFrameHandler; | ||
}; | ||
}, 1, []] call CBA_fnc_addPerFrameHandler; | ||
|
||
[ | ||
{ | ||
if (GVAR(showFps)) then { | ||
[QGVAR(fps), [clientOwner, diag_fps, count EGVAR(lifecycle,localCivs)]] call CBA_fnc_globalEvent; | ||
}; | ||
}, | ||
2, | ||
[] | ||
] call CBA_fnc_addPerFrameHandler; | ||
}; | ||
|
||
if (isServer) then { | ||
[ | ||
QEGVAR(lifecycle,civ_added), | ||
{ | ||
if (isServer) then { | ||
[ | ||
QEGVAR(lifecycle,civ_added), | ||
{ | ||
private _civ = _x; | ||
_civ setVariable [QGVAR(localAt), owner _civ, true]; | ||
_civ addEventHandler ["Local", { | ||
params ["_civ", ""]; | ||
{ | ||
private _civ = _x; | ||
_civ setVariable [QGVAR(localAt), owner _civ, true]; | ||
}]; | ||
} forEach _this; | ||
_civ addEventHandler ["Local", { | ||
params ["_civ", ""]; | ||
_civ setVariable [QGVAR(localAt), owner _civ, true]; | ||
}]; | ||
} forEach _this; | ||
|
||
} | ||
] call CBA_fnc_addEventHandler; | ||
}; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
}; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
if (!(GVAR(enabled))) exitWith {}; | ||
if (!(GVAR(enabled))) exitWith {}; | ||
|
||
if (hasInterface) then { | ||
player addEventHandler ["GetInMan", FUNC(onGetInMan)]; | ||
player addEventHandler ["GetOutMan", FUNC(onGetOutMan)]; | ||
player addEventHandler ["SeatSwitchedMan", FUNC(onSeatSwitchedMan)]; | ||
}; | ||
if (hasInterface) then { | ||
player addEventHandler ["GetInMan", FUNC(onGetInMan)]; | ||
player addEventHandler ["GetOutMan", FUNC(onGetOutMan)]; | ||
player addEventHandler ["SeatSwitchedMan", FUNC(onSeatSwitchedMan)]; | ||
}; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
if (hasInterface) then { | ||
call FUNC(aceInteractWrapper); | ||
if (isNil "ace_interact_menu_fnc_createAction") then { | ||
WARNING("ACE interact not loaded - this limits interaction with civilians"); | ||
} else { | ||
call FUNC(addCivInteractions); | ||
}; | ||
if (hasInterface) then { | ||
call FUNC(aceInteractWrapper); | ||
if (isNil "ace_interact_menu_fnc_createAction") then { | ||
WARNING("ACE interact not loaded - this limits interaction with civilians"); | ||
} else { | ||
call FUNC(addCivInteractions); | ||
}; | ||
|
||
|
||
[{ | ||
if (!isGameFocused || isGamePaused) exitWith {}; | ||
[] call FUNC(checkWeaponOnCivilianPointer); | ||
}, 0.5, []] call CBA_fnc_addPerFrameHandler; | ||
private _playerUnit = call CBA_fnc_currentUnit; | ||
_playerUnit addEventHandler ["GetInMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["SeatSwitchedMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["GetOutMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["Killed", { FUNC(vehicleSeatHandler) }]; | ||
_playerUnit addEventHandler ["Respawn", { FUNC(vehicleSeatHandler) }]; | ||
[] call FUNC(vehicleSeatHandler); | ||
}; | ||
[{ | ||
if (!isGameFocused || isGamePaused) exitWith {}; | ||
[] call FUNC(checkWeaponOnCivilianPointer); | ||
}, 0.5, []] call CBA_fnc_addPerFrameHandler; | ||
private _playerUnit = call CBA_fnc_currentUnit; | ||
_playerUnit addEventHandler ["GetInMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["SeatSwitchedMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["GetOutMan", FUNC(vehicleSeatHandler)]; | ||
_playerUnit addEventHandler ["Killed", { FUNC(vehicleSeatHandler) }]; | ||
_playerUnit addEventHandler ["Respawn", { FUNC(vehicleSeatHandler) }]; | ||
[] call FUNC(vehicleSeatHandler); | ||
}; | ||
|
||
[] call FUNC(addInteractEventHandlers); | ||
[] call FUNC(addInteractEventHandlers); | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
["activities", ["act_business"], FUNC(sm_activities)] call EFUNC(common,augmentStateMachine); | ||
}; | ||
if (isServer || CBA_isHeadlessClient) then { | ||
["activities", ["act_business"], FUNC(sm_activities)] call EFUNC(common,augmentStateMachine); | ||
}; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
ISNILS(GVAR(EXITON), {false}); | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
[] call FUNC(initHCs); | ||
}; | ||
|
||
[ | ||
QGVAR(do_dismiss_civ), | ||
{ | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
ISNILS(GVAR(EXITON), {false}); | ||
|
||
if (isServer || CBA_isHeadlessClient) then { | ||
[] call FUNC(initHCs); | ||
}; | ||
|
||
[ | ||
QGVAR(do_dismiss_civ), | ||
{ | ||
params [ | ||
["_object", objNull, [objNull, grpNull]] | ||
]; | ||
if (!((leader _object) in GVAR(localCivs))) exitWith { | ||
INFO_2("not dismissing %1 (%2) as it is not local civ led", _object, typeName _object); | ||
}; | ||
|
||
if (_object isEqualType grpNull) then { | ||
[_object] call FUNC(dismissGroup); | ||
} else { | ||
[_object] call FUNC(dismissCiv); | ||
}; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
|
||
|
||
["ace_unconscious", { | ||
params [ | ||
["_object", objNull, [objNull, grpNull]] | ||
["_unit", objNull, [objNull]], | ||
["_isUnconscious", true, [true]] | ||
]; | ||
if (!((leader _object) in GVAR(localCivs))) exitWith { | ||
INFO_2("not dismissing %1 (%2) as it is not local civ led", _object, typeName _object); | ||
}; | ||
|
||
if (_object isEqualType grpNull) then { | ||
[_object] call FUNC(dismissGroup); | ||
} else { | ||
[_object] call FUNC(dismissCiv); | ||
}; | ||
} | ||
] call CBA_fnc_addEventHandler; | ||
|
||
|
||
["ace_unconscious", { | ||
params [ | ||
["_unit", objNull, [objNull]], | ||
["_isUnconscious", true, [true]] | ||
]; | ||
|
||
private _eventName = if (_isUnconscious) then {QGVAR(unconscious)} else {QGVAR(conscious)}; | ||
[_eventName, [_unit], _unit] call CBA_fnc_targetEvent; | ||
private _eventName = if (_isUnconscious) then {QGVAR(unconscious)} else {QGVAR(conscious)}; | ||
[_eventName, [_unit], _unit] call CBA_fnc_targetEvent; | ||
|
||
}] call CBA_fnc_addEventHandler; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
#include "script_component.hpp" | ||
|
||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith {}; | ||
|
||
[QEGVAR(lifecycle,civ_added), { | ||
{ | ||
private _civ = _x; | ||
if (local _civ) then { | ||
[_civ] call FUNC(civAddLoadout); | ||
}; | ||
} forEach _this; | ||
}] call CBA_fnc_addEventHandler; | ||
[QEGVAR(lifecycle,civ_added), { | ||
{ | ||
private _civ = _x; | ||
if (local _civ) then { | ||
[_civ] call FUNC(civAddLoadout); | ||
}; | ||
} forEach _this; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
[QGVAR(broadcastFace), { | ||
params [ | ||
["_unit", objNull, [objNull]], | ||
["_face", "", [""]] | ||
]; | ||
if (isNull _unit) exitWith {}; | ||
_unit setFace _face; | ||
[QGVAR(broadcastFace), { | ||
params [ | ||
["_unit", objNull, [objNull]], | ||
["_face", "", [""]] | ||
]; | ||
if (isNull _unit) exitWith {}; | ||
_unit setFace _face; | ||
}] call CBA_fnc_addEventHandler; | ||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#include "script_component.hpp" | ||
|
||
["CBA_SettingsInitialized", { | ||
if (!(EGVAR(main,enabled))) exitWith { | ||
INFO("GRAD civs is disabled. Good bye!"); | ||
}; | ||
|
||
if (!(EGVAR(main,enabled))) exitWith { | ||
INFO("GRAD civs is disabled. Good bye!"); | ||
}; | ||
|
||
INFO_3("I am a player: %1 | HC: %2 | Server: %3", hasInterface, CBA_isHeadlessClient, isServer); | ||
INFO_3("I am a player: %1 | HC: %2 | Server: %3", hasInterface, CBA_isHeadlessClient, isServer); | ||
}] call CBA_fnc_addEventHandler; |
Oops, something went wrong.