From 41695dd9f271ad9e9d260e7ad9d245b63f96ddbf Mon Sep 17 00:00:00 2001 From: Moritz Schmidt Date: Thu, 19 Mar 2020 18:09:46 +0100 Subject: [PATCH] population zones (i.e. whitelisting areas) + bugfix (#55) * fix for no position found * wait a few secs until server loop starts * `[thisTrigger] call grad_civs_fnc_addExclusionZone` <-give that a chance to run before spawning the first civs * add POPULATION_ZONES : whitelist populations zones, and restrict them with exclusion ones. default population zone is the whole map. * be explicit about empty arrays (thx @diwako) --- cfgFunctions.hpp | 4 ++++ docs/exclusion_zone_trigger.png | Bin 0 -> 16662 bytes functions/api/fn_addExclusionZone.sqf | 2 +- functions/api/fn_addPopulationZone.sqf | 13 +++++++++++++ functions/api/fn_clearExclusionZones.sqf | 2 +- functions/api/fn_clearPopulationZones.sqf | 5 +++++ functions/api/fn_getExclusionZones.sqf | 4 +++- functions/api/fn_getPopulationZones.sqf | 3 +++ .../behaviour/fn_taskPatrolFindWaypoint.sqf | 5 ++++- .../behaviour/fn_taskPatrolFindWaypoints.sqf | 2 +- functions/common/fn_findPositionOfInterest.sqf | 2 +- functions/common/fn_isInPopulatedZone.sqf | 16 ++++++++++++++++ functions/init/fn_initConfig.sqf | 3 ++- functions/spawn/fn_createSideRoadVehicles.sqf | 2 +- functions/spawn/fn_findSpawnPosition.sqf | 2 +- functions/spawn/fn_findSpawnRoadSegment.sqf | 2 +- functions/spawn/fn_serverLoop.sqf | 12 +++++++++++- functions/spawn/fn_spawnPass.sqf | 2 +- 18 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 docs/exclusion_zone_trigger.png create mode 100644 functions/api/fn_addPopulationZone.sqf create mode 100644 functions/api/fn_clearPopulationZones.sqf create mode 100644 functions/api/fn_getPopulationZones.sqf create mode 100644 functions/common/fn_isInPopulatedZone.sqf diff --git a/cfgFunctions.hpp b/cfgFunctions.hpp index b630b958..a849fee8 100644 --- a/cfgFunctions.hpp +++ b/cfgFunctions.hpp @@ -22,6 +22,9 @@ class grad_civs { class addExclusionZone {}; class clearExclusionZones {}; class getExclusionZones {}; + class addPopulationZone {}; + class clearPopulationZones {}; + class getPopulationZones {}; class populateArea {}; class setBackpacks {}; class setClothes {}; @@ -56,6 +59,7 @@ class grad_civs { class getGlobalCivs {}; class isInHouse {}; class nowPlusSeconds {}; + class isInPopulatedZone {}; class removeFromStateMachine {}; }; diff --git a/docs/exclusion_zone_trigger.png b/docs/exclusion_zone_trigger.png new file mode 100644 index 0000000000000000000000000000000000000000..9511492ff98a74d02493c0f6772cda44887736d0 GIT binary patch literal 16662 zcmdtJcT`hrw>KKM8`*-$rYnf36zL!VRHTSf1VSg2(1ipDAfObbDvC%~sR5;hn$QJl z0s_*55J*5kKtQDT-oGch-~H}!&OP@VXWZ|eJH~Yk|6paUXFYR1bN=R>zd2Wkj+QDN z4Lc140-;m8qofCc9A|()j!pdW8@ST@k&5!eu?Kppw;% z^*z~lQ&w?)6hW@r@ml_RzV%e~lvi z4uQN>MS*8qxuM4(knbBXl=tRk_!3TZokpI+H(q zu&2Ya_4Pp%2WdEx#ViwZu(#Fau8tUD1M7LP9?I*}PiDO2l{IpB4&HEc=@PWFd2zTp z#cy)}s~Uy-mdJjAvRE}L1#`HredIp$-nl@6S_B$B+)%7AX5zB0#)+iz2nh^3k<;(N zQ+@i}H7oP+L>fan`s`cdPZbd+8X+_V0^hD)ILxi|Ry1j0KZw>-#G7D=m&QBpp^BW1 z#0=OZ5xo%=n=?7MLVptlP6&jAL8A1mdiGXo{r1fKPOm2~JPpcLsW}Kyz`GU|1e|)~O6zp0XAF9Om8p>m z>wK9tX4&A2p=+2E%U9q;g9XyHR(`8&7KcZUY38bda>l!WjdOX}`%C#b2-f#sD-Oc1^w zk9L=YDo4oEP2;`ui8)O@H`9e+r}$2t6WP*H)m8{sv>sdzUL%c1y?$}ca5E)x^elO+pFEPi z8c*Oss1NCAY;Va+J)cn(BFI1;1m?<)n_#!!0V|r7Y=_PD7aq;k9nMW9`)DndrJZkw zS?;tO4Zg-m_8dNdYBL=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GQF)W{ITc&2BdPGiYAF7@y=%u(mULXjV3rTQXR2NDItSm^HSjSS)`LV|JzGXv zHgm8c%jP$W`Hs;R=ouXNm^P+-c_w1|-k!?nq(N8G^PocPS--8`#FVLdFU2GhL~Qp> z92M2U%bYw5DtpJPopq|jF53;WplbA?Tu;$-^^sS=me7m>HSR~Tc_io zUMa`3{V2H~?RdJVLIgyD(Tt57rTE|1OQH(=(wo5`Q=L~VyGJmqkAi0`J9%Qz8EPc( ztSeouu;4CQvg)DoMAE!E6V}8;MB8c_KvsVtDSb5G1AG`W3=?}Tr^Mq|0NZsUEtrHU zxfIW$cft|qZ6(C%z2Jat>Hr(cq$2SLyz}rA-?Xbpm&(QmiTUASV z>l#G2A8d^lUhym>O2x9vV`s(TSTe2}y()(*$U`=IC>@t1#A7Gkf9Ml936GMGk4-Xr z@VLqOiXC4K3E$6UN>&GWm zr5-W+r~@a@puGfNVhLRuyXw)_X9BPHpk@raQ&o<$Mxl3Ly*_<0;6p8t>gZR;)*URk zfKk1~eahbbS9B*8H)pcMm?dM?IvDY_oU8)nMY==E_oE810Z>fUlCH-jK;{qI<6#AQe{@-F`eck0u_t!4&vqu; z{gk8BuIs#cHm0@u-qqjWb%xi< zw1?3{p5+3h@0X<&gL|1NPW(FAY1@}W9*e7d1DrT*^1+Jx1tg!4khtea;X+#V18;9jz!L3hv>59Yeo-F&nW<0cN@zA@?D+cTxk2yAT%1j8Jou64_! z4NLgTqN_q~1))t~Y1;_07oW4w7KP?PezdSSu*{mB~zG}sJTJvCLRT(3SO(awm1 z*K{*7rt|owqY49&EtaYU7@zHylTg>DfNGvROA^LZ)6b6pRryhMMjhBGovt;+QT zrU((-HB26uJ&No z?XT~*|A#Bne|~EI|9P4G|KH7YdZBi|J*7VcgiUJyPew0O3(2=50!}}95)_C}DHVtn nk@8VJ random 100}) then { [_searchPosition, false] call FUNC(findPositionOfInterest); @@ -35,7 +38,7 @@ for "_i" from 1 to _maxTries do { _searchPosition }; - private _inAnyExclusionZone = [GRAD_CIVS_EXCLUSION_ZONES, {_searchPosition inArea (_this#0)}] call FUNC(arrayContains); + private _inAnyExclusionZone = [_searchPosition] call FUNC(isInPopulatedZone); if (!_inAnyExclusionZone) exitWith { LOG_1("position %1 is not in exclusionzone, return it", _searchPosition); _waypointPosition = _searchPosition; diff --git a/functions/behaviour/fn_taskPatrolFindWaypoints.sqf b/functions/behaviour/fn_taskPatrolFindWaypoints.sqf index b98ea268..f9885a75 100644 --- a/functions/behaviour/fn_taskPatrolFindWaypoints.sqf +++ b/functions/behaviour/fn_taskPatrolFindWaypoints.sqf @@ -26,7 +26,7 @@ for [{_i=0}, {_i<_count}, {_i=_i+1}] do { _findWaterPos ] call FUNC(taskPatrolFindWaypoint); - if (count _nextWaypoint == 0) exitWith { + if (_nextWaypoint isEqualTo []) exitWith { WARNING_3("could not find more than %1 waypoints within %2m around %3", _i, _radius, _position) }; LOG_1("waypoint #%1 found", _i); diff --git a/functions/common/fn_findPositionOfInterest.sqf b/functions/common/fn_findPositionOfInterest.sqf index 2c8955c8..728e278f 100644 --- a/functions/common/fn_findPositionOfInterest.sqf +++ b/functions/common/fn_findPositionOfInterest.sqf @@ -21,7 +21,7 @@ private _position = if (count _buildingPositions > 0) then {selectRandom _buildi [_searchPosition,[50,100],[0,360]] call FUNC(findRandomPos); }; -if (count _position == 0) then { +if (_position isEqualTo []) then { _position = _searchPosition; }; diff --git a/functions/common/fn_isInPopulatedZone.sqf b/functions/common/fn_isInPopulatedZone.sqf new file mode 100644 index 00000000..b8a5b2d5 --- /dev/null +++ b/functions/common/fn_isInPopulatedZone.sqf @@ -0,0 +1,16 @@ +#include "..\..\component.hpp" + +params [ + ["_position", [0, 0, 0]] +]; + +private _inAnyPopulationZone = if (count GVAR(POPULATION_ZONES) == 0) then { + true +} else { + [GVAR(POPULATION_ZONES), {_position inArea (_this#0)}] call FUNC(arrayContains) +}; +if (!_inAnyPopulationZone) exitWith {false}; + +private _inAnyExclusionZone = [GVAR(EXCLUSION_ZONES), {_position inArea (_this#0)}] call FUNC(arrayContains); + +!_inAnyExclusionZone diff --git a/functions/init/fn_initConfig.sqf b/functions/init/fn_initConfig.sqf index 30741417..64af1557 100644 --- a/functions/init/fn_initConfig.sqf +++ b/functions/init/fn_initConfig.sqf @@ -68,4 +68,5 @@ missionNamespace setVariable ["GRAD_CIVS_SPAWNDISTANCEINVEHICLESMAX",_distances GRAD_CIVS_BUS_MEETNEIGHBOR_COOLDOWN = 150; GRAD_CIVS_CHAT_TIME = 20; -GRAD_CIVS_EXCLUSION_ZONES = []; +GVAR(EXCLUSION_ZONES) = []; +GVAR(POPULATION_ZONES) = []; diff --git a/functions/spawn/fn_createSideRoadVehicles.sqf b/functions/spawn/fn_createSideRoadVehicles.sqf index 5c351edc..73a1c0f7 100644 --- a/functions/spawn/fn_createSideRoadVehicles.sqf +++ b/functions/spawn/fn_createSideRoadVehicles.sqf @@ -2,7 +2,7 @@ params ["_locationPosition","_locationRadius","_amountFactor","_houseFactor","_minDistance","_maxAmount"]; -if (count GRAD_CIVS_VEHICLES == 0) exitWith {}; +if (GRAD_CIVS_VEHICLES isEqualTo []) exitWith {}; private _vehiclePositions = []; //LOCAL FUNCTIONS ============================================================== diff --git a/functions/spawn/fn_findSpawnPosition.sqf b/functions/spawn/fn_findSpawnPosition.sqf index afe3ae07..387c0150 100644 --- a/functions/spawn/fn_findSpawnPosition.sqf +++ b/functions/spawn/fn_findSpawnPosition.sqf @@ -57,7 +57,7 @@ private _result = { [_allPlayers, _candidate, _minDistance] call grad_civs_fnc_isInDistanceFromOtherPlayers } && { - ({ _candidate inArea _x; } count GRAD_CIVS_EXCLUSION_ZONES) == 0 + [_candidate] call FUNC(isInPopulatedZone) } ) exitWith { LOG_1("found spawn position %1", _candidate); diff --git a/functions/spawn/fn_findSpawnRoadSegment.sqf b/functions/spawn/fn_findSpawnRoadSegment.sqf index e4d691af..593aa9f3 100644 --- a/functions/spawn/fn_findSpawnRoadSegment.sqf +++ b/functions/spawn/fn_findSpawnRoadSegment.sqf @@ -3,7 +3,7 @@ params ["_allPlayers", "_minSpawnDistance", "_maxSpawnDistance", "_civilians"]; -if (count _allPlayers == 0) exitWith {LOG("_allPlayers is empty"); objNull}; +if (_allPlayers isEqualTo []) exitWith {LOG("_allPlayers is empty"); objNull}; private _refPlayerPos = getPos (selectRandom _allPlayers); diff --git a/functions/spawn/fn_serverLoop.sqf b/functions/spawn/fn_serverLoop.sqf index 0cf096ea..a75aafd1 100644 --- a/functions/spawn/fn_serverLoop.sqf +++ b/functions/spawn/fn_serverLoop.sqf @@ -18,7 +18,17 @@ private _mainLoop = { [] call grad_civs_fnc_spawnPass; }; -grad_civs_mainLoop = [_mainLoop, 2, []] call CBA_fnc_addPerFrameHandler; + +// wait a bit until the main loop starts. that way, exclusion zone trigger inits have a chance to run +[ + { + private _mainLoop = _this#0; + grad_civs_mainLoop = [_mainLoop, 2, []] call CBA_fnc_addPerFrameHandler; + }, + [_mainLoop], + 10 +] call CBA_fnc_waitAndExecute; + grad_civs_debugLoop = [{ params ["_args", "_handle"]; diff --git a/functions/spawn/fn_spawnPass.sqf b/functions/spawn/fn_spawnPass.sqf index ebf2e498..82608430 100644 --- a/functions/spawn/fn_spawnPass.sqf +++ b/functions/spawn/fn_spawnPass.sqf @@ -1,7 +1,7 @@ #include "..\..\component.hpp" _allPlayers = allPlayers - (entities "HeadlessClient_F"); -if (count _allPlayers == 0) exitWith {}; +if (_allPlayers isEqualTo []) exitWith {}; private _fps = diag_fps; if (_fps < GRAD_CIVS_MINFPS) exitWith {INFO_2("not spawning additional civs: less FPS than required (%1/%2)", _fps, GRAD_CIVS_MINFPS)};