From 00b5bd895c87173ead882483e67fdee6231c6473 Mon Sep 17 00:00:00 2001 From: Moritz Schmidt Date: Sun, 13 Dec 2020 17:46:33 +0100 Subject: [PATCH] fix #104 and also probably last big refactor - split "legacy" module into "lifecycle" and "activities" (#106) * add vanilla military buildings to exclusion lists, put lists into GVARs * addNestedStateMachine to nest another machine within a compound state * split legacy -> activities,lifecycle * move % rename lots of settings * move civClasses setting, localCivs array & getter, civ_added|removed events into lifecycle module * unify & fix dismount conditions, add (!not driver) --- README.md | 16 ++--- addons/activities/$PBOPREFIX$ | 1 + .../CfgEventHandlers.hpp | 0 addons/{legacy => activities}/XEH_PREP.hpp | 24 -------- addons/activities/XEH_postInit.sqf | 11 ++++ addons/{legacy => activities}/XEH_preInit.sqf | 0 addons/{legacy => activities}/config.cpp | 0 .../functions/fnc_adoptAbandonedCivs.sqf | 2 +- .../functions/fnc_deleteIfDamaged.sqf | 0 .../functions/fnc_doCarryOn.sqf | 0 .../functions/fnc_doCustomActivity.sqf | 0 .../functions/fnc_doReverse.sqf | 0 .../functions/fnc_doStop.sqf | 0 .../functions/fnc_doingCustomActivity.sqf | 0 .../functions/fnc_endCustomActivity.sqf | 0 .../functions/fnc_findPositionOfInterest.sqf | 0 .../functions/fnc_forceEmotionSpeed.sqf | 0 .../functions/fnc_forcePanicSpeed.sqf | 0 .../functions/fnc_handleAceUnconscious.sqf | 0 .../functions/fnc_initCommonEventhandlers.sqf | 0 .../activities/functions/fnc_initConfig.sqf | 16 +++++ .../functions/fnc_isInHouse.sqf | 0 .../functions/fnc_isStopped.sqf | 0 .../activities/functions/fnc_onCivAdded.sqf | 7 +++ .../functions/fnc_overclockStateMachines.sqf | 0 .../functions/fnc_reverse.spec.sqf | 10 ++-- .../functions/fnc_reverse.sqf | 0 .../functions/fnc_reverse_abort.sqf | 0 .../functions/fnc_reverse_internal_end.sqf | 0 .../functions/fnc_reverse_internal_pfh.sqf | 0 .../fnc_reverse_internal_stopCondition.sqf | 0 .../functions/fnc_sm_activities.sqf | 11 +++- ...nc_sm_activities_state_asOrdered_enter.sqf | 0 ...fnc_sm_activities_state_asOrdered_exit.sqf | 0 .../fnc_sm_activities_state_panic_enter.sqf | 0 .../fnc_sm_activities_state_panic_exit.sqf | 0 ...ivities_trans_business_panic_condition.sqf | 0 .../functions/fnc_sm_business.sqf | 0 .../fnc_sm_business_state_rally_enter.sqf | 0 .../functions/fnc_sm_emotions.sqf | 14 +++-- .../functions/fnc_sm_panic.sqf | 0 .../fnc_sm_panic_state_flight_enter.sqf | 0 .../fnc_sm_panic_state_flight_loop.sqf | 0 .../fnc_sm_panic_state_hidden_enter.sqf | 0 .../fnc_sm_panic_state_hide_enter.sqf | 0 ...c_sm_panic_trans_hide_hidden_condition.sqf | 0 ...fnc_sm_panic_trans_hide_hidden_handler.sqf | 0 .../functions/fnc_uid.sqf | 0 addons/activities/script_component.hpp | 14 +++++ addons/cars/XEH_PREP.hpp | 1 + addons/cars/XEH_postInit.sqf | 1 + addons/cars/config.cpp | 2 +- .../cars/functions/fnc_dismountCondition.sqf | 9 +++ .../cars/functions/fnc_getGlobalVehicles.sqf | 2 +- addons/cars/functions/fnc_initConfig.sqf | 2 +- ...iness_trans_mountUp_dismount_condition.sqf | 4 +- addons/cars/functions/fnc_spawnCarAndCrew.sqf | 2 +- addons/cars/functions/fnc_spawnVehicle.sqf | 2 +- addons/cba_statemachine/XEH_PREP.hpp | 1 + .../functions/fnc_addCompoundState.sqf | 10 ++-- .../functions/fnc_addNestedStateMachine.sqf | 16 +++++ .../functions/fnc_addState.sqf | 6 -- .../functions/fnc_addTransition.sqf | 5 -- .../functions/fnc_removeFromStateMachine.sqf | 3 - addons/cba_statemachine/script_component.hpp | 13 +++++ addons/common/XEH_PREP.hpp | 4 -- addons/common/XEH_postInit.sqf | 18 ------ addons/common/XEH_preInit.sqf | 3 - addons/common/functions/fnc_initConfig.sqf | 16 ----- addons/diagnostics/XEH_postInit.sqf | 8 +-- addons/diagnostics/config.cpp | 2 +- .../diagnostics/functions/fnc_initConfig.sqf | 2 +- .../functions/fnc_showInfoLine.sqf | 2 +- .../diagnostics/functions/fnc_showOnMap.sqf | 2 +- .../functions/fnc_showPinkArrows.sqf | 4 +- addons/gta/XEH_postInit.sqf | 2 +- addons/gta/functions/fnc_initConfig.sqf | 5 +- .../functions/fnc_isUnitBeingSeenByCivs.sqf | 2 +- addons/interact/config.cpp | 2 +- .../functions/fnc_aceInteractWrapper.sqf | 4 +- .../functions/fnc_addCivInteractions.sqf | 2 +- .../fnc_addInteractEventHandlers.sqf | 6 +- .../functions/fnc_checkHonkingOnCivilian.sqf | 2 +- .../functions/fnc_handleGestureGo.sqf | 2 +- .../functions/fnc_handleGestureStop.sqf | 2 +- .../functions/fnc_interact_carryOnAction.sqf | 2 +- .../fnc_interact_carryOnCondition.sqf | 2 +- .../functions/fnc_interact_stopAction.sqf | 2 +- addons/legacy/$PBOPREFIX$ | 1 - addons/legacy/XEH_postInit.sqf | 11 ---- addons/lifecycle/$PBOPREFIX$ | 1 + addons/lifecycle/CfgEventHandlers.hpp | 14 +++++ addons/lifecycle/XEH_PREP.hpp | 25 ++++++++ addons/lifecycle/XEH_postInit.sqf | 27 +++++++++ addons/lifecycle/XEH_preInit.sqf | 34 +++++++++++ addons/lifecycle/config.cpp | 15 +++++ .../functions/fnc_cleanupLocalCivs.sqf | 0 .../functions/fnc_config_getCivClasses.sqf | 2 +- .../functions/fnc_dismissCiv.sqf | 2 +- .../functions/fnc_dismissGroup.sqf | 0 .../functions/fnc_findBuildings.sqf | 0 .../functions/fnc_findRandomPos.sqf | 0 .../functions/fnc_findRandomPosArea.sqf | 0 .../functions/fnc_findSpawnPosition.spec.sqf | 2 +- .../functions/fnc_findSpawnPosition.sqf | 0 .../functions/fnc_findUnclaimedHouse.sqf | 27 ++------- .../functions/fnc_getGlobalCivs.sqf | 6 +- .../functions/fnc_globalSpawnPass.sqf | 0 .../functions/fnc_initConfig.sqf | 58 +++++++++---------- .../functions/fnc_initHCs.sqf | 0 .../fnc_isInDistanceFromOtherPlayers.sqf | 0 .../functions/fnc_localSpawnPass.sqf | 0 .../functions/fnc_sm_lifecycle.sqf | 7 +-- .../fnc_sm_lifecycle_state_death_enter.sqf | 2 +- .../fnc_sm_lifecycle_state_despawn_enter.sqf | 4 +- .../fnc_sm_lifecycle_state_life_enter.sqf | 0 .../fnc_sm_lifecycle_state_life_exit.sqf | 0 .../fnc_sm_lifecycle_state_spawn_enter.sqf | 3 +- ...lifecycle_trans_life_despawn_condition.sqf | 0 .../functions/fnc_spawnCivilian.sqf | 4 +- .../functions/fnc_spawnCivilianGroup.sqf | 0 .../script_component.hpp | 2 +- addons/loadout/XEH_postInit.sqf | 2 +- addons/loadout/functions/fnc_initConfig.sqf | 2 +- addons/mimikry/config.cpp | 2 +- .../functions/fnc_addEventHandlers.sqf | 6 +- addons/mimikry/functions/fnc_initConfig.sqf | 2 +- addons/patrol/XEH_postInit.sqf | 4 +- addons/patrol/config.cpp | 2 +- addons/patrol/functions/fnc_addFootsy.sqf | 4 +- addons/patrol/functions/fnc_initConfig.sqf | 14 ++--- .../fnc_sm_business_state_patrol_enter.sqf | 2 +- .../patrol/functions/fnc_taskPatrol.spec.sqf | 4 +- .../functions/fnc_taskPatrolFindWaypoint.sqf | 4 +- .../fnc_taskPatrolFindWaypoints.spec.sqf | 4 +- addons/residents/XEH_PREP.hpp | 1 + addons/residents/XEH_postInit.sqf | 4 +- addons/residents/config.cpp | 2 +- .../residents/functions/fnc_addResident.sqf | 4 +- .../functions/fnc_compare.sqf | 0 addons/residents/functions/fnc_initConfig.sqf | 2 +- .../fnc_sm_business_state_housework_enter.sqf | 2 +- ...nc_sm_business_state_meetNeighbor_loop.sqf | 4 +- ...trans_housework_meetNeighbor_condition.sqf | 2 +- addons/transit/XEH_postInit.sqf | 2 +- addons/transit/functions/fnc_initConfig.sqf | 2 +- .../fnc_sm_business_state_transit_loop.sqf | 2 +- ...iness_trans_transit_dismount_condition.sqf | 2 +- addons/voyage/XEH_postInit.sqf | 4 +- addons/voyage/config.cpp | 2 +- addons/voyage/functions/fnc_addCarCrew.sqf | 2 +- .../functions/fnc_findSpawnRoadSegment.sqf | 2 +- addons/voyage/functions/fnc_initConfig.sqf | 4 +- .../fnc_sm_business_state_voyage_loop.sqf | 2 +- ...siness_trans_voyage_dismount_condition.sqf | 2 +- addons/zeus/config.cpp | 2 +- .../fnc_context_condition_doCarryOn.sqf | 2 +- .../fnc_context_statement_dismissCiv.sqf | 2 +- .../fnc_context_statement_doCarryOn.sqf | 2 +- .../fnc_context_statement_doStop.sqf | 2 +- 160 files changed, 381 insertions(+), 276 deletions(-) create mode 100644 addons/activities/$PBOPREFIX$ rename addons/{legacy => activities}/CfgEventHandlers.hpp (100%) rename addons/{legacy => activities}/XEH_PREP.hpp (64%) create mode 100644 addons/activities/XEH_postInit.sqf rename addons/{legacy => activities}/XEH_preInit.sqf (100%) rename addons/{legacy => activities}/config.cpp (100%) rename addons/{legacy => activities}/functions/fnc_adoptAbandonedCivs.sqf (90%) rename addons/{legacy => activities}/functions/fnc_deleteIfDamaged.sqf (100%) rename addons/{legacy => activities}/functions/fnc_doCarryOn.sqf (100%) rename addons/{legacy => activities}/functions/fnc_doCustomActivity.sqf (100%) rename addons/{legacy => activities}/functions/fnc_doReverse.sqf (100%) rename addons/{legacy => activities}/functions/fnc_doStop.sqf (100%) rename addons/{legacy => activities}/functions/fnc_doingCustomActivity.sqf (100%) rename addons/{legacy => activities}/functions/fnc_endCustomActivity.sqf (100%) rename addons/{legacy => activities}/functions/fnc_findPositionOfInterest.sqf (100%) rename addons/{legacy => activities}/functions/fnc_forceEmotionSpeed.sqf (100%) rename addons/{legacy => activities}/functions/fnc_forcePanicSpeed.sqf (100%) rename addons/{legacy => activities}/functions/fnc_handleAceUnconscious.sqf (100%) rename addons/{legacy => activities}/functions/fnc_initCommonEventhandlers.sqf (100%) create mode 100644 addons/activities/functions/fnc_initConfig.sqf rename addons/{legacy => activities}/functions/fnc_isInHouse.sqf (100%) rename addons/{legacy => activities}/functions/fnc_isStopped.sqf (100%) create mode 100644 addons/activities/functions/fnc_onCivAdded.sqf rename addons/{legacy => activities}/functions/fnc_overclockStateMachines.sqf (100%) rename addons/{legacy => activities}/functions/fnc_reverse.spec.sqf (97%) rename addons/{legacy => activities}/functions/fnc_reverse.sqf (100%) rename addons/{legacy => activities}/functions/fnc_reverse_abort.sqf (100%) rename addons/{legacy => activities}/functions/fnc_reverse_internal_end.sqf (100%) rename addons/{legacy => activities}/functions/fnc_reverse_internal_pfh.sqf (100%) rename addons/{legacy => activities}/functions/fnc_reverse_internal_stopCondition.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_activities.sqf (92%) rename addons/{legacy => activities}/functions/fnc_sm_activities_state_asOrdered_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_activities_state_asOrdered_exit.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_activities_state_panic_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_activities_state_panic_exit.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_activities_trans_business_panic_condition.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_business.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_business_state_rally_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_emotions.sqf (92%) rename addons/{legacy => activities}/functions/fnc_sm_panic.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_state_flight_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_state_flight_loop.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_state_hidden_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_state_hide_enter.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_trans_hide_hidden_condition.sqf (100%) rename addons/{legacy => activities}/functions/fnc_sm_panic_trans_hide_hidden_handler.sqf (100%) rename addons/{legacy => activities}/functions/fnc_uid.sqf (100%) create mode 100644 addons/activities/script_component.hpp create mode 100644 addons/cars/functions/fnc_dismountCondition.sqf create mode 100644 addons/cba_statemachine/functions/fnc_addNestedStateMachine.sqf delete mode 100644 addons/common/functions/fnc_initConfig.sqf delete mode 100644 addons/legacy/$PBOPREFIX$ delete mode 100644 addons/legacy/XEH_postInit.sqf create mode 100644 addons/lifecycle/$PBOPREFIX$ create mode 100644 addons/lifecycle/CfgEventHandlers.hpp create mode 100644 addons/lifecycle/XEH_PREP.hpp create mode 100644 addons/lifecycle/XEH_postInit.sqf create mode 100644 addons/lifecycle/XEH_preInit.sqf create mode 100644 addons/lifecycle/config.cpp rename addons/{legacy => lifecycle}/functions/fnc_cleanupLocalCivs.sqf (100%) rename addons/{common => lifecycle}/functions/fnc_config_getCivClasses.sqf (58%) rename addons/{common => lifecycle}/functions/fnc_dismissCiv.sqf (93%) rename addons/{common => lifecycle}/functions/fnc_dismissGroup.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_findBuildings.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_findRandomPos.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_findRandomPosArea.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_findSpawnPosition.spec.sqf (98%) rename addons/{legacy => lifecycle}/functions/fnc_findSpawnPosition.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_findUnclaimedHouse.sqf (70%) rename addons/{legacy => lifecycle}/functions/fnc_getGlobalCivs.sqf (89%) rename addons/{legacy => lifecycle}/functions/fnc_globalSpawnPass.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_initConfig.sqf (87%) rename addons/{legacy => lifecycle}/functions/fnc_initHCs.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_isInDistanceFromOtherPlayers.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_localSpawnPass.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle.sqf (91%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_state_death_enter.sqf (90%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_state_despawn_enter.sqf (75%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_state_life_enter.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_state_life_exit.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_state_spawn_enter.sqf (91%) rename addons/{legacy => lifecycle}/functions/fnc_sm_lifecycle_trans_life_despawn_condition.sqf (100%) rename addons/{legacy => lifecycle}/functions/fnc_spawnCivilian.sqf (78%) rename addons/{legacy => lifecycle}/functions/fnc_spawnCivilianGroup.sqf (100%) rename addons/{legacy => lifecycle}/script_component.hpp (91%) rename addons/{legacy => residents}/functions/fnc_compare.sqf (100%) diff --git a/README.md b/README.md index c222b67a..4f365316 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ common events: ["grad_civs_vehicleTheft", { params ["_vehicle", "_thief"]; }] call CBA_fnc_addEventHandler; -### grad_civs_legacy_fnc_doCustomActivity +### grad_civs_activities_fnc_doCustomActivity To let civilians break from their usual activity and do something else for a limited time. @@ -108,7 +108,7 @@ Example: [], "hiding", "pooped my pants, hiding for ten minutes" -] call grad_civs_legacy_fnc_doCustomActivity; +] call grad_civs_activities_fnc_doCustomActivity; ``` **NOTE**: this whole thing will *NOT* work while they are panicking. @@ -173,7 +173,7 @@ headgear | Array - All classnames of clothes that civilians may wear. Sets all backpacks that civilians may wear and sets probability. Overwrites value from CBA settings. Execute globally #### Syntax -`[backpacks,probability] call grad_civs_legacy_fnc_setHeadgear` +`[backpacks,probability] call grad_civs_loadout_fnc_setHeadgear` Parameter | Explanation ------------|----------------------------------------------------------------------- @@ -227,9 +227,9 @@ Let's have a very simple example: ```sqf MY_CIV_LIST = ["C_Offroad_01_F" createVehicle position player]; _machine = [{MY_CIV_LIST}] call CBA_statemachine_fnc_create; -_state_init = [_machine, { diag_log "init"; }, { diag_log "onEnter_init" }, { diag_log "onExit_init" }] call grad_civs_legacy_fnc_addState; -_state_stuff = [_machine, {diag_log "wörk" }, {diag_log "onEnter_wörk"}, {}] call grad_civs_legacy_fnc_addState; -_transition = [_machine, _state_init, _state_stuff, {CBA_missionTime > 30}, {diag_log "changing state" }] call grad_civs_legacy_fnc_addTransition; +_state_init = [_machine, { diag_log "init"; }, { diag_log "onEnter_init" }, { diag_log "onExit_init" }] call grad_civs_cba_statemachine_fnc_addState; +_state_stuff = [_machine, {diag_log "wörk" }, {diag_log "onEnter_wörk"}, {}] call grad_civs_cba_statemachine_fnc_addState; +_transition = [_machine, _state_init, _state_stuff, {CBA_missionTime > 30}, {diag_log "changing state" }] call grad_civs_cba_statemachine_fnc_addTransition; ``` this will print something like this to RPT: @@ -252,12 +252,12 @@ wörk In our case, and with CBA state machines, that means: * we have a bunch of state machines, chief of which is the *activities* state machine. It is implemented in `/functions/sm_activities/fn_activities.sqf` -* states are added to it using [grad_civs_legacy_fnc_addState](https://cbateam.github.io/CBA_A3/docs/files/statemachine/fnc_addState-sqf.html) . +* states are added to it using [grad_civs_cba_statemachine_fnc_addState](https://cbateam.github.io/CBA_A3/docs/files/statemachine/fnc_addState-sqf.html) . * every state has a bunch of callbacks that are called with a civilian as parameter * one is called periodically as long as the civ is in the state * one is called when the civ enters the state * one is called when the civ leaves the state -* transitions are being added by using [grad_civs_legacy_fnc_addTransition](https://cbateam.github.io/CBA_A3/docs/files/statemachine/fnc_addTransition-sqf.html) (or fnc_addEventTransition for transitions triggered by CBA events) +* transitions are being added by using [grad_civs_cba_statemachine_fnc_addTransition](https://cbateam.github.io/CBA_A3/docs/files/statemachine/fnc_addTransition-sqf.html) (or fnc_addEventTransition for transitions triggered by CBA events) * every transition is defined as a one-way connection between two states * every transition gets two callbacks * one is called periodically to check whether a civ can move along the transition diff --git a/addons/activities/$PBOPREFIX$ b/addons/activities/$PBOPREFIX$ new file mode 100644 index 00000000..f0feffc8 --- /dev/null +++ b/addons/activities/$PBOPREFIX$ @@ -0,0 +1 @@ +z\grad_civs\addons\activities diff --git a/addons/legacy/CfgEventHandlers.hpp b/addons/activities/CfgEventHandlers.hpp similarity index 100% rename from addons/legacy/CfgEventHandlers.hpp rename to addons/activities/CfgEventHandlers.hpp diff --git a/addons/legacy/XEH_PREP.hpp b/addons/activities/XEH_PREP.hpp similarity index 64% rename from addons/legacy/XEH_PREP.hpp rename to addons/activities/XEH_PREP.hpp index c8bb469f..af47823a 100644 --- a/addons/legacy/XEH_PREP.hpp +++ b/addons/activities/XEH_PREP.hpp @@ -1,5 +1,4 @@ PREP(adoptAbandonedCivs); -PREP(compare); PREP(doReverse); PREP(deleteIfDamaged); PREP(doCustomActivity); @@ -10,23 +9,12 @@ PREP(isStopped); PREP(doCarryOn); PREP(endCustomActivity); - -PREP(findBuildings); PREP(findPositionOfInterest); -PREP(findRandomPosArea); -PREP(findRandomPos); -// PREP(findSpawnPosition.spec); -PREP(findSpawnPosition); -PREP(findUnclaimedHouse); PREP(forceEmotionSpeed); PREP(forcePanicSpeed); PREP(handleAceUnconscious); -PREP(getGlobalCivs); - PREP(initCommonEventhandlers); PREP(initConfig); -PREP(initHCs); -PREP(isInDistanceFromOtherPlayers); PREP(isInHouse); PREP(overclockStateMachines); PREP(reverse_abort); @@ -44,13 +32,6 @@ PREP(sm_activities_trans_business_panic_condition); PREP(sm_business); PREP(sm_business_state_rally_enter); PREP(sm_emotions); -PREP(sm_lifecycle); -PREP(sm_lifecycle_state_death_enter); -PREP(sm_lifecycle_state_despawn_enter); -PREP(sm_lifecycle_state_life_enter); -PREP(sm_lifecycle_state_life_exit); -PREP(sm_lifecycle_state_spawn_enter); -PREP(sm_lifecycle_trans_life_despawn_condition); PREP(sm_panic); PREP(sm_panic_state_flight_enter); PREP(sm_panic_state_flight_loop); @@ -58,9 +39,4 @@ PREP(sm_panic_state_hidden_enter); PREP(sm_panic_state_hide_enter); PREP(sm_panic_trans_hide_hidden_condition); PREP(sm_panic_trans_hide_hidden_handler); -PREP(spawnCivilianGroup); -PREP(spawnCivilian); -PREP(localSpawnPass); -PREP(globalSpawnPass); PREP(uid); -PREP(cleanupLocalCivs); diff --git a/addons/activities/XEH_postInit.sqf b/addons/activities/XEH_postInit.sqf new file mode 100644 index 00000000..ef9c1a27 --- /dev/null +++ b/addons/activities/XEH_postInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +if (!(EGVAR(main,enabled))) exitWith {}; + +[] 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), FUNC(onCivAdded)] call CBA_fnc_addEventHandler; +}; diff --git a/addons/legacy/XEH_preInit.sqf b/addons/activities/XEH_preInit.sqf similarity index 100% rename from addons/legacy/XEH_preInit.sqf rename to addons/activities/XEH_preInit.sqf diff --git a/addons/legacy/config.cpp b/addons/activities/config.cpp similarity index 100% rename from addons/legacy/config.cpp rename to addons/activities/config.cpp diff --git a/addons/legacy/functions/fnc_adoptAbandonedCivs.sqf b/addons/activities/functions/fnc_adoptAbandonedCivs.sqf similarity index 90% rename from addons/legacy/functions/fnc_adoptAbandonedCivs.sqf rename to addons/activities/functions/fnc_adoptAbandonedCivs.sqf index 513b8348..cef57698 100644 --- a/addons/legacy/functions/fnc_adoptAbandonedCivs.sqf +++ b/addons/activities/functions/fnc_adoptAbandonedCivs.sqf @@ -5,7 +5,7 @@ * this *should not happen, as we're setting the acex exlusion var, but you never know... */ -private _civClasses = call EFUNC(common,config_getCivClasses); +private _civClasses = call EFUNC(lifecycle,config_getCivClasses); private _allCivs = entities [_civClasses, [], true, true]; private _myCivs = _allCivs select { local _x && (_x getVariable ["grad_civs_primaryTask", ""] != "")}; private _orphanedCivs = _myCivs - GVAR(localCivs); diff --git a/addons/legacy/functions/fnc_deleteIfDamaged.sqf b/addons/activities/functions/fnc_deleteIfDamaged.sqf similarity index 100% rename from addons/legacy/functions/fnc_deleteIfDamaged.sqf rename to addons/activities/functions/fnc_deleteIfDamaged.sqf diff --git a/addons/legacy/functions/fnc_doCarryOn.sqf b/addons/activities/functions/fnc_doCarryOn.sqf similarity index 100% rename from addons/legacy/functions/fnc_doCarryOn.sqf rename to addons/activities/functions/fnc_doCarryOn.sqf diff --git a/addons/legacy/functions/fnc_doCustomActivity.sqf b/addons/activities/functions/fnc_doCustomActivity.sqf similarity index 100% rename from addons/legacy/functions/fnc_doCustomActivity.sqf rename to addons/activities/functions/fnc_doCustomActivity.sqf diff --git a/addons/legacy/functions/fnc_doReverse.sqf b/addons/activities/functions/fnc_doReverse.sqf similarity index 100% rename from addons/legacy/functions/fnc_doReverse.sqf rename to addons/activities/functions/fnc_doReverse.sqf diff --git a/addons/legacy/functions/fnc_doStop.sqf b/addons/activities/functions/fnc_doStop.sqf similarity index 100% rename from addons/legacy/functions/fnc_doStop.sqf rename to addons/activities/functions/fnc_doStop.sqf diff --git a/addons/legacy/functions/fnc_doingCustomActivity.sqf b/addons/activities/functions/fnc_doingCustomActivity.sqf similarity index 100% rename from addons/legacy/functions/fnc_doingCustomActivity.sqf rename to addons/activities/functions/fnc_doingCustomActivity.sqf diff --git a/addons/legacy/functions/fnc_endCustomActivity.sqf b/addons/activities/functions/fnc_endCustomActivity.sqf similarity index 100% rename from addons/legacy/functions/fnc_endCustomActivity.sqf rename to addons/activities/functions/fnc_endCustomActivity.sqf diff --git a/addons/legacy/functions/fnc_findPositionOfInterest.sqf b/addons/activities/functions/fnc_findPositionOfInterest.sqf similarity index 100% rename from addons/legacy/functions/fnc_findPositionOfInterest.sqf rename to addons/activities/functions/fnc_findPositionOfInterest.sqf diff --git a/addons/legacy/functions/fnc_forceEmotionSpeed.sqf b/addons/activities/functions/fnc_forceEmotionSpeed.sqf similarity index 100% rename from addons/legacy/functions/fnc_forceEmotionSpeed.sqf rename to addons/activities/functions/fnc_forceEmotionSpeed.sqf diff --git a/addons/legacy/functions/fnc_forcePanicSpeed.sqf b/addons/activities/functions/fnc_forcePanicSpeed.sqf similarity index 100% rename from addons/legacy/functions/fnc_forcePanicSpeed.sqf rename to addons/activities/functions/fnc_forcePanicSpeed.sqf diff --git a/addons/legacy/functions/fnc_handleAceUnconscious.sqf b/addons/activities/functions/fnc_handleAceUnconscious.sqf similarity index 100% rename from addons/legacy/functions/fnc_handleAceUnconscious.sqf rename to addons/activities/functions/fnc_handleAceUnconscious.sqf diff --git a/addons/legacy/functions/fnc_initCommonEventhandlers.sqf b/addons/activities/functions/fnc_initCommonEventhandlers.sqf similarity index 100% rename from addons/legacy/functions/fnc_initCommonEventhandlers.sqf rename to addons/activities/functions/fnc_initCommonEventhandlers.sqf diff --git a/addons/activities/functions/fnc_initConfig.sqf b/addons/activities/functions/fnc_initConfig.sqf new file mode 100644 index 00000000..8970099c --- /dev/null +++ b/addons/activities/functions/fnc_initConfig.sqf @@ -0,0 +1,16 @@ +#include "..\script_component.hpp" + +INFO("initConfig running..."); + +private _settingsGroup = ["GRAD Civs", "4) basic activities - panicking"]; + +[ + QGVAR(panicCooldown), + "EDITBOX", + "Time for panic to wear off [low, med, high]", + _settingsGroup, + QUOTE([ARR_3(15,120,240)]), + false, + {}, + false +] call CBA_fnc_addSetting; diff --git a/addons/legacy/functions/fnc_isInHouse.sqf b/addons/activities/functions/fnc_isInHouse.sqf similarity index 100% rename from addons/legacy/functions/fnc_isInHouse.sqf rename to addons/activities/functions/fnc_isInHouse.sqf diff --git a/addons/legacy/functions/fnc_isStopped.sqf b/addons/activities/functions/fnc_isStopped.sqf similarity index 100% rename from addons/legacy/functions/fnc_isStopped.sqf rename to addons/activities/functions/fnc_isStopped.sqf diff --git a/addons/activities/functions/fnc_onCivAdded.sqf b/addons/activities/functions/fnc_onCivAdded.sqf new file mode 100644 index 00000000..d0307465 --- /dev/null +++ b/addons/activities/functions/fnc_onCivAdded.sqf @@ -0,0 +1,7 @@ +params [ + ["_civ", objNull, [objNull]] +]; +if (!local _civ) exitWith {}; + +private _panicCooldown = [GVAR(panicCooldown)] call EFUNC(common,parseCsv); +_civ setVariable["GRAD_CIVS_PANICCOOLDOWN" , random _panicCooldown, true]; diff --git a/addons/legacy/functions/fnc_overclockStateMachines.sqf b/addons/activities/functions/fnc_overclockStateMachines.sqf similarity index 100% rename from addons/legacy/functions/fnc_overclockStateMachines.sqf rename to addons/activities/functions/fnc_overclockStateMachines.sqf diff --git a/addons/legacy/functions/fnc_reverse.spec.sqf b/addons/activities/functions/fnc_reverse.spec.sqf similarity index 97% rename from addons/legacy/functions/fnc_reverse.spec.sqf rename to addons/activities/functions/fnc_reverse.spec.sqf index 247102a4..0df30000 100644 --- a/addons/legacy/functions/fnc_reverse.spec.sqf +++ b/addons/activities/functions/fnc_reverse.spec.sqf @@ -21,7 +21,7 @@ if (isClass (configFile >> "CfgVehicles" >> "LOP_AFR_Civ_Ural_open")) then { [ ["WHEN I let it reverse", { - [_this, [0, -50, 0]] call grad_civs_legacy_fnc_reverse; + [_this, [0, -50, 0]] call grad_civs_activities_fnc_reverse; _this }, [ @@ -54,7 +54,7 @@ if (isClass (configFile >> "CfgVehicles" >> "LOP_AFR_Civ_Ural_open")) then { [ ["WHEN I let it reverse", { - [_this, [0, -50, 0]] call grad_civs_legacy_fnc_reverse; + [_this, [0, -50, 0]] call grad_civs_activities_fnc_reverse; _this }, [ @@ -92,7 +92,7 @@ if (isClass (configFile >> "CfgVehicles" >> "LOP_AFR_Civ_Ural_open")) then { [ ["WHEN I let it reverse", { - [_this, [0, -20, 0]] call grad_civs_legacy_fnc_reverse; + [_this, [0, -20, 0]] call grad_civs_activities_fnc_reverse; _this }, [ @@ -126,9 +126,9 @@ if (isClass (configFile >> "CfgVehicles" >> "LOP_AFR_Civ_Ural_open")) then { ], ["WHEN I let it reverse 100m AND abort after 2 seconds", { - [_this, [0, -100, 0]] call grad_civs_legacy_fnc_reverse; + [_this, [0, -100, 0]] call grad_civs_activities_fnc_reverse; sleep 2; - [_this] call grad_civs_legacy_fnc_reverse_abort; + [_this] call grad_civs_activities_fnc_reverse_abort; _this }, [ diff --git a/addons/legacy/functions/fnc_reverse.sqf b/addons/activities/functions/fnc_reverse.sqf similarity index 100% rename from addons/legacy/functions/fnc_reverse.sqf rename to addons/activities/functions/fnc_reverse.sqf diff --git a/addons/legacy/functions/fnc_reverse_abort.sqf b/addons/activities/functions/fnc_reverse_abort.sqf similarity index 100% rename from addons/legacy/functions/fnc_reverse_abort.sqf rename to addons/activities/functions/fnc_reverse_abort.sqf diff --git a/addons/legacy/functions/fnc_reverse_internal_end.sqf b/addons/activities/functions/fnc_reverse_internal_end.sqf similarity index 100% rename from addons/legacy/functions/fnc_reverse_internal_end.sqf rename to addons/activities/functions/fnc_reverse_internal_end.sqf diff --git a/addons/legacy/functions/fnc_reverse_internal_pfh.sqf b/addons/activities/functions/fnc_reverse_internal_pfh.sqf similarity index 100% rename from addons/legacy/functions/fnc_reverse_internal_pfh.sqf rename to addons/activities/functions/fnc_reverse_internal_pfh.sqf diff --git a/addons/legacy/functions/fnc_reverse_internal_stopCondition.sqf b/addons/activities/functions/fnc_reverse_internal_stopCondition.sqf similarity index 100% rename from addons/legacy/functions/fnc_reverse_internal_stopCondition.sqf rename to addons/activities/functions/fnc_reverse_internal_stopCondition.sqf diff --git a/addons/legacy/functions/fnc_sm_activities.sqf b/addons/activities/functions/fnc_sm_activities.sqf similarity index 92% rename from addons/legacy/functions/fnc_sm_activities.sqf rename to addons/activities/functions/fnc_sm_activities.sqf index da2fe1b6..45b14ab2 100644 --- a/addons/legacy/functions/fnc_sm_activities.sqf +++ b/addons/activities/functions/fnc_sm_activities.sqf @@ -1,10 +1,16 @@ #include "..\script_component.hpp" +params [ + ["_sm_lifecycle", locationNull, [locationNull]] +]; + + private _activities = [[], true, "activities"] call EFUNC(cba_statemachine,create); private _business = [] call FUNC(sm_business); private _panic = [] call FUNC(sm_panic); // STATES + assert(_activities isEqualType locationNull); assert(_business isEqualType locationNull); assert(_panic isEqualType locationNull); @@ -75,7 +81,6 @@ assert ([ _act_asOrdered + _act_business + "_event" ] call CBA_statemachine_fnc_addEventTransition); -EGVAR(common,stateMachines) setVariable ["activities", _activities]; - +[_sm_lifecycle, "lfc_life", _activities] call EFUNC(cba_statemachine,addNestedStateMachine); -_activities +EGVAR(common,stateMachines) setVariable ["activities", _activities]; diff --git a/addons/legacy/functions/fnc_sm_activities_state_asOrdered_enter.sqf b/addons/activities/functions/fnc_sm_activities_state_asOrdered_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_activities_state_asOrdered_enter.sqf rename to addons/activities/functions/fnc_sm_activities_state_asOrdered_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_activities_state_asOrdered_exit.sqf b/addons/activities/functions/fnc_sm_activities_state_asOrdered_exit.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_activities_state_asOrdered_exit.sqf rename to addons/activities/functions/fnc_sm_activities_state_asOrdered_exit.sqf diff --git a/addons/legacy/functions/fnc_sm_activities_state_panic_enter.sqf b/addons/activities/functions/fnc_sm_activities_state_panic_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_activities_state_panic_enter.sqf rename to addons/activities/functions/fnc_sm_activities_state_panic_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_activities_state_panic_exit.sqf b/addons/activities/functions/fnc_sm_activities_state_panic_exit.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_activities_state_panic_exit.sqf rename to addons/activities/functions/fnc_sm_activities_state_panic_exit.sqf diff --git a/addons/legacy/functions/fnc_sm_activities_trans_business_panic_condition.sqf b/addons/activities/functions/fnc_sm_activities_trans_business_panic_condition.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_activities_trans_business_panic_condition.sqf rename to addons/activities/functions/fnc_sm_activities_trans_business_panic_condition.sqf diff --git a/addons/legacy/functions/fnc_sm_business.sqf b/addons/activities/functions/fnc_sm_business.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_business.sqf rename to addons/activities/functions/fnc_sm_business.sqf diff --git a/addons/legacy/functions/fnc_sm_business_state_rally_enter.sqf b/addons/activities/functions/fnc_sm_business_state_rally_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_business_state_rally_enter.sqf rename to addons/activities/functions/fnc_sm_business_state_rally_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_emotions.sqf b/addons/activities/functions/fnc_sm_emotions.sqf similarity index 92% rename from addons/legacy/functions/fnc_sm_emotions.sqf rename to addons/activities/functions/fnc_sm_emotions.sqf index c9dfb6c8..21ce76ab 100644 --- a/addons/legacy/functions/fnc_sm_emotions.sqf +++ b/addons/activities/functions/fnc_sm_emotions.sqf @@ -1,8 +1,13 @@ #include "..\script_component.hpp" +params [ + ["_sm_lifecycle", locationNull, [locationNull]] +]; + + private _emotions = [[], true, "emotions"] call EFUNC(cba_statemachine,create); - // STATES +// STATES private _emo_relaxed = [ _emotions, @@ -48,9 +53,7 @@ private _emo_panic = [ "emo_panic" ] call EFUNC(cba_statemachine,addState); - - // TRANSITIONS - +// TRANSITIONS assert ([ _emotions, @@ -96,7 +99,8 @@ assert ([ _emo_relaxed + _emo_wary ] call CBA_statemachine_fnc_addEventTransition); -EGVAR(common,stateMachines) setVariable ["emotions", _emotions]; +[_sm_lifecycle, "lfc_life", _emotions] call EFUNC(cba_statemachine,addNestedStateMachine); +EGVAR(common,stateMachines) setVariable ["emotions", _emotions]; _emotions diff --git a/addons/legacy/functions/fnc_sm_panic.sqf b/addons/activities/functions/fnc_sm_panic.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic.sqf rename to addons/activities/functions/fnc_sm_panic.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_state_flight_enter.sqf b/addons/activities/functions/fnc_sm_panic_state_flight_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_state_flight_enter.sqf rename to addons/activities/functions/fnc_sm_panic_state_flight_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_state_flight_loop.sqf b/addons/activities/functions/fnc_sm_panic_state_flight_loop.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_state_flight_loop.sqf rename to addons/activities/functions/fnc_sm_panic_state_flight_loop.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_state_hidden_enter.sqf b/addons/activities/functions/fnc_sm_panic_state_hidden_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_state_hidden_enter.sqf rename to addons/activities/functions/fnc_sm_panic_state_hidden_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_state_hide_enter.sqf b/addons/activities/functions/fnc_sm_panic_state_hide_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_state_hide_enter.sqf rename to addons/activities/functions/fnc_sm_panic_state_hide_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_trans_hide_hidden_condition.sqf b/addons/activities/functions/fnc_sm_panic_trans_hide_hidden_condition.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_trans_hide_hidden_condition.sqf rename to addons/activities/functions/fnc_sm_panic_trans_hide_hidden_condition.sqf diff --git a/addons/legacy/functions/fnc_sm_panic_trans_hide_hidden_handler.sqf b/addons/activities/functions/fnc_sm_panic_trans_hide_hidden_handler.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_panic_trans_hide_hidden_handler.sqf rename to addons/activities/functions/fnc_sm_panic_trans_hide_hidden_handler.sqf diff --git a/addons/legacy/functions/fnc_uid.sqf b/addons/activities/functions/fnc_uid.sqf similarity index 100% rename from addons/legacy/functions/fnc_uid.sqf rename to addons/activities/functions/fnc_uid.sqf diff --git a/addons/activities/script_component.hpp b/addons/activities/script_component.hpp new file mode 100644 index 00000000..a2995f8d --- /dev/null +++ b/addons/activities/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT activities +#include "\z\grad_civs\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_MAIN + #define DEBUG_MODE_FULL +#endif +#ifdef DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN +#endif + +#include "\z\grad_civs\addons\main\script_macros.hpp" diff --git a/addons/cars/XEH_PREP.hpp b/addons/cars/XEH_PREP.hpp index 6e525666..774fb786 100644 --- a/addons/cars/XEH_PREP.hpp +++ b/addons/cars/XEH_PREP.hpp @@ -1,3 +1,4 @@ +PREP(dismountCondition); PREP(getGlobalVehicles); PREP(getGroupVehicle); PREP(initConfig); diff --git a/addons/cars/XEH_postInit.sqf b/addons/cars/XEH_postInit.sqf index e8399878..5551983b 100644 --- a/addons/cars/XEH_postInit.sqf +++ b/addons/cars/XEH_postInit.sqf @@ -4,4 +4,5 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { ["business", ["bus_rally"], FUNC(sm_business)] call EFUNC(common,augmentStateMachine); + [QEGVAR(lifecycle,civ_added), FUNC(onCivAdded)] call CBA_fnc_addEventHandler; }; diff --git a/addons/cars/config.cpp b/addons/cars/config.cpp index 74aa1f6c..496bef3e 100644 --- a/addons/cars/config.cpp +++ b/addons/cars/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"grad_civs_common", "grad_civs_legacy"}; + requiredAddons[] = {"grad_civs_common", "grad_civs_activities"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/cars/functions/fnc_dismountCondition.sqf b/addons/cars/functions/fnc_dismountCondition.sqf new file mode 100644 index 00000000..54430032 --- /dev/null +++ b/addons/cars/functions/fnc_dismountCondition.sqf @@ -0,0 +1,9 @@ +#include "..\script_component.hpp" + +if (leader _this != _this) exitWith {true}; + +if (driver vehicle _this != _this) exitWith {true}; + +if (!(canMove vehicle _this)) exitWith {true}; + +(([_this, "emotions"] call EFUNC(common,civGetState)) == "emo_panic") || (_this call EFUNC(interact,sm_activities_helper_surrenderCondition)) diff --git a/addons/cars/functions/fnc_getGlobalVehicles.sqf b/addons/cars/functions/fnc_getGlobalVehicles.sqf index dc360410..33c11e67 100644 --- a/addons/cars/functions/fnc_getGlobalVehicles.sqf +++ b/addons/cars/functions/fnc_getGlobalVehicles.sqf @@ -5,7 +5,7 @@ params [ ["_primaryTask", "", [""]] /* filter civs by primary task */ ]; -private _civs = _this call EFUNC(legacy,getGlobalCivs); +private _civs = _this call EFUNC(lifecycle,getGlobalCivs); private _vehicles = []; { private _veh = vehicle _x; diff --git a/addons/cars/functions/fnc_initConfig.sqf b/addons/cars/functions/fnc_initConfig.sqf index 956b08fc..006af536 100644 --- a/addons/cars/functions/fnc_initConfig.sqf +++ b/addons/cars/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "5) cars"]; +private _settingsGroup = ["GRAD Civs", "7) cars - basic settings for civilian drivers"]; [ QGVAR(animalTransportChance), diff --git a/addons/cars/functions/fnc_sm_business_trans_mountUp_dismount_condition.sqf b/addons/cars/functions/fnc_sm_business_trans_mountUp_dismount_condition.sqf index e3f9ba1a..eae82e2f 100644 --- a/addons/cars/functions/fnc_sm_business_trans_mountUp_dismount_condition.sqf +++ b/addons/cars/functions/fnc_sm_business_trans_mountUp_dismount_condition.sqf @@ -1,5 +1,3 @@ #include "..\script_component.hpp" -if (leader _this != _this) exitWith {true}; - -(([_this, "emotions"] call EFUNC(common,civGetState)) == "emo_panic") || (_this call EFUNC(interact,sm_activities_helper_surrenderCondition)) +_this call FUNC(dismountCondition); \ No newline at end of file diff --git a/addons/cars/functions/fnc_spawnCarAndCrew.sqf b/addons/cars/functions/fnc_spawnCarAndCrew.sqf index c07d141e..ff4c66d7 100644 --- a/addons/cars/functions/fnc_spawnCarAndCrew.sqf +++ b/addons/cars/functions/fnc_spawnCarAndCrew.sqf @@ -37,7 +37,7 @@ if (_automtaicVehicleGroupSize) then { _groupSize = (floor random [0, 1, _maxCount]) + 1 }; -private _group = [_pos, _groupSize, _house, _primaryTask] call EFUNC(legacy,spawnCivilianGroup); +private _group = [_pos, _groupSize, _house, _primaryTask] call EFUNC(lifecycle,spawnCivilianGroup); { // for convenience & speed: shortcut so units dont have to lengthily embark on their own diff --git a/addons/cars/functions/fnc_spawnVehicle.sqf b/addons/cars/functions/fnc_spawnVehicle.sqf index 9d1acc5c..8b431293 100644 --- a/addons/cars/functions/fnc_spawnVehicle.sqf +++ b/addons/cars/functions/fnc_spawnVehicle.sqf @@ -18,7 +18,7 @@ _veh addEventHandler [ { params ["_vec", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"]; { - [QEGVAR(legacy,firedNear), [_x], _x] call CBA_fnc_targetEvent; + [QEGVAR(activities,firedNear), [_x], _x] call CBA_fnc_targetEvent; } forEach (crew _vec); } ]; diff --git a/addons/cba_statemachine/XEH_PREP.hpp b/addons/cba_statemachine/XEH_PREP.hpp index 4e4e6577..1733204a 100644 --- a/addons/cba_statemachine/XEH_PREP.hpp +++ b/addons/cba_statemachine/XEH_PREP.hpp @@ -1,4 +1,5 @@ PREP(addCompoundState); +PREP(addNestedStateMachine); PREP(addState); PREP(addToStateMachine); PREP(addTransition); diff --git a/addons/cba_statemachine/functions/fnc_addCompoundState.sqf b/addons/cba_statemachine/functions/fnc_addCompoundState.sqf index 60fbae20..5d70f4b1 100644 --- a/addons/cba_statemachine/functions/fnc_addCompoundState.sqf +++ b/addons/cba_statemachine/functions/fnc_addCompoundState.sqf @@ -1,9 +1,5 @@ #include "..\script_component.hpp" -#define NESTED(var) (var + "_nested") -#define COMPOUNDONSTATEENTERED(var) (var + "_onCompoundStateEntered") -#define COMPOUNDONSTATELEAVING(var) (var + "_onCompoundStateLeaving") - params [ ["_outerStateMachine", locationNull, [locationNull]], ["_nestedStateMachines", [], [locationNull, []]], @@ -14,7 +10,11 @@ params [ ]; if (!(_nestedStateMachines isEqualType [])) then { _nestedStateMachines = [_nestedStateMachines]; }; -if (!(_nestedStateMachines isEqualTypeAll locationNull)) exitWith {ERROR_2("when trying to create state %1: not all _nestedStateMachines %2 are CBA state machines!", _name, _nestedStateMachines); ""}; +if (!((_nestedStateMachines isEqualTo []) || (_nestedStateMachines isEqualTypeAll locationNull))) exitWith { + // NOTE bug: isEqualTypeAll returns false for empty arrays + ERROR_2("when trying to create state %1: not all _nestedStateMachines %2 are CBA state machines!", _name, _nestedStateMachines); "" +}; + { if (!((_x getVariable ["cba_statemachine_list", []]) isEqualType [])) exitWith {ERROR("nested state machines must have empty items array!"); ""}; } forEach _nestedStateMachines; diff --git a/addons/cba_statemachine/functions/fnc_addNestedStateMachine.sqf b/addons/cba_statemachine/functions/fnc_addNestedStateMachine.sqf new file mode 100644 index 00000000..91f9e06a --- /dev/null +++ b/addons/cba_statemachine/functions/fnc_addNestedStateMachine.sqf @@ -0,0 +1,16 @@ +#include "..\script_component.hpp" + +params [ + ["_outerStateMachine", locationNull, [locationNull]], + ["_outerState", "", [""]], + ["_nestedStateMachine", locationNull, [locationNull]] +]; + +if (!(_nestedStateMachine isEqualType locationNull)) exitWith {ERROR_1("when trying to adding state machine %1: is not CBA state machine!", _nestedStateMachine);}; + +private _nestedStateMachines = _outerStateMachine getVariable [NESTED(_outerState), false]; +if (!(_nestedStateMachines isEqualType [])) exitWith {ERROR_2("state %1 of %2 is not a compound state!", _outerState, _outerStateMachine)}; + +_nestedStateMachines pushBackUnique _nestedStateMachine; + +_outerStateMachine setVariable [NESTED(_outerState), _nestedStateMachines]; diff --git a/addons/cba_statemachine/functions/fnc_addState.sqf b/addons/cba_statemachine/functions/fnc_addState.sqf index 8da325f0..f7fd20fa 100644 --- a/addons/cba_statemachine/functions/fnc_addState.sqf +++ b/addons/cba_statemachine/functions/fnc_addState.sqf @@ -1,11 +1,5 @@ #include "..\script_component.hpp" -#define TIMEDONSTATEENTERED(var) (var + "_onTimedStateEntered") -#define TIMEDONSTATELEAVING(var) (var + "_onTimedStateLeaving") -#define TIMEDONSTATE(var) (var + "_onTimedState") -#define STATEMACHINEIDVAR(var) (var getVariable "CBA_statemachine_ID") -#define TIMEVAR(var) format["grad_civs_state_time_%1", var] - params [ ["_stateMachine", locationNull, [locationNull]], ["_onState", {}, [{}]], diff --git a/addons/cba_statemachine/functions/fnc_addTransition.sqf b/addons/cba_statemachine/functions/fnc_addTransition.sqf index 4e4d5c07..6f8637f4 100644 --- a/addons/cba_statemachine/functions/fnc_addTransition.sqf +++ b/addons/cba_statemachine/functions/fnc_addTransition.sqf @@ -1,10 +1,5 @@ #include "..\script_component.hpp" -#define TIMEDTRANSITIONCONDITION(var) (var + "_onTimedTransitionCondition") -#define TIMEDTRANSITIONHANDLER(var) (var + "_onTimedTransitionHandler") -#define STATEMACHINEIDVAR(var) (var getVariable "CBA_statemachine_ID") -#define TIMEVAR(var) format["grad_civs_state_time_%1", var] - params [ ["_stateMachine", locationNull, [locationNull]], ["_originalState", "", [""]], diff --git a/addons/cba_statemachine/functions/fnc_removeFromStateMachine.sqf b/addons/cba_statemachine/functions/fnc_removeFromStateMachine.sqf index eab735c0..6b4aa9a6 100644 --- a/addons/cba_statemachine/functions/fnc_removeFromStateMachine.sqf +++ b/addons/cba_statemachine/functions/fnc_removeFromStateMachine.sqf @@ -1,8 +1,5 @@ #include "..\script_component.hpp" -// see https://github.com/CBATeam/CBA_A3/blob/f62038fadd4fdc0690beb29271bd4cdf8eb57301/addons/statemachine/script_component.hpp#L21 -#define ONSTATELEAVING(var) (var + "_onStateLeaving") - params [ ["_listItem", objNull, [missionNamespace, objNull, grpNull, teamMemberNull, taskNull, locationNull]], ["_stateMachine", locationNull] diff --git a/addons/cba_statemachine/script_component.hpp b/addons/cba_statemachine/script_component.hpp index 7af0c18e..b5bc9c07 100644 --- a/addons/cba_statemachine/script_component.hpp +++ b/addons/cba_statemachine/script_component.hpp @@ -12,3 +12,16 @@ #endif #include "\z\grad_civs\addons\main\script_macros.hpp" + +#define COMPOUNDONSTATEENTERED(var) (var + "_onCompoundStateEntered") +#define COMPOUNDONSTATELEAVING(var) (var + "_onCompoundStateLeaving") +#define NESTED(var) (var + "_nested") +// see https://github.com/CBATeam/CBA_A3/blob/f62038fadd4fdc0690beb29271bd4cdf8eb57301/addons/statemachine/script_component.hpp#L21 +#define ONSTATELEAVING(var) (var + "_onStateLeaving") +#define STATEMACHINEIDVAR(var) (var getVariable "CBA_statemachine_ID") +#define TIMEDONSTATE(var) (var + "_onTimedState") +#define TIMEDONSTATEENTERED(var) (var + "_onTimedStateEntered") +#define TIMEDONSTATELEAVING(var) (var + "_onTimedStateLeaving") +#define TIMEDTRANSITIONCONDITION(var) (var + "_onTimedTransitionCondition") +#define TIMEDTRANSITIONHANDLER(var) (var + "_onTimedTransitionHandler") +#define TIMEVAR(var) format["grad_civs_state_time_%1", var] \ No newline at end of file diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index b18e4e7a..075f9972 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -4,13 +4,9 @@ PREP(augmentStateMachine); PREP(civGetState); PREP(clearExclusionZones); PREP(clearPopulationZones); -PREP(config_getCivClasses); -PREP(dismissCiv); -PREP(dismissGroup); PREP(formatNowPlusSeconds); PREP(getExclusionZones); PREP(getPopulationZones); -PREP(initConfig); PREP(isInPopulatedZone); PREP(module_exclusionZone); PREP(module_populationZone); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 81fa40b5..ab2b73ca 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,21 +1,3 @@ #include "script_component.hpp" if (!(EGVAR(main,enabled))) exitWith {}; - -[ - QGVAR(do_dismiss_civ), - { - params [ - ["_object", objNull, [objNull, grpNull]] - ]; - if (!((leader _object) in EGVAR(legacy,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; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index f7edd58d..b47cf662 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -7,6 +7,3 @@ PREP_RECOMPILE_START; PREP_RECOMPILE_END; ADDON = true; - - -[] call FUNC(initConfig); diff --git a/addons/common/functions/fnc_initConfig.sqf b/addons/common/functions/fnc_initConfig.sqf deleted file mode 100644 index 9675142c..00000000 --- a/addons/common/functions/fnc_initConfig.sqf +++ /dev/null @@ -1,16 +0,0 @@ -#include "..\script_component.hpp" - -INFO("initConfig running..."); - -private _settingsGroup = ["GRAD Civs", "2) basics"]; - -[ - QGVAR(civClasses), - "EDITBOX", - "Unit classes to use for spawning civilians", - _settingsGroup, - "C_Man_1", - true, - {}, - false -] call CBA_fnc_addSetting; diff --git a/addons/diagnostics/XEH_postInit.sqf b/addons/diagnostics/XEH_postInit.sqf index 393ebdab..2b201d44 100644 --- a/addons/diagnostics/XEH_postInit.sqf +++ b/addons/diagnostics/XEH_postInit.sqf @@ -15,16 +15,16 @@ if (isServer || CBA_isHeadlessClient) then { GVAR(debugLoopHandle) = [{ params ["_args", "_handle"]; if (hasInterface && (!isGameFocused || isGamePaused)) exitWith {}; - if (call EGVAR(legacy,EXITON)) exitWith {[_handle] call CBA_fnc_removePerFrameHandler}; + if (call EGVAR(lifecycle,EXITON)) exitWith {[_handle] call CBA_fnc_removePerFrameHandler}; if (GVAR(showInfoLine)) then { - { _x call FUNC(updateInfoLine); } forEach EGVAR(legacy,localCivs); + { _x call FUNC(updateInfoLine); } forEach EGVAR(lifecycle,localCivs); }; }, 1, []] call CBA_fnc_addPerFrameHandler; [ { if (GVAR(showFps)) then { - [QGVAR(fps), [clientOwner, diag_fps, count EGVAR(legacy,localCivs)]] call CBA_fnc_globalEvent; + [QGVAR(fps), [clientOwner, diag_fps, count EGVAR(lifecycle,localCivs)]] call CBA_fnc_globalEvent; }; }, 2, @@ -34,7 +34,7 @@ if (isServer || CBA_isHeadlessClient) then { if (isServer) then { [ - QEGVAR(common,civ_added), + QEGVAR(lifecycle,civ_added), { params [["_civ", objNull, [objNull]]]; _civ setVariable [QGVAR(localAt), owner _civ, true]; diff --git a/addons/diagnostics/config.cpp b/addons/diagnostics/config.cpp index 05f02bfa..5ce17799 100644 --- a/addons/diagnostics/config.cpp +++ b/addons/diagnostics/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"grad_civs_main", "grad_civs_legacy"}; + requiredAddons[] = {"grad_civs_main", "grad_civs_activities"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/diagnostics/functions/fnc_initConfig.sqf b/addons/diagnostics/functions/fnc_initConfig.sqf index 512519f9..47f31138 100644 --- a/addons/diagnostics/functions/fnc_initConfig.sqf +++ b/addons/diagnostics/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "a) diagnostics"]; +private _settingsGroup = ["GRAD Civs", "c) diagnostics - debugging info"]; [ QGVAR(showFps), diff --git a/addons/diagnostics/functions/fnc_showInfoLine.sqf b/addons/diagnostics/functions/fnc_showInfoLine.sqf index 9c132d60..bfed8dac 100644 --- a/addons/diagnostics/functions/fnc_showInfoLine.sqf +++ b/addons/diagnostics/functions/fnc_showInfoLine.sqf @@ -56,7 +56,7 @@ ISNILS(GVAR(actionIds), []); 1, 1, 0, _text, 0, 0.03, "EtelkaNarrowMediumPro", "center", true ]; - } forEach ([] call EFUNC(legacy,getGlobalCivs)); + } forEach ([] call EFUNC(lifecycle,getGlobalCivs)); }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/diagnostics/functions/fnc_showOnMap.sqf b/addons/diagnostics/functions/fnc_showOnMap.sqf index 14c1162f..9d19a08e 100644 --- a/addons/diagnostics/functions/fnc_showOnMap.sqf +++ b/addons/diagnostics/functions/fnc_showOnMap.sqf @@ -6,7 +6,7 @@ GVAR(DRAWUNITSEH) = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", { if (!GVAR(showOnMap)) exitWith {}; - private _civs = [] call EFUNC(legacy,getGlobalCivs); + private _civs = [] call EFUNC(lifecycle,getGlobalCivs); private _civsInCarDrivers = _civs select { private _vec = vehicle _x; _vec != _x && driver _vec == _x diff --git a/addons/diagnostics/functions/fnc_showPinkArrows.sqf b/addons/diagnostics/functions/fnc_showPinkArrows.sqf index 30d20556..9ad0d221 100644 --- a/addons/diagnostics/functions/fnc_showPinkArrows.sqf +++ b/addons/diagnostics/functions/fnc_showPinkArrows.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" GVAR(showWhatTheyThink_civ_added) = [ - QEGVAR(common,civ_added), + QEGVAR(lifecycle,civ_added), { if (!GVAR(showPinkArrows)) exitWith {}; params [["_civ", objNull, [objNull]]]; @@ -12,7 +12,7 @@ GVAR(showWhatTheyThink_civ_added) = [ ] call CBA_fnc_addEventHandler; GVAR(showWhatTheyThinkciv_removed) = [ - QEGVAR(common,civ_removed), + QEGVAR(lifecycle,civ_removed), { params [["_civ", objNull, [objNull]]]; SCRIPT("showWhatTheyThink_civ_removed"); diff --git a/addons/gta/XEH_postInit.sqf b/addons/gta/XEH_postInit.sqf index 47ac18b8..9fdc2d4a 100644 --- a/addons/gta/XEH_postInit.sqf +++ b/addons/gta/XEH_postInit.sqf @@ -5,7 +5,7 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (!(GVAR(enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { - [QEGVAR(common,civ_added), FUNC(onCivAdded)] call CBA_fnc_addEventHandler; + [QEGVAR(lifecycle,civ_added), FUNC(onCivAdded)] call CBA_fnc_addEventHandler; }; if (hasInterface) then { diff --git a/addons/gta/functions/fnc_initConfig.sqf b/addons/gta/functions/fnc_initConfig.sqf index 27451bd7..2a99546d 100644 --- a/addons/gta/functions/fnc_initConfig.sqf +++ b/addons/gta/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "8) gta"]; +private _settingsGroup = ["GRAD Civs", "9) GTA - vehicles have owners now"]; [ QGVAR(enabled), @@ -15,7 +15,7 @@ private _settingsGroup = ["GRAD Civs", "8) gta"]; true ] call CBA_fnc_addSetting; - +/* [ QGVAR(carOwnershipRatio), "SLIDER", @@ -26,3 +26,4 @@ private _settingsGroup = ["GRAD Civs", "8) gta"]; {}, false ] call CBA_fnc_addSetting; +*/ \ No newline at end of file diff --git a/addons/gta/functions/fnc_isUnitBeingSeenByCivs.sqf b/addons/gta/functions/fnc_isUnitBeingSeenByCivs.sqf index 9df33152..e1e7df66 100644 --- a/addons/gta/functions/fnc_isUnitBeingSeenByCivs.sqf +++ b/addons/gta/functions/fnc_isUnitBeingSeenByCivs.sqf @@ -6,6 +6,6 @@ params [ ["_visibility", 0.5, [0]] ]; -private _civClasses = call EFUNC(common,config_getCivClasses); +private _civClasses = call EFUNC(lifecycle,config_getCivClasses); -1 != ((player nearEntities [_civClasses, _maxDistance]) findIf {([vehicle _unit, "VIEW"] checkVisibility [eyePos _x, getPosASL _unit]) > _visibility}) \ No newline at end of file diff --git a/addons/interact/config.cpp b/addons/interact/config.cpp index 036e4edd..c3b45b96 100644 --- a/addons/interact/config.cpp +++ b/addons/interact/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"grad_civs_main", "grad_civs_legacy", "ace_interaction", "ace_captives"}; + requiredAddons[] = {"grad_civs_main", "grad_civs_lifecycle", "ace_interaction", "ace_captives"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/interact/functions/fnc_aceInteractWrapper.sqf b/addons/interact/functions/fnc_aceInteractWrapper.sqf index dff383e2..5096791e 100644 --- a/addons/interact/functions/fnc_aceInteractWrapper.sqf +++ b/addons/interact/functions/fnc_aceInteractWrapper.sqf @@ -18,7 +18,7 @@ [], "ace_interaction_getDown", format["I will keep my head down until %1", _waitTime call EFUNC(common,formatNowPlusSeconds)] - ] call EFUNC(legacy,doCustomActivity); + ] call EFUNC(activities,doCustomActivity); } ] call CBA_fnc_addEventHandler; @@ -41,7 +41,7 @@ [], "ace_interaction_sendAway", format["am being sent away to %1, will resume activity at %2", _pos, _waitTime call EFUNC(common,formatNowPlusSeconds)] - ] call EFUNC(legacy,doCustomActivity); + ] call EFUNC(activities,doCustomActivity); } ] call CBA_fnc_addEventHandler; diff --git a/addons/interact/functions/fnc_addCivInteractions.sqf b/addons/interact/functions/fnc_addCivInteractions.sqf index 15bb8c71..4c3ec239 100644 --- a/addons/interact/functions/fnc_addCivInteractions.sqf +++ b/addons/interact/functions/fnc_addCivInteractions.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" -private _civClasses = call EFUNC(common,config_getCivClasses); +private _civClasses = call EFUNC(lifecycle,config_getCivClasses); private _carryOnAction = [ QGVAR(carryOnAction), diff --git a/addons/interact/functions/fnc_addInteractEventHandlers.sqf b/addons/interact/functions/fnc_addInteractEventHandlers.sqf index 23a21cd1..3f194708 100644 --- a/addons/interact/functions/fnc_addInteractEventHandlers.sqf +++ b/addons/interact/functions/fnc_addInteractEventHandlers.sqf @@ -45,7 +45,7 @@ if ((_moveVector distance _carPos) > ((_moveVectors select 1) distance _carPos)) then { _moveVector = _moveVectors select 1; }; - _civ call EFUNC(legacy,forcePanicSpeed); + _civ call EFUNC(activities,forcePanicSpeed); _civ doMove ((position _civ) vectorAdd _moveVector); }, {}, @@ -53,7 +53,7 @@ [_carPos, _carVelocity], "honked_at", format["am avoiding honking car, will resume activity at %1", _waitTime call EFUNC(common,formatNowPlusSeconds)] - ] call EFUNC(legacy,doCustomActivity); + ] call EFUNC(activities,doCustomActivity); } ] call CBA_fnc_addEventHandler; @@ -63,5 +63,5 @@ ["_reverseTargetPos", [0, 0, 0], [[]]] ]; if (_target == ACE_player) exitWith {}; - [_target, _reverseTargetPos] call EFUNC(legacy,doReverse); + [_target, _reverseTargetPos] call EFUNC(activities,doReverse); }] call CBA_fnc_addEventHandler; diff --git a/addons/interact/functions/fnc_checkHonkingOnCivilian.sqf b/addons/interact/functions/fnc_checkHonkingOnCivilian.sqf index 65a51b74..e791aeb7 100644 --- a/addons/interact/functions/fnc_checkHonkingOnCivilian.sqf +++ b/addons/interact/functions/fnc_checkHonkingOnCivilian.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" private _playerPos = getPosATL player; -private _nearCivs = (_playerPos nearEntities [["Man"], 200]) arrayIntersect ([] call EFUNC(legacy,getGlobalCivs)); +private _nearCivs = (_playerPos nearEntities [["Man"], 200]) arrayIntersect ([] call EFUNC(lifecycle,getGlobalCivs)); private _playerVelocity = velocity player; private _speed = vectorMagnitude _playerVelocity; diff --git a/addons/interact/functions/fnc_handleGestureGo.sqf b/addons/interact/functions/fnc_handleGestureGo.sqf index 2f0d167b..0d489269 100644 --- a/addons/interact/functions/fnc_handleGestureGo.sqf +++ b/addons/interact/functions/fnc_handleGestureGo.sqf @@ -25,7 +25,7 @@ private _vectorDir = vectorDirVisual _gesturer; { private _reverseTargetPos = (getPos _x) vectorAdd (_vectorDir vectorMultiply 50); - [_target, _reverseTargetPos] call EFUNC(legacy,doReverse); + [_target, _reverseTargetPos] call EFUNC(activities,doReverse); } forEach _observers; INFO_1("%1 civs were triggered for being gestured with 'go'", count _observers); diff --git a/addons/interact/functions/fnc_handleGestureStop.sqf b/addons/interact/functions/fnc_handleGestureStop.sqf index 3970cd3a..94d9ef38 100644 --- a/addons/interact/functions/fnc_handleGestureStop.sqf +++ b/addons/interact/functions/fnc_handleGestureStop.sqf @@ -22,7 +22,7 @@ private _observers = _potentialObservers select { { private _recklessness = _x getVariable ["grad_civs_recklessness", 5]; private _waitTime = linearConversion [0, 10, _recklessness, 60*15, 15, false]; - [_x, _waitTime] call EFUNC(legacy,doStop); + [_x, _waitTime] call EFUNC(activities,doStop); } forEach _observers; INFO_1("%1 civ observers were triggered for being gestured with 'stop'", count _observers); diff --git a/addons/interact/functions/fnc_interact_carryOnAction.sqf b/addons/interact/functions/fnc_interact_carryOnAction.sqf index 52ef4edb..ea68ba6e 100644 --- a/addons/interact/functions/fnc_interact_carryOnAction.sqf +++ b/addons/interact/functions/fnc_interact_carryOnAction.sqf @@ -3,4 +3,4 @@ private _veh = vehicle _target; // target may be a vehicle itself private _civ = driver _veh; -[_civ] call EFUNC(legacy,doCarryOn); +[_civ] call EFUNC(activities,doCarryOn); diff --git a/addons/interact/functions/fnc_interact_carryOnCondition.sqf b/addons/interact/functions/fnc_interact_carryOnCondition.sqf index 37871850..8415802e 100644 --- a/addons/interact/functions/fnc_interact_carryOnCondition.sqf +++ b/addons/interact/functions/fnc_interact_carryOnCondition.sqf @@ -5,4 +5,4 @@ private _civ = driver _veh; alive _civ && (_civ isKindOf "Man") && - ([_civ] call EFUNC(legacy,doingCustomActivity)) + ([_civ] call EFUNC(activities,doingCustomActivity)) diff --git a/addons/interact/functions/fnc_interact_stopAction.sqf b/addons/interact/functions/fnc_interact_stopAction.sqf index a323b4f0..9b700d50 100644 --- a/addons/interact/functions/fnc_interact_stopAction.sqf +++ b/addons/interact/functions/fnc_interact_stopAction.sqf @@ -3,4 +3,4 @@ private _veh = vehicle _target; // target may be a vehicle itself private _civ = driver _veh; -[_civ] call EFUNC(legacy,doStop); +[_civ] call EFUNC(activities,doStop); diff --git a/addons/legacy/$PBOPREFIX$ b/addons/legacy/$PBOPREFIX$ deleted file mode 100644 index bc2645ed..00000000 --- a/addons/legacy/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\grad_civs\addons\legacy diff --git a/addons/legacy/XEH_postInit.sqf b/addons/legacy/XEH_postInit.sqf deleted file mode 100644 index 3af3ae68..00000000 --- a/addons/legacy/XEH_postInit.sqf +++ /dev/null @@ -1,11 +0,0 @@ -#include "script_component.hpp" - -if (!(EGVAR(main,enabled))) exitWith {}; - -ISNILS(GVAR(EXITON), {false}); - -[] call FUNC(initCommonEventhandlers); - -if (isServer || CBA_isHeadlessClient) then { - [] call FUNC(initHCs); -}; diff --git a/addons/lifecycle/$PBOPREFIX$ b/addons/lifecycle/$PBOPREFIX$ new file mode 100644 index 00000000..d2af5b36 --- /dev/null +++ b/addons/lifecycle/$PBOPREFIX$ @@ -0,0 +1 @@ +z\grad_civs\addons\lifecycle diff --git a/addons/lifecycle/CfgEventHandlers.hpp b/addons/lifecycle/CfgEventHandlers.hpp new file mode 100644 index 00000000..770e715f --- /dev/null +++ b/addons/lifecycle/CfgEventHandlers.hpp @@ -0,0 +1,14 @@ +class Extended_PostInit_EventHandlers +{ + class ADDON + { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; +class Extended_PreInit_EventHandlers +{ + class ADDON + { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/lifecycle/XEH_PREP.hpp b/addons/lifecycle/XEH_PREP.hpp new file mode 100644 index 00000000..f9b9b6ba --- /dev/null +++ b/addons/lifecycle/XEH_PREP.hpp @@ -0,0 +1,25 @@ +PREP(cleanupLocalCivs); +PREP(config_getCivClasses); +PREP(dismissCiv); +PREP(dismissGroup); +PREP(initConfig); +PREP(findBuildings); +PREP(findRandomPosArea); +PREP(findRandomPos); +// PREP(findSpawnPosition.spec); +PREP(findSpawnPosition); +PREP(findUnclaimedHouse); +PREP(getGlobalCivs); +PREP(globalSpawnPass); +PREP(initHCs); +PREP(isInDistanceFromOtherPlayers); +PREP(sm_lifecycle); +PREP(sm_lifecycle_state_death_enter); +PREP(sm_lifecycle_state_despawn_enter); +PREP(sm_lifecycle_state_life_enter); +PREP(sm_lifecycle_state_life_exit); +PREP(sm_lifecycle_state_spawn_enter); +PREP(sm_lifecycle_trans_life_despawn_condition); +PREP(localSpawnPass); +PREP(spawnCivilianGroup); +PREP(spawnCivilian); diff --git a/addons/lifecycle/XEH_postInit.sqf b/addons/lifecycle/XEH_postInit.sqf new file mode 100644 index 00000000..43681d5e --- /dev/null +++ b/addons/lifecycle/XEH_postInit.sqf @@ -0,0 +1,27 @@ +#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), + { + 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; diff --git a/addons/lifecycle/XEH_preInit.sqf b/addons/lifecycle/XEH_preInit.sqf new file mode 100644 index 00000000..4ce8fef3 --- /dev/null +++ b/addons/lifecycle/XEH_preInit.sqf @@ -0,0 +1,34 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; + +GVAR(excludedFinalClasses) = [ + "Land_Pier_F", + "Land_Pier_small_F", + "Land_NavigLight", + "Land_LampHarbour_F", + "Land_runway_edgelight", + "gm_structure_euro_80_wall_base", + "Land_MilOffices_V1_F", + "Land_Radar_F", + "Land_dp_bigTank_F", + "Land_dp_bigTank_old_F" +]; + +GVAR(excludedParentClasses) = [ + "CargoPlatform_01_base_F", + "Cargo_Tower_base_F", + "Cargo_HQ_base_F", + "Cargo_House_base_F", + "Cargo_Patrol_base_F", + "Land_i_Barracks_V1_F" // yes, is parent for others! +]; + +[] call FUNC(initConfig); + diff --git a/addons/lifecycle/config.cpp b/addons/lifecycle/config.cpp new file mode 100644 index 00000000..65a51a37 --- /dev/null +++ b/addons/lifecycle/config.cpp @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = QUOTE(COMPONENT); + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"grad_civs_common"}; + author = "AUTHOR"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/legacy/functions/fnc_cleanupLocalCivs.sqf b/addons/lifecycle/functions/fnc_cleanupLocalCivs.sqf similarity index 100% rename from addons/legacy/functions/fnc_cleanupLocalCivs.sqf rename to addons/lifecycle/functions/fnc_cleanupLocalCivs.sqf diff --git a/addons/common/functions/fnc_config_getCivClasses.sqf b/addons/lifecycle/functions/fnc_config_getCivClasses.sqf similarity index 58% rename from addons/common/functions/fnc_config_getCivClasses.sqf rename to addons/lifecycle/functions/fnc_config_getCivClasses.sqf index f5f1b1af..e78ed92c 100644 --- a/addons/common/functions/fnc_config_getCivClasses.sqf +++ b/addons/lifecycle/functions/fnc_config_getCivClasses.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" if (GVAR(civClasses) isEqualType "") then { - GVAR(civClasses) = [GVAR(civClasses)] call FUNC(parseCsv); + GVAR(civClasses) = [GVAR(civClasses)] call EFUNC(common,parseCsv); }; GVAR(civClasses) diff --git a/addons/common/functions/fnc_dismissCiv.sqf b/addons/lifecycle/functions/fnc_dismissCiv.sqf similarity index 93% rename from addons/common/functions/fnc_dismissCiv.sqf rename to addons/lifecycle/functions/fnc_dismissCiv.sqf index 576ff430..a9df3502 100644 --- a/addons/common/functions/fnc_dismissCiv.sqf +++ b/addons/lifecycle/functions/fnc_dismissCiv.sqf @@ -9,7 +9,7 @@ if (!(local _civ)) exitWith { }; // take control from state machine first! -EGVAR(legacy,localCivs) = EGVAR(legacy,localCivs) - [_civ]; +GVAR(localCivs) = GVAR(localCivs) - [_civ]; // reset AI capabilities that were disabled at the very start _civ enableAI "TARGET"; diff --git a/addons/common/functions/fnc_dismissGroup.sqf b/addons/lifecycle/functions/fnc_dismissGroup.sqf similarity index 100% rename from addons/common/functions/fnc_dismissGroup.sqf rename to addons/lifecycle/functions/fnc_dismissGroup.sqf diff --git a/addons/legacy/functions/fnc_findBuildings.sqf b/addons/lifecycle/functions/fnc_findBuildings.sqf similarity index 100% rename from addons/legacy/functions/fnc_findBuildings.sqf rename to addons/lifecycle/functions/fnc_findBuildings.sqf diff --git a/addons/legacy/functions/fnc_findRandomPos.sqf b/addons/lifecycle/functions/fnc_findRandomPos.sqf similarity index 100% rename from addons/legacy/functions/fnc_findRandomPos.sqf rename to addons/lifecycle/functions/fnc_findRandomPos.sqf diff --git a/addons/legacy/functions/fnc_findRandomPosArea.sqf b/addons/lifecycle/functions/fnc_findRandomPosArea.sqf similarity index 100% rename from addons/legacy/functions/fnc_findRandomPosArea.sqf rename to addons/lifecycle/functions/fnc_findRandomPosArea.sqf diff --git a/addons/legacy/functions/fnc_findSpawnPosition.spec.sqf b/addons/lifecycle/functions/fnc_findSpawnPosition.spec.sqf similarity index 98% rename from addons/legacy/functions/fnc_findSpawnPosition.spec.sqf rename to addons/lifecycle/functions/fnc_findSpawnPosition.spec.sqf index 98a4becd..f6e815e7 100644 --- a/addons/legacy/functions/fnc_findSpawnPosition.spec.sqf +++ b/addons/lifecycle/functions/fnc_findSpawnPosition.spec.sqf @@ -41,7 +41,7 @@ private _house = objNull; for "_i" from 0 to 10 do { - _house = [_allPlayers, 50, 100, "house"] call grad_civs_legacy_fnc_findSpawnPosition; + _house = [_allPlayers, 50, 100, "house"] call grad_civs_lifecycle_fnc_findSpawnPosition; if (!(isNull _house)) exitWith {}; }; diff --git a/addons/legacy/functions/fnc_findSpawnPosition.sqf b/addons/lifecycle/functions/fnc_findSpawnPosition.sqf similarity index 100% rename from addons/legacy/functions/fnc_findSpawnPosition.sqf rename to addons/lifecycle/functions/fnc_findSpawnPosition.sqf diff --git a/addons/legacy/functions/fnc_findUnclaimedHouse.sqf b/addons/lifecycle/functions/fnc_findUnclaimedHouse.sqf similarity index 70% rename from addons/legacy/functions/fnc_findUnclaimedHouse.sqf rename to addons/lifecycle/functions/fnc_findUnclaimedHouse.sqf index 5ad94a6b..abb44f52 100644 --- a/addons/legacy/functions/fnc_findUnclaimedHouse.sqf +++ b/addons/lifecycle/functions/fnc_findUnclaimedHouse.sqf @@ -15,25 +15,6 @@ private _houses = [ true ] call FUNC(findBuildings); -// TODO exclude watchtowers - -//exclusion list for houses -private _exclusionList = [ - "Land_Pier_F", - "Land_Pier_small_F", - "Land_NavigLight", - "Land_LampHarbour_F", - "Land_runway_edgelight", - "gm_structure_euro_80_wall_base" -]; - -/* -private _exclusionPrefixList = [ - "land_gm_fence" -]; -*/ - - private _minPosCount = 2; LOG_3("%1 houses within %2m of %3, will whittle down by positions and excluded types", count _houses, _radius, _position); @@ -42,6 +23,7 @@ private _idx = _houses findIf { // assumptions: // a) there will be many more houses than civs - hence, occupation filter should come last // b) there are many unsuited house types, and their number will grow (heck even *fences* can be of type "house") - good filter, comes first + private _house = _x; private _isUnoccupied = { (count (_x getVariable ["grad_civs_residents", []])) == 0; @@ -49,9 +31,12 @@ private _idx = _houses findIf { private _hasEnoughPositions = { (count (_x buildingPos -1)) >= _minPosCount; }; - private _goodHouseType = !((typeOf _x) in _exclusionList); + private _goodHouseType2 = { + -1 == (GVAR(excludedParentClasses) findIf {_house isKindOf _x}); + }; + private _goodHouseType = !((typeOf _x) in GVAR(excludedFinalClasses)); - _goodHouseType && _hasEnoughPositions && _isUnoccupied + _goodHouseType && _goodHouseType2 && _hasEnoughPositions && _isUnoccupied }; if (_idx != -1) then { diff --git a/addons/legacy/functions/fnc_getGlobalCivs.sqf b/addons/lifecycle/functions/fnc_getGlobalCivs.sqf similarity index 89% rename from addons/legacy/functions/fnc_getGlobalCivs.sqf rename to addons/lifecycle/functions/fnc_getGlobalCivs.sqf index aec77f1a..1fbf8ad6 100644 --- a/addons/legacy/functions/fnc_getGlobalCivs.sqf +++ b/addons/lifecycle/functions/fnc_getGlobalCivs.sqf @@ -7,13 +7,13 @@ params [ if (isNil QGVAR(getGlobalCivs_arr)) then { // on first run, init array with existing civs - private _civClasses = call EFUNC(common,config_getCivClasses); + private _civClasses = call FUNC(config_getCivClasses); private _potentialCivs = entities [_civClasses, [], true, true]; GVAR(getGlobalCivs_arr) = _potentialCivs select { (_x getVariable ["grad_civs_primaryTask", ""]) != ""}; // then, register event handler to update the array appropriately to always include all living civs [ - QEGVAR(common,civ_added), + QGVAR(civ_added), { params [["_civ", objNull, [objNull]]]; SCRIPT("getGlobalCivs_civ_added"); @@ -21,7 +21,7 @@ if (isNil QGVAR(getGlobalCivs_arr)) then { } ] call CBA_fnc_addEventHandler; [ - QEGVAR(common,civ_removed), + QGVAR(civ_removed), { params [["_civ", objNull, [objNull]]]; SCRIPT("getGlobalCivs_civ_removed"); diff --git a/addons/legacy/functions/fnc_globalSpawnPass.sqf b/addons/lifecycle/functions/fnc_globalSpawnPass.sqf similarity index 100% rename from addons/legacy/functions/fnc_globalSpawnPass.sqf rename to addons/lifecycle/functions/fnc_globalSpawnPass.sqf diff --git a/addons/legacy/functions/fnc_initConfig.sqf b/addons/lifecycle/functions/fnc_initConfig.sqf similarity index 87% rename from addons/legacy/functions/fnc_initConfig.sqf rename to addons/lifecycle/functions/fnc_initConfig.sqf index 700dfe17..d733c52e 100644 --- a/addons/legacy/functions/fnc_initConfig.sqf +++ b/addons/lifecycle/functions/fnc_initConfig.sqf @@ -2,25 +2,36 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "2) basics"]; +private _settingsGroup = ["GRAD Civs", "2) lifecycle - performance & spawning"]; [ - QGVAR(minCivUpdateTime), - "SLIDER", - "Keep civ reaction times under [s]", + QGVAR(civClasses), + "EDITBOX", + "Unit classes to use for spawning civilians", _settingsGroup, - [0.1, 10, 3, 1], - false, + "C_Man_1", + true, {}, false ] call CBA_fnc_addSetting; [ - QGVAR(smMultiplicator), - "SLIDER", - "CBA state machine speed multiplicator on HCs", + QGVAR(cleanupCorpses), + "CHECKBOX", + "support corpseManagerMode", + _settingsGroup, + true, + true, + {}, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(spawnOnlyWithPlayers), + "CHECKBOX", + "Spawn civilians only when players on server", _settingsGroup, - [1, 10, 1, 0], + true, true, {}, false @@ -49,33 +60,22 @@ private _settingsGroup = ["GRAD Civs", "2) basics"]; ] call CBA_fnc_addSetting; [ - QGVAR(panicCooldown), - "EDITBOX", - "Time for panic to wear off [low, med, high]", + QGVAR(minCivUpdateTime), + "SLIDER", + "Keep civ reaction times under [s]", _settingsGroup, - QUOTE([ARR_3(15,120,240)]), + [0.1, 10, 3, 1], false, {}, false ] call CBA_fnc_addSetting; [ - QGVAR(cleanupCorpses), - "CHECKBOX", - "support corpseManagerMode", - _settingsGroup, - true, - true, - {}, - false -] call CBA_fnc_addSetting; - -[ - QGVAR(spawnOnlyWithPlayers), - "CHECKBOX", - "Spawn civilians only when players on server", + QGVAR(smMultiplicator), + "SLIDER", + "CBA state machine speed multiplicator on HCs", _settingsGroup, - true, + [1, 10, 1, 0], true, {}, false diff --git a/addons/legacy/functions/fnc_initHCs.sqf b/addons/lifecycle/functions/fnc_initHCs.sqf similarity index 100% rename from addons/legacy/functions/fnc_initHCs.sqf rename to addons/lifecycle/functions/fnc_initHCs.sqf diff --git a/addons/legacy/functions/fnc_isInDistanceFromOtherPlayers.sqf b/addons/lifecycle/functions/fnc_isInDistanceFromOtherPlayers.sqf similarity index 100% rename from addons/legacy/functions/fnc_isInDistanceFromOtherPlayers.sqf rename to addons/lifecycle/functions/fnc_isInDistanceFromOtherPlayers.sqf diff --git a/addons/legacy/functions/fnc_localSpawnPass.sqf b/addons/lifecycle/functions/fnc_localSpawnPass.sqf similarity index 100% rename from addons/legacy/functions/fnc_localSpawnPass.sqf rename to addons/lifecycle/functions/fnc_localSpawnPass.sqf diff --git a/addons/legacy/functions/fnc_sm_lifecycle.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle.sqf similarity index 91% rename from addons/legacy/functions/fnc_sm_lifecycle.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle.sqf index 3176f06e..8edbc89a 100644 --- a/addons/legacy/functions/fnc_sm_lifecycle.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle.sqf @@ -2,9 +2,6 @@ private _lifecycle = [{GVAR(localCivs)}, true, "lifecycle"] call EFUNC(cba_statemachine,create); -private _activities = [] call FUNC(sm_activities); -private _emotions = [] call FUNC(sm_emotions); - // STATES private _lifecycle_spawn = [ @@ -17,9 +14,9 @@ private _lifecycle_spawn = [ private _lifecycle_life = [ _lifecycle, - [_activities, _emotions], + [], {}, - { _this call FUNC(sm_lifecycle_state_life_enter) }, + { _this call FUNC(sm_lifecycle_state_life_enter) }, { _this call FUNC(sm_lifecycle_state_life_exit) }, "lfc_life" ] call EFUNC(cba_statemachine,addCompoundState); diff --git a/addons/legacy/functions/fnc_sm_lifecycle_state_death_enter.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_death_enter.sqf similarity index 90% rename from addons/legacy/functions/fnc_sm_lifecycle_state_death_enter.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_state_death_enter.sqf index 78055b9e..c26b2469 100644 --- a/addons/legacy/functions/fnc_sm_lifecycle_state_death_enter.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle_state_death_enter.sqf @@ -9,7 +9,7 @@ INFO_3("releasing civ %1 killed at %2 by %3", _this, _deathPos, _killer); ["grad_civs_civKilled", [_deathPos, _killer, _this]] call CBA_fnc_globalEvent; GVAR(localCivs) = GVAR(localCivs) - [_this]; -[QEGVAR(common,civ_removed), [_this]] call CBA_fnc_globalEvent; +[QGVAR(civ_removed), [_this]] call CBA_fnc_globalEvent; if (GVAR(cleanupCorpses)) then { addToRemainsCollector [_this]; diff --git a/addons/legacy/functions/fnc_sm_lifecycle_state_despawn_enter.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_despawn_enter.sqf similarity index 75% rename from addons/legacy/functions/fnc_sm_lifecycle_state_despawn_enter.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_state_despawn_enter.sqf index 4b9dd768..40add3c2 100644 --- a/addons/legacy/functions/fnc_sm_lifecycle_state_despawn_enter.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle_state_despawn_enter.sqf @@ -3,7 +3,7 @@ private _vec = vehicle _this; if (_vec != _this) then { GVAR(localCivs) = GVAR(localCivs) - (crew _vec); - [QEGVAR(common,civ_removed), (crew _vec)] call CBA_fnc_globalEvent; + [QGVAR(civ_removed), (crew _vec)] call CBA_fnc_globalEvent; private _count = { _vec deleteVehicleCrew _x; true @@ -12,7 +12,7 @@ if (_vec != _this) then { INFO_1("vehicle with %1 civs was despawned", _count); } else { GVAR(localCivs) = GVAR(localCivs) - [_this]; - [QEGVAR(common,civ_removed), [_this]] call CBA_fnc_globalEvent; + [QGVAR(civ_removed), [_this]] call CBA_fnc_globalEvent; deleteVehicle _this; INFO("1 civ was despawned"); }; diff --git a/addons/legacy/functions/fnc_sm_lifecycle_state_life_enter.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_life_enter.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_lifecycle_state_life_enter.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_state_life_enter.sqf diff --git a/addons/legacy/functions/fnc_sm_lifecycle_state_life_exit.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_life_exit.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_lifecycle_state_life_exit.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_state_life_exit.sqf diff --git a/addons/legacy/functions/fnc_sm_lifecycle_state_spawn_enter.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf similarity index 91% rename from addons/legacy/functions/fnc_sm_lifecycle_state_spawn_enter.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf index 54363684..f2cd5ebb 100644 --- a/addons/legacy/functions/fnc_sm_lifecycle_state_spawn_enter.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf @@ -53,8 +53,7 @@ private _addVars = { ["_civ", objNull] ]; private _fastSpeed = _civ getSpeed "FAST"; - private _panicCooldown = [GVAR(panicCooldown)] call EFUNC(common,parseCsv); - _civ setVariable["GRAD_CIVS_PANICCOOLDOWN" , random _panicCooldown, true]; + _civ setVariable["grad_civs_runspeed", random [_fastSpeed * 0.5, _fastSpeed, _fastSpeed * 1.3], true]; _civ setVariable["grad_civs_recklessness", random [0, 5, 10], true]; }; diff --git a/addons/legacy/functions/fnc_sm_lifecycle_trans_life_despawn_condition.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_trans_life_despawn_condition.sqf similarity index 100% rename from addons/legacy/functions/fnc_sm_lifecycle_trans_life_despawn_condition.sqf rename to addons/lifecycle/functions/fnc_sm_lifecycle_trans_life_despawn_condition.sqf diff --git a/addons/legacy/functions/fnc_spawnCivilian.sqf b/addons/lifecycle/functions/fnc_spawnCivilian.sqf similarity index 78% rename from addons/legacy/functions/fnc_spawnCivilian.sqf rename to addons/lifecycle/functions/fnc_spawnCivilian.sqf index f8ccb681..47f8e06f 100644 --- a/addons/legacy/functions/fnc_spawnCivilian.sqf +++ b/addons/lifecycle/functions/fnc_spawnCivilian.sqf @@ -6,7 +6,7 @@ params [ ["_primaryTask", ""] ]; -private _civClasses = call EFUNC(common,config_getCivClasses); +private _civClasses = call FUNC(config_getCivClasses); private _civ = _group createUnit [selectRandom _civClasses, _pos, [], 0, "NONE"]; // TODO: ensure unit is not spawning within editor-placed rocks/houses GVAR(localCivs) = GVAR(localCivs) + [_civ]; @@ -14,6 +14,6 @@ GVAR(localCivs) = GVAR(localCivs) + [_civ]; _civ setVariable ["grad_civs_primaryTask", _primaryTask, true]; _civ setVariable ["acex_headless_blacklist", true, true]; -[QEGVAR(common,civ_added), [_civ]] call CBA_fnc_globalEvent; +[QGVAR(civ_added), [_civ]] call CBA_fnc_globalEvent; _civ diff --git a/addons/legacy/functions/fnc_spawnCivilianGroup.sqf b/addons/lifecycle/functions/fnc_spawnCivilianGroup.sqf similarity index 100% rename from addons/legacy/functions/fnc_spawnCivilianGroup.sqf rename to addons/lifecycle/functions/fnc_spawnCivilianGroup.sqf diff --git a/addons/legacy/script_component.hpp b/addons/lifecycle/script_component.hpp similarity index 91% rename from addons/legacy/script_component.hpp rename to addons/lifecycle/script_component.hpp index 46c1132c..f6158821 100644 --- a/addons/legacy/script_component.hpp +++ b/addons/lifecycle/script_component.hpp @@ -1,4 +1,4 @@ -#define COMPONENT legacy +#define COMPONENT lifecycle #include "\z\grad_civs\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/loadout/XEH_postInit.sqf b/addons/loadout/XEH_postInit.sqf index 0b7b5e06..4039ccf4 100644 --- a/addons/loadout/XEH_postInit.sqf +++ b/addons/loadout/XEH_postInit.sqf @@ -2,7 +2,7 @@ if (!(EGVAR(main,enabled))) exitWith {}; -[QEGVAR(common,civ_added), { +[QEGVAR(lifecycle,civ_added), { params [["_civ", objNull, [objNull]]]; assert(!isNull _civ); if (local _civ) then { diff --git a/addons/loadout/functions/fnc_initConfig.sqf b/addons/loadout/functions/fnc_initConfig.sqf index c883d00c..4ccf88ff 100644 --- a/addons/loadout/functions/fnc_initConfig.sqf +++ b/addons/loadout/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "7) loadout"]; +private _settingsGroup = ["GRAD Civs", "3) loadout - everything from underwear to scarves"]; [ QGVAR(backpacks), diff --git a/addons/mimikry/config.cpp b/addons/mimikry/config.cpp index 218a1efa..8558d12c 100644 --- a/addons/mimikry/config.cpp +++ b/addons/mimikry/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"CBA_Extended_EventHandlers", "ace_common", "grad_civs_legacy"}; + requiredAddons[] = {"CBA_Extended_EventHandlers", "ace_common", "grad_civs_activities"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/mimikry/functions/fnc_addEventHandlers.sqf b/addons/mimikry/functions/fnc_addEventHandlers.sqf index 18830207..f6734783 100644 --- a/addons/mimikry/functions/fnc_addEventHandlers.sqf +++ b/addons/mimikry/functions/fnc_addEventHandlers.sqf @@ -63,7 +63,7 @@ [_message] call FUNC(showCivHint); }] call CBA_fnc_addEventHandler; -[QEGVAR(legacy,doStop), { +[QEGVAR(activities,doStop), { params ["_civ"]; if (_civ != ACE_player) exitWith {}; if !GVAR(playerActsAsCiv) exitWith {}; @@ -72,7 +72,7 @@ [_message] call FUNC(showCivHint); }] call CBA_fnc_addEventHandler; -[QEGVAR(legacy,doReverse), { +[QEGVAR(activities,doReverse), { params ["_civ"]; if (_civ != ACE_player) exitWith {}; if !GVAR(playerActsAsCiv) exitWith {}; @@ -81,7 +81,7 @@ [_message] call FUNC(showCivHint); }] call CBA_fnc_addEventHandler; -[QEGVAR(legacy,doCarryOn), { +[QEGVAR(activities,doCarryOn), { params ["_civ"]; if (_civ != ACE_player) exitWith {}; if !GVAR(playerActsAsCiv) exitWith {}; diff --git a/addons/mimikry/functions/fnc_initConfig.sqf b/addons/mimikry/functions/fnc_initConfig.sqf index 24632968..6a40c3d6 100644 --- a/addons/mimikry/functions/fnc_initConfig.sqf +++ b/addons/mimikry/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "8) player mimikry"]; +private _settingsGroup = ["GRAD Civs", "b) player mimikry - help with acting like a grad-civ"]; [ QGVAR(enabled), diff --git a/addons/patrol/XEH_postInit.sqf b/addons/patrol/XEH_postInit.sqf index ee27bb25..1649f135 100644 --- a/addons/patrol/XEH_postInit.sqf +++ b/addons/patrol/XEH_postInit.sqf @@ -4,10 +4,10 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { [ - QEGVAR(legacy,localSpawn), + QEGVAR(activities,localSpawn), { ISNILS(GVAR(maxCivsOnFoot), GVAR(maxCivsOnFoot)); - if ((count (["patrol"] call EFUNC(legacy,getGlobalCivs))) < GVAR(maxCivsOnFoot)) then { + if ((count (["patrol"] call EFUNC(lifecycle,getGlobalCivs))) < GVAR(maxCivsOnFoot)) then { [ALL_HUMAN_PLAYERS] call FUNC(addFootsy); }; } diff --git a/addons/patrol/config.cpp b/addons/patrol/config.cpp index f1cc2370..71dae1e8 100644 --- a/addons/patrol/config.cpp +++ b/addons/patrol/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"CBA_Extended_EventHandlers", "grad_civs_main", "grad_civs_common", "grad_civs_legacy"}; + requiredAddons[] = {"CBA_Extended_EventHandlers", "grad_civs_main", "grad_civs_common", "grad_civs_activities"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/patrol/functions/fnc_addFootsy.sqf b/addons/patrol/functions/fnc_addFootsy.sqf index 8d9a21bc..6bbf93c2 100644 --- a/addons/patrol/functions/fnc_addFootsy.sqf +++ b/addons/patrol/functions/fnc_addFootsy.sqf @@ -13,7 +13,7 @@ private _house = [ _footSpawnDistanceMin, _footSpawnDistanceMax, "house" -] call EFUNC(legacy,findSpawnPosition); +] call EFUNC(lifecycle,findSpawnPosition); if (isNull _house) exitWith { LOG("could not find house for patrol"); @@ -22,4 +22,4 @@ if (isNull _house) exitWith { private _maxInitialGroupSize = GVAR(initialGroupSize); private _groupSize = (floor random _maxInitialGroupSize) + 1; -_group = [getPos _house, _groupSize, _house, "patrol"] call EFUNC(legacy,spawnCivilianGroup); +_group = [getPos _house, _groupSize, _house, "patrol"] call EFUNC(lifecycle,spawnCivilianGroup); diff --git a/addons/patrol/functions/fnc_initConfig.sqf b/addons/patrol/functions/fnc_initConfig.sqf index b607a162..adc91e15 100644 --- a/addons/patrol/functions/fnc_initConfig.sqf +++ b/addons/patrol/functions/fnc_initConfig.sqf @@ -2,25 +2,25 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "4) patrols"]; +private _settingsGroup = ["GRAD Civs", "6) patrols - going for long walks"]; [ - QGVAR(initialGroupSize), + QGVAR(maxCivsOnFoot), "SLIDER", - "Max group size for civilians", + "Max number of civilians patroling on foot", _settingsGroup, - [0, 50, 3, 0], + [0, 300, 30, 0], true, {}, false ] call CBA_fnc_addSetting; [ - QGVAR(maxCivsOnFoot), + QGVAR(initialGroupSize), "SLIDER", - "Max number of civilians patroling on foot", + "Max group size for civilians", _settingsGroup, - [0, 300, 30, 0], + [0, 50, 3, 0], true, {}, false diff --git a/addons/patrol/functions/fnc_sm_business_state_patrol_enter.sqf b/addons/patrol/functions/fnc_sm_business_state_patrol_enter.sqf index f386182e..6c608658 100644 --- a/addons/patrol/functions/fnc_sm_business_state_patrol_enter.sqf +++ b/addons/patrol/functions/fnc_sm_business_state_patrol_enter.sqf @@ -13,5 +13,5 @@ if (_this == leader _this) then { _x enableDynamicSimulation true; false } count (units _grp); - _this call EFUNC(legacy,forceEmotionSpeed); + _this call EFUNC(activities,forceEmotionSpeed); }; diff --git a/addons/patrol/functions/fnc_taskPatrol.spec.sqf b/addons/patrol/functions/fnc_taskPatrol.spec.sqf index 3e03584b..ef0620e2 100644 --- a/addons/patrol/functions/fnc_taskPatrol.spec.sqf +++ b/addons/patrol/functions/fnc_taskPatrol.spec.sqf @@ -27,7 +27,7 @@ ["who is tasked to patrol on foot", { params [["_civ", objNull]]; - [_civ, getPos _civ, 250, 3] call grad_civs_legacy_fnc_taskPatrol; + [_civ, getPos _civ, 250, 3] call grad_civs_patrol_fnc_taskPatrol; [_civ] }, [ @@ -114,7 +114,7 @@ ["and tasked to patrol", { params [["_civ", objNull]]; - [_civ, getPos _civ, 250, 3] call grad_civs_legacy_fnc_taskPatrol; + [_civ, getPos _civ, 250, 3] call grad_civs_patrol_fnc_taskPatrol; [_civ] }, [ diff --git a/addons/patrol/functions/fnc_taskPatrolFindWaypoint.sqf b/addons/patrol/functions/fnc_taskPatrolFindWaypoint.sqf index 6d9174e2..b1ee2fa3 100644 --- a/addons/patrol/functions/fnc_taskPatrolFindWaypoint.sqf +++ b/addons/patrol/functions/fnc_taskPatrolFindWaypoint.sqf @@ -27,13 +27,13 @@ for "_i" from 1 to _maxTries do { nil, _findWaterPos, _findRoadPos - ] call EFUNC(legacy,findRandomPos); + ] call EFUNC(lifecycle,findRandomPos); if (_searchPosition isEqualTo []) then { _searchPosition = _position; }; _searchPosition = if (_findPosOfInterest && {80 > random 100}) then { - [_searchPosition, false] call EFUNC(legacy,findPositionOfInterest); + [_searchPosition, false] call EFUNC(lifecycle,findPositionOfInterest); } else { _searchPosition }; diff --git a/addons/patrol/functions/fnc_taskPatrolFindWaypoints.spec.sqf b/addons/patrol/functions/fnc_taskPatrolFindWaypoints.spec.sqf index bf21b28f..b4d9c111 100644 --- a/addons/patrol/functions/fnc_taskPatrolFindWaypoints.spec.sqf +++ b/addons/patrol/functions/fnc_taskPatrolFindWaypoints.spec.sqf @@ -15,7 +15,7 @@ [ ["when a patrol path is created", { - [([[0, 0, 0], 250, 3] call grad_civs_legacy_fnc_taskPatrolFindWaypoints)] + [([[0, 0, 0], 250, 3] call grad_civs_patrol_fnc_taskPatrolFindWaypoints)] }, [ ["three positions are returned as requested", @@ -53,7 +53,7 @@ ["GIVEN a point and no exclusion zones WHEN a patrol path is created", { - [([[0, 0, 0], 250, 3] call grad_civs_legacy_fnc_taskPatrolFindWaypoints)] + [([[0, 0, 0], 250, 3] call grad_civs_patrol_fnc_taskPatrolFindWaypoints)] }, [ ["three positions are returned as requested", diff --git a/addons/residents/XEH_PREP.hpp b/addons/residents/XEH_PREP.hpp index 17074145..9724717a 100644 --- a/addons/residents/XEH_PREP.hpp +++ b/addons/residents/XEH_PREP.hpp @@ -1,4 +1,5 @@ PREP(addResident); +PREP(compare); PREP(initConfig); PREP(sm_business); PREP(sm_business_state_chat_enter); diff --git a/addons/residents/XEH_postInit.sqf b/addons/residents/XEH_postInit.sqf index b5c72c82..5b8bee27 100644 --- a/addons/residents/XEH_postInit.sqf +++ b/addons/residents/XEH_postInit.sqf @@ -4,10 +4,10 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { [ - QEGVAR(legacy,localSpawn), + QEGVAR(lifecycle,localSpawn), { ISNILS(GVAR(maxCivsResidents), GVAR(maxCivsResidents)); - if ((count (["reside"] call EFUNC(legacy,getGlobalCivs))) < GVAR(maxCivsResidents)) then { + if ((count (["reside"] call EFUNC(lifecycle,getGlobalCivs))) < GVAR(maxCivsResidents)) then { [ALL_HUMAN_PLAYERS] call FUNC(addResident); }; } diff --git a/addons/residents/config.cpp b/addons/residents/config.cpp index 74aa1f6c..496bef3e 100644 --- a/addons/residents/config.cpp +++ b/addons/residents/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"grad_civs_common", "grad_civs_legacy"}; + requiredAddons[] = {"grad_civs_common", "grad_civs_activities"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/residents/functions/fnc_addResident.sqf b/addons/residents/functions/fnc_addResident.sqf index a763bc64..90cedc1e 100644 --- a/addons/residents/functions/fnc_addResident.sqf +++ b/addons/residents/functions/fnc_addResident.sqf @@ -13,12 +13,12 @@ private _house = [ _residentSpawnDistanceMin, _residentSpawnDistanceMax, "house" -] call EFUNC(legacy,findSpawnPosition); +] call EFUNC(lifecycle,findSpawnPosition); if (isNil "_house") exitWith {LOG("could not find spawn position for resident this time (nil)")}; if (isNull _house) exitWith {LOG("could not find spawn position for resident this time (null)")}; -private _group = [getPos _house, 1, _house, "reside"] call EFUNC(legacy,spawnCivilianGroup); +private _group = [getPos _house, 1, _house, "reside"] call EFUNC(lifecycle,spawnCivilianGroup); if (isNull _group) exitWith {}; _group diff --git a/addons/legacy/functions/fnc_compare.sqf b/addons/residents/functions/fnc_compare.sqf similarity index 100% rename from addons/legacy/functions/fnc_compare.sqf rename to addons/residents/functions/fnc_compare.sqf diff --git a/addons/residents/functions/fnc_initConfig.sqf b/addons/residents/functions/fnc_initConfig.sqf index a9b17edb..d7d1aa8d 100644 --- a/addons/residents/functions/fnc_initConfig.sqf +++ b/addons/residents/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "3) residents"]; +private _settingsGroup = ["GRAD Civs", "5) residents - between housework and chats with the neighbors"]; [ diff --git a/addons/residents/functions/fnc_sm_business_state_housework_enter.sqf b/addons/residents/functions/fnc_sm_business_state_housework_enter.sqf index 397ddf85..c474230d 100644 --- a/addons/residents/functions/fnc_sm_business_state_housework_enter.sqf +++ b/addons/residents/functions/fnc_sm_business_state_housework_enter.sqf @@ -2,7 +2,7 @@ private _house = _this getVariable ["grad_civs_home", objNull]; _this setVariable ["grad_civs_housework_time", random [5, 15, 120]]; -_this call EFUNC(legacy,forceEmotionSpeed); +_this call EFUNC(activities,forceEmotionSpeed); if (isNull _house) exitWith {}; diff --git a/addons/residents/functions/fnc_sm_business_state_meetNeighbor_loop.sqf b/addons/residents/functions/fnc_sm_business_state_meetNeighbor_loop.sqf index df8a3d15..be79da69 100644 --- a/addons/residents/functions/fnc_sm_business_state_meetNeighbor_loop.sqf +++ b/addons/residents/functions/fnc_sm_business_state_meetNeighbor_loop.sqf @@ -3,7 +3,7 @@ private _neighbor = _this getVariable ["grad_civs_neighborToMeet", objNull]; if (isNull _neighbor) exitWith {WARNING("wanted to meet neighbor, but now he's null!")}; -private _isSenior = ([_this, _neighbor] call EFUNC(legacy,compare)) > 0; +private _isSenior = ([_this, _neighbor] call FUNC(compare)) > 0; private _stopDistance = _this getVariable ["grad_civs_stopDistance", 5]; if (!(isOnRoad _this) && _isSenior && (_this distance _neighbor) < _stopDistance && (random 10 > 1)) exitWith {doStop _this}; // one of both may wait the last meters @@ -12,5 +12,5 @@ private _neighborPos = getPos _neighbor; if ((_knownNeighborPos distance _neighborPos) > 1) then { _this setVariable ["grad_civs_neighborPos", _neighborPos]; _this doMove _neighborPos; - _this call EFUNC(legacy,forceEmotionSpeed); + _this call EFUNC(activities,forceEmotionSpeed); }; diff --git a/addons/residents/functions/fnc_sm_business_trans_housework_meetNeighbor_condition.sqf b/addons/residents/functions/fnc_sm_business_trans_housework_meetNeighbor_condition.sqf index 144ec3b9..c3deec96 100644 --- a/addons/residents/functions/fnc_sm_business_trans_housework_meetNeighbor_condition.sqf +++ b/addons/residents/functions/fnc_sm_business_trans_housework_meetNeighbor_condition.sqf @@ -15,7 +15,7 @@ if (random 10 < 9) exitWith {false}; private _neighborToMeet = { private _maxDist = _x; - private _civClasses = call EFUNC(common,config_getCivClasses); + private _civClasses = call EFUNC(lifecycle,config_getCivClasses); private _nearCivs = (_this nearEntities [_civClasses, _maxDist]); private _socialNeighbors = _nearCivs select { (_x != _this) && diff --git a/addons/transit/XEH_postInit.sqf b/addons/transit/XEH_postInit.sqf index 9992de01..3bbfa318 100644 --- a/addons/transit/XEH_postInit.sqf +++ b/addons/transit/XEH_postInit.sqf @@ -4,7 +4,7 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { [ - QEGVAR(legacy,localSpawn), + QEGVAR(lifecycle,localSpawn), { _maxVehiclesInTransit = GVAR(maxVehiclesInTransit); if ((count (["transit"] call EFUNC(cars,getGlobalVehicles))) < _maxVehiclesInTransit) then { diff --git a/addons/transit/functions/fnc_initConfig.sqf b/addons/transit/functions/fnc_initConfig.sqf index 3c3768f9..d3dfca7c 100644 --- a/addons/transit/functions/fnc_initConfig.sqf +++ b/addons/transit/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "9) transit"]; +private _settingsGroup = ["GRAD Civs", "a) transit - traffic between pre-set points"]; [ QGVAR(maxVehiclesInTransit), diff --git a/addons/transit/functions/fnc_sm_business_state_transit_loop.sqf b/addons/transit/functions/fnc_sm_business_state_transit_loop.sqf index d6883f2e..e3c5dbb3 100644 --- a/addons/transit/functions/fnc_sm_business_state_transit_loop.sqf +++ b/addons/transit/functions/fnc_sm_business_state_transit_loop.sqf @@ -7,7 +7,7 @@ if (isNull _this) exitWith { private _group = group _this; if (isNull _group) exitWith { private _livedAs = _this getVariable ["grad_civs_livedAs", str _this]; - WARNING_5("unit %1 (type %2) in voyage loop has no group. will ignore. alive %3 index %4 pos %5", _livedAs, typeof _this, alive _this, EGVAR(legacy,localCivs) find _this, getPos _this); + WARNING_5("unit %1 (type %2) in voyage loop has no group. will ignore. alive %3 index %4 pos %5", _livedAs, typeof _this, alive _this, EGVAR(lifecycle,localCivs) find _this, getPos _this); }; private _wpidx = currentWaypoint _group; diff --git a/addons/transit/functions/fnc_sm_business_trans_transit_dismount_condition.sqf b/addons/transit/functions/fnc_sm_business_trans_transit_dismount_condition.sqf index 2debf65c..c9423d1c 100644 --- a/addons/transit/functions/fnc_sm_business_trans_transit_dismount_condition.sqf +++ b/addons/transit/functions/fnc_sm_business_trans_transit_dismount_condition.sqf @@ -1,3 +1,3 @@ #include "..\script_component.hpp" -(_this call EFUNC(interact,sm_activities_helper_surrenderCondition)) || !(canMove vehicle _this) +_this call EFUNC(cars,dismountCondition); \ No newline at end of file diff --git a/addons/voyage/XEH_postInit.sqf b/addons/voyage/XEH_postInit.sqf index 2acaaaf8..41f67e89 100644 --- a/addons/voyage/XEH_postInit.sqf +++ b/addons/voyage/XEH_postInit.sqf @@ -4,10 +4,10 @@ if (!(EGVAR(main,enabled))) exitWith {}; if (isServer || CBA_isHeadlessClient) then { [ - QEGVAR(legacy,localSpawn), + QEGVAR(lifecycle,localSpawn), { private _maxCivsInVehicles = GVAR(maxCivsInVehicles); - if ((count (["voyage"] call EFUNC(legacy,getGlobalCivs))) < _maxCivsInVehicles) then { + if ((count (["voyage"] call EFUNC(lifecycle,getGlobalCivs))) < _maxCivsInVehicles) then { [ALL_HUMAN_PLAYERS] call FUNC(addCarCrew); }; } diff --git a/addons/voyage/config.cpp b/addons/voyage/config.cpp index 74aa1f6c..9a789558 100644 --- a/addons/voyage/config.cpp +++ b/addons/voyage/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"grad_civs_common", "grad_civs_legacy"}; + requiredAddons[] = {"grad_civs_common", "grad_civs_cars"}; author = "AUTHOR"; VERSION_CONFIG; }; diff --git a/addons/voyage/functions/fnc_addCarCrew.sqf b/addons/voyage/functions/fnc_addCarCrew.sqf index 97a11606..831fffdd 100644 --- a/addons/voyage/functions/fnc_addCarCrew.sqf +++ b/addons/voyage/functions/fnc_addCarCrew.sqf @@ -16,7 +16,7 @@ private _pos = if (_forcePosition isEqualTo []) then { _allPlayers, _vehicleSpawnDistanceMin, _vehicleSpawnDistanceMax, - ["voyage"] call EFUNC(legacy,getGlobalCivs) + ["voyage"] call EFUNC(lifecycle,getGlobalCivs) ] call FUNC(findSpawnRoadSegment); if (isNull _segment) then { diff --git a/addons/voyage/functions/fnc_findSpawnRoadSegment.sqf b/addons/voyage/functions/fnc_findSpawnRoadSegment.sqf index 6f22eb28..0242694a 100644 --- a/addons/voyage/functions/fnc_findSpawnRoadSegment.sqf +++ b/addons/voyage/functions/fnc_findSpawnRoadSegment.sqf @@ -8,4 +8,4 @@ if (_allPlayers isEqualTo []) exitWith {LOG("_allPlayers is empty"); objNull}; private _refPlayerPos = getPos (selectRandom _allPlayers); -([ALL_HUMAN_PLAYERS, _minSpawnDistance, _maxSpawnDistance, "road"] call EFUNC(legacy,findSpawnPosition)); +([ALL_HUMAN_PLAYERS, _minSpawnDistance, _maxSpawnDistance, "road"] call EFUNC(lifecycle,findSpawnPosition)); diff --git a/addons/voyage/functions/fnc_initConfig.sqf b/addons/voyage/functions/fnc_initConfig.sqf index ad3d5bf3..681d0ca8 100644 --- a/addons/voyage/functions/fnc_initConfig.sqf +++ b/addons/voyage/functions/fnc_initConfig.sqf @@ -2,7 +2,7 @@ INFO("initConfig running..."); -private _settingsGroup = ["GRAD Civs", "6) voyagers"]; +private _settingsGroup = ["GRAD Civs", "8) voyagers - AI driving unleashed"]; [ QGVAR(maxCivsInVehicles), @@ -29,7 +29,7 @@ private _settingsGroup = ["GRAD Civs", "6) voyagers"]; [ QGVAR(maxTravelRadius), "SLIDER", - "max travel radius around spawn (otional)", + "max travel radius around spawn (optional)", _settingsGroup, [0, 100000, 0, 0], false, diff --git a/addons/voyage/functions/fnc_sm_business_state_voyage_loop.sqf b/addons/voyage/functions/fnc_sm_business_state_voyage_loop.sqf index ff2a677b..d143fdcc 100644 --- a/addons/voyage/functions/fnc_sm_business_state_voyage_loop.sqf +++ b/addons/voyage/functions/fnc_sm_business_state_voyage_loop.sqf @@ -3,7 +3,7 @@ private _group = group _this; if (isNull _group) exitWith { private _livedAs = _this getVariable ["grad_civs_livedAs", str _this]; - WARNING_5("unit %1 (type %2) in voyage loop has no group. will ignore. alive %3 index %4 pos %5", _livedAs, typeof _this, alive _this, EGVAR(legacy,localCivs) find _this, getPos _this); + WARNING_5("unit %1 (type %2) in voyage loop has no group. will ignore. alive %3 index %4 pos %5", _livedAs, typeof _this, alive _this, EGVAR(lifecycle,localCivs) find _this, getPos _this); }; private _wps = waypoints _group; private _wppos = waypointPosition (_wps select (currentWaypoint _group)); diff --git a/addons/voyage/functions/fnc_sm_business_trans_voyage_dismount_condition.sqf b/addons/voyage/functions/fnc_sm_business_trans_voyage_dismount_condition.sqf index 2debf65c..c9423d1c 100644 --- a/addons/voyage/functions/fnc_sm_business_trans_voyage_dismount_condition.sqf +++ b/addons/voyage/functions/fnc_sm_business_trans_voyage_dismount_condition.sqf @@ -1,3 +1,3 @@ #include "..\script_component.hpp" -(_this call EFUNC(interact,sm_activities_helper_surrenderCondition)) || !(canMove vehicle _this) +_this call EFUNC(cars,dismountCondition); \ No newline at end of file diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 0b84f8a1..b34393f0 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -8,7 +8,7 @@ class CfgPatches { requiredVersion = REQUIRED_VERSION; requiredAddons[] = { "grad_civs_common" - ,"grad_civs_legacy" + ,"grad_civs_activities" ,"grad_civs_voyage" #ifdef HARD_DEPENDENCIES ,"zen_context_menu" diff --git a/addons/zeus/functions/fnc_context_condition_doCarryOn.sqf b/addons/zeus/functions/fnc_context_condition_doCarryOn.sqf index 36a23e8d..0b91ff6d 100644 --- a/addons/zeus/functions/fnc_context_condition_doCarryOn.sqf +++ b/addons/zeus/functions/fnc_context_condition_doCarryOn.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" private _stoppeds = (_objects call FUNC(selectGradCivs)) select { - _x call EFUNC(legacy,isStopped) + _x call EFUNC(activities,isStopped) }; count _stoppeds > 0 diff --git a/addons/zeus/functions/fnc_context_statement_dismissCiv.sqf b/addons/zeus/functions/fnc_context_statement_dismissCiv.sqf index 990c1008..ac3a7ce0 100644 --- a/addons/zeus/functions/fnc_context_statement_dismissCiv.sqf +++ b/addons/zeus/functions/fnc_context_statement_dismissCiv.sqf @@ -2,5 +2,5 @@ { INFO_1("%1 is being dismissed from GRAD Civs", _x); - [_x] call EFUNC(common,dismissCiv); + [_x] call EFUNC(lifecycle,dismissCiv); } forEach (_objects call FUNC(selectGradCivs)) diff --git a/addons/zeus/functions/fnc_context_statement_doCarryOn.sqf b/addons/zeus/functions/fnc_context_statement_doCarryOn.sqf index 50d90631..a8d7cd98 100644 --- a/addons/zeus/functions/fnc_context_statement_doCarryOn.sqf +++ b/addons/zeus/functions/fnc_context_statement_doCarryOn.sqf @@ -2,5 +2,5 @@ { INFO_1("%1 will carry on with whatever", _x); - [_x] call EFUNC(legacy,doCarryOn); + [_x] call EFUNC(activities,doCarryOn); } forEach (_objects call FUNC(selectGradCivs)) diff --git a/addons/zeus/functions/fnc_context_statement_doStop.sqf b/addons/zeus/functions/fnc_context_statement_doStop.sqf index e4ae1717..003a0b3a 100644 --- a/addons/zeus/functions/fnc_context_statement_doStop.sqf +++ b/addons/zeus/functions/fnc_context_statement_doStop.sqf @@ -2,5 +2,5 @@ { INFO_1("%1 will stop until told otherwise", _x); - [_x] call EFUNC(legacy,doStop); + [_x] call EFUNC(activities,doStop); } forEach (_objects call FUNC(selectGradCivs))