diff --git a/README.md b/README.md index d2638e5d..54f8b475 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ The mod is meant to make use of Headless Clients, no extra configuration necessa * [CBA_A3](https://github.com/CBATeam/CBA_A3) * [ACE3](https://github.com/acemod/ACE3) * optional: [ZEN](https://github.com/zen-mod/ZEN/) adds some context menus for Zeus -* optional: [Gruppe Adler Mod](https://github.com/gruppe-adler/gruppe_adler_mod/) will have livestock onto trucks +* optional: [Gruppe Adler Mod](https://github.com/gruppe-adler/gruppe_adler_mod/) to enable having livestock onto trucks ## Installation @@ -37,6 +37,27 @@ If that is not possible, civilian group size (looking at you, [Ikarus 260](https Civilians on separate islands can run into pathing problems. Avoid by creating exclusion zones. +## Detailed documentation + +should be found for the distinct modules: + +* [activities](addons/activities/README.md) +* [cars](addons/cars/README.md) +* [cba_statemachine](addons/cba_statemachine/README.md) +* [common](addons/common/README.md) +* [diagnostics](addons/diagnostics/README.md) +* [gta](addons/gta/README.md) +* [interact](addons/interact/README.md) +* [lifecycle](addons/lifecycle/README.md) +* [loadout](addons/loadout/README.md) +* [main](addons/main/README.md) +* [mimikry](addons/mimikry/README.md) +* [patrol](addons/patrol/README.md) +* [residents](addons/residents/README.md) +* [transit](addons/transit/README.md) +* [voyage](addons/voyage/README.md) +* [zeus](addons/zeus/README.md) + ## Config Settings can be found as CBA Addon settings. @@ -68,20 +89,10 @@ spawnDistancesOnFoot | [1000,4500] | Minimum and maximum distance to playe spawnDistancesResidents | [500, 1000] | Minimum and maximum distance to players that civilians living in houses spawn in. vehicles | ["C_Van_01_fuel_F", "C_Hatchback_01_F", "C_Offroad_02_unarmed_F", "C_Truck_02_fuel_F", "C_Truck_02_covered_F", "C_Offroad_01_F", "C_SUV_01_F", "C_Van_01_transport_F", "C_Van_01_box_F"] | All classnames of vehicles that civilians may drive. -## 3DEN modules - -### exclusion zone - -Blacklist an area for civs by syncing it to a trigger. Exclusion zones override population zones in the same area. - -### population zone - -Whitelist an area for civs by syncing it to a trigger. - -*NOTE: if no population zone is defined, the whole map will be considered a population zone.* - ## API +see the various module READMEs + ### EVENTS #### global @@ -90,188 +101,21 @@ common events: ["grad_civs_civKilled", { params ["_deathPos", "_killer", "_civilian"]; }] call CBA_fnc_addEventHandler; -[GTA module](addons/gta/README.md) TL;DR: ["grad_civs_vehicleTheft", { params ["_vehicle", "_thief"]; }] call CBA_fnc_addEventHandler; -### grad_civs_activities_fnc_doCustomActivity - -To let civilians break from their usual activity and do something else for a limited time. - -Example: - -``` -[ - _civ, - { _this#0 setBehaviour "STEALTH" }, - { _this#0 setBehaviour "CARELESS" }, - 600, - [], - "hiding", - "pooped my pants, hiding for ten minutes" -] call grad_civs_activities_fnc_doCustomActivity; -``` - -**NOTE**: this whole thing will *NOT* work while they are panicking. - -**NOTE**: do clean up after yourself in the `_doEnd` parameter. reset disableAI stuff etc! - -#### Parameters - -Parameter | Explanation ---------------------|----------------------------------------------------------- -civ | unit - civilian to apply to -doStart | code - execute desired behavior. gets `civ` as first parameter, and the elements of `moreParameters` -doEnd | code - end desired behavior. gets `civ` as first parameter, and the elements of `moreParameters`. -timeoutOrCondition | number or code - behavior length in seconds, or condition to end behavior -moreParameters | array (optional) - more parameters to be passed to doStart and doEnd -name | string (optional) - behavior name -description | string (optional) - behavior description - -### grad_civs_loadout_fnc_setClothes - -Sets all clothes that civilians may wear. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[clothes] call grad_civs_loadout_fnc_setClothes` - -Parameter | Explanation -----------|----------------------------------------------------------- -clothes | Array - All classnames of clothes that civilians may wear. - -### grad_civs_loadout_fnc_setFaces -Sets all faces that civilians may have. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[faces] call grad_civs_loadout_fnc_setFaces` - -Parameter | Explanation -----------|--------------------------------------------------------- -faces | Array - All classnames of faces that civilians may have. - - -### grad_civs_loadout_fnc_setGoggles -Sets all goggles that civilians may wear. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[goggles] call grad_civs_loadout_fnc_setGoggles` - -Parameter | Explanation -----------|----------------------------------------------------------- -goggles | Array - All classnames of goggles that civilians may wear. - -### grad_civs_loadout_fnc_setHeadgear -Sets all headgear that civilians may wear. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[headgear] call grad_civs_loadout_fnc_setHeadgear` - -Parameter | Explanation -----------|----------------------------------------------------------- -headgear | Array - All classnames of clothes that civilians may wear. - -### grad_civs_loadout_fnc_setBackpacks -Sets all backpacks that civilians may wear and sets probability. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[backpacks,probability] call grad_civs_loadout_fnc_setHeadgear` - -Parameter | Explanation -------------|----------------------------------------------------------------------- -backpacks | Array - All classnames of clothes that civilians may wear. -probability | Number - Probability that civilian will wear a backpack. Default: 0.5. - -### grad_civs_cars_fnc_setVehicles -Sets all vehicles that civilians may drive. Overwrites value from CBA settings. Execute globally - -#### Syntax -`[vehicles] call grad_civs_voyage_fnc_setVehicles` - -Parameter | Explanation -----------|------------------------------------------------------------- -vehicles | Array - All classnames of vehicles that civilians may drive. - -### grad_civs_common_fnc_addExclusionZone and grad_civs_common_fnc_addPopulationZone - -Prevent civilians from entering areas. - -Optionally whitelist areas using `[_area] call grad_civs_common_fnc_addPopulationZone` , then forbid parts of them using `[_area] call grad_civs_common_fnc_addExclusionZone` . - -*known issues: pathing through area is not checked. To minimize that problem, define exclusionZones with large diameter.* - -#### Syntax - -`[_trigger] call grad_civs_common_fnc_addExclusionZone;` ## Development -* we're using the CBA state machine implementation, see `addons/*/functions/sm_*/` -* there's also some extensions being done to the CBA state machnie implementation to allow for nested states and other shenanigans, see addons/cba_statemachine -* if you add states or transitions, please update the DOT files in `/docs` - * which is where you'll find the compiled SVG files, too. - * install [Graphviz](https://graphviz.gitlab.io/) and generate them using `dot -Tsvg states.gv > states.svg` or use an online editor - -### state stot wot? +* we're using the CBA state machine implementation, see `addons/*/functions/fn_sm_*/` +* there's also some extensions being done to the CBA state machnie implementation to allow for nested states and other shenanigans, see [`addons/cba_statemachine`](addons/cba_statemachine/README.md) +* if you add states or transitions, do update the DOT files in `/docs` +* also, install [Graphviz](https://graphviz.gitlab.io/) and generate graphs using `dot -Tsvg states.gv > states.svg` etc or use an online editor -worry not, here comes a friendly introduction: +### State Machines -**CBA state machine for dummies** - -#### what are state machines - -A state machine is a construct made of states and transitions between states. It can be visualized very easily as a directed graph with nodes (states) and edges (transitions). The state machine gets fed with a bunch of entities that inhabit the states. It periodically checks the states and moves the entities along the transitions from one state to the next. - -#### how do they look like with CBA - -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_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: - -``` -onEnter_init -init -# … (until CBA_missionTime > 30) -init -onExit_init -changing state -onEnter_wörk -wörk -wörk -# … -``` - -#### how do we use them - -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_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_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 - * the second is called once when the civ actually makes the transition -* The state machine can get big quickly. - * The callbacks should not execute code directly, but execute in separate functions: - * states in `fn_sm_activities_state__(loop|enter|exit).sqf` - * transitions in `fn_sm_activities_trans___(condition|handler).sqf` - * this makes for easier Profiling using the [Arma Script Profiler](https://github.com/dedmen/ArmaScriptProfiler) - * and reduces file size for `fn_sm_activities.sqf` - -#### what it looks like - -This is the current structure (plz update when you change anything!): +This is the current structure: ![activities state machine](docs/states.png) + +see `addons/*/fnc_sm*.sqf` for all the places where state machines are defined/added to. \ No newline at end of file diff --git a/addons/activities/README.md b/addons/activities/README.md new file mode 100644 index 00000000..c37fd290 --- /dev/null +++ b/addons/activities/README.md @@ -0,0 +1,41 @@ +# Activities + +## Description + +Manages basic life states. Emotions, special activities, + +## API + +### grad_civs_activities_fnc_doCustomActivity + +Let civilians break from their usual activity and do something else for a limited time. + +Example: + +```sqf +[ + _civ, + { _this#0 setBehaviour "STEALTH" }, + { _this#0 setBehaviour "CARELESS" }, + 600, + [], + "hiding", + "pooped my pants, hiding for ten minutes" +] call grad_civs_activities_fnc_doCustomActivity; +``` + +**NOTE**: this whole thing will *NOT* work while they are panicking. + +**NOTE**: do clean up after yourself in the `doEnd` parameter (reset AI stuff, animations etc)! + +#### Parameters + +Parameter | Explanation +--------------------|----------------------------------------------------------- +civ | unit - civilian to apply to +doStart | code - execute desired behavior. gets `civ` as first parameter, and the elements of `moreParameters` +doEnd | code - end desired behavior. gets `civ` as first parameter, and the elements of `moreParameters`. +timeoutOrCondition | number or code - behavior length in seconds, or condition to end behavior +moreParameters | array (optional) - more parameters to be passed to doStart and doEnd +name | string (optional) - behavior name +description | string (optional) - behavior description diff --git a/addons/activities/XEH_postInit.sqf b/addons/activities/XEH_postInit.sqf index ef9c1a27..e868983d 100644 --- a/addons/activities/XEH_postInit.sqf +++ b/addons/activities/XEH_postInit.sqf @@ -7,5 +7,12 @@ if (!(EGVAR(main,enabled))) exitWith {}; 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; + [ + QEGVAR(lifecycle,civ_added), + { + { + [_x] call FUNC(onCivAdded); + } forEach _this; + } + ] call CBA_fnc_addEventHandler; }; diff --git a/addons/activities/functions/fnc_onCivAdded.sqf b/addons/activities/functions/fnc_onCivAdded.sqf index de8ce729..e2f9aca8 100644 --- a/addons/activities/functions/fnc_onCivAdded.sqf +++ b/addons/activities/functions/fnc_onCivAdded.sqf @@ -12,6 +12,9 @@ _civ addEventHandler [ "FiredNear", { params ["_unit"]; + if !(alive _unit) exitWith { + _unit removeEventHandler ["FiredNear", _thisEventHandler]; + }; // throttle to once every 15s max - which is still a lot if ((_unit getVariable [QGVAR(lastFiredNear), 0]) > (CBA_missionTime - 15)) exitWith {}; diff --git a/addons/activities/functions/fnc_sm_emotions.sqf b/addons/activities/functions/fnc_sm_emotions.sqf index 4a28b358..eba273b8 100644 --- a/addons/activities/functions/fnc_sm_emotions.sqf +++ b/addons/activities/functions/fnc_sm_emotions.sqf @@ -90,15 +90,6 @@ assert ([ _emo_wary + _emo_panic ] call CBA_statemachine_fnc_addEventTransition); -assert ([ - _emotions, - _emo_relaxed, _emo_wary, - ["fired_far"], - {true}, - {}, - _emo_relaxed + _emo_wary -] call CBA_statemachine_fnc_addEventTransition); - [_sm_lifecycle, "lfc_life", _emotions] call EFUNC(cba_statemachine,addNestedStateMachine); EGVAR(common,stateMachines) setVariable ["emotions", _emotions]; diff --git a/addons/cars/README.md b/addons/cars/README.md new file mode 100644 index 00000000..ca4ef7c0 --- /dev/null +++ b/addons/cars/README.md @@ -0,0 +1,17 @@ +# grad\_civs\_cars + +Basic handling of civs driving cars. + +As a user, see transit and voyage modules to actually get civs driving on the streets. + +## API + +### grad_civs_cars_fnc_setVehicles +Sets all vehicles that civilians may drive. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[vehicles] call grad_civs_cars_fnc_setVehicles` + +Parameter | Explanation +----------|------------------------------------------------------------- +vehicles | Array - All classnames of vehicles that civilians may drive. diff --git a/addons/cba_statemachine/README.md b/addons/cba_statemachine/README.md new file mode 100644 index 00000000..b37d7fe8 --- /dev/null +++ b/addons/cba_statemachine/README.md @@ -0,0 +1,40 @@ +# grad\_civs\_cba\_statemachine + +Some extensions to the CBA statemachine module. Probably nothing of interest unless you're a developer. + +### state stot wot? + +worry not, here comes a friendly introduction: + +**CBA state machine for dummies** + +#### what are state machines + +A state machine is a construct made of states and transitions between states. It can be visualized very easily as a directed graph with nodes (states) and edges (transitions). The state machine gets fed with a bunch of entities that inhabit the states. It periodically checks the states and moves the entities along the transitions from one state to the next. + +#### how do they look like with CBA + +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_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: + +``` +onEnter_init +init +# … (until CBA_missionTime > 30) +init +onExit_init +changing state +onEnter_wörk +wörk +wörk +# … +``` diff --git a/addons/common/README.md b/addons/common/README.md new file mode 100644 index 00000000..a257e03d --- /dev/null +++ b/addons/common/README.md @@ -0,0 +1,17 @@ +# grad\_civs\_common + +Generic library. Probably nothing of interest unless you're a developer. + +## API + +### grad_civs_common_fnc_addExclusionZone and grad_civs_common_fnc_addPopulationZone + +Prevent civilians from entering areas. + +Optionally whitelist areas using `[_area] call grad_civs_common_fnc_addPopulationZone` , then forbid parts of them using `[_area] call grad_civs_common_fnc_addExclusionZone` . + +*known issues: pathing through area is not checked. To minimize that problem, define exclusionZones with large diameter.* + +#### Syntax + +`[_trigger] call grad_civs_common_fnc_addExclusionZone;` \ No newline at end of file diff --git a/addons/diagnostics/README.md b/addons/diagnostics/README.md new file mode 100644 index 00000000..4ef69450 --- /dev/null +++ b/addons/diagnostics/README.md @@ -0,0 +1,3 @@ +# grad\_civs\_diagnostics + +Debugging GUI stuff \ No newline at end of file diff --git a/addons/diagnostics/XEH_postInit.sqf b/addons/diagnostics/XEH_postInit.sqf index 2b201d44..07a47e01 100644 --- a/addons/diagnostics/XEH_postInit.sqf +++ b/addons/diagnostics/XEH_postInit.sqf @@ -36,12 +36,15 @@ if (isServer) then { [ QEGVAR(lifecycle,civ_added), { - params [["_civ", objNull, [objNull]]]; - _civ setVariable [QGVAR(localAt), owner _civ, true]; - _civ addEventHandler ["Local", { - params ["_civ", ""]; + { + private _civ = _x; _civ setVariable [QGVAR(localAt), owner _civ, true]; - }]; + _civ addEventHandler ["Local", { + params ["_civ", ""]; + _civ setVariable [QGVAR(localAt), owner _civ, true]; + }]; + } forEach _this; + } ] call CBA_fnc_addEventHandler; }; diff --git a/addons/diagnostics/functions/fnc_showPinkArrows.sqf b/addons/diagnostics/functions/fnc_showPinkArrows.sqf index 9ad0d221..cf7d19f5 100644 --- a/addons/diagnostics/functions/fnc_showPinkArrows.sqf +++ b/addons/diagnostics/functions/fnc_showPinkArrows.sqf @@ -4,20 +4,24 @@ GVAR(showWhatTheyThink_civ_added) = [ QEGVAR(lifecycle,civ_added), { if (!GVAR(showPinkArrows)) exitWith {}; - params [["_civ", objNull, [objNull]]]; SCRIPT("showWhatTheyThink_civ_added"); - private _arrow = createSimpleObject ["Sign_Arrow_Large_Pink_F", [0, 0, 0]]; - _arrow attachTo [_civ, [0, 0, 5]]; + { + private _civ = _x; + private _arrow = createSimpleObject ["Sign_Arrow_Large_Pink_F", [0, 0, 0]]; + _arrow attachTo [_civ, [0, 0, 5]]; + } forEach _this; } ] call CBA_fnc_addEventHandler; GVAR(showWhatTheyThinkciv_removed) = [ QEGVAR(lifecycle,civ_removed), { - params [["_civ", objNull, [objNull]]]; SCRIPT("showWhatTheyThink_civ_removed"); { - deleteVehicle _x; - } forEach (attachedObjects _civ); + private _civ = _x; + { + deleteVehicle _x; + } forEach (attachedObjects _civ); + } forEach _this; } ] call CBA_fnc_addEventHandler; diff --git a/addons/interact/README.md b/addons/interact/README.md new file mode 100644 index 00000000..bb19fe56 --- /dev/null +++ b/addons/interact/README.md @@ -0,0 +1,5 @@ +# grad\_civs\_interact + +Player interactions & reactions + +## API diff --git a/addons/lifecycle/README.md b/addons/lifecycle/README.md new file mode 100644 index 00000000..54baffa9 --- /dev/null +++ b/addons/lifecycle/README.md @@ -0,0 +1,14 @@ +# grad\_civs\_lifecycle + +Controls all spawning & despawning of civilians, as well as incapacitation & death. + +## API + +### Events + +**NOTE:** event names are prefixed with `grad_civs_lifecycle_` + +#### `civ_added` , `civ_removed` + +If civilians come under the control of grad-civs or are removed from grad-civs control, respectively. +Argument is an *array of* civilians (i.e. units) diff --git a/addons/lifecycle/functions/fnc_getGlobalCivs.sqf b/addons/lifecycle/functions/fnc_getGlobalCivs.sqf index 1fbf8ad6..8455ca39 100644 --- a/addons/lifecycle/functions/fnc_getGlobalCivs.sqf +++ b/addons/lifecycle/functions/fnc_getGlobalCivs.sqf @@ -15,17 +15,15 @@ if (isNil QGVAR(getGlobalCivs_arr)) then { [ QGVAR(civ_added), { - params [["_civ", objNull, [objNull]]]; SCRIPT("getGlobalCivs_civ_added"); - GVAR(getGlobalCivs_arr) = GVAR(getGlobalCivs_arr) + [_civ]; + GVAR(getGlobalCivs_arr) = GVAR(getGlobalCivs_arr) + _this; } ] call CBA_fnc_addEventHandler; [ QGVAR(civ_removed), { - params [["_civ", objNull, [objNull]]]; SCRIPT("getGlobalCivs_civ_removed"); - GVAR(getGlobalCivs_arr) = GVAR(getGlobalCivs_arr) - [_civ]; + GVAR(getGlobalCivs_arr) = GVAR(getGlobalCivs_arr) - _this; } ] call CBA_fnc_addEventHandler; }; diff --git a/addons/lifecycle/functions/fnc_sm_lifecycle.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle.sqf index bd7ff37d..9e3c0242 100644 --- a/addons/lifecycle/functions/fnc_sm_lifecycle.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle.sqf @@ -66,7 +66,7 @@ assert ([ assert ([ _lifecycle, _lifecycle_life, _lifecycle_death, - ["killed"], + [QGVAR(killed)], { true }, {}, _lifecycle_life + _lifecycle_death @@ -93,7 +93,7 @@ assert ([ assert ([ _lifecycle, _lifecycle_unconscious, _lifecycle_death, - ["killed"], + [QGVAR(killed)], { true }, {}, _lifecycle_unconscious + _lifecycle_death diff --git a/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf b/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf index ae9495b3..a1b81d2e 100644 --- a/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf +++ b/addons/lifecycle/functions/fnc_sm_lifecycle_state_spawn_enter.sqf @@ -26,10 +26,9 @@ _unit addEventHandler [ params ["_unit"]; INFO_2("civ %1 was killed (index: %2), firing internal 'killed' event", _unit, GVAR(localCivs) find _unit); - ["killed", [_unit], [_unit]] call CBA_fnc_targetEvent; + [QGVAR(killed), [_unit], [_unit]] call CBA_fnc_targetEvent; - _unit removeAllEventHandlers "Killed"; - _unit removeAllEventHandlers "FiredNear"; + _unit removeEventHandler ["Killed", _thisEventHandler]; } ]; diff --git a/addons/loadout/README.md b/addons/loadout/README.md new file mode 100644 index 00000000..89b2d424 --- /dev/null +++ b/addons/loadout/README.md @@ -0,0 +1,59 @@ +# grad\_civs\_loadout + +Determine clothing etc for civilians + +## API + + +### grad_civs_loadout_fnc_setClothes + +Sets all clothes that civilians may wear. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[clothes] call grad_civs_loadout_fnc_setClothes` + +Parameter | Explanation +----------|----------------------------------------------------------- +clothes | Array - All classnames of clothes that civilians may wear. + +### grad_civs_loadout_fnc_setFaces +Sets all faces that civilians may have. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[faces] call grad_civs_loadout_fnc_setFaces` + +Parameter | Explanation +----------|--------------------------------------------------------- +faces | Array - All classnames of faces that civilians may have. + + +### grad_civs_loadout_fnc_setGoggles +Sets all goggles that civilians may wear. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[goggles] call grad_civs_loadout_fnc_setGoggles` + +Parameter | Explanation +----------|----------------------------------------------------------- +goggles | Array - All classnames of goggles that civilians may wear. + +### grad_civs_loadout_fnc_setHeadgear +Sets all headgear that civilians may wear. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[headgear] call grad_civs_loadout_fnc_setHeadgear` + +Parameter | Explanation +----------|----------------------------------------------------------- +headgear | Array - All classnames of clothes that civilians may wear. + +### grad_civs_loadout_fnc_setBackpacks +Sets all backpacks that civilians may wear and sets probability. Overwrites value from CBA settings. Execute globally + +#### Syntax +`[backpacks,probability] call grad_civs_loadout_fnc_setHeadgear` + +Parameter | Explanation +------------|----------------------------------------------------------------------- +backpacks | Array - All classnames of clothes that civilians may wear. +probability | Number - Probability that civilian will wear a backpack. Default: 0.5. diff --git a/addons/loadout/XEH_postInit.sqf b/addons/loadout/XEH_postInit.sqf index 4039ccf4..138e8440 100644 --- a/addons/loadout/XEH_postInit.sqf +++ b/addons/loadout/XEH_postInit.sqf @@ -2,12 +2,13 @@ if (!(EGVAR(main,enabled))) exitWith {}; -[QEGVAR(lifecycle,civ_added), { - params [["_civ", objNull, [objNull]]]; - assert(!isNull _civ); - if (local _civ) then { - [_civ] call FUNC(civAddLoadout); - }; +[QEGVAR(lifecycle,civ_added), { + { + private _civ = _x; + if (local _civ) then { + [_civ] call FUNC(civAddLoadout); + }; + } forEach _this; }] call CBA_fnc_addEventHandler; [QGVAR(broadcastFace), { diff --git a/addons/patrol/README.md b/addons/patrol/README.md new file mode 100644 index 00000000..a1640b1c --- /dev/null +++ b/addons/patrol/README.md @@ -0,0 +1,3 @@ +# grad\_civs\_patrol + +Civilians who patrol the neighborhood, alone or in groups. diff --git a/addons/residents/README.md b/addons/residents/README.md new file mode 100644 index 00000000..636162ac --- /dev/null +++ b/addons/residents/README.md @@ -0,0 +1,3 @@ +# grad\_civs\_residents + +Civilians who live in their homes and leave them only for a short chat with the neighbors. \ No newline at end of file diff --git a/addons/transit/README.md b/addons/transit/README.md index ce33223d..72a68cd0 100644 --- a/addons/transit/README.md +++ b/addons/transit/README.md @@ -1,6 +1,6 @@ # grad\_civs\_transit -Add transit routes along which cvilians travel the whole width of the map +Add fixed transit routes along which cvilians travel the whole width of the map ## configuration notes diff --git a/addons/voyage/README.md b/addons/voyage/README.md new file mode 100644 index 00000000..3e0dad7e --- /dev/null +++ b/addons/voyage/README.md @@ -0,0 +1,3 @@ +# grad\_civs\_voyage + +Voyagers are civilians who randomly drive around in cars. \ No newline at end of file diff --git a/addons/zeus/README.md b/addons/zeus/README.md new file mode 100644 index 00000000..a3e988b3 --- /dev/null +++ b/addons/zeus/README.md @@ -0,0 +1,14 @@ +# grad\_civs\_zeus + + +## 3DEN modules + +### exclusion zone + +Blacklist an area for civs by syncing it to a trigger. Exclusion zones override population zones in the same area. + +### population zone + +Whitelist an area for civs by syncing it to a trigger. + +*NOTE: if no population zone is defined, the whole map will be considered a population zone.* \ No newline at end of file diff --git a/docs/states.gv b/docs/states.gv index 48689661..84a9805b 100644 --- a/docs/states.gv +++ b/docs/states.gv @@ -11,7 +11,7 @@ digraph lifecycle { subgraph cluster_emotions { bgcolor="lightyellow"; label="emo"; - emo_relaxed -> emo_wary; + emo[shape=point,width=0.2,height=0.2]; emo -> emo_relaxed [len=0.2]; {emo_wary, emo_relaxed} -> emo_panic [color="red"]; emo_panic -> emo_wary -> emo_relaxed; } @@ -24,6 +24,7 @@ digraph lifecycle { bgcolor="lightgreen"; label="bus"; cluster_business_node [shape=point style=invis]; + bus [shape=point,width=0.2,height=0.2]; bus -> bus_rally [len=0.2,weight=5]; bus_rally -> bus_patrol; bus_rally -> bus_mountUp; bus_rally -> bus_rideInBack; @@ -45,9 +46,12 @@ digraph lifecycle { bgcolor="pink"; label="panic"; cluster_panic_node [shape=point style=invis]; + pan [shape=point,width=0.2,height=0.2]; pan -> pan_flight; pan_flight -> pan_hide -> pan_hidden; } + act [shape=point,width=0.2,height=0.2]; act -> cluster_business_node [lhead=cluster_business]; + act_asOrdered [shape=rectangle]; act_surrendered [shape=rectangle]; @@ -69,6 +73,8 @@ digraph lifecycle { cyc_death [shape=Msquare]; cyc_unconscious [shape=Msquare]; + cyc_0 [shape=point,width=0.2,height=0.2]; cyc_0 -> cyc_spawn; + cyc_1 [shape=point,width=0.2,height=0.2,peripheries=2]; cyc_death -> cyc_1; cyc_despawn -> cyc_1; cyc_spawn -> cluster_life_node [lhead=cluster_life]; cluster_life_node -> cyc_despawn [ltail=cluster_life]; cluster_life_node -> cyc_death [ltail=cluster_life color=blue]; diff --git a/docs/states.png b/docs/states.png index d03e225f..f04b7676 100644 Binary files a/docs/states.png and b/docs/states.png differ diff --git a/docs/states.svg b/docs/states.svg index 6db2867b..192ba9f0 100644 --- a/docs/states.svg +++ b/docs/states.svg @@ -1,393 +1,466 @@ - - - + + lifecycle - + cluster_life - -cyc_life + +cyc_life cluster_emotions - -emo + +emo cluster_activities - -act + +act cluster_business - -bus + +bus cluster_panic - -panic + +panic - + cyc_despawn - - - - - -cyc_despawn + + + + + +cyc_despawn - -cluster_life_node:->cyc_despawn: - - + +cluster_life_node->cyc_despawn + + - + cyc_death - - - - - -cyc_death + + + + + +cyc_death - -cluster_life_node:->cyc_death: - - + +cluster_life_node->cyc_death + + - + cyc_unconscious - - - - - -cyc_unconscious + + + + + +cyc_unconscious - -cluster_life_node:->cyc_unconscious: - - + +cluster_life_node->cyc_unconscious + + - + -emo_relaxed - -emo_relaxed +emo + - + -emo_wary - -emo_wary +emo_relaxed + +emo_relaxed - + -emo_relaxed:->emo_wary: - - +emo->emo_relaxed + + - + emo_panic - -emo_panic + +emo_panic -emo_relaxed:->emo_panic: - - +emo_relaxed->emo_panic + + + + + +emo_wary + +emo_wary -emo_wary:->emo_relaxed: - - +emo_wary->emo_relaxed + + -emo_wary:->emo_panic: - - +emo_wary->emo_panic + + -emo_panic:->emo_wary: - - +emo_panic->emo_wary + + - -cluster_business_node:->cluster_panic_node: - - + +cluster_business_node->cluster_panic_node + + - + act_asOrdered - -act_asOrdered + +act_asOrdered - -cluster_business_node:->act_asOrdered: - - + +cluster_business_node->act_asOrdered + + - + act_surrendered - -act_surrendered + +act_surrendered - -cluster_business_node:->act_surrendered: - - + +cluster_business_node->act_surrendered + + + + + +bus + - + bus_rally - -bus_rally + +bus_rally + + + +bus->bus_rally + + - + bus_patrol - -bus_patrol + +bus_patrol - -bus_rally:->bus_patrol: - - + +bus_rally->bus_patrol + + - + bus_mountUp - -bus_mountUp + +bus_mountUp - -bus_rally:->bus_mountUp: - - + +bus_rally->bus_mountUp + + - + bus_rideInBack - -bus_rideInBack + +bus_rideInBack - -bus_rally:->bus_rideInBack: - - + +bus_rally->bus_rideInBack + + - + bus_housework - -bus_housework + +bus_housework - -bus_rally:->bus_housework: - - + +bus_rally->bus_housework + + - + bus_transit - -bus_transit + +bus_transit - -bus_mountUp:->bus_transit: - - + +bus_mountUp->bus_transit + + - + bus_voyage - -bus_voyage + +bus_voyage - -bus_mountUp:->bus_voyage: - - + +bus_mountUp->bus_voyage + + - + bus_dismount - -bus_dismount + +bus_dismount - -bus_mountUp:->bus_dismount: - - + +bus_mountUp->bus_dismount + + - -bus_rideInBack:->bus_rally: - - + +bus_rideInBack->bus_rally + + - -bus_transit:->bus_dismount: - - + +bus_transit->bus_dismount + + - -bus_voyage:->bus_dismount: - - + +bus_voyage->bus_dismount + + - -bus_dismount:->bus_rally: - - + +bus_dismount->bus_rally + + - -bus_housework:->bus_housework: - - + +bus_housework->bus_housework + + - + bus_meetNeighbor - -bus_meetNeighbor + +bus_meetNeighbor - -bus_housework:->bus_meetNeighbor: - - + +bus_housework->bus_meetNeighbor + + - + bus_chat - -bus_chat + +bus_chat - -bus_meetNeighbor:->bus_chat: - - + +bus_meetNeighbor->bus_chat + + - -bus_chat:->bus_housework: - - + +bus_chat->bus_housework + + - -cluster_panic_node:->cluster_business_node: - - + +cluster_panic_node->cluster_business_node + + + + + +pan + - + pan_flight - -pan_flight + +pan_flight + + + +pan->pan_flight + + - + pan_hide - -pan_hide + +pan_hide - -pan_flight:->pan_hide: - - + +pan_flight->pan_hide + + - + pan_hidden - -pan_hidden + +pan_hidden - -pan_hide:->pan_hidden: - - + +pan_hide->pan_hidden + + + + + +act + + + + +act->cluster_business_node + + - -act_asOrdered:->cluster_business_node: - - + +act_asOrdered->cluster_business_node + + - -act_surrendered:->cluster_business_node: - - + +act_surrendered->cluster_business_node + + - -act_surrendered:->cluster_panic_node: - - + +act_surrendered->cluster_panic_node + + - + cyc_spawn - - - - - -cyc_spawn + + + + + +cyc_spawn - -cyc_spawn:->cluster_life_node: - - + +cyc_spawn->cluster_life_node + + + + + +cyc_1 + + + + + +cyc_despawn->cyc_1 + + + + + +cyc_death->cyc_1 + + - -cyc_unconscious:->cluster_life_node: - - + +cyc_unconscious->cluster_life_node + + + + + +cyc_unconscious->cyc_death + + + + + +cyc_0 + + + + +cyc_0->cyc_spawn + +