/* File: fn_initHouses.sqf Author: Bryan "Tonic" Boardwine Modified by: blackfisch for Mountain Valley RPG Description: Initalizes house setup when player joins the server. */ private _count = (["selectAllHouses" ,2] call DB_fnc_asyncCall) select 0; for [{_x=0},{_x<=_count},{_x=_x+10}] do { private _query = format ["selectPlayerHouses:%1", _x]; private _queryResult = [_query, 2, true] call DB_fnc_asyncCall; if (_queryResult isEqualTo []) exitWith {}; { diag_log str _x; _x params [ "_id", ["_pos",[],[[]]], ["_class","",[""]], "_name", "_garage", "_userID" ]; private _house = _pos nearestObject _class; diag_log format["DEBUG : initHouses :: %1 %4 - %2 %5 - %3 %6",_pos, _class, _house, typeName _pos, typeName _class, typeName _house]; _house setVariable ["WTF",true,true]; _house setVariable ["house_owner",[_userID, _name],true]; _house setVariable ["house_id", _id, true]; _house setVariable ["locked", true, true]; //Lock up all the stuff. if (_garage isEqualTo 1) then { _house setVariable ["garageBought", true, true]; }; _numOfDoors = getNumber(configFile >> "CfgVehicles" >> (typeOf _house) >> "numberOfDoors"); for "_i" from 1 to _numOfDoors do { _house setVariable [format ["bis_disabled_Door_%1",_i], 1, true]; }; } forEach _queryResult; }; private _blacklistedHouses = "count (getArray (_x >> 'garageBlacklists')) > 0" configClasses (missionconfigFile >> "Housing" >> worldName); private _blacklistedGarages = "count (getArray (_x >> 'garageBlacklists')) > 0" configClasses (missionconfigFile >> "Garages" >> worldName); _blacklistedHouses = _blacklistedHouses apply {configName _x}; _blacklistedGarages = _blacklistedGarages apply {configName _x}; for "_i" from 0 to count(_blacklistedHouses)-1 do { _className = _blacklistedHouses select _i; _positions = getArray(missionConfigFile >> "Housing" >> worldName >> _className >> "garageBlacklists"); { _obj = nearestObject [_x,_className]; if (isNull _obj) then { _obj setVariable ["blacklistedGarage", true, true]; }; } forEach _positions; }; for "_i" from 0 to count(_blacklistedGarages)-1 do { _className = _blacklistedGarages select _i; _positions = getArray(missionConfigFile >> "Garages" >> worldName >> _className >> "garageBlacklists"); { _obj = nearestObject [_x,_className]; if (isNull _obj) then { _obj setVariable ["blacklistedGarage", true, true]; }; } forEach _positions; };