diff --git a/README.md b/README.md index b79bef3c..eeeb9246 100644 --- a/README.md +++ b/README.md @@ -59,31 +59,32 @@ Attribute | Default Value | Explanation -------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------ autoInit | 0 | Toggles on automatic initialization of module on missions start (0/1). Keep this off if you want to use functions to set civs properties first. automaticVehicleGroupSize| 1 | Allow vehicles to be filled according to capacity, ignoring *initialGroupSize* (0,1). -enableOnFoot | 1 | Enable civilians on foot (0/1). -enableInVehicles | 1 | Enable civilians in vehicles (0/1). -maxCivsOnFoot | 30 | Maximum number of civs on foot. -maxCivsInVehicles | 10 | Maximum number of civs in vehicles. -maxCivsResidents | 20 | Maximum number of civs that are residents, mostly doing their thing at home. -spawnDistancesOnFoot | [1000,4500] | Minimum and maximum distance to players that civilians on foot can spawn in. -spawnDistancesResidents | [500, 1000] | Minimum and maximum distance to players that civilians living in houses spawn in. -spawnDistancesInVehicles | [1500,6000] | Minimum and maximum distance to players that civilians in vehicles can spawn in. +backpackProbability | 50 | Probability that a civilian will wear a backpack, in percent +backpacks | [] | All classnames of backpacks that civilians may wear. +civClass | "C_Man_1" | Unit class to use for spawning civilians +clothes | [] | All classnames of clothes that civilians may wear. debugCivState | 0 | Toggles civ behavior debugging mode (0/1). debugFps | 0 | Toggles fps monitoring mode (0/1). +enableInVehicles | 1 | Enable civilians in vehicles (0/1). +enableOnFoot | 1 | Enable civilians on foot (0/1). +exitOn | "" | Condition upon which grad-civs loops will stop. +faces | [] | All classnames of faces that civilians may have. +goggles | [] | All classnames of goggles that civilians may wear. +headgear | [] | All classnames of headgear that civilians may wear. initialGroupSize | 3 | Initial group size for civilians, between 1..N . Value may be any valid parameter to the `random` command. +maxCivsInVehicles | 10 | Maximum number of civs in vehicles. +maxCivsOnFoot | 30 | Maximum number of civs on foot. +maxCivsResidents | 20 | Maximum number of civs that are residents, mostly doing their thing at home. minCivUpdateTime | 2 | Spawn new civilians only if their beheviour states get updated at least every N seconds. NOTE: each frame only one civ gets updated. Example: With 40fps and minCivUpdateTime=2, not more than 80 civs will be alive at any given time. This setting is meant to prevent civs from becoming too unresponsive. minFps | 40 | Spawn new civilians only if fps are at or above N . NOTE: the fps are taken from the machine that spawns the civs, which may be a HC. -onSpawn | "" | Code to execute on civilian spawn. Passed parameters are: [civilian,vehicle (objNull if on foot)]. onHeldUp | "" | Code to execute when civilian stops because a weapon is pointed at him. Passed parameters are: [civilian]. onKilled | "" | Code to execute when civilian is killed. Passed parameters are: [civilian,killer]. -exitOn | "" | Condition upon which grad-civs loops will stop. -clothes | [] | All classnames of clothes that civilians may wear. -faces | [] | All classnames of faces that civilians may have. -goggles | [] | All classnames of goggles that civilians may wear. -headgear | [] | All classnames of headgear that civilians may wear. -backpacks | [] | All classnames of backpacks that civilians may wear. +onSpawn | "" | Code to execute on civilian spawn. Passed parameters are: [civilian,vehicle (objNull if on foot)]. panicCooldown | [15,120,240] | Time it takes until a civilian relaxes after panicking (trivariate: [lowest, median, highest]) +spawnDistancesInVehicles | [1500,6000] | Minimum and maximum distance to players that civilians in vehicles can spawn in. +spawnDistancesOnFoot | [1000,4500] | Minimum and maximum distance to players that civilians on foot can spawn in. +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. -backpackProbability | 50 | Probability that a civilian will wear a backpack, in percent ### Example diff --git a/component.hpp b/component.hpp index 26202204..e9c7fe35 100644 --- a/component.hpp +++ b/component.hpp @@ -4,8 +4,6 @@ //#define DEBUG_MODE_FULL #include "\x\cba\addons\main\script_macros_mission.hpp" -#define GRAD_CIVS_CIVCLASS "C_man_1" - #ifdef DEBUG_MODE_FULL #define LOGTIME_START(var1) missionNamespace setVariable [var1,diag_tickTime] diff --git a/functions/common/fn_getGlobalCivs.sqf b/functions/common/fn_getGlobalCivs.sqf index ae2ecd47..8c28e717 100644 --- a/functions/common/fn_getGlobalCivs.sqf +++ b/functions/common/fn_getGlobalCivs.sqf @@ -7,7 +7,7 @@ params [ if (isNil "GRAD_CIVS_fnc_getGlobalCivs_arr") then { // on first run, init array with existing civs - private _potentialCivs = entities [[GRAD_CIVS_CIVCLASS], [], true, true]; + private _potentialCivs = entities [[GVAR(CIVCLASS)], [], true, true]; GRAD_CIVS_fnc_getGlobalCivs_arr = _potentialCivs select { (_x getVariable ["grad_civs_primaryTask", ""]) != ""}; // then, register event handler to update the array appropriately to always include all living civs diff --git a/functions/init/fn_initConfig.sqf b/functions/init/fn_initConfig.sqf index bcde6fbc..30741417 100644 --- a/functions/init/fn_initConfig.sqf +++ b/functions/init/fn_initConfig.sqf @@ -13,6 +13,7 @@ if !(([missionConfigFile, "corpseManagerMode", -1] call BIS_fnc_returnConfigEntr INFO("Civs initConfig running..."); +if (isNil QGVAR(CIVCLASS)) then {missionNamespace setVariable [QGVAR(CIVCLASS),[missionConfigFile >> "cfgGradCivs","civClass","C_man_1"] call BIS_fnc_returnConfigEntry]}; if (isNil "GRAD_CIVS_CLOTHES") then {missionNamespace setVariable ["GRAD_CIVS_CLOTHES",[missionConfigFile >> "cfgGradCivs","clothes",[]] call BIS_fnc_returnConfigEntry]}; if (isNil "GRAD_CIVS_HEADGEAR") then {missionNamespace setVariable ["GRAD_CIVS_HEADGEAR",[missionConfigFile >> "cfgGradCivs","headgear",[]] call BIS_fnc_returnConfigEntry]}; if (isNil "GRAD_CIVS_FACES") then {missionNamespace setVariable ["GRAD_CIVS_FACES",[missionConfigFile >> "cfgGradCivs","faces",[]] call BIS_fnc_returnConfigEntry]}; diff --git a/functions/sm_business/fn_sm_business_trans_housework_meetNeighbor_condition.sqf b/functions/sm_business/fn_sm_business_trans_housework_meetNeighbor_condition.sqf index 20cee0b2..b3dbb8b9 100644 --- a/functions/sm_business/fn_sm_business_trans_housework_meetNeighbor_condition.sqf +++ b/functions/sm_business/fn_sm_business_trans_housework_meetNeighbor_condition.sqf @@ -13,7 +13,7 @@ if (random 10 < 9) exitWith {false}; private _neighborToMeet = { private _maxDist = _x; - private _nearCivs = (_this nearEntities [[GRAD_CIVS_CIVCLASS], _maxDist]); + private _nearCivs = (_this nearEntities [[GVAR(CIVCLASS)], _maxDist]); private _socialNeighbors = _nearCivs select { (_x != _this) && (_x getVariable ["grad_civs_primaryTask", ""] == "reside") && diff --git a/functions/spawn/fn_serverLoop.sqf b/functions/spawn/fn_serverLoop.sqf index b5a05719..3f657ad4 100644 --- a/functions/spawn/fn_serverLoop.sqf +++ b/functions/spawn/fn_serverLoop.sqf @@ -66,7 +66,7 @@ grad_civs_debugLoop = [{ if (!hasInterface && !isDedicated) then { [ { - private _allCivs = entities GRAD_CIVS_CIVCLASS; + private _allCivs = entities GVAR(CIVCLASS); private _myCivs = _allCivs select { local _x && (_x getVariable ["grad_civs_primaryTask", ""] != "")}; private _orphanedCivs = _myCivs - GRAD_CIVS_LOCAL_CIVS; INFO_1("%1 orphaned civs - putting them into my own array", count _orphanedCivs); diff --git a/functions/spawn/fn_spawnCivilian.sqf b/functions/spawn/fn_spawnCivilian.sqf index 34a1d2fe..62a7f881 100644 --- a/functions/spawn/fn_spawnCivilian.sqf +++ b/functions/spawn/fn_spawnCivilian.sqf @@ -6,7 +6,7 @@ params [ ["_primaryTask", ""] ]; -private _civ = _group createUnit [GRAD_CIVS_CIVCLASS, _pos, [], 0, "NONE"]; +private _civ = _group createUnit [GVAR(CIVCLASS), _pos, [], 0, "NONE"]; GRAD_CIVS_LOCAL_CIVS = GRAD_CIVS_LOCAL_CIVS + [_civ]; [QGVAR(civ_added), [_civ]] call CBA_fnc_globalEvent;