Compare commits
No commits in common. "main" and "2.0.0" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -478,3 +478,4 @@ dkms.conf
|
||||
|
||||
/project/SamSWAT.TimeWeatherChanger/Key.snk
|
||||
/project/Shared/Keys
|
||||
/project/SamSWAT.TimeWeatherChanger/SamSWAT.TimeWeatherChanger.sln
|
||||
|
26
README.md
26
README.md
@ -2,27 +2,25 @@
|
||||
|
||||
Change the weather and time with GUI-based mod
|
||||
|
||||
## Controls
|
||||
### Controls
|
||||
|
||||
In order to open panel, press keypad "Home" by default or open game console with tilde(~) and write "twc"
|
||||
In order to open panel, press keypad "Home" or open game console with ` and write "twc"
|
||||
|
||||
You can change the key in the game menu, to open it, press F12 on your keyboard and expand SamSWAT.TimeWeatherChanger section. Press on the `Time Weather Panel Toggle Key` option and choose the key you like. If you launched the game with this mod at least once, you can find `com.samswat.timeweatherchanger.cfg` file in the `BepInEx/config/` and change keybind here too.
|
||||
|
||||
## How to install
|
||||
### How to install
|
||||
|
||||
1. Download the latest release here: [link](https://dev.sp-tarkov.com/SamSWAT/TimeWeatherChanger/releases) -OR- build from source (instructions below)
|
||||
2. Extract the zip file `SamSWAT.TimeWeatherChanger` into your root SPT-AKI directory near `EscapeFromTarkov.exe`.
|
||||
3. Inside `BepInEx/plugins` folder you should see `SamSWAT.TimeWeatherChanger.dll`
|
||||
2. Simply drop the folder `SamSWAT-TWChanger` into your SPT-AKI `user/mods/` directory.
|
||||
|
||||
## Preview
|
||||
### Preview
|
||||
|
||||

|
||||
|
||||
## How to build from source
|
||||
### How to build from source
|
||||
|
||||
1. Download/clone this repository
|
||||
2. VS2019 > File > Open solution > `SamSWAT.TimeWeatherChanger.sln`
|
||||
3. VS2019 > Build > Rebuild solution
|
||||
4. `SamSWAT.TimeWeatherChanger.dll` should appear in `bin\Debug` directory
|
||||
5. Copy the .dll into the `BepInEx/plugins` folder
|
||||
6. That's it, you have a working release of this mod.
|
||||
2. Download/clone the `SPT-AKI/Modules` repository: [link](https://dev.sp-tarkov.com/SPT-AKI/Modules)
|
||||
3. Move the contents of the `project` folder over to the SPT-AKI Modules `project` folder
|
||||
4. Add the `SamSWAT.TimeWeatherChanger` project to the SPT-AKI Modules solution
|
||||
5. Build modules - `SamSWAT.TimeWeatherChanger.dll` should appear under `Build/EscapeFromTarkov_Data/Managed` in the SPT-AKI Modules directory
|
||||
6. Copy the .dll into the `mod/SamSWAT-TWChanger` folder and rename to `module.dll`
|
||||
7. That's it, you have a working release of this mod! Follow the `How to install` instructions on how to get the mod into your game
|
4
mod/SamSWAT-TWChanger/config.ini
Normal file
4
mod/SamSWAT-TWChanger/config.ini
Normal file
@ -0,0 +1,4 @@
|
||||
[Config]
|
||||
PanelToggleKey=Home
|
||||
|
||||
#list of available keys you can find at: https://docs.unity3d.com/ScriptReference/KeyCode.html
|
8
mod/SamSWAT-TWChanger/package.json
Normal file
8
mod/SamSWAT-TWChanger/package.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "time_weather_changer",
|
||||
"author": "SamSWAT",
|
||||
"version": "1.0.0",
|
||||
"license": "CC BY-NC 4.0",
|
||||
"akiVersion": "2.1.2"
|
||||
}
|
||||
|
15
project/SamSWAT.TimeWeatherChanger/Program.cs
Normal file
15
project/SamSWAT.TimeWeatherChanger/Program.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SamSWAT.TimeWeatherChanger
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static GameObject Hook;
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Hook = new GameObject();
|
||||
Hook.AddComponent<TimeWeatherController>();
|
||||
Object.DontDestroyOnLoad(Hook);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -37,48 +37,30 @@
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>References\0Harmony.dll</HintPath>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\Shared\References\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Reflection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>References\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="bsg.console.core">
|
||||
<HintPath>References\bsg.console.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\Comfort.dll</HintPath>
|
||||
<Reference Include="Comfort">
|
||||
<HintPath>..\Shared\References\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>References\UnityEngine.dll</HintPath>
|
||||
<HintPath>..\Shared\References\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>References\UnityEngine.CoreModule.dll</HintPath>
|
||||
<HintPath>..\Shared\References\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>.\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>..\Shared\References\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TimeWeatherPlugin.cs" />
|
||||
<Compile Include="TimeWeatherController.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils\CursorSettings.cs" />
|
||||
<Compile Include="Utils\Notifier.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
|
@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31624.102
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamSWAT.TimeWeatherChanger", "SamSWAT.TimeWeatherChanger.csproj", "{70E8207D-4F1B-4E86-A452-DC86C86C377C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70E8207D-4F1B-4E86-A452-DC86C86C377C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{70E8207D-4F1B-4E86-A452-DC86C86C377C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{70E8207D-4F1B-4E86-A452-DC86C86C377C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{70E8207D-4F1B-4E86-A452-DC86C86C377C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8C1D0B00-ADE4-49B9-835A-90AD4AC60B9A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
566
project/SamSWAT.TimeWeatherChanger/TimeWeatherController.cs
Normal file
566
project/SamSWAT.TimeWeatherChanger/TimeWeatherController.cs
Normal file
@ -0,0 +1,566 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EFT;
|
||||
using EFT.UI;
|
||||
using EFT.Communications;
|
||||
using EFT.Weather;
|
||||
using Comfort.Common;
|
||||
using RegexCMD = GClass2296;
|
||||
using GameDateTime = GClass1258;
|
||||
using Notifier = GClass1691;
|
||||
using CursorSettings = GClass2299;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace SamSWAT.TimeWeatherChanger
|
||||
{
|
||||
public class TimeWeatherController : MonoBehaviour
|
||||
{
|
||||
private static GameObject input;
|
||||
private static WeatherController weatherController;
|
||||
private static GameWorld gameWorld;
|
||||
private static GameDateTime gameDateTime;
|
||||
private static DateTime modifiedDateTime;
|
||||
private static DateTime currentDateTime;
|
||||
private static Rect windowRect = new Rect(50, 50, 460, 365);
|
||||
private static bool GUIStatus = false;
|
||||
private static bool weatherdebug = false;
|
||||
|
||||
private static float _clouddensity;
|
||||
private static float _fog;
|
||||
private static float _rain;
|
||||
private static float _lightningthunderprobability;
|
||||
private static float _temperature;
|
||||
private static float _windmagnitude;
|
||||
private static int _direction = 2;
|
||||
private static int topwinddirection = 2;
|
||||
private static WeatherDebug.Direction _winddirection;
|
||||
private static Vector2 _topwinddirection;
|
||||
|
||||
private static string weatherdebugtex;
|
||||
private static int targetTimeHours;
|
||||
private static int targetTimeMinutes;
|
||||
|
||||
private static KeyCode ToggleKey = KeyCode.Home;
|
||||
private static Dictionary<string, string> ini;
|
||||
|
||||
private static string modfolder = Path.Combine(Directory.GetParent(Application.dataPath).ToString(), "user/mods/SamSWAT-TWChanger");
|
||||
private static string configpath = Path.Combine(modfolder, "config.ini");
|
||||
|
||||
void Start()
|
||||
{
|
||||
Debug.LogError("SamSWAT - Time and Weather Changer loaded");
|
||||
|
||||
//Duplicate functionality of toggle key
|
||||
ConsoleScreen.Commands.AddCommand(new RegexCMD("twc", match =>
|
||||
{
|
||||
gameWorld = Singleton<GameWorld>.Instance;
|
||||
if (gameWorld == null)
|
||||
{
|
||||
string log = "In order to change the weather, you have to go in a raid first.";
|
||||
Notifier.DisplayWarningNotification(log, ENotificationDurationType.Long);
|
||||
PreloaderUI.Instance.Console.AddLog(" " + log, "[TWChanger]:");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameObject.Find("Weather") == null)
|
||||
{
|
||||
string log = "An error occurred when executing command, seems like you are either in the hideout or factory.";
|
||||
Notifier.DisplayWarningNotification(log);
|
||||
PreloaderUI.Instance.Console.AddLog(" " + log, "[TWChanger]:");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
input = GameObject.Find("___Input");
|
||||
}
|
||||
gameDateTime = gameWorld.GameDateTime;
|
||||
GUIStatus = !GUIStatus;
|
||||
Cursor.visible = GUIStatus;
|
||||
if (GUIStatus)
|
||||
{
|
||||
CursorSettings.SetCursor(ECursorType.Idle);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuContextMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorSettings.SetCursor(ECursorType.Invisible);
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuDropdown);
|
||||
}
|
||||
input.SetActive(!GUIStatus);
|
||||
PreloaderUI.Instance.Console.AddLog(" Switching control panel...", "[TWChanger]:");
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
//Load config
|
||||
StartCoroutine(PreloaderUIWaiter());
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(ToggleKey))
|
||||
{
|
||||
//Obtaining current GameWorld for later time change
|
||||
gameWorld = Singleton<GameWorld>.Instance;
|
||||
//If GameWorld is null, it means that player currently is not in the raid. We notify the player with an error screen that he first needs to go in a raid
|
||||
if (gameWorld == null)
|
||||
{
|
||||
if (GameObject.Find("ErrorScreen"))
|
||||
PreloaderUI.Instance.CloseErrorScreen();
|
||||
PreloaderUI.Instance.ShowErrorScreen("Time & Weather Changer Error", "In order to change the weather, you have to go in a raid first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Looking for the weather GameObject to which the WeatherController script is attached. If it's null, means that the player is either in a hideout or factory where dynamic weather and time are not available
|
||||
if (GameObject.Find("Weather") == null)
|
||||
{
|
||||
//Notify player with bottom-right error popup
|
||||
Notifier.DisplayWarningNotification("An error occurred when opening weather panel, seems like you are either in the hideout or factory.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Caching input manager GameObject which script is responsible for reading the player inputs
|
||||
if (input == null)
|
||||
{
|
||||
input = GameObject.Find("___Input");
|
||||
}
|
||||
//Getting class responsible for time in the current world for later use
|
||||
gameDateTime = gameWorld.GameDateTime;
|
||||
GUIStatus = !GUIStatus;
|
||||
Cursor.visible = GUIStatus;
|
||||
if (GUIStatus)
|
||||
{
|
||||
//Changing the default windows cursor to an EFT-style one and playing a sound when the menu appears
|
||||
CursorSettings.SetCursor(ECursorType.Idle);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuContextMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Hiding cursor and playing a sound when the menu disappears
|
||||
CursorSettings.SetCursor(ECursorType.Invisible);
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuDropdown);
|
||||
}
|
||||
//Disabling the input manager so the player won't move
|
||||
input.SetActive(!GUIStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void OnGUI()
|
||||
{
|
||||
if (GUIStatus)
|
||||
windowRect = GUI.Window(0, windowRect, WindowFunction, "Time & Weather Changer by SamSWAT v1.0");
|
||||
}
|
||||
void WindowFunction(int windowID)
|
||||
{
|
||||
if (weatherdebug)
|
||||
weatherdebugtex = "ON";
|
||||
else
|
||||
weatherdebugtex = "OFF";
|
||||
|
||||
//Caching WeatherController script for the first time
|
||||
if (weatherController == null)
|
||||
{
|
||||
weatherController = GameObject.Find("Weather").GetComponent<WeatherController>();
|
||||
}
|
||||
|
||||
//Shit ton of different sliders and buttons
|
||||
|
||||
GUI.DragWindow(new Rect(0, 0, 10000, 20));
|
||||
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUI.Box(new Rect(15, 23, 140, 60), "");
|
||||
weatherdebug = GUI.Toggle(new Rect(33, 37, 110, 25), weatherdebug, "Weather debug");
|
||||
GUI.Label(new Rect(74, 52, 110, 25), weatherdebugtex);
|
||||
|
||||
currentDateTime = gameDateTime.Calculate();
|
||||
GUI.Box(new Rect(160, 23, 285, 60), "Current time: " + currentDateTime.ToString("HH:mm:ss"));
|
||||
|
||||
GUI.Label(new Rect(190, 42, 40, 20), "Hours");
|
||||
targetTimeHours = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(165, 60, 80, 15), targetTimeHours, 0, 23));
|
||||
GUI.TextField(new Rect(248, 50, 20, 20), targetTimeHours.ToString());
|
||||
|
||||
GUI.Label(new Rect(295, 42, 50, 20), "Minutes");
|
||||
targetTimeMinutes = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(272, 60, 90, 15), targetTimeMinutes, 0, 59));
|
||||
GUI.TextField(new Rect(365, 50, 20, 20), targetTimeMinutes.ToString());
|
||||
|
||||
if (GUI.Button(new Rect(390, 40, 50, 30), "Set"))
|
||||
{
|
||||
modifiedDateTime = currentDateTime.AddHours((double)targetTimeHours - currentDateTime.Hour);
|
||||
modifiedDateTime = modifiedDateTime.AddMinutes((double)targetTimeMinutes - currentDateTime.Minute);
|
||||
gameDateTime.Reset(modifiedDateTime);
|
||||
Notifier.DisplayMessageNotification("Time was set to: " + modifiedDateTime.ToString("HH:mm"));
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuInspectorWindowClose);
|
||||
}
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(15, 100, 140, 250));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Cloud Density: " + Math.Round(_clouddensity * 1000) / 1000);
|
||||
_clouddensity = GUILayout.HorizontalSlider(_clouddensity, -1f, 1f);
|
||||
|
||||
GUILayout.Box("Wind Magnitude: " + Math.Round(_windmagnitude * 100) / 100);
|
||||
_windmagnitude = GUILayout.HorizontalSlider(_windmagnitude, 0f, 1f);
|
||||
|
||||
GUILayout.Box("Wind Direction: " + _winddirection.ToString());
|
||||
_direction = Mathf.RoundToInt(GUILayout.HorizontalSlider(_direction, 1, 8));
|
||||
_winddirection = (WeatherDebug.Direction)_direction;
|
||||
|
||||
if (GUILayout.Button("Clear"))
|
||||
{
|
||||
_clouddensity = -0.7f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Clear Wind"))
|
||||
{
|
||||
_clouddensity = -0.7f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0.4f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Clear Fog"))
|
||||
{
|
||||
_clouddensity = -0.4f;
|
||||
_fog = 0.02f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Partly Cloud"))
|
||||
{
|
||||
_clouddensity = -0.2f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Mostly Cloud"))
|
||||
{
|
||||
_clouddensity = 0f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(160, 100, 140, 160));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Fog: " + Math.Round(_fog * 1000) / 1000);
|
||||
_fog = GUILayout.HorizontalSlider(_fog, 0f, 0.35f);
|
||||
|
||||
GUILayout.Box("Thunder prob: " + Math.Round(_lightningthunderprobability * 1000) / 1000);
|
||||
_lightningthunderprobability = GUILayout.HorizontalSlider(_lightningthunderprobability, 0f, 1f);
|
||||
|
||||
if (GUILayout.Button("Randomize"))
|
||||
{
|
||||
float num = Random.Range(-1f, 1f);
|
||||
int num3;
|
||||
_rain = 0f;
|
||||
_clouddensity = num;
|
||||
if (num > 0.5f)
|
||||
{
|
||||
num3 = Random.Range(0, 5);
|
||||
_rain = Random.Range(0f, 1f);
|
||||
_fog = 0.004f;
|
||||
switch (num3)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
_fog = 0.008f;
|
||||
goto IL_C5;
|
||||
case 2:
|
||||
_fog = 0.012f;
|
||||
goto IL_C5;
|
||||
case 3:
|
||||
_fog = 0.02f;
|
||||
goto IL_C5;
|
||||
case 4:
|
||||
_fog = 0.03f;
|
||||
goto IL_C5;
|
||||
default:
|
||||
goto IL_C5;
|
||||
}
|
||||
}
|
||||
_fog = Random.Range(0.003f, 0.006f);
|
||||
IL_C5:
|
||||
_direction = Random.Range(1, 8);
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
_windmagnitude = Random.Range(0f, 1f);
|
||||
_lightningthunderprobability = Random.Range(0f, 1f);
|
||||
_temperature = Random.Range(-50f, 50f);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(160, 229, 140, 160));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
if (GUILayout.Button("Full Cloud"))
|
||||
{
|
||||
_clouddensity = 1f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Wind"))
|
||||
{
|
||||
_clouddensity = 0.2f;
|
||||
_fog = 0.003f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0.66f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Fog"))
|
||||
{
|
||||
_clouddensity = 0.2f;
|
||||
_fog = 0.02f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Thunder Cloud"))
|
||||
{
|
||||
_clouddensity = 1f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0.8f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0.4f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Wind Rain"))
|
||||
{
|
||||
_clouddensity = 1f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0.5f;
|
||||
_rain = 0.8f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0.6f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(305, 100, 140, 250));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Rain: " + Math.Round(_rain * 1000) / 1000);
|
||||
_rain = GUILayout.HorizontalSlider(_rain, 0f, 1f);
|
||||
|
||||
GUILayout.Box("Temperature: " + Math.Round(_temperature * 10) / 10);
|
||||
_temperature = GUILayout.HorizontalSlider(_temperature, -50f, 50f);
|
||||
|
||||
GUILayout.Box("TopWind dir " + _topwinddirection.ToString());
|
||||
topwinddirection = Mathf.RoundToInt(GUILayout.HorizontalSlider(topwinddirection, 1, 6));
|
||||
|
||||
switch (topwinddirection)
|
||||
{
|
||||
case 1:
|
||||
_topwinddirection = Vector2.down;
|
||||
break;
|
||||
case 2:
|
||||
_topwinddirection = Vector2.left;
|
||||
break;
|
||||
case 3:
|
||||
_topwinddirection = Vector2.one;
|
||||
break;
|
||||
case 4:
|
||||
_topwinddirection = Vector2.right;
|
||||
break;
|
||||
case 5:
|
||||
_topwinddirection = Vector2.up;
|
||||
break;
|
||||
case 6:
|
||||
_topwinddirection = Vector2.zero;
|
||||
break;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Light Rain"))
|
||||
{
|
||||
_clouddensity = -0.1f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0.5f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Rain"))
|
||||
{
|
||||
_clouddensity = 0.05f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0.3f;
|
||||
_rain = 1f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0.15f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Fog"))
|
||||
{
|
||||
_clouddensity = -0.4f;
|
||||
_fog = 0.1f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 22f;
|
||||
_direction = Random.Range(1, 8);
|
||||
_windmagnitude = 0f;
|
||||
topwinddirection = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Default"))
|
||||
{
|
||||
_clouddensity = -0.3f;
|
||||
_fog = 0.004f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 20f;
|
||||
_direction = 7;
|
||||
_windmagnitude = 0.75f;
|
||||
topwinddirection = 2;
|
||||
}
|
||||
if (GUILayout.Button("BSG Preset"))
|
||||
{
|
||||
_clouddensity = -0.371f;
|
||||
_fog = 0.009f;
|
||||
_lightningthunderprobability = 0f;
|
||||
_rain = 0f;
|
||||
_temperature = 0f;
|
||||
_direction = 8;
|
||||
_windmagnitude = 0.125f;
|
||||
topwinddirection = 2;
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
|
||||
if (!weatherdebug)
|
||||
GUI.Box(new Rect(10, 95, 440, 260), "");
|
||||
|
||||
//Writing all the parameters selected by the player to the WeatherDebug script
|
||||
weatherController.WeatherDebug.Enabled = weatherdebug;
|
||||
weatherController.WeatherDebug.CloudDensity = _clouddensity;
|
||||
weatherController.WeatherDebug.Fog = _fog;
|
||||
weatherController.WeatherDebug.LightningThunderProbability = _lightningthunderprobability;
|
||||
weatherController.WeatherDebug.Rain = _rain;
|
||||
weatherController.WeatherDebug.Temperature = _temperature;
|
||||
weatherController.WeatherDebug.TopWindDirection = _topwinddirection;
|
||||
weatherController.WeatherDebug.WindDirection = _winddirection;
|
||||
weatherController.WeatherDebug.WindMagnitude = _windmagnitude;
|
||||
|
||||
}
|
||||
|
||||
IEnumerator PreloaderUIWaiter()
|
||||
{
|
||||
//Waiting for preloader ui to load in case we need to show an error mesage if integrity of config.ini is compromised
|
||||
yield return new WaitUntil(() => PreloaderUI.Instantiated);
|
||||
if (File.Exists(configpath))
|
||||
{
|
||||
//If the file exists, loading config values
|
||||
LoadConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Message if there is no config.ini file in the mod folder, default home key will be used instead
|
||||
PreloaderUI.Instance.ShowErrorScreen("Time & Weather Changer Error", "Time & Weather Changer Error: \n \n Integrity compromised, config.ini is missing from the mod folder. \n Default \"Home\" key will be used.");
|
||||
Debug.LogError("Time & Weather Changer Error: Integrity compromised, config.ini is missing from the mod folder. Default \"Home\" key will be used.");
|
||||
}
|
||||
}
|
||||
private void LoadConfig()
|
||||
{
|
||||
//reading config.ini and separating line in it into dictionary where key=value so we will be able to use our prefered key
|
||||
ini = File.ReadLines(configpath).Where(IsConfigurationLine).Select(line => line.Split('=')).ToDictionary(line => line[0], line => line[1]);
|
||||
|
||||
//checking if the line exists in the config file
|
||||
if (!ini.TryGetValue("PanelToggleKey", out var value))
|
||||
{
|
||||
//Showing error message if there is no such line
|
||||
PreloaderUI.Instance.ShowErrorScreen("Time & Weather Changer Error", "Time & Weather Changer Error: \n \n Integrity compromised, config.ini is missing PanelToggleKey line. \n Default \"Home\" key will be used.");
|
||||
Debug.LogError("Time & Weather Changer Error: Integrity compromised, config.ini is missing PanelToggleKey line. Default \"Home\" key will be used.");
|
||||
ToggleKey = KeyCode.Home;
|
||||
}
|
||||
else
|
||||
{
|
||||
//If enum is good, replacing default one
|
||||
if (Enum.TryParse(value, out ToggleKey))
|
||||
{
|
||||
Enum.TryParse(value, out ToggleKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If not, showing error mesage
|
||||
PreloaderUI.Instance.ShowErrorScreen("Time & Weather Changer Error", "Time & Weather Changer Error: \n \n The key in config.ini is invalid, please compare it with the list of available keys at: \n https://docs.unity3d.com/ScriptReference/KeyCode.html \n \n Default \"Home\" key will be used.");
|
||||
Debug.LogError("Time & Weather Changer Error: The key in config.ini is invalid, please compare it with the list of available keys at: https://docs.unity3d.com/ScriptReference/KeyCode.html Default \"Home\" key will be used.");
|
||||
ToggleKey = KeyCode.Home;
|
||||
}
|
||||
}
|
||||
}
|
||||
private static bool IsConfigurationLine(string line)
|
||||
{
|
||||
//ignore [Config] and # commentary in the file
|
||||
return !line.StartsWith("#") && line.Contains("=");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,522 +0,0 @@
|
||||
using Aki.Reflection.Utils;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using Comfort.Common;
|
||||
using EFT;
|
||||
using EFT.Communications;
|
||||
using EFT.Console.Core;
|
||||
using EFT.UI;
|
||||
using EFT.Weather;
|
||||
using SamSWAT.TimeWeatherChanger.Utils;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace SamSWAT.TimeWeatherChanger
|
||||
{
|
||||
[BepInPlugin("com.samswat.timeweatherchanger", "SamSWAT.TimeWeatherChanger", "2.3.0")]
|
||||
public class TimeWeatherPlugin : BaseUnityPlugin
|
||||
{
|
||||
internal static ConfigEntry<KeyboardShortcut> TogglePanel;
|
||||
|
||||
private static GameObject input;
|
||||
private static WeatherController weatherController;
|
||||
private static GameWorld gameWorld;
|
||||
|
||||
private static Type gameDateTime;
|
||||
private static MethodInfo calculateTime;
|
||||
private static MethodInfo resetTime;
|
||||
|
||||
private static DateTime modifiedDateTime;
|
||||
private static DateTime currentDateTime;
|
||||
private static Rect windowRect = new Rect(50, 50, 460, 365);
|
||||
private static bool guiStatus = false;
|
||||
private static bool weatherDebug = false;
|
||||
|
||||
private static float cloudDensity;
|
||||
private static float fog;
|
||||
private static float rain;
|
||||
private static float lightningThunderProb;
|
||||
private static float temperature;
|
||||
private static float windMagnitude;
|
||||
private static int windDir = 2;
|
||||
private static WeatherDebug.Direction windDirection;
|
||||
private static int topWindDir = 2;
|
||||
private static Vector2 topWindDirection;
|
||||
|
||||
private static string weatherDebugTex;
|
||||
private static int targetTimeHours;
|
||||
private static int targetTimeMinutes;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
//Getting type responsible for time in the current world for later use
|
||||
gameDateTime = PatchConstants.EftTypes.Single(x => x.GetMethod("CalculateTaxonomyDate") != null);
|
||||
calculateTime = gameDateTime.GetMethod("Calculate", BindingFlags.Public | BindingFlags.Instance);
|
||||
resetTime = gameDateTime.GetMethods(BindingFlags.Public | BindingFlags.Instance).Single(x => x.Name == "Reset" && x.GetParameters().Length == 1);
|
||||
ConsoleScreen.Processor.RegisterCommand("twc", new Action(OpenPanel));
|
||||
|
||||
TogglePanel = Config.Bind(
|
||||
"Main Settings",
|
||||
"Time Weather Panel Toggle Key",
|
||||
new KeyboardShortcut(KeyCode.Home),
|
||||
"The keyboard shortcut that toggles control panel");
|
||||
}
|
||||
|
||||
[ConsoleCommand("Open Time&Weather panel")]
|
||||
public static void OpenPanel()
|
||||
{
|
||||
gameWorld = Singleton<GameWorld>.Instance;
|
||||
if (gameWorld == null)
|
||||
{
|
||||
string log = "In order to change the weather, you have to go in a raid first.";
|
||||
Notifier.DisplayWarningNotification(log, ENotificationDurationType.Long);
|
||||
ConsoleScreen.Log($"[TWChanger]: {log}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameObject.Find("Weather") == null)
|
||||
{
|
||||
string log = "An error occurred when executing command, seems like you are either in the hideout or factory.";
|
||||
Notifier.DisplayWarningNotification(log);
|
||||
ConsoleScreen.Log($"[TWChanger]: {log}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
input = GameObject.Find("___Input");
|
||||
}
|
||||
|
||||
guiStatus = !guiStatus;
|
||||
Cursor.visible = guiStatus;
|
||||
if (guiStatus)
|
||||
{
|
||||
CursorSettings.SetCursor(ECursorType.Idle);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuContextMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorSettings.SetCursor(ECursorType.Invisible);
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuDropdown);
|
||||
}
|
||||
input.SetActive(!guiStatus);
|
||||
ConsoleScreen.Log("[TWChanger]: Switching control panel...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(TogglePanel.Value.MainKey))
|
||||
{
|
||||
//Obtaining current GameWorld for later time change
|
||||
gameWorld = Singleton<GameWorld>.Instance;
|
||||
//If GameWorld is null, it means that player currently is not in the raid. We notify the player with an error screen that he first needs to go in a raid
|
||||
if (gameWorld == null)
|
||||
{
|
||||
if (GameObject.Find("ErrorScreen"))
|
||||
PreloaderUI.Instance.CloseErrorScreen();
|
||||
PreloaderUI.Instance.ShowErrorScreen("Time & Weather Changer Error", "In order to change the weather, you have to go in a raid first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Looking for the weather GameObject to which the WeatherController script is attached. If it's null, means that the player is either in a hideout or factory where dynamic weather and time are not available
|
||||
if (GameObject.Find("Weather") == null)
|
||||
{
|
||||
//Notify player with bottom-right error popup
|
||||
Notifier.DisplayWarningNotification("An error occurred when opening weather panel, seems like you are either in the hideout or factory.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Caching input manager GameObject which script is responsible for reading the player inputs
|
||||
if (input == null)
|
||||
{
|
||||
input = GameObject.Find("___Input");
|
||||
}
|
||||
|
||||
guiStatus = !guiStatus;
|
||||
Cursor.visible = guiStatus;
|
||||
if (guiStatus)
|
||||
{
|
||||
//Changing the default windows cursor to an EFT-style one and playing a sound when the menu appears
|
||||
CursorSettings.SetCursor(ECursorType.Idle);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuContextMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Hiding cursor and playing a sound when the menu disappears
|
||||
CursorSettings.SetCursor(ECursorType.Invisible);
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuDropdown);
|
||||
}
|
||||
//Disabling the input manager so the player won't move
|
||||
input.SetActive(!guiStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void OnGUI()
|
||||
{
|
||||
if (guiStatus)
|
||||
windowRect = GUI.Window(0, windowRect, WindowFunction, "Time & Weather Changer by SamSWAT v2.3");
|
||||
}
|
||||
void WindowFunction(int TWCWindowID)
|
||||
{
|
||||
if (weatherDebug)
|
||||
weatherDebugTex = "ON";
|
||||
else
|
||||
weatherDebugTex = "OFF";
|
||||
|
||||
//Caching WeatherController script for the first time
|
||||
if (weatherController == null)
|
||||
{
|
||||
weatherController = GameObject.Find("Weather").GetComponent<WeatherController>();
|
||||
}
|
||||
|
||||
//Shit ton of different sliders and buttons
|
||||
|
||||
GUI.DragWindow(new Rect(0, 0, 10000, 20));
|
||||
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUI.Box(new Rect(15, 23, 140, 60), "");
|
||||
weatherDebug = GUI.Toggle(new Rect(33, 37, 110, 25), weatherDebug, "Weather debug");
|
||||
GUI.Label(new Rect(74, 52, 110, 25), weatherDebugTex);
|
||||
|
||||
currentDateTime = (DateTime)calculateTime.Invoke(typeof(GameWorld).GetField("GameDateTime").GetValue(gameWorld), null);
|
||||
GUI.Box(new Rect(160, 23, 285, 60), "Current time: " + currentDateTime.ToString("HH:mm:ss"));
|
||||
|
||||
GUI.Label(new Rect(190, 42, 40, 20), "Hours");
|
||||
targetTimeHours = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(165, 60, 80, 15), targetTimeHours, 0, 23));
|
||||
GUI.TextField(new Rect(248, 50, 20, 20), targetTimeHours.ToString());
|
||||
|
||||
GUI.Label(new Rect(295, 42, 50, 20), "Minutes");
|
||||
targetTimeMinutes = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(272, 60, 90, 15), targetTimeMinutes, 0, 59));
|
||||
GUI.TextField(new Rect(365, 50, 20, 20), targetTimeMinutes.ToString());
|
||||
|
||||
if (GUI.Button(new Rect(390, 40, 50, 30), "Set"))
|
||||
{
|
||||
modifiedDateTime = currentDateTime.AddHours((double)targetTimeHours - currentDateTime.Hour);
|
||||
modifiedDateTime = modifiedDateTime.AddMinutes((double)targetTimeMinutes - currentDateTime.Minute);
|
||||
resetTime.Invoke(typeof(GameWorld).GetField("GameDateTime").GetValue(gameWorld), new object[] { modifiedDateTime });
|
||||
Notifier.DisplayMessageNotification("Time was set to: " + modifiedDateTime.ToString("HH:mm"));
|
||||
Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.MenuInspectorWindowClose);
|
||||
}
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(15, 100, 140, 250));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Cloud Density: " + Math.Round(cloudDensity * 1000) / 1000);
|
||||
cloudDensity = GUILayout.HorizontalSlider(cloudDensity, -1f, 1f);
|
||||
|
||||
GUILayout.Box("Wind Magnitude: " + Math.Round(windMagnitude * 100) / 100);
|
||||
windMagnitude = GUILayout.HorizontalSlider(windMagnitude, 0f, 1f);
|
||||
|
||||
GUILayout.Box("Wind Direction: " + windDirection.ToString());
|
||||
windDir = Mathf.RoundToInt(GUILayout.HorizontalSlider(windDir, 1, 8));
|
||||
windDirection = (WeatherDebug.Direction)windDir;
|
||||
|
||||
if (GUILayout.Button("Clear"))
|
||||
{
|
||||
cloudDensity = -0.7f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Clear Wind"))
|
||||
{
|
||||
cloudDensity = -0.7f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0.4f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Clear Fog"))
|
||||
{
|
||||
cloudDensity = -0.4f;
|
||||
fog = 0.02f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Partly Cloud"))
|
||||
{
|
||||
cloudDensity = -0.2f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Mostly Cloud"))
|
||||
{
|
||||
cloudDensity = 0f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(160, 100, 140, 160));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Fog: " + Math.Round(fog * 1000) / 1000);
|
||||
fog = GUILayout.HorizontalSlider(fog, 0f, 0.35f);
|
||||
|
||||
GUILayout.Box("Thunder prob: " + Math.Round(lightningThunderProb * 1000) / 1000);
|
||||
lightningThunderProb = GUILayout.HorizontalSlider(lightningThunderProb, 0f, 1f);
|
||||
|
||||
if (GUILayout.Button("Randomize"))
|
||||
{
|
||||
float num = Random.Range(-1f, 1f);
|
||||
int num3;
|
||||
rain = 0f;
|
||||
cloudDensity = num;
|
||||
if (num > 0.5f)
|
||||
{
|
||||
num3 = Random.Range(0, 5);
|
||||
rain = Random.Range(0f, 1f);
|
||||
fog = 0.004f;
|
||||
switch (num3)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
fog = 0.008f;
|
||||
goto IL_C5;
|
||||
case 2:
|
||||
fog = 0.012f;
|
||||
goto IL_C5;
|
||||
case 3:
|
||||
fog = 0.02f;
|
||||
goto IL_C5;
|
||||
case 4:
|
||||
fog = 0.03f;
|
||||
goto IL_C5;
|
||||
default:
|
||||
goto IL_C5;
|
||||
}
|
||||
}
|
||||
fog = Random.Range(0.003f, 0.006f);
|
||||
IL_C5:
|
||||
windDir = Random.Range(1, 8);
|
||||
topWindDir = Random.Range(0, 5);
|
||||
windMagnitude = Random.Range(0f, 1f);
|
||||
lightningThunderProb = Random.Range(0f, 1f);
|
||||
temperature = Random.Range(-50f, 50f);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(160, 229, 140, 160));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
if (GUILayout.Button("Full Cloud"))
|
||||
{
|
||||
cloudDensity = 1f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Wind"))
|
||||
{
|
||||
cloudDensity = 0.2f;
|
||||
fog = 0.003f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0.66f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Fog"))
|
||||
{
|
||||
cloudDensity = 0.2f;
|
||||
fog = 0.02f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Thunder Cloud"))
|
||||
{
|
||||
cloudDensity = 1f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0.8f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0.4f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Cloud Wind Rain"))
|
||||
{
|
||||
cloudDensity = 1f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0.5f;
|
||||
rain = 0.8f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0.6f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
//---------------------------------------------\\
|
||||
|
||||
GUILayout.BeginArea(new Rect(305, 100, 140, 250));
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Box("Rain: " + Math.Round(rain * 1000) / 1000);
|
||||
rain = GUILayout.HorizontalSlider(rain, 0f, 1f);
|
||||
|
||||
GUILayout.Box("Temperature: " + Math.Round(temperature * 10) / 10);
|
||||
temperature = GUILayout.HorizontalSlider(temperature, -50f, 50f);
|
||||
|
||||
GUILayout.Box("TopWind dir " + topWindDirection.ToString());
|
||||
topWindDir = Mathf.RoundToInt(GUILayout.HorizontalSlider(topWindDir, 1, 6));
|
||||
|
||||
switch (topWindDir)
|
||||
{
|
||||
case 1:
|
||||
topWindDirection = Vector2.down;
|
||||
break;
|
||||
case 2:
|
||||
topWindDirection = Vector2.left;
|
||||
break;
|
||||
case 3:
|
||||
topWindDirection = Vector2.one;
|
||||
break;
|
||||
case 4:
|
||||
topWindDirection = Vector2.right;
|
||||
break;
|
||||
case 5:
|
||||
topWindDirection = Vector2.up;
|
||||
break;
|
||||
case 6:
|
||||
topWindDirection = Vector2.zero;
|
||||
break;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Light Rain"))
|
||||
{
|
||||
cloudDensity = -0.1f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0.5f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Rain"))
|
||||
{
|
||||
cloudDensity = 0.05f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0.3f;
|
||||
rain = 1f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0.15f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Fog"))
|
||||
{
|
||||
cloudDensity = -0.4f;
|
||||
fog = 0.1f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 22f;
|
||||
windDir = Random.Range(1, 8);
|
||||
windMagnitude = 0f;
|
||||
topWindDir = Random.Range(0, 5);
|
||||
}
|
||||
if (GUILayout.Button("Default"))
|
||||
{
|
||||
cloudDensity = -0.3f;
|
||||
fog = 0.004f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 20f;
|
||||
windDir = 7;
|
||||
windMagnitude = 0.75f;
|
||||
topWindDir = 2;
|
||||
}
|
||||
if (GUILayout.Button("BSG Preset"))
|
||||
{
|
||||
cloudDensity = -0.371f;
|
||||
fog = 0.009f;
|
||||
lightningThunderProb = 0f;
|
||||
rain = 0f;
|
||||
temperature = 0f;
|
||||
windDir = 8;
|
||||
windMagnitude = 0.125f;
|
||||
topWindDir = 2;
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndArea();
|
||||
|
||||
//---------------------------------------------\\
|
||||
|
||||
if (!weatherDebug)
|
||||
GUI.Box(new Rect(10, 95, 440, 260), "");
|
||||
|
||||
//Writing all the parameters selected by the player to the WeatherDebug script
|
||||
weatherController.WeatherDebug.Enabled = weatherDebug;
|
||||
weatherController.WeatherDebug.CloudDensity = cloudDensity;
|
||||
weatherController.WeatherDebug.Fog = fog;
|
||||
weatherController.WeatherDebug.LightningThunderProbability = lightningThunderProb;
|
||||
weatherController.WeatherDebug.Rain = rain;
|
||||
weatherController.WeatherDebug.Temperature = temperature;
|
||||
weatherController.WeatherDebug.TopWindDirection = topWindDirection;
|
||||
weatherController.WeatherDebug.WindDirection = windDirection;
|
||||
weatherController.WeatherDebug.WindMagnitude = windMagnitude;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using Aki.Reflection.Utils;
|
||||
using EFT.UI;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SamSWAT.TimeWeatherChanger.Utils
|
||||
{
|
||||
static class CursorSettings
|
||||
{
|
||||
private static readonly MethodInfo setCursorMethod;
|
||||
|
||||
static CursorSettings()
|
||||
{
|
||||
var cursorType = PatchConstants.EftTypes.Single(x => x.GetMethod("SetCursor") != null);
|
||||
setCursorMethod = cursorType.GetMethod("SetCursor");
|
||||
}
|
||||
|
||||
public static void SetCursor(ECursorType type)
|
||||
{
|
||||
setCursorMethod.Invoke(null, new object[] { type });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
using Aki.Reflection.Utils;
|
||||
using EFT.Communications;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SamSWAT.TimeWeatherChanger.Utils
|
||||
{
|
||||
static class Notifier
|
||||
{
|
||||
private static readonly MethodInfo notifierMessageMethod;
|
||||
private static readonly MethodInfo notifierWarningMessageMethod;
|
||||
|
||||
static Notifier()
|
||||
{
|
||||
var notifierType = PatchConstants.EftTypes.Single(x => x.GetMethod("DisplayMessageNotification") != null);
|
||||
notifierMessageMethod = notifierType.GetMethod("DisplayMessageNotification");
|
||||
notifierWarningMessageMethod = notifierType.GetMethod("DisplayWarningNotification");
|
||||
}
|
||||
|
||||
public static void DisplayMessageNotification(string message, ENotificationDurationType duration = ENotificationDurationType.Default, ENotificationIconType iconType = ENotificationIconType.Default, Color? textColor = null)
|
||||
{
|
||||
notifierMessageMethod.Invoke(null, new object[] { message, duration, iconType, textColor });
|
||||
}
|
||||
|
||||
public static void DisplayWarningNotification(string message, ENotificationDurationType duration = ENotificationDurationType.Default)
|
||||
{
|
||||
notifierWarningMessageMethod.Invoke(null, new object[] { message, duration });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user