From 30175ed3b15f65eb222c60da9e9f21723b981b83 Mon Sep 17 00:00:00 2001 From: McDiod Date: Fri, 8 Sep 2017 21:09:32 +0200 Subject: [PATCH] fix populateArea when grad-civs not initialized --- README.md | 2 ++ functions/common/fn_populateArea.sqf | 1 + functions/spawn/fn_serverLoop.sqf | 3 ++- package.json | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6bf32e12..410654ce 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ Add the class `cfgGradCivs` to your `description.ext`. Use the following attribu Attribute | Default Value | Explanation -------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------ autoInit | 1 | Toggles on automatic initialization of module on missions start (0/1). Turn this off if you want to use functions to set civs properties first. +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. spawnDistancesOnFoot | [1000,4500] | Minimum and maximum distance to players that civilians on foot can spawn in. diff --git a/functions/common/fn_populateArea.sqf b/functions/common/fn_populateArea.sqf index 515b9131..04559eb1 100644 --- a/functions/common/fn_populateArea.sqf +++ b/functions/common/fn_populateArea.sqf @@ -2,6 +2,7 @@ if (!isServer) exitWith {}; if (!canSuspend) exitWith {_this spawn grad_civs_fnc_populateArea}; +if (isNil "GRAD_CIVS_ONFOOTUNITS") exitWith {ERROR("grad-civs has not been initialized.")}; params ["_area",["_amount",20]]; diff --git a/functions/spawn/fn_serverLoop.sqf b/functions/spawn/fn_serverLoop.sqf index 6f421912..30720435 100644 --- a/functions/spawn/fn_serverLoop.sqf +++ b/functions/spawn/fn_serverLoop.sqf @@ -1,6 +1,7 @@ #include "..\..\component.hpp" -if (!isServer) exitWith {}; +if (!isServer) exitWith {-1}; +if (!GRAD_CIVS_ENABLEDINVEHICLES && !GRAD_CIVS_ENABLEDONFOOT) exitWith {-1}; private _mainLoop = { params ["_args", "_handle"]; diff --git a/package.json b/package.json index 37d8afb3..6c897c22 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grad-civs", "description": "ambient civilians", - "version": "0.3.0", + "version": "0.3.1", "contributors": [ { "name": "nomisum"