From 1df0da1b1ca3f12212adeaf4d7891de4e7297097 Mon Sep 17 00:00:00 2001
From: targetingsnake <94396851+targetingsnake@users.noreply.github.com>
Date: Sat, 10 Feb 2024 21:39:57 +0100
Subject: [PATCH] readded debug functions second time (#3131)

* readed debug functions seccond time

---------

Co-authored-by: targetingsnake <targetingsnake@users.noreply.github.com>
---
 A3A/addons/core/CfgFunctions.hpp              |   2 +
 .../functions/Debug/fn_debugSpawnVics.sqf     |  90 ++++++++++
 .../Debug/fn_spawnSelectedTemplateAI.sqf      | 156 ++++++++++++++++++
 3 files changed, 248 insertions(+)
 create mode 100644 A3A/addons/core/functions/Debug/fn_debugSpawnVics.sqf
 create mode 100644 A3A/addons/core/functions/Debug/fn_spawnSelectedTemplateAI.sqf

diff --git a/A3A/addons/core/CfgFunctions.hpp b/A3A/addons/core/CfgFunctions.hpp
index 01eef2125b..8446453d1e 100644
--- a/A3A/addons/core/CfgFunctions.hpp
+++ b/A3A/addons/core/CfgFunctions.hpp
@@ -293,6 +293,8 @@ class CfgFunctions
             class installSchrodingersBuildingFix {};
             class prepFunctions {};
             class spawnDebuggingLoop {};
+            class spawnSelectedTemplateAI {};
+            class debugSpawnVics {};    
         };
 
         class Dialogs {
diff --git a/A3A/addons/core/functions/Debug/fn_debugSpawnVics.sqf b/A3A/addons/core/functions/Debug/fn_debugSpawnVics.sqf
new file mode 100644
index 0000000000..7e60727a04
--- /dev/null
+++ b/A3A/addons/core/functions/Debug/fn_debugSpawnVics.sqf
@@ -0,0 +1,90 @@
+/*
+Author: Targetingsnake
+Description:
+    Spawns a vehicles from template around player
+
+Arguments: None
+
+Return Value: None
+
+Scope: Local
+Environment: Any
+Public: Yes
+Dependencies:
+
+Example: [] call A3A_fnc_debugSpawnVics;
+
+License: MIT License
+*/
+
+#include "..\..\script_component.hpp"
+FIX_LINE_NUMBERS()
+private _factions  = [A3A_faction_reb, A3A_faction_inv, A3A_faction_occ, A3A_faction_civ];
+
+private _pos = getPos player;
+private _lines = 10;
+private _current_line = 0;
+private _start_y = _pos select 0;
+
+private _calcPos = {
+	params ["_lpos", "_llines", "_currentLines", "_y_start"];
+	if (_currentLines >= (_llines - 1)) then {
+		_lpos set [1, (_lpos#1 + 30 )];
+		_lpos set [0, _y_start];
+		_currentLines = 0;
+	} else {
+		_lpos set [0, (_lpos#0) + 30];
+		_currentLines = _currentLines + 1;
+	};
+	[_lpos, _currentLines]
+};
+
+private _debugOutput = {
+	params["_type"];
+	if (typeName _type != "STRING") then {
+		_type = str _type;
+	};
+	private _string = "Spawning: " + _type;
+	Info(_string);
+};
+
+Info("Start spawning vehicles");
+{
+	Info("Spawning next Faction");
+	private _fn = _x get "name";
+	_fn = "Spawning " + _fn ;
+	Info(_fn);
+	private _faction = _x;
+	private _keys = keys _x;
+	{
+		private _key = _x;
+		if (typeName _key == "STRING") then {
+			private _value = _faction get _key;
+			if (["vehicle", _x] call BIS_fnc_inString || (["static", _x] call BIS_fnc_inString 
+				&& (!(["unit", _x] call BIS_fnc_inString)) && (!(["Mag", _x] call BIS_fnc_inString))) ) then {
+				if (typeName _value == "ARRAY" ) then {
+					{
+						if (typeName _x == "STRING") then {
+							_ar = [_pos, _lines, _current_line, _start_y] call _calcPos;
+							_pos = _ar#0;
+							_current_line = _ar#1;
+							[_x] call _debugOutput;
+							createVehicle [_x, _pos, [], 0, "CAN_COLLIDE"];
+						};
+					} forEach _value;
+				};
+				if (typeName _value == "STRING" ) then {
+						_ar = [_pos, _lines, _current_line, _start_y] call _calcPos;
+						_pos = _ar#0;
+						_current_line = _ar#1;
+						[_value] call _debugOutput;
+						createVehicle [_value, _pos, [], 0, "CAN_COLLIDE"];
+				};
+			};
+		};
+	} forEach _keys;
+	_pos set [1, ((_pos#1) + 100)];
+	_pos set [0, (_start_y - 30)];
+	_current_line = _lines;
+} forEach _factions;
+Info("End spawning vehicles");
\ No newline at end of file
diff --git a/A3A/addons/core/functions/Debug/fn_spawnSelectedTemplateAI.sqf b/A3A/addons/core/functions/Debug/fn_spawnSelectedTemplateAI.sqf
new file mode 100644
index 0000000000..ad0b0c166c
--- /dev/null
+++ b/A3A/addons/core/functions/Debug/fn_spawnSelectedTemplateAI.sqf
@@ -0,0 +1,156 @@
+/*
+Author: Targetingsnake, Bob, Laze
+Description:
+    Spawns a couple of AI Units to check template
+
+Arguments: None
+
+Return Value: None
+
+Scope: Local
+Environment: Any
+Public: Yes
+Dependencies:
+
+Example: [] call A3A_fnc_spawnSelectedTemplateAI;
+
+License: MIT License
+*/
+#include "..\..\script_component.hpp"
+FIX_LINE_NUMBERS()
+
+Info("Start spawning units");
+
+//All Loadouts with 15 meters in between with NatoInit 
+ private _returnpos = getpos (player); 
+ private _westGrp = createGroup west; 
+ private _eastGrp = createGroup east; 
+ 
+//All Loadouts with 15 meters in between
+    _returnpos = getpos (player);
+    //SF
+        [_westGrp, "loadouts_occ_SF_SquadLeader", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Rifleman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Medic", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Engineer", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Grenadier", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_LAT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_AT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_AA", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_MachineGunner", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Marksman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_SF_Sniper", getpos (player)] call A3A_fnc_createUnit;
+        player setPos (getPos player vectorAdd [15,0,0]);
+    //Military
+        [_westGrp, "loadouts_occ_military_SquadLeader", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Rifleman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Medic", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Engineer", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Grenadier", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_LAT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_AT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_AA", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_MachineGunner", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Marksman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_military_Sniper", getpos (player)] call A3A_fnc_createUnit;
+        player setPos (getPos player vectorAdd [15,0,0]);
+    //Militia
+        [_westGrp, "loadouts_occ_militia_SquadLeader", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Rifleman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Medic", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Engineer", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Grenadier", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_LAT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_AT", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_AA", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_MachineGunner", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Marksman", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_militia_Sniper", getpos (player)] call A3A_fnc_createUnit;
+        player setPos (getPos player vectorAdd [15,0,0]);
+    //Other Loadouts
+        [_westGrp, "loadouts_occ_police_SquadLeader", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_police_Standard", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_other_Official", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_other_Traitor", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_other_Crew", getpos (player)] call A3A_fnc_createUnit; 
+        [_westGrp, "loadouts_occ_other_Pilot", getpos (player)] call A3A_fnc_createUnit;
+        player setpos _returnpos;
+        player setPos (getPos player vectorAdd [0,10,0]);
+		//Safety west
+        _westGrp setCombatMode "BLUE";
+        _westGrp setBehaviourStrong "CARELESS";
+        {
+        _x disableAI "TARGET"; 
+        _x disableAI "AUTOTARGET";
+        _x stop true;
+        _x setCaptive true;
+        } forEach units _westGrp;
+		{[_x] call A3A_fnc_NATOinit} forEach units _westGrp;
+    //All INV Loadouts
+    //SF 
+        [_eastGrp, "loadouts_inv_SF_SquadLeader", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Rifleman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Medic", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Engineer", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Grenadier", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_LAT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_AT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_AA", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_MachineGunner", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Marksman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_SF_Sniper", getpos (player)] call A3A_fnc_createUnit; 
+        player setPos (getPos player vectorAdd [15,0,0]); 
+    //Military 
+        [_eastGrp, "loadouts_inv_military_SquadLeader", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Rifleman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Medic", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Engineer", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Grenadier", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_LAT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_AT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_AA", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_MachineGunner", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Marksman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_military_Sniper", getpos (player)] call A3A_fnc_createUnit; 
+        player setPos (getPos player vectorAdd [15,0,0]); 
+    //Militia 
+        [_eastGrp, "loadouts_inv_militia_SquadLeader", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Rifleman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Medic", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Engineer", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_ExplosivesExpert", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Grenadier", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_LAT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_AT", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_AA", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_MachineGunner", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Marksman", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_militia_Sniper", getpos (player)] call A3A_fnc_createUnit; 
+        player setPos (getPos player vectorAdd [15,0,0]); 
+    //Other Loadouts 
+        [_eastGrp, "loadouts_inv_police_SquadLeader", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_police_Standard", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_other_Official", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_other_Traitor", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_other_Crew", getpos (player)] call A3A_fnc_createUnit;  
+        [_eastGrp, "loadouts_inv_other_Pilot", getpos (player)] call A3A_fnc_createUnit; 
+
+
+    //Safety east
+ _eastGrp setCombatMode "BLUE"; 
+ _eastGrp setBehaviourStrong "CARELESS"; 
+ { 
+	_x disableAI "TARGET";  
+	_x disableAI "AUTOTARGET"; 
+	_x stop true; 
+	_x setCaptive true; 
+	} forEach units _eastGrp; 
+	{[_x] call A3A_fnc_NATOinit} forEach units _eastGrp;
+	player setpos _returnpos; 
+
+Info("End spawning units");
\ No newline at end of file