Fixed Issues with relPos unit spawning, removed some logging

This commit is contained in:
Chris Cardozo 2020-10-05 22:41:56 -04:00
parent 6b3a295a2a
commit eb683730b5
5 changed files with 70 additions and 14 deletions

View File

@ -40,13 +40,27 @@ if !(isNull _group) then
{
{
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
_x params["_bldClassName","_bldRelPos","_bldDir","_allowDamage","_enableSimulation","_probabilityOfGarrision","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = blck_staticWeapons};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack (netID _building);
_building setPosATL (_bldRelPos vectorAdd _center);
[_building, _bldDir] call blck_fnc_setDirUp;
_staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
_staticsSpawned = [
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
}forEach _garrisonedBuilding_relPosSystem;
};
_return = [_group,_buildingsSpawned,_staticsSpawned];

View File

@ -101,10 +101,8 @@ if !(_defaultMissionLocations isEqualTo []) then
if (_isScubaMission) then
{
_coords = [] call blck_fnc_findShoreLocation;
diag_log format["_initializeMission (102): _coords = %1",_coords];
} else {
_coords = [] call blck_fnc_findSafePosn;
diag_log format["_initializeMission (105): _coords = %1",_coords];
};
};

View File

@ -270,6 +270,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then
{
// params["_building","_group",["_noStatics",0],["_typesStatics",blck_staticWeapons],["_noUnits",0],["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
private _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
if (_temp isEqualTo grpNull) then {throw 1} else
// TODO: add error checks for grpNull to the RelPosSystem
@ -283,7 +284,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
private _userelativepos = true;
private _emplacedWeaponsThisMission = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
[format["_monitorInitializedMissions(284): _noEmplacedWeapons = %1 | _emplacedWeaponsThisMission = %2 | _missionEmplacedWeapons = %3",_noEmplacedWeapons,_emplacedWeaponsThisMission,_missionEmplacedWeapons]] call blck_fnc_log;
//[format["_monitorInitializedMissions(284): _noEmplacedWeapons = %1 | _emplacedWeaponsThisMission = %2 | _missionEmplacedWeapons = %3",_noEmplacedWeapons,_emplacedWeaponsThisMission,_missionEmplacedWeapons]] call blck_fnc_log;
if (blck_useStatic && ((_emplacedWeaponsThisMission > 0) || !(_missionEmplacedWeapons isEqualTo []))) then
// TODO: add error checks for grpNull to the emplaced weapon spawner
{
@ -298,7 +299,16 @@ for "_i" from 1 to (count blck_activeMissionsList) do
uisleep 5;
private _noPatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
//diag_log format["_monitorInitializedMissions(299): _markerMissionName = %2 | count _missionAIVehicles = %1",count _missionAIVehicles,_markerMissionName];
/*
diag_log format[
"_monitorInitializeMissions(300): __noVehiclePatrols %1 | _noPatrols %2 | count _missionPatrolVehicles %3 | _missionPatrolVehicles = %4",
_noVehiclePatrols,
_noPatrols,
count _missionPatrolVehicles,
_missionPatrolVehicles
];
*/
if (blck_useVehiclePatrols && ((_noPatrols > 0) || !(_missionPatrolVehicles isEqualTo []))) then
{
_temp = [_coords,_noPatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;

View File

@ -40,7 +40,7 @@ private _hiddenObjs = [];
};
_obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"];
_obj setPosATL _objPos;
//diag_log format["_spawnCompositionObjects: _obj = %1 | netID _obj = %2",_obj,netID _obj];
_newObjs pushback (netID _obj);
[_obj, _dir] call blck_fnc_setDirUp;
_obj setVectorUp [0,0,1];

View File

@ -10,7 +10,41 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_building","_group",["_noStatics",0],["_typesStatics",blck_staticWeapons],["_noUnits",0],["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
/*
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
*/
params[
"_building",
"_group",
["_noStatics",0],
["_typesStatics",blck_staticWeapons],
["_noUnits",0],
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_launcher","none"],
["_weaponList",[]],
["_sideArms",[]]
];
{
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _this %1 = %2",_forEachIndex,_x];
} forEach _this;
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
@ -19,12 +53,11 @@ if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
private["_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"];
private _allBldPsn = [[_building] call BIS_fnc_buildingPositions] call BIS_fnc_arrayShuffle;
private _allBldPsn = ([_building] call BIS_fnc_buildingPositions) call BIS_fnc_arrayShuffle;
private _countBldPsn = count _allBldPsn;
private _floor = floor(_countBldPsn/2);
private _ceil = ceil(_countBldPsn/2);
private _statics = if (_ceil > _noStatics) then {_noStatics} else {_ceil};
private _units = if (_floor > _noUnits) then {_noUnits} else {_floor};
private _statics = _noStatics min ceil(_countBldPsn/2);
private _units = _countBldPsn - _statics;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _statics = %1 | _units = %2 | count _allBldPsn = %3 | _allBldPsn %4",_statics,_units,count _allBldPsn,_allBldPsn];
private _staticsSpawned = [];
private _locsUsed = [];
uiSleep 1;
@ -32,6 +65,7 @@ for "_i" from 1 to _statics do
{
if (_allBldPsn isEqualTo []) exitWith {};
_pos = _allBldPsn deleteAt 0;
//diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _pos = %1",_pos];
_locsUsed pushBack _pos;
_staticClassName = selectRandom _typesStatics;
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;