diff --git a/Assembly-CSharp-Editor-firstpass.csproj b/Assembly-CSharp-Editor-firstpass.csproj
index 1d117221..d2c6be2f 100644
--- a/Assembly-CSharp-Editor-firstpass.csproj
+++ b/Assembly-CSharp-Editor-firstpass.csproj
@@ -22,7 +22,7 @@
full
false
Temp\bin\Debug\
- DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_1_0;UNITY_2018_1;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_PACKMAN;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_IL2CPP;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_3D;USE_KOPILUA;LUA_CORE;CATCH_EXCEPTIONS;ENABLE_MONO
+ DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_1_0;UNITY_2018_1;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_PACKMAN;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_3D;USE_KOPILUA;LUA_CORE;CATCH_EXCEPTIONS
prompt
4
0169
diff --git a/Assets/Editor/BuildWithResources.cs b/Assets/Editor/BuildWithResources.cs
index e6932eae..7cc3a26b 100644
--- a/Assets/Editor/BuildWithResources.cs
+++ b/Assets/Editor/BuildWithResources.cs
@@ -34,7 +34,8 @@ public static void BuildSettings64()
string[] levels = new string[] { "Assets/MapEditor.unity" };
- PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, ScriptingImplementation.IL2CPP);
+ //PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, ScriptingImplementation.IL2CPP);
+ PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, ScriptingImplementation.Mono2x);
BuildPipeline.BuildPlayer(levels, path + "/FAForeverMapEditor.exe", BuildTarget.StandaloneWindows64, (BuildOptions.CompressWithLz4HC));
// Copy structure files
diff --git a/Assets/MapEditor.unity b/Assets/MapEditor.unity
index 017669d0..5ee35646 100644
--- a/Assets/MapEditor.unity
+++ b/Assets/MapEditor.unity
@@ -37195,7 +37195,7 @@ Camera:
serializedVersion: 2
m_Bits: 2560
m_RenderingPath: 1
- m_TargetTexture: {fileID: 918867212}
+ m_TargetTexture: {fileID: 1638597788}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
@@ -62016,37 +62016,6 @@ MonoBehaviour:
type: 2}
m_PrefabInternal: {fileID: 917032096}
m_Script: {fileID: 11500000, guid: 8c60df5520bfea740b1f3db0c3478272, type: 3}
---- !u!84 &918867212
-RenderTexture:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_Name:
- m_ImageContentsHash:
- serializedVersion: 2
- Hash: 00000000000000000000000000000000
- m_ForcedFallbackFormat: 4
- m_DownscaleFallback: 0
- m_Width: 256
- m_Height: 256
- m_AntiAliasing: 1
- m_DepthFormat: 1
- m_ColorFormat: 0
- m_MipMap: 0
- m_GenerateMips: 1
- m_SRGB: 0
- m_UseDynamicScale: 0
- m_BindMS: 0
- m_TextureSettings:
- serializedVersion: 2
- m_FilterMode: 1
- m_Aniso: 0
- m_MipBias: 0
- m_WrapU: 1
- m_WrapV: 1
- m_WrapW: 1
- m_Dimension: 2
- m_VolumeDepth: 1
--- !u!1 &920728585
GameObject:
m_ObjectHideFlags: 0
@@ -89712,6 +89681,7 @@ MonoBehaviour:
SaveLuaHeader: {fileID: 4900000, guid: 5368258e2ff473249b819becae8bdd91, type: 3}
SaveLuaFooter: {fileID: 4900000, guid: b1332c5a2fe8f05459462cad7daf3b77, type: 3}
DefaultScript: {fileID: 4900000, guid: 72b107c7fd14a424890fc680054706ae, type: 3}
+ AdaptiveScript: {fileID: 4900000, guid: 2ade02f91319ce54487311f60f2e3c11, type: 3}
HeightmapControler: {fileID: 1334852568}
EditMenu: {fileID: 1559365572}
History: {fileID: 1917036355}
@@ -89720,7 +89690,7 @@ MonoBehaviour:
ScenarioFileName:
Background: {fileID: 1320305011}
InfoPopup: {fileID: 503630892}
- ErrorPopup: {fileID: 0}
+ ErrorPopup: {fileID: 1845082475}
PropsMenu: {fileID: 703931132}
DecalsMenu: {fileID: 943940807}
MapCenterPoint: {x: 0, y: 0, z: 0}
@@ -110706,6 +110676,37 @@ RectTransform:
m_PrefabParentObject: {fileID: 224245749221985618, guid: b9c991c271c736249a3262b1b5a7d7d4,
type: 2}
m_PrefabInternal: {fileID: 1638252513}
+--- !u!84 &1638597788
+RenderTexture:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name:
+ m_ImageContentsHash:
+ serializedVersion: 2
+ Hash: 00000000000000000000000000000000
+ m_ForcedFallbackFormat: 4
+ m_DownscaleFallback: 0
+ m_Width: 256
+ m_Height: 256
+ m_AntiAliasing: 1
+ m_DepthFormat: 1
+ m_ColorFormat: 0
+ m_MipMap: 0
+ m_GenerateMips: 1
+ m_SRGB: 0
+ m_UseDynamicScale: 0
+ m_BindMS: 0
+ m_TextureSettings:
+ serializedVersion: 2
+ m_FilterMode: 1
+ m_Aniso: 0
+ m_MipBias: 0
+ m_WrapU: 1
+ m_WrapV: 1
+ m_WrapW: 1
+ m_Dimension: 2
+ m_VolumeDepth: 1
--- !u!1 &1642348278
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/MapEditor/LightingData.asset b/Assets/MapEditor/LightingData.asset
index 6431ae54..e9534db8 100644
Binary files a/Assets/MapEditor/LightingData.asset and b/Assets/MapEditor/LightingData.asset differ
diff --git a/Assets/Scripts/Camera/CameraControler.cs b/Assets/Scripts/Camera/CameraControler.cs
index 723158c4..03223c27 100644
--- a/Assets/Scripts/Camera/CameraControler.cs
+++ b/Assets/Scripts/Camera/CameraControler.cs
@@ -40,7 +40,7 @@ void Awake(){
const float CameraMinOffset = 0.5f;
//float MaxY = 100;
- public void RestartCam(){
+ public void RestartCam(bool NoRect = false){
if(!Terrain.activeTerrain) return;
Pos = Vector3.zero + Vector3.right * MapSize / 20.0f - Vector3.forward * MapSize / 20.0f;
Pos.y = Terrain.activeTerrain.SampleHeight(Pos);
@@ -58,13 +58,22 @@ public void RestartCam(){
PanOffsetX = Vector3.zero;
PanOffsetZ = Vector3.zero;
- UpdateRect();
+ UpdateRect(NoRect);
}
- public void UpdateRect()
+ public void UpdateRect(bool NoRect = false)
{
float RemoveCamPropHeight = 30f / (float)Screen.height;
float RemoveCamPropWidth = 309f / (float)Screen.width;
+
+ if (NoRect)
+ {
+ RemoveCamPropHeight = 0;
+ RemoveCamPropWidth = 0;
+ }
+
+
+
Cam.rect = new Rect(RemoveCamPropWidth, 0, 1 - RemoveCamPropWidth, 1 - RemoveCamPropHeight);
LastWidth = Screen.width;
diff --git a/Assets/Scripts/GFX/OzoneDecals/Scripts/OzoneDecalRenderer_OnPreRender.cs b/Assets/Scripts/GFX/OzoneDecals/Scripts/OzoneDecalRenderer_OnPreRender.cs
index a4e22099..a558d3a7 100644
--- a/Assets/Scripts/GFX/OzoneDecals/Scripts/OzoneDecalRenderer_OnPreRender.cs
+++ b/Assets/Scripts/GFX/OzoneDecals/Scripts/OzoneDecalRenderer_OnPreRender.cs
@@ -71,6 +71,8 @@ private void DrawDeferredDecals_Albedo(Camera cam)
}
}
+ public static int CutoffMultiplier = 1;
+
private void DrawDeferredDecals_AlbedoInstanced(Camera cam)
{
_bufferDeferred.SetRenderTarget(_albedoRenderTarget, BuiltinRenderTextureType.CameraTarget);
@@ -101,7 +103,7 @@ private void DrawDeferredDecals_AlbedoInstanced(Camera cam)
{
_matrices[n] = decal.tr.localToWorldMatrix;
_NearCutOffLODValues[n] = decal.NearCutOff;
- _CutOffLODValues[n] = decal.CutOff;
+ _CutOffLODValues[n] = decal.CutOff * CutoffMultiplier;
++n;
if (n == 1023)
@@ -196,7 +198,7 @@ private void DrawDeferredDecals_Normal(Camera cam)
{
// Instanced drawing
_matrices[n] = decal.tr.localToWorldMatrix;
- _CutOffLODValues[n] = decal.CutOff;
+ _CutOffLODValues[n] = decal.CutOff * CutoffMultiplier;
_NearCutOffLODValues[n] = decal.NearCutOff;
++n;
@@ -224,7 +226,7 @@ private void DrawDeferredDecals_Normal(Camera cam)
_bufferDeferred.SetRenderTarget(_normalRenderTarget, BuiltinRenderTextureType.CameraTarget);
_directBlock.Clear();
- _directBlock.SetFloat("_NearCutOffLOD", decal.NearCutOff);
+ _directBlock.SetFloat("_NearCutOffLOD", decal.NearCutOff * CutoffMultiplier);
_directBlock.SetFloat("_CutOffLOD", decal.CutOff);
_bufferDeferred.DrawMesh(_cubeMesh, decal.tr.localToWorldMatrix, material, 0, 1, _directBlock);
diff --git a/Assets/Scripts/HazardX SCMAP Code/Prop.cs b/Assets/Scripts/HazardX SCMAP Code/Prop.cs
index 84b7d744..ba2aa868 100644
--- a/Assets/Scripts/HazardX SCMAP Code/Prop.cs
+++ b/Assets/Scripts/HazardX SCMAP Code/Prop.cs
@@ -17,7 +17,6 @@ public partial class Prop
public Vector3 RotationZ;
public Vector3 Scale;
- private static Vector3 V1 = new Vector3(1f, 1f, 1f);
public void Load(BinaryReader Stream)
{
BlueprintPath = Stream.ReadStringNull();
@@ -26,7 +25,6 @@ public void Load(BinaryReader Stream)
RotationY = Stream.ReadVector3();
RotationZ = Stream.ReadVector3();
Scale = Stream.ReadVector3();
- // scale (unused)
}
public void Save(BinaryWriter Stream)
@@ -36,8 +34,6 @@ public void Save(BinaryWriter Stream)
Stream.Write(RotationX);
Stream.Write(RotationY);
Stream.Write(RotationZ);
- Stream.Write(V1);
- // scale (unused)
+ Stream.Write(Scale);
}
-
}
\ No newline at end of file
diff --git a/Assets/Scripts/HazardX SCMAP Code/Prop_Instance.cs b/Assets/Scripts/HazardX SCMAP Code/Prop_Instance.cs
index 82d4ed13..918c91f3 100644
--- a/Assets/Scripts/HazardX SCMAP Code/Prop_Instance.cs
+++ b/Assets/Scripts/HazardX SCMAP Code/Prop_Instance.cs
@@ -28,11 +28,6 @@ public void Bake()
if (!BlueprintPath.StartsWith("/"))
BlueprintPath = "/" + BlueprintPath;
- //if (BlueprintPath.StartsWith("/maps"))
- // BlueprintPath = BlueprintPath.Remove(0, 1);
-
- //Debug.Log("PropPath: " + BlueprintPath);
-
Position = ScmapEditor.WorldPosToScmap(Obj.Tr.position);
RotationX = Vector3.zero;
diff --git a/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt b/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt
new file mode 100644
index 00000000..f68e2b05
--- /dev/null
+++ b/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt
@@ -0,0 +1,805 @@
+------------------------------------------------------------------------
+----- Script by CookieNoob and KeyBlue ---------------------------------
+----- Generated by FAF Map Editor --------------------------------------
+------------------------------------------------------------------------
+local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
+local ScenarioFramework = import('/lua/ScenarioFramework.lua')
+local Tables = import([**TablesPath**])
+
+-- get scenario info about how the map should look like, if no option is changed, change it to the default
+local automex = ScenarioInfo.Options.automex or 1
+local hydroplus = ScenarioInfo.Options.hydroplus or 1
+local optional_reclaim_middle = ScenarioInfo.Options.optional_reclaim_middle or 1
+local optional_reclaim_adaptive = ScenarioInfo.Options.optional_reclaim_adaptive or 1
+local middlemex = ScenarioInfo.Options.middlemex or 1
+local sidemex = ScenarioInfo.Options.sidemex or 1
+local underwatermex = ScenarioInfo.Options.underwatermex or 1
+local backmex = ScenarioInfo.Options.backmex or 1
+local islandmex = ScenarioInfo.Options.islandmex or 1
+local optional_reclaim = ScenarioInfo.Options.optional_reclaim or 1
+local mirrormex = ScenarioInfo.Options.mirrormex or 1
+local optional_civilian_base = ScenarioInfo.Options.optional_civilian_base or 1
+local dupicatesinglemex = ScenarioInfo.Options.dupicatesinglemex or 1
+local additionalmex = ScenarioInfo.Options.additionalmex or 1
+
+--stuff for the crazyrush script
+local currentResSpot = 0
+local generatedMass = {}
+local checkedExtractor = {}
+local MexList ={}
+
+--stuff for expansion script
+local spawnedMassSpots={}
+local spawnedMexNumber = 0
+local expandmap = ScenarioInfo.Options.expandmap or 1
+
+--stuff for tree script
+local InitialListTrees = {}
+local TreeRegrowSpeed = ScenarioInfo.Options.tree or 1
+math.randomseed(1)
+
+
+
+
+function OnPopulate()
+------------------------------------------------------------------------
+----- special options (civilians, reclaim...) --------------------------
+------------------------------------------------------------------------
+
+ if ((optional_reclaim == 2) or (optional_reclaim == 3)) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_' .. optional_reclaim, true)
+ elseif (optional_reclaim == 4) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_2', true)
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_3', true)
+ end
+ if optional_reclaim_middle > 1 then
+ for midreclaim = 2, optional_reclaim_middle do
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Middle_'..midreclaim, true)
+ end
+ end
+ if(optional_reclaim_adaptive > 1) then
+ AddFactionReclaimBack(optional_reclaim_adaptive)
+ end
+ if(optional_civilian_base > 1) then
+ local spawncivs = true
+ for m = 13, 14 do
+ armystring = "ARMY_" .. m
+ for _, army in ListArmies() do
+ if( army == armystring) then
+ LOG("ULTIMATE found player in civ base. remove civs")
+ spawncivs = false
+ end
+ end
+ end
+ if(spawncivs) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Base', false)
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Defences_'.. optional_civilian_base, false)
+ end
+ end
+
+ ScenarioUtils.InitializeArmies();
+end
+
+function OnStart()
+ --check if a message needs to be displayed
+ ForkThread(showmessage)
+
+--[[ --remove some of the rocks
+ if(removeRock > 1) then
+ ForkThread(Rock_RemoveRocks, 1 - 0.2* (removeRock - 1) )
+ LOG('rocks removed')
+ end]]
+
+ --activate the map expansion code
+-- ScenarioFramework.SetPlayableArea('AREA_4' , false)
+ if(Expand_StartupCheck()) then
+ ForkThread(Expand_MapExpandConditions)
+ end
+
+ --activate crazyrush in case the correct option is checked
+ if(automex >5) then
+ LOG("ULTIMATE activate Crazyrush")
+ ForkThread(Crazyrush_checkMassPoint, true)
+ else
+ if(dupicatesinglemex == 2) then
+ LOG("ULTIMATE activate Crazyrush, singlemex mode")
+ ForkThread(Crazyrush_checkMassPoint, false)
+ end
+ end
+
+
+ --activate regrowing trees
+ if(TreeRegrowSpeed > 1) then
+ ForkThread(Tree_StartGrowingTrees)
+ end
+
+ ForkThread(gatherFeedback)
+
+end
+
+
+
+
+
+function gatherFeedback()
+ WaitSeconds(10)
+ BroadcastMSG('If you see any bugs with the map, plz tell CookieNoob. Thx.', -- message
+ 30, -- fontsize
+ 'ff9400', -- color
+ 10, -- duration
+ 'center') -- position
+end
+
+
+
+
+
+
+------------------------------------------------------------------------
+----- dynamic spawns ---------------------------------------------------
+------------------------------------------------------------------------
+function ScenarioUtils.CreateResources()
+-- Script by CookieNoob and KeyBlue
+
+ LOG("ULTIMATE create Ressources. Settings:")
+ LOG("ULTIMATE", automex, hydroplus, optional_reclaim_middle, optional_reclaim_adaptive, middlemex, sidemex, underwatermex, optional_reclaim, mirrormex, optional_civilian_base)
+ -- get map markers
+ local markers = ScenarioUtils.GetMarkers();
+
+-- table of which ressources belong to which player, it is sorted in such a way that the first line
+-- corresponds to player one, the second to player 2 and so on... load it from the _tables.lua file
+
+ local spwnMexArmy = Tables.spwnMexArmy or {}
+ local spwnHydroArmy = Tables.spwnHydroArmy or {}
+ local spwnAdditionalHydro = Tables.spwnAdditionalHydro or {}
+ local spwnAdditionalmiddlemass = Tables.middlemass or {}
+ local spwnAdditionalsidemass = Tables.sidemass or {}
+ local spwnAdditionalunderwatermex = Tables.underwatermass or {}
+ local spwnAdditionalislandmex = Tables.islandmass or {}
+ local spwnAdditionalbackmex = Tables.backmass or {}
+ local crazyrushOneMex = Tables.crazyrushOneMex or {}
+ local DuplicateListMex = Tables.DuplicateListMex or {}
+ local AdditionalMass = Tables.extramass or {}
+
+
+ -- find out if there are spots that do not have a mirror
+ -- in that case store the pair in the list with false
+
+ local numberOfNotPresentArmies = 1
+
+-- check which army isnt there
+ local Notpresentarmies = {}
+ local ArmyList = ListArmies()
+ for j, spawnmex in ScenarioInfo.Options.SpawnMex or {} do
+ if spawnmex then
+ ArmyList[table.getn(ArmyList) + 1] = 'ARMY_' .. j
+ end
+ end
+
+ if(automex == 1 or automex == 6 or automex == 7) then
+ for m = 1, 8 do
+ local army1 = (2*m - 1)
+ local army2 = (2*m)
+ local army1String = "ARMY_" .. army1
+ local army2String = "ARMY_" .. army2
+
+ local here = 0;
+ for number, army in ArmyList do
+ if( army == army1String or army == army2String ) then
+ here = here + 1;
+ end
+ end
+
+ if ( (mirrormex == 1 and here < 1 ) or (mirrormex == 2 and here < 2) ) then
+ Notpresentarmies[numberOfNotPresentArmies] = army1;
+ numberOfNotPresentArmies = numberOfNotPresentArmies + 1;
+ Notpresentarmies[numberOfNotPresentArmies] = army2;
+ numberOfNotPresentArmies = numberOfNotPresentArmies + 1;
+ end
+ end
+
+ elseif(automex == 2) then
+ for m = 9, 16 do
+ Notpresentarmies[numberOfNotPresentArmies] = m;
+ numberOfNotPresentArmies = numberOfNotPresentArmies + 1;
+ end
+
+ elseif(automex == 3) then
+ Notpresentarmies = {};
+ end
+
+
+ for name, tblData in pairs(markers) do
+-- spawn resources?
+
+-- only spawn ressources (obviously)
+ if (not tblData.resource) then
+ doit = false;
+ else
+ -- standard resources, spawn it
+ doit = true;
+
+-- remove the spawn when a player is not present, loop over all not present armies and check if the marker
+-- for the current mex/hydro is corresponds to one of those in the list
+ for _ ,armynumber in Notpresentarmies do
+-- loop over all markers of mexes in the table of the row of the missing army
+ doit=FalseIfInList(name, spwnMexArmy[armynumber], MassString, doit);
+ doit=FalseIfInList(name, spwnHydroArmy[armynumber], HydroString, doit);
+ end
+
+ if(hydroplus == 1) then
+ doit=FalseIfInList(name, spwnAdditionalHydro, HydroString, doit);
+ end
+ for l = 1, middlemex - 1 do
+ doit=FalseIfInList(name, spwnAdditionalmiddlemass[l], MassString, doit);
+ end
+ for l = 1, sidemex - 1 do
+ doit=FalseIfInList(name, spwnAdditionalsidemass[l], MassString, doit);
+ end
+ for l = 1, underwatermex - 1 do
+ doit=FalseIfInList(name, spwnAdditionalunderwatermex[l], MassString, doit);
+ end
+ for l = 1, backmex - 1 do
+ doit=FalseIfInList(name, spwnAdditionalbackmex[l], MassString, doit);
+ end
+ for l = 1, islandmex - 1 do
+ doit=FalseIfInList(name, spwnAdditionalislandmex[l], MassString, doit);
+ end
+ if(automex == 6) then
+ doit = DoitIfInList(name, crazyrushOneMex, MassString, doit);
+ end
+ if(additionalmex == 1) then
+ doit = FalseIfInList(name, AdditionalMass, MassString, doit)
+ end
+ end
+
+ if (doit) then
+ if(tblData.type == 'Mass') then
+ spawnedMexNumber = spawnedMexNumber + 1
+ spawnedMassSpots[spawnedMexNumber] = name
+ end
+ if DoitIfInList(name, DuplicateListMex, MassString, true) and dupicatesinglemex == 2 then
+ spawnressource(tblData.position,tblData.type, false)
+ else
+ spawnressource(tblData.position,tblData.type, true)
+ end
+ end
+ end
+end
+
+function MassString(_mexname)
+ if(_mexname > 9) then
+ return "Mass " .. _mexname;
+ else
+ return "Mass 0" .. _mexname;
+ end
+end
+
+function HydroString(_hydroname)
+ if(_hydroname > 9) then
+ return "Hydrocarbon " .. _hydroname;
+ else
+ return "Hydrocarbon 0" .. _hydroname;
+ end
+end
+
+function FalseIfInList(name,list, string_function, _doit)
+ for k = 1, table.getn(list) do
+ if(name == (string_function(list[k]))) then
+ return false
+ end
+ end
+ return _doit;
+end
+
+function DoitIfInList(name, list, string_function, _doit)
+ for k = 1, table.getn(list) do
+ if(name == (string_function(list[k]))) then
+ return _doit
+ end
+ end
+ return false
+end
+
+function spawnressource(Position,restype, spawnhpr)
+ local albedo,bp,lod,Size
+
+ albedo = "/env/common/splats/";
+ if(restype== 'Mass') then
+ albedo = albedo .. "mass_marker.dds"
+ bp = "/env/common/props/massDeposit01_prop.bp";
+ lod = 100
+ Size = 2
+ else
+ albedo = albedo .. "hydrocarbon_marker.dds"
+ bp = "/env/common/props/hydrocarbonDeposit01_prop.bp";
+ lod = 200
+ Size = 6
+ end
+
+ CreateSplat(
+ Position, -- Position
+ 0, -- Heading (rotation)
+ albedo, -- Texture name for albedo
+ Size, Size, -- SizeX/Z
+ lod, -- LOD
+ 0, -- Duration (0 == does not expire)
+ -1, -- army (-1 == not owned by any single army)
+ 0 -- fidelity
+ );
+ CreateResourceDeposit(restype, Position[1], Position[2], Position[3], Size/2);
+ if spawnhpr then
+ CreatePropHPR(bp, Position[1], Position[2], Position[3], Random(0,360), 0, 0);
+ end
+end
+
+
+
+
+
+
+
+
+------------------------------------------------------------------------
+----- Message part -----------------------------------------------------
+------------------------------------------------------------------------
+function showmessage()
+ local message = ''
+ local mexsidetop = ScenarioInfo.Options.mexsidetop or 1
+ local mexsidebot = ScenarioInfo.Options.mexsidebot or 1
+ local sendmessage = false
+
+ if mexsidebot != mexsidetop then
+ message = message .. 'There is a difference in the number of mexes between the bottom left corner and the top right corner.'
+
+ for k = 1, 4 do
+ local counter = 0
+ for _, army in ListArmies() do
+--adjust these pairs! They are correct on wonder but maybe not on this map!
+ if ((army == 'ARMY_'..(2+k) ) or (army == 'ARMY_'..(11-k))) then
+ counter = counter + 1
+ end
+ end
+ if(counter == 1) then
+ sendmessage = true
+ break;
+ end
+--[[ if(IsAllied('ARMY_'.. (2+k), 'ARMY_'.. (11-k) )) then
+ sendmessage = true
+ break
+ end ]]--
+ end
+ for k = 1, 2 do
+ local counter = 0
+ for _, army in ListArmies() do
+--adjust these pairs! They are correct on wonder but maybe not on this map!
+ if ((army == 'ARMY_'..(11+2*k) ) or (army == 'ARMY_'..(18-2*k))) then
+ counter = counter + 1
+ end
+ end
+ if(counter == 1) then
+ sendmessage = true
+ break;
+ end
+--[[ if(IsAllied('ARMY_'.. (11+2*k), 'ARMY_'.. (18-2*k) )) then
+ sendmessage = true
+ break
+ end ]]--
+ end
+ end
+
+ if(sendmessage) then
+ WaitSeconds(7)
+ BroadcastMSG(message, 20, 'ff0000', 15, 'center')
+ end
+-- local countDownDialog = SimDialogue.Create(LOC('There is a difference in the number of mexes between bot and top'), {'Ok'})
+-- countDownDialog.OnButtonPressed = function(self, info)
+-- countDownDialog:Destroy()
+-- end
+
+end
+
+function BroadcastMSG(message, fontsize, RGBColor, duration, location)
+----------------------------------------
+-- broadcast a text message to players
+-- possible locations = lefttop, leftcenter, leftbottom, righttop, rightcenter, rightbottom, rightbottom, centertop, center, centerbottom
+----------------------------------------
+ PrintText(message, fontsize, 'ff' .. RGBColor, duration , location) ;
+end
+
+
+
+
+
+
+
+
+
+------------------------------------------------------------------------
+----- Crazyrush part ---------------------------------------------------
+------------------------------------------------------------------------
+function Crazyrush_checkMassPoint(AllOrList)
+ if(AllOrList) then
+ while(true)do
+ local units = GetUnitsInRect({x0 = 0, x1 = ScenarioInfo.size[1], y0 = 0, y1 = ScenarioInfo.size[2]})
+ if(units~=nil)then
+ for i,unit in units do
+ if(EntityCategoryContains(categories.MASSEXTRACTION,unit))then
+ posx = unit:GetPosition()[1]
+ posy = unit:GetPosition()[3]
+ if(not Crazyrush_alreadyCheckedExtractor(posx, posy))then
+ Crazyrush_GenerateResourcesMarker(posx - 2, posy)
+ Crazyrush_GenerateResourcesMarker(posx + 2, posy)
+ Crazyrush_GenerateResourcesMarker(posx, posy - 2)
+ Crazyrush_GenerateResourcesMarker(posx, posy + 2)
+ end
+ WaitSeconds( 0.01 )
+ end
+ end
+ end
+ WaitSeconds( 1 )
+ end
+ else
+ local DuplicateListMex = Tables.DuplicateListMex or {}
+ if(table.getn(DuplicateListMex)== 0) then
+ return 0
+ else
+ for marker,markerpointer in pairs(ScenarioUtils.GetMarkers()) do
+ if DoitIfInList(marker, DuplicateListMex, MassString, true) then
+ MexList[table.getn(MexList) + 1]= {markerpointer.position[1], markerpointer.position[3]}
+ CreatePropHPR('/env/common/props/hydrocarbonDeposit01_prop.bp', markerpointer.position[1],
+ GetTerrainHeight(markerpointer.position[1], markerpointer.position[3]),
+ markerpointer.position[3], Random(0,360), 0, 0)
+ end
+ end
+ while(true) do
+ for _, marker in MexList do
+ local units = GetUnitsInRect({x0 = marker[1] - 0.2, x1 = marker[1] + 0.2, y0 = marker[2] - 0.2, y1 = marker[2] + 0.2}) or {}
+ for _,unit in units or {} do
+ if EntityCategoryContains(categories.MASSEXTRACTION, unit) then
+ posx = unit:GetPosition()[1]
+ posy = unit:GetPosition()[3]
+ if(posx == marker[1] and posy == marker[2] ) then
+ if(not Crazyrush_alreadyCheckedExtractor(posx, posy))then
+ Crazyrush_GenerateResourcesMarker(posx - 2, posy)
+ Crazyrush_GenerateResourcesMarker(posx + 2, posy)
+ Crazyrush_GenerateResourcesMarker(posx, posy - 2)
+ Crazyrush_GenerateResourcesMarker(posx, posy + 2)
+ end
+ end
+ end
+ end
+ WaitSeconds( 0.01 )
+ end
+ WaitSeconds( 1 )
+ end
+ end
+ end
+end
+
+function Crazyrush_alreadyCheckedExtractor(x,y)
+ local foundIt = false
+ if(checkedExtractor[x]==nil)then
+ checkedExtractor[x]={}
+ checkedExtractor[x][y] = true
+ else
+ if(checkedExtractor[x][y]==nil)then
+ checkedExtractor[x][y] = true
+ else
+ foundIt = true
+ end
+ end
+ return foundIt
+end
+
+function Crazyrush_GenerateResourcesMarker(x, y)
+ local foundIt = false
+ if(generatedMass[x]==nil)then
+ generatedMass[x]={}
+ generatedMass[x][y] = true
+ else
+ if(generatedMass[x][y]==nil)then
+ generatedMass[x][y] = true
+ else
+ foundIt = true
+ end
+ end
+
+ if(not foundIt)then
+ tmptable = {x, y}
+ table.insert(generatedMass, tmptable)
+ marker =
+ {
+ ['Mass '..(300 + currentResSpot)] =
+ {
+ ['type'] = STRING( 'Mass' ),
+ ['position'] = VECTOR3( x, GetTerrainHeight(x,y), y ),
+ ['orientation'] = VECTOR3( 0.00, 0.00, 0.00 ),
+ ['size'] = FLOAT( 1.00 ),
+ ['resource'] = BOOLEAN( true ),
+ ['amount'] = FLOAT( 100.00 ),
+ ['color'] = STRING( 'ff808080' ),
+ ['editorIcon'] = STRING( '/textures/editor/marker_mass.bmp' ),
+ ['prop'] = STRING( '/env/common/props/markers/M_Mass_prop.bp' ),
+ },
+ }
+ currentResSpot = currentResSpot + 1
+ Crazyrush_CreateResources(marker)
+ MexList[table.getn(MexList)+1] = tmptable
+ end
+end
+
+function Crazyrush_CreateResources(markers)
+ --local markers = GetMarkers()
+ for i, tblData in pairs(markers) do
+ if tblData.resource then
+ spawnressource(tblData.position, tblData.type, true)
+ end
+ end
+end
+
+
+
+
+
+
+
+------------------------------------------------------------------------
+----- Expansion part ---------------------------------------------------
+------------------------------------------------------------------------
+
+-- Expansion script adapted from Primus_Alpha by Super, Ithilis_Quo and Speed2
+function Expand_MapExpandConditions()
+ if(expandmap < 7) then
+ ScenarioFramework.CreateTimerTrigger(Expand_MapExpand, 60*5*(expandmap-2), true)
+ end
+ if(expandmap >= 7 ) then
+ local MexToBuild = Expand_CountMexMarkersInArea('AREA_1') * 0.1* (expandmap + 1)
+ while not ScenarioInfo.MapAlreadyExpanded do
+ local curMexies = 0
+ for _, brain in ArmyBrains do
+ curMexies = curMexies + table.getn(ScenarioFramework.GetCatUnitsInArea(categories.MASSEXTRACTION, 'AREA_1', brain))
+ end
+ if curMexies > MexToBuild then
+ if not ScenarioInfo.MapAlreadyExpanded then
+ Expand_MapExpand()
+ end
+ break
+ end
+ WaitSeconds(5)
+ end
+ end
+end
+
+function Expand_MapExpand()
+ if ScenarioInfo.MapAlreadyExpanded == false then
+ ScenarioInfo.MapAlreadyExpanded = true
+ ScenarioFramework.SetPlayableArea('AREA_1' , false)
+ end
+end
+
+function Expand_CountMexMarkersInArea(area)
+ local rect = ScenarioUtils.AreaToRect(area)
+ local mexNum = 0
+ for markerName, markerTable in Scenario.MasterChain['_MASTERCHAIN_'].Markers do
+ if markerTable.type =='Mass' then
+ for m = 1, spawnedMexNumber do
+ if markerName == spawnedMassSpots[m] then
+ if ScenarioUtils.InRect(markerTable.position, rect) then
+ mexNum = mexNum + 1
+ end
+ end
+ end
+ end
+ end
+ return mexNum
+end
+
+function Expand_StartupCheck()
+--check if a player is outside of the starting area and expand the map in that case
+ ScenarioInfo.MapAlreadyExpanded = false
+ LOG("ULTIMATE Activate map expansion script. Setting = ", expandmap)
+
+ for m = 13, 14 do
+ armystring = "ARMY_" .. m
+ for _, army in ListArmies() do
+ if army == armystring then
+ LOG("ULTIMATE found player outside of playable region. Expand map")
+ Expand_MapExpand()
+ return false
+ end
+ end
+ end
+ if expandmap == 1 then
+ return false
+ end
+ if expandmap == 2 then
+ Expand_MapExpand()
+ return false
+ end
+ return true
+end
+
+
+
+
+
+
+------------------------------------------------------------------------
+----- Respawning trees--------------------------------------------------
+------------------------------------------------------------------------
+function Tree_StartGrowingTrees()
+ local SQRTnumberofareas = 1
+ if(ScenarioInfo.size[1]>300) then
+ SQRTnumberofareas = 4
+ elseif(ScenarioInfo.size[1]>600) then
+ SQRTnumberofareas = 8
+ elseif(ScenarioInfo.size[1]>1200) then
+ SQRTnumberofareas = 16
+ end
+ local m = 0
+ local firstIndex = 1
+ for i = 0, SQRTnumberofareas - 1 do
+ for j = 0, SQRTnumberofareas - 1 do
+ m = m + 1
+ local Tree_Area = {
+ ["x0"] = ScenarioInfo.size[1]/SQRTnumberofareas*i,
+ ["y0"] = ScenarioInfo.size[2]/SQRTnumberofareas*j,
+ ["x1"] = ScenarioInfo.size[1]/SQRTnumberofareas*(i+1),
+ ["y1"] = ScenarioInfo.size[2]/SQRTnumberofareas*(j+1),
+ }
+ local numberTreeInArea = Tree_InitializeTrees(Tree_Area, InitialListTrees, firstIndex)
+ if(numberTreeInArea > 0) then
+ ForkThread(Tree_RegrowTrees, InitialListTrees, m, firstIndex, firstIndex + numberTreeInArea - 1)
+ firstIndex = firstIndex + numberTreeInArea
+ end
+ end
+ end
+ LOG("ULTIMATE Tree script finished initialization, total number of trees = ", firstIndex)
+end
+
+function Tree_InitializeTrees(area, list, firstIndex)
+ local i = firstIndex
+ for _, r in GetReclaimablesInRect(area) or {} do
+ if (string.find(r:GetBlueprint().BlueprintId, "tree" )) then
+ local storethetree = { r:GetBlueprint().BlueprintId,
+ r:GetPosition()['x'],
+ r:GetPosition()['y'],
+ r:GetPosition()['z']
+ }
+ list[i] = storethetree
+ i = i + 1
+ end
+ end
+ LOG("ULTIMATE Trees initialized, number in this area = ", i - firstIndex)
+ return i - firstIndex
+end
+
+function Tree_RegrowTrees(listoftrees, m, firstIndex, lastIndex)
+ WaitSeconds(m + 10)
+ while( true ) do
+ Tree_NextCycle(listoftrees, firstIndex, lastIndex)
+ end
+end
+
+function Tree_NextCycle(listoftrees, firstIndex, lastIndex)
+ local numberToRespawn = 0
+ local RespawnOnNextCycle = {}
+ local MissingTrees = false
+ for i = firstIndex, lastIndex do
+ local respawnprop = Tree_CheckIfReclaimed(listoftrees[i])
+ if(respawnprop > 0) then
+ MissingTrees = true
+ if(math.random() < respawnprop/30/TreeRegrowSpeed) then
+ numberToRespawn = numberToRespawn + 1
+ RespawnOnNextCycle[numberToRespawn] = i
+ end
+ end
+ end
+ WaitSeconds(30)
+ if(not MissingTrees) then
+ WaitSeconds(110/TreeRegrowSpeed)
+ end
+ for i, _ in RespawnOnNextCycle or {} do
+ CreateProp( VECTOR3( listoftrees[RespawnOnNextCycle[i]][2],
+ listoftrees[RespawnOnNextCycle[i]][3],
+ listoftrees[RespawnOnNextCycle[i]][4] ),
+ listoftrees[RespawnOnNextCycle[i]][1])
+ end
+end
+
+function Tree_CheckIfReclaimed(tree)
+ local NumberOfCloseTrees = 0
+
+ local area1 = {
+ ["x0"] = tree[2] - 0.05,
+ ["y0"] = tree[4] - 0.05,
+ ["x1"] = tree[2] + 0.05,
+ ["y1"] = tree[4] + 0.05,
+ }
+ for _, t in GetReclaimablesInRect(area1) or {} do
+ if(string.find(t:GetBlueprint().BlueprintId, "tree" )) then
+ if(tree[2] == t:GetPosition()['x']) then
+ if(tree[4] == t:GetPosition()['z']) then
+ if(tree[1] == t:GetBlueprint().BlueprintId) then
+ return - 1
+ end
+ end
+ end
+ end
+ end
+
+ local area2 = {
+ ["x0"] = tree[2] - 1.5,
+ ["y0"] = tree[4] - 1.5,
+ ["x1"] = tree[2] + 1.5,
+ ["y1"] = tree[4] + 1.5,
+ }
+ for _, t in GetReclaimablesInRect(area2) or {} do
+ if(string.find(t:GetBlueprint().BlueprintId, "tree" )) then
+ NumberOfCloseTrees = NumberOfCloseTrees + 1
+ end
+ if(NumberOfCloseTrees > 20) then
+ return - 1
+ end
+ end
+ if NumberOfCloseTrees > 10 then
+ return 20- NumberOfCloseTrees
+ else
+ return NumberOfCloseTrees
+ end
+end
+
+
+
+------------------------------------------------------------------------
+------Faction dependent reclaim-----------------------------------------
+------------------------------------------------------------------------
+function AddFactionReclaimBack(optional_reclaim_back)
+ local SpawnReclaimArmy7 = false
+ local SpawnReclaimArmy8 = false
+ local armyTable = ListArmies()
+ for _, army in armyTable do
+ if( army == "ARMY_7") then
+ if(GetArmyBrain(army):GetFactionIndex() == 1 or GetArmyBrain(army):GetFactionIndex() == 2) then
+ SpawnReclaimArmy7 = true
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_UEF_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_UEF_3', true)
+ end
+ else
+ SpawnReclaimArmy7 = true
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_Cybran_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_Cybran_3', true)
+ end
+ end
+ end
+ if( army == "ARMY_8") then
+ if(GetArmyBrain(army):GetFactionIndex() == 1 or GetArmyBrain(army):GetFactionIndex() == 2) then
+ SpawnReclaimArmy8 = true
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_UEF_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_UEF_3', true)
+ end
+ else
+ SpawnReclaimArmy8 = true
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_Cybran_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_Cybran_3', true)
+ end
+ end
+ end
+ end
+ if(SpawnReclaimArmy8 and not SpawnReclaimArmy7) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_Cybran_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Top_Cybran_3', true)
+ end
+ elseif (not SpawnReclaimArmy8 and SpawnReclaimArmy7) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_UEF_2', true)
+ if(optional_reclaim_back == 3) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Back_Bot_UEF_3', true)
+ end
+ end
+end
diff --git a/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt.meta b/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt.meta
new file mode 100644
index 00000000..6fd203c1
--- /dev/null
+++ b/Assets/Scripts/Ozone SCMAP Code/Lua/AdaptiveScript.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2ade02f91319ce54487311f60f2e3c11
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Ozone SCMAP Code/Lua/ScenarioLua.cs b/Assets/Scripts/Ozone SCMAP Code/Lua/ScenarioLua.cs
index 2436a340..f35f15af 100644
--- a/Assets/Scripts/Ozone SCMAP Code/Lua/ScenarioLua.cs
+++ b/Assets/Scripts/Ozone SCMAP Code/Lua/ScenarioLua.cs
@@ -470,7 +470,8 @@ public void Save(string Path)
LuaFile.AddLine(LuaParser.Write.StringToLua(ScenarioInfo.KEY_PREVIEW, Data.preview));
LuaFile.AddLine(LuaParser.Write.FloatToLua(ScenarioInfo.KEY_MAPVERSION, Data.map_version));
- if(Data.AdaptiveMap)
+ Data.AdaptiveMap = MapLuaParser.Current.TablesLuaFile.IsLoaded;
+ if (Data.AdaptiveMap)
LuaFile.AddLine(LuaParser.Write.BoolToLua(ScenarioInfo.KEY_ADAPTIVEMAP, Data.AdaptiveMap));
LuaFile.AddLine(LuaParser.Write.StringToLua(ScenarioInfo.KEY_TYPE, Data.type));
LuaFile.AddLine(LuaParser.Write.BoolToLua(ScenarioInfo.KEY_STARTS, Data.starts));
diff --git a/Assets/Scripts/Ozone SCMAP Code/Lua/TablesLua.cs b/Assets/Scripts/Ozone SCMAP Code/Lua/TablesLua.cs
index 602dac26..3894d23c 100644
--- a/Assets/Scripts/Ozone SCMAP Code/Lua/TablesLua.cs
+++ b/Assets/Scripts/Ozone SCMAP Code/Lua/TablesLua.cs
@@ -72,6 +72,17 @@ public TableKey(string Key, bool OneDimension)
}
}
+ public TableKey(string Key, int count)
+ {
+ this.Key = Key;
+ this.OneDimension = false;
+ IsHydro = Key.ToLower().Contains("hydro");
+
+ Values = new MexArray[count];
+ for(int i = 0; i < count; i++)
+ Values[i] = new MexArray(new string[i]);
+ }
+
}
#endregion
@@ -287,10 +298,31 @@ public bool Load(string FolderName, string ScenarioFileName, string FolderParent
#endregion
+ public void CreateDefault()
+ {
+ Data.AllTables = new List();
+
+ Data.AllTables.Add(new TableKey("spwnAdditionalHydro", true));
+
+ Data.AllTables.Add(new TableKey("middlemass", 2));
+ Data.AllTables.Add(new TableKey("sidemass", 2));
+ Data.AllTables.Add(new TableKey("underwatermass", 2));
+ Data.AllTables.Add(new TableKey("islandmass", 2));
+ Data.AllTables.Add(new TableKey("backmass", 2));
+
+ Data.AllTables.Add(new TableKey("crazyrushOneMex", true));
+ Data.AllTables.Add(new TableKey("extramass", true));
+ Data.AllTables.Add(new TableKey("DuplicateListMex", true));
+
+ IsLoaded = true;
+ }
#region Save
public void Save(string Path)
{
+ if (!IsLoaded)
+ return;
+
ScenarioLua.ScenarioInfo ScenarioData = MapLuaParser.Current.ScenarioLuaFile.Data;
SaveLua.Marker[] AllMarkers = MarkersControler.GetMarkers();
diff --git a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs
index b30210de..93263229 100644
--- a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs
+++ b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser.cs
@@ -23,6 +23,7 @@ public partial class MapLuaParser : MonoBehaviour
public TextAsset SaveLuaHeader;
public TextAsset SaveLuaFooter;
public TextAsset DefaultScript;
+ public TextAsset AdaptiveScript;
#region Variables
[Header("Core")]
@@ -118,7 +119,7 @@ public void ResetUI()
#region Loading
- public IEnumerator ForceLoadMapAtPath(string path)
+ public IEnumerator ForceLoadMapAtPath(string path, bool Props, bool Decals)
{
path = path.Replace("\\", "/");
Debug.Log("Load from: " + path);
@@ -126,6 +127,11 @@ public IEnumerator ForceLoadMapAtPath(string path)
char[] NameSeparator = ("/").ToCharArray();
string[] Names = path.Split(NameSeparator);
+ FolderParentPath = "";
+
+ for (int i = 0; i < Names.Length - 2; i++)
+ FolderParentPath += Names[i] + "/";
+
FolderName = Names[Names.Length - 2];
ScenarioFileName = Names[Names.Length - 1].Replace(".lua", "");
//string NewMapPath = path.Replace(FolderName + "/" + ScenarioFileName + ".lua", "");
@@ -138,7 +144,9 @@ public IEnumerator ForceLoadMapAtPath(string path)
//PlayerPrefs.SetString("MapsPath", NewMapPath);
loadSave = false;
- LoadProps = false;
+ LoadProps = Props;
+ LoadDecals = Decals;
+
var LoadFile = StartCoroutine("LoadingFile");
yield return LoadFile;
@@ -391,23 +399,9 @@ public IEnumerator SaveMapProcess()
while (DecalsControler.IsUpdating)
yield return null;
- string BackupId = System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
-
- BackupPath = EnvPaths.GetBackupPath();
- if (string.IsNullOrEmpty(BackupPath))
- {
- BackupPath = Application.dataPath + "/MapsBackup/";
-#if UNITY_EDITOR
- BackupPath = BackupPath.Replace("Assets/", "");
-#endif
- //BackupPath = FolderParentPath;
- }
-
- BackupPath += FolderName + "/Backup_" + BackupId;
+ GenerateBackupPath();
- if (BackupFiles && !System.IO.Directory.Exists(BackupPath))
- System.IO.Directory.CreateDirectory(BackupPath);
yield return null;
// Scenario.lua
@@ -437,7 +431,7 @@ public IEnumerator SaveMapProcess()
string TablesFilePath = LoadedMapFolderPath + ScenarioFileName + ".lua";
TablesFilePath = TablesLua.ScenarioToTableFileName(TablesFilePath);
- Debug.Log(TablesFilePath);
+ //Debug.Log(TablesFilePath);
if (BackupFiles && System.IO.File.Exists(TablesFilePath))
System.IO.File.Move(TablesFilePath, TablesLua.ScenarioToTableFileName(BackupPath + "/" + ScenarioFileName + ".lua"));
TablesLuaFile.Save(TablesFilePath);
@@ -447,6 +441,26 @@ public IEnumerator SaveMapProcess()
SavingMapProcess = false;
}
+ void GenerateBackupPath()
+ {
+ string BackupId = System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
+
+ BackupPath = EnvPaths.GetBackupPath();
+ if (string.IsNullOrEmpty(BackupPath))
+ {
+ BackupPath = Application.dataPath + "/MapsBackup/";
+#if UNITY_EDITOR
+ BackupPath = BackupPath.Replace("Assets/", "");
+#endif
+ //BackupPath = FolderParentPath;
+ }
+
+ BackupPath += FolderName + "/Backup_" + BackupId;
+
+ if (BackupFiles && !System.IO.Directory.Exists(BackupPath))
+ System.IO.Directory.CreateDirectory(BackupPath);
+ }
+
public void SaveScmap()
{
@@ -464,23 +478,28 @@ public void SaveScmap()
}
- public void SaveScriptLua(int ID = 0)
+ public void SaveScriptLua(int ID = 0, bool NewBackup = false)
{
- string SaveData = DefaultScript.text;
+ string SaveData = "";
- /*
- string loadedFile = "";
+ switch (ID)
+ {
+ case 1:
+ string TablesFilePath = FolderName + "/" + ScenarioFileName + ".lua\"";
+ TablesFilePath = TablesLua.ScenarioToTableFileName(TablesFilePath);
- System.Text.Encoding encodeType = System.Text.Encoding.ASCII;
- string loc = "";
- if(ID == 0) return;
- else if(ID == 1) loc = StructurePath + "script_structure1.lua";
- else if(ID == 2) loc = StructurePath + "script_structure2.lua";
+ SaveData = AdaptiveScript.text.Replace("[**TablesPath**]", "\"/maps/" + TablesFilePath);
- loadedFile = System.IO.File.ReadAllText(loc, encodeType);
+ break;
+ default:
+ SaveData = DefaultScript.text;
+ break;
+ }
- SaveData = loadedFile;
- */
+ if (NewBackup)
+ {
+ GenerateBackupPath();
+ }
string SaveFilePath = MapRelativePath(ScenarioLuaFile.Data.script);
@@ -488,12 +507,17 @@ public void SaveScriptLua(int ID = 0)
char[] NameSeparator = ("/").ToCharArray();
string[] Names = FileName.Split(NameSeparator);
- if (System.IO.File.Exists(SaveFilePath))
+ Debug.Log(SaveFilePath);
+ Debug.Log(BackupPath + "/" + Names[Names.Length - 1]);
+
+ if (BackupFiles && System.IO.File.Exists(SaveFilePath))
System.IO.File.Move(SaveFilePath, BackupPath + "/" + Names[Names.Length - 1]);
System.IO.File.WriteAllText(SaveFilePath, SaveData);
}
+
+
#endregion
diff --git a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser_App.cs b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser_App.cs
index 0a23652e..df52ccfa 100644
--- a/Assets/Scripts/Ozone SCMAP Code/MapLuaParser_App.cs
+++ b/Assets/Scripts/Ozone SCMAP Code/MapLuaParser_App.cs
@@ -5,10 +5,15 @@
public partial class MapLuaParser : MonoBehaviour
{
- static int More = 1;
static string[] Args;
void Start () {
Args = System.Environment.GetCommandLineArgs();
+
+ for(int i = 0; i < Args.Length; i++)
+ {
+ Debug.Log(Args[i]);
+ }
+
if (Args.Length > 0)
if (Args.Length == 3 && Args[1] == "-setInstalationPath")
@@ -18,32 +23,52 @@ void Start () {
}
- if (Args.Length == 6 + More && Args[1 + More] == "-renderPreviewImage")
+ Debug.Log(Args.Length);
+ Debug.Log(Args[0]);
+ if (Args.Length >= 6)
{
- GetGamedataFile.MipmapBias = -0.9f;
- StartCoroutine("RenderImageAndClose");
+ if (Args[1] == "-renderPreviewImage" || Args[1] == "-renderPreviewImageNoProps" || Args[1] == "-renderPreviewImageNoDecals" || Args[1] == "-renderPreviewImageNoPropsDecals")
+ {
+
+ GetGamedataFile.MipmapBias = -0.9f;
+
+ bool Props = Args[1] == "-renderPreviewImage" || Args[1] == "-renderPreviewImageNoDecals";
+ bool Decals = Args[1] == "-renderPreviewImage" || Args[1] == "-renderPreviewImageNoProps";
+
+ int Widht = int.Parse(Args[2]);
+ int Height = int.Parse(Args[3]);
+ Debug.Log("Begin coroutine");
+ StartCoroutine(RenderImageAndClose(Props, Decals, Widht, Height, Args[4], Args[5]));
+ }
}
}
- public IEnumerator RenderImageAndClose()
+ public IEnumerator RenderImageAndClose(bool Props, bool Decals, int Width, int Height, string MapPath, string ImagePath)
{
- var LoadScmapFile = MapLuaParser.Current.StartCoroutine("ForceLoadMapAtPath", Args[4 + More]);
+ var LoadScmapFile = MapLuaParser.Current.StartCoroutine(ForceLoadMapAtPath(MapPath, Props, Decals));
yield return LoadScmapFile;
+ QualitySettings.lodBias = 100000;
+ QualitySettings.shadowDistance = CameraControler.Current.transform.localPosition.y * 1.1f;
+
+ if (Decals)
+ {
+ OzoneDecals.OzoneDecalRenderer.CutoffMultiplier = 100000;
- int Widht = int.Parse(Args[2 + More]);
- int Height = int.Parse(Args[3 + More]);
- CameraControler.Current.RestartCam();
+ }
- CameraControler.Current.RenderCamera(Widht, Height, Args[5 + More]);
+ CameraControler.Current.RestartCam(true);
+ yield return null;
+ CameraControler.Current.RenderCamera(Width, Height, ImagePath);
+ //ScmapEditor.Current.PreviewRenderer.RenderPreview()
- Debug.Log("Success! Preview rendered to: " + Args[5 + More]);
+ Debug.Log("Success! Preview rendered to: " + ImagePath);
- Application.Quit();
+ OnFafEditorQuit.ForceQuit();
}
}
diff --git a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs
index dc9617d2..798eafaf 100644
--- a/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs
+++ b/Assets/Scripts/Ozone SCMAP Code/Texture/PreviewTex.cs
@@ -8,7 +8,7 @@ public class PreviewTex : MonoBehaviour {
public RenderTexture RT;
public Color Empty;
- public Texture2D RenderPreview(float HeightOffset = 0) {
+ public Texture2D RenderPreview(float HeightOffset = 0, int Width = 256, int Height = 256, bool Flip = true) {
bool Slope = ScmapEditor.Current.Slope;
bool Grid = ScmapEditor.Current.Grid;
@@ -37,9 +37,9 @@ public Texture2D RenderPreview(float HeightOffset = 0) {
Cam.Render();
QualitySettings.lodBias = LastLodBias;
- Texture2D PreviewRender = new Texture2D(256, 256, TextureFormat.RGBA32, false);
+ Texture2D PreviewRender = new Texture2D(Width, Height, TextureFormat.RGBA32, false);
- Color[] Colors = new Color[256 * 256];
+ Color[] Colors = new Color[Width * Height];
for(int i = 0; i < Colors.Length; i++)
{
Colors[i] = Empty;
@@ -49,13 +49,6 @@ public Texture2D RenderPreview(float HeightOffset = 0) {
PreviewRender.ReadPixels(new Rect(0, 0, PreviewRender.width, PreviewRender.height), 0, 0, false);
PreviewRender.Apply();
- //Texture2D Preview = TextureLoader.ConvertToBGRA(PreviewRender);
- //Graphics.ConvertTexture(PreviewRender, Preview);
-
- //Preview = TextureFlip.FlipTextureVertical(Preview, false);
- //Preview.Compress(true);
- //Preview.Apply();
-
RenderTexture.active = currentActiveRT;
if(Slope)
@@ -63,7 +56,11 @@ public Texture2D RenderPreview(float HeightOffset = 0) {
if(Grid)
ScmapEditor.Current.ToogleGrid(Grid);
- return TextureFlip.FlipTextureVertical(PreviewRender, false);
+
+ if (Flip)
+ return TextureFlip.FlipTextureVertical(PreviewRender, false);
+ else
+ return PreviewRender;
}
diff --git a/Assets/Scripts/UI/Tools/Markers/AdaptiveInfo.cs b/Assets/Scripts/UI/Tools/Markers/AdaptiveInfo.cs
index 60222394..593f96b6 100644
--- a/Assets/Scripts/UI/Tools/Markers/AdaptiveInfo.cs
+++ b/Assets/Scripts/UI/Tools/Markers/AdaptiveInfo.cs
@@ -403,12 +403,17 @@ public void CreateTablesFile()
void ReplaceScript()
{
-
+ MapLuaParser.Current.SaveScriptLua(1, true);
+ NoScript();
}
void NoScript()
{
+ if (MapLuaParser.Current.TablesLuaFile.IsLoaded)
+ return;
+ MapLuaParser.Current.TablesLuaFile.CreateDefault();
+ OnEnable();
}
void Cancel()
diff --git a/Assets/Scripts/UI/Windows/NewMap.cs b/Assets/Scripts/UI/Windows/NewMap.cs
index f988b112..916380a9 100644
--- a/Assets/Scripts/UI/Windows/NewMap.cs
+++ b/Assets/Scripts/UI/Windows/NewMap.cs
@@ -191,7 +191,7 @@ public void CreateMap()
MapLuaParser.Current.SaveMap(false);
- MapLuaParser.Current.SaveScriptLua(1);
+ MapLuaParser.Current.SaveScriptLua(0);
Debug.Log(FolderName);
MapLuaParser.Current.LoadFile();
Debug.Log(FolderName);
diff --git a/Assets/Scripts/UI/Windows/OnFafEditorQuit.cs b/Assets/Scripts/UI/Windows/OnFafEditorQuit.cs
index 983f34ab..e8d327a8 100644
--- a/Assets/Scripts/UI/Windows/OnFafEditorQuit.cs
+++ b/Assets/Scripts/UI/Windows/OnFafEditorQuit.cs
@@ -28,7 +28,8 @@ void WaitForSavingDone()
if (!MapLuaParser.SavingMapProcess)
{
CancelInvoke();
- Application.Quit();
+ //Application.Quit();
+ ForceQuit();
}
}
@@ -36,7 +37,8 @@ public void PressNo()
{
AllowQuit = true;
Popup.SetActive(false);
- Application.Quit();
+ //Application.Quit();
+ ForceQuit();
}
public void PressCancel()
@@ -44,8 +46,18 @@ public void PressCancel()
Popup.SetActive(false);
}
+ static bool QuitForced = false;
+ public static void ForceQuit()
+ {
+ QuitForced = true;
+ Application.Quit();
+ }
+
static bool WantsToQuit()
{
+ if (QuitForced)
+ return true;
+
if (Current == null)
return true;
diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset
index 68895ee5..4051a601 100644
--- a/ProjectSettings/GraphicsSettings.asset
+++ b/ProjectSettings/GraphicsSettings.asset
@@ -97,7 +97,7 @@ GraphicsSettings:
enableLPPV: 0
useDitherMaskForAlphaBlendedShadows: 1
m_Automatic: 0
- m_LightmapStripping: 0
+ m_LightmapStripping: 1
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 0
diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset
index 1a40f793..db693306 100644
--- a/ProjectSettings/ProjectSettings.asset
+++ b/ProjectSettings/ProjectSettings.asset
@@ -674,7 +674,7 @@ PlayerSettings:
Android: 0
Metro: 1
PS4: 0
- Standalone: 1
+ Standalone: 0
WP8: 2
WebGL: 1
iOS: 1
diff --git a/Structure/AdaptiveMap/steps_for_dynamic_map.txt b/Structure/AdaptiveMap/README.md
similarity index 97%
rename from Structure/AdaptiveMap/steps_for_dynamic_map.txt
rename to Structure/AdaptiveMap/README.md
index 05036f5c..3e266b76 100644
--- a/Structure/AdaptiveMap/steps_for_dynamic_map.txt
+++ b/Structure/AdaptiveMap/README.md
@@ -1,3 +1,5 @@
+# Ultimate-Maps-forged-alliance
+
1) finish your map (hightmap, decals, mex positions,...)
2) download the latest version of the script
@@ -46,4 +48,4 @@
you can still change the map and add decals or even change the hightmap
-if you add mexes and remove some, dont forget to adjust the table!
\ No newline at end of file
+if you add mexes and remove some, dont forget to adjust the table!
diff --git a/Structure/AdaptiveMap/mapname_script.lua b/Structure/AdaptiveMap/mapname_script.lua
index d53ceabe..1a053c58 100644
--- a/Structure/AdaptiveMap/mapname_script.lua
+++ b/Structure/AdaptiveMap/mapname_script.lua
@@ -20,7 +20,6 @@ local mirrormex = ScenarioInfo.Options.mirrormex or 1
local optional_civilian_base = ScenarioInfo.Options.optional_civilian_base or 1
local dupicatesinglemex = ScenarioInfo.Options.dupicatesinglemex or 1
local additionalmex = ScenarioInfo.Options.additionalmex or 1
---local removeRock = ScenarioInfo.Options.removeRock or 1
--stuff for the crazyrush script
local currentResSpot = 0
@@ -40,10 +39,43 @@ math.randomseed(1)
+
+function OnPopulate()
------------------------------------------------------------------------
------ Initialization part ----------------------------------------------
+----- special options (civilians, reclaim...) --------------------------
------------------------------------------------------------------------
-function OnPopulate()
+
+ if ((optional_reclaim == 2) or (optional_reclaim == 3)) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_' .. optional_reclaim, true)
+ elseif (optional_reclaim == 4) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_2', true)
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_3', true)
+ end
+ if optional_reclaim_middle > 1 then
+ for midreclaim = 2, optional_reclaim_middle do
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Middle_'..midreclaim, true)
+ end
+ end
+ if(optional_reclaim_adaptive > 1) then
+ AddFactionReclaimBack(optional_reclaim_adaptive)
+ end
+ if(optional_civilian_base > 1) then
+ local spawncivs = true
+ for m = 13, 14 do
+ armystring = "ARMY_" .. m
+ for _, army in ListArmies() do
+ if( army == armystring) then
+ LOG("ULTIMATE found player in civ base. remove civs")
+ spawncivs = false
+ end
+ end
+ end
+ if(spawncivs) then
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Base', false)
+ ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Defences_'.. optional_civilian_base, false)
+ end
+ end
+
ScenarioUtils.InitializeArmies();
end
@@ -113,46 +145,6 @@ function ScenarioUtils.CreateResources()
-- get map markers
local markers = ScenarioUtils.GetMarkers();
-
-
-
-
-
-------------------------------------------------------------------------
------ special options (civilians, reclaim...) --------------------------
-------------------------------------------------------------------------
-
- if ((optional_reclaim == 2) or (optional_reclaim == 3)) then
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_' .. optional_reclaim, true)
- elseif (optional_reclaim == 4) then
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_2', true)
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_3', true)
- end
- if optional_reclaim_middle > 1 then
- for midreclaim = 2, optional_reclaim_middle do
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Wreckage_Middle_'..midreclaim, true)
- end
- end
- if(optional_reclaim_adaptive > 1) then
- AddFactionReclaimBack(optional_reclaim_adaptive)
- end
- if(optional_civilian_base > 1) then
- local spawncivs = true
- for m = 13, 14 do
- armystring = "ARMY_" .. m
- for _, army in ListArmies() do
- if( army == armystring) then
- LOG("ULTIMATE found player in civ base. remove civs")
- spawncivs = false
- end
- end
- end
- if(spawncivs) then
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Base', false)
- ScenarioUtils.CreateArmyGroup('ARMY_17', 'Optional_Civilian_Defences_'.. optional_civilian_base, false)
- end
- end
-
-- table of which ressources belong to which player, it is sorted in such a way that the first line
-- corresponds to player one, the second to player 2 and so on... load it from the _tables.lua file
@@ -332,7 +324,7 @@ function spawnressource(Position,restype, spawnhpr)
lod, -- LOD
0, -- Duration (0 == does not expire)
-1, -- army (-1 == not owned by any single army)
- 0 -- ???
+ 0 -- fidelity
);
CreateResourceDeposit(restype, Position[1], Position[2], Position[3], Size/2);
if spawnhpr then
@@ -610,17 +602,17 @@ function Expand_StartupCheck()
for m = 13, 14 do
armystring = "ARMY_" .. m
for _, army in ListArmies() do
- if( army == armystring) then
- Expand_MapExpand()
+ if army == armystring then
LOG("ULTIMATE found player outside of playable region. Expand map")
+ Expand_MapExpand()
return false
end
end
end
- if(expandmap == 1) then
+ if expandmap == 1 then
return false
end
- if(expandmap == 2) then
+ if expandmap == 2 then
Expand_MapExpand()
return false
end
@@ -810,21 +802,3 @@ function AddFactionReclaimBack(optional_reclaim_back)
end
end
end
-
-
-
---[[
-------------------------------------------------------------------------
-------remove some of the rock reclaim-----------------------------------
-------------------------------------------------------------------------
-function Rock_RemoveRocks(percentage)
- LOG('remove ', 1 - percentage, ' percent of the rock reclaim')
- local totalProps = GetReclaimablesInRect(Rect(unpack(ScenarioInfo.PlayableArea)))
- for _ , r in totalProps or {} do
- local propid = r:GetBlueprint().BlueprintId
- if(string.find(propid, 'rock' ) or string.find(propid, 'iceberg') or string.find(propid, 'boulder') or string.find(propid, 'fieldstone' )) then
- r:AdjustHealth(r, -(r:GetHealth())*(1-percentage))
- --r:SetMaxReclaimValues( percentage * (r:GetBlueprint().Economy.ReclaimTime), percentage * (r:GetBlueprint().Economy.ReclaimMassMax), percentage * (r:GetBlueprint().Economy.ReclaimEnergyMax))
- end
- end
-end]]--
\ No newline at end of file