Skip to content

Commit

Permalink
Updated source code to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ClonkAndre committed May 27, 2024
1 parent b93c200 commit a9add22
Show file tree
Hide file tree
Showing 20 changed files with 2,913 additions and 933 deletions.
25 changes: 25 additions & 0 deletions ProjectThunderIV/ProjectThunderIV.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectThunderIV", "ProjectThunderIV\ProjectThunderIV.csproj", "{868CD14E-2269-40A2-98AB-AD08AD1AD9F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{868CD14E-2269-40A2-98AB-AD08AD1AD9F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{868CD14E-2269-40A2-98AB-AD08AD1AD9F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{868CD14E-2269-40A2-98AB-AD08AD1AD9F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{868CD14E-2269-40A2-98AB-AD08AD1AD9F7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B24475AA-3608-48EA-AFF4-2092491273D2}
EndGlobalSection
EndGlobal
50 changes: 50 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/API/LightningBoltSummonConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.Numerics;

namespace ProjectThunderIV.API
{
internal class LightningBoltSummonConfig
{
#region Variables
public Vector3 SpawnPosition;
public bool CanHaveBranches;
public bool GrowFromGroundUp;
public int OverrideLightningSize;
public Vector3 OverrideBoltColor;
public Vector3 OverrideSkyColor;
public float OverrideSkyBrightness;
#endregion

#region Constructor
public LightningBoltSummonConfig(Vector3 spawnPosition,
bool canHaveBranches,
bool growFromGroundUp,
int overrideLightningSize,
Vector3 overrideBoltColor,
Vector3 overrideSkyColor,
float overrideSkyBrightness)
{
SpawnPosition = spawnPosition;
CanHaveBranches = canHaveBranches;
GrowFromGroundUp = growFromGroundUp;
OverrideLightningSize = overrideLightningSize;
OverrideBoltColor = overrideBoltColor;
OverrideSkyColor = overrideSkyColor;
OverrideSkyBrightness = overrideSkyBrightness;
}
public LightningBoltSummonConfig(Vector3 spawnPosition)
{
SpawnPosition = spawnPosition;
CanHaveBranches = true;
GrowFromGroundUp = false;
OverrideLightningSize = -1;
OverrideBoltColor = default(Vector3);
OverrideSkyColor = default(Vector3);
OverrideSkyBrightness = -1f;
}
public LightningBoltSummonConfig()
{

}
#endregion
}
}
29 changes: 29 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/Consts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace ProjectThunderIV.Classes
{
internal class Consts
{
public static string[] ExplosionTypes = new string[]
{
"GRENADE",
"MOLOTOV",
"ROCKET",
"HI_OCTANE",
"CAR",
"PLANE",
"PETROL_PUMP",
"BIKE",
"DIR_STEAM",
"DIR_FLAME",
"DIR_WATER_HYDRANT",
"DIR_GAS_CANISTER",
"BOAT",
"SHIP_DESTROY",
"TRUCK"
};
public static string[] TriggerTypes = new string[]
{
"LookAt",
"BeAt"
};
}
}
20 changes: 20 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/DelayedCall.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace ProjectThunderIV.Classes
{
internal class DelayedCall
{
#region Variables
public Action ActionToExecute;
public DateTime ExecuteAt;
#endregion

#region Constructor
public DelayedCall(DateTime executeAt, Action a)
{
ActionToExecute = a;
ExecuteAt = executeAt;
}
#endregion
}
}
22 changes: 22 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace ProjectThunderIV.Classes
{
internal enum ThunderstormProgress
{
Starting,
Ongoing,
Ending
}

internal enum TriggerType
{
/// <summary>
/// Player has to look at position for the lightning bolt to appear at the predefined location.
/// </summary>
LookAt,

/// <summary>
/// Player has to be within the predefined radius at the position inorder for the lightning bolt to appear at the predefined location.
/// </summary>
BeAt
}
}
36 changes: 36 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/LightningBolt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Numerics;

namespace ProjectThunderIV.Classes
{
internal class LightningBolt
{
#region Variables
public Vector3[] Points;
public List<LightningBoltBranch> Branches;

public float StartingCoronaSize;
public float CoronaSize;
public float FadeOutSpeed;

public Vector3 OverrideBoltColor;
public Vector3 OverrideSkyColor;
public float OverrideSkyBrightness;
#endregion

#region Constructor
public LightningBolt(int size, float coronaSize, float fadeOutSpeed)
{
Points = new Vector3[size];
StartingCoronaSize = coronaSize;
CoronaSize = coronaSize;
FadeOutSpeed = fadeOutSpeed;
}
#endregion

public void ResetSize()
{
CoronaSize = StartingCoronaSize;
}
}
}
28 changes: 28 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/LightningBoltBranch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Numerics;

using static IVSDKDotNet.Native.Natives;

namespace ProjectThunderIV.Classes
{
internal class LightningBoltBranch
{

#region Variables
public Vector3[] Points;

public float XValue;
public float YValue;
#endregion

#region Constructor
public LightningBoltBranch(int size)
{
Points = new Vector3[size];

XValue = GENERATE_RANDOM_FLOAT_IN_RANGE(-0.5f, 0.5f);
YValue = GENERATE_RANDOM_FLOAT_IN_RANGE(-0.5f, 0.5f);
}
#endregion

}
}
29 changes: 29 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/Logging.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using IVSDKDotNet;

namespace ProjectThunderIV.Classes
{
internal class Logging
{

public static void Log(string str, params object[] args)
{
IVGame.Console.Print(string.Format("[ProjectThunderIV] {0}", string.Format(str, args)));
}
public static void LogWarning(string str, params object[] args)
{
IVGame.Console.PrintWarning(string.Format("[ProjectThunderIV] {0}", string.Format(str, args)));
}
public static void LogError(string str, params object[] args)
{
IVGame.Console.PrintError(string.Format("[ProjectThunderIV] {0}", string.Format(str, args)));
}

public static void LogDebug(string str, params object[] args)
{
#if DEBUG
IVGame.Console.Print(string.Format("[ProjectThunderIV] [DEBUG] {0}", string.Format(str, args)));
#endif
}

}
}
122 changes: 122 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/ModSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using System.Numerics;

using ProjectThunderIV.Extensions;

using IVSDKDotNet;

namespace ProjectThunderIV.Classes
{
internal class ModSettings
{
#region Variables
// General
public static bool EnableDebug;
public static bool ReloadTimeCycleWhenModUnloads;
public static bool AllowLightningBoltsInCutscene;

// Sound
public static float GlobalSoundMultiplier;
public static bool VolumeIsAllowedToGoAboveOne;
public static float LowerVolumeByCertainAmountWhenInInterior;
public static string SoundPackToUse;

// LightningBolt
public static float SpawnChancePercentageBeginning;
public static float SpawnChancePercentageOngoing;
public static float SpawnChancePercentageEnding;
public static float ScriptedSpawnChance;
public static float BranchSpawnChance;
public static float DelayThunderSoundMultiplier;
public static int MinBoltSize;
public static int MaxBoltSize;
public static float MinBoltFadeOutSpeed;
public static float MaxBoltFadeOutSpeed;
public static Vector3 BoltColor;
public static float CoronaSize;
public static float SpawnHeight;

// Light
public static float LightIntensity;
public static float LightRange;

// Sky
public static float AdditionalCloudBrightness;

// Danger
public static bool EnableDangerousHeight;
public static float DangerousHeight;
public static float SpawnChanceWhenAboveDangerousHeight;

public static bool EnableUmbrellaDanger;
public static float SpawnChanceWhenHoldingUmbrella;

// Reactions
public static bool AllowPedReactions;
public static float ReactionChance;

// Explosion
public static bool CreateExplosions;
public static int ExplosionType;
public static float ExplosionRadius;
public static float ExplosionCamShake;
#endregion

public static void Load(SettingsFile settings)
{
// General
#if DEBUG
EnableDebug = true;
#else
EnableDebug = settings.GetBoolean("General", "EnableDebug", false);
#endif
ReloadTimeCycleWhenModUnloads = settings.GetBoolean("General", "ReloadTimeCycleWhenModUnloads", true);
AllowLightningBoltsInCutscene = settings.GetBoolean("General", "AllowLightningBoltsInCutscene", true);

// Sound
GlobalSoundMultiplier = settings.GetFloat("Sound", "GlobalMultiplier", 1.0f);
VolumeIsAllowedToGoAboveOne = settings.GetBoolean("Sound", "VolumeIsAllowedToGoAboveOne", false);
LowerVolumeByCertainAmountWhenInInterior = settings.GetFloat("Sound", "LowerVolumeByCertainAmountWhenInInterior", 0.25f);
SoundPackToUse = settings.GetValue("Sound", "UseSoundPack", "GTAIVSoundPack");

// LightningBolt
SpawnChancePercentageBeginning = settings.GetFloat("LightningBolt", "SpawnChancePercentageBeginning", 6.0f);
SpawnChancePercentageOngoing = settings.GetFloat("LightningBolt", "SpawnChancePercentageOngoing", 10.0f);
SpawnChancePercentageEnding = settings.GetFloat("LightningBolt", "SpawnChancePercentageEnding", 4.0f);
ScriptedSpawnChance = settings.GetFloat("LightningBolt", "ScriptedSpawnChance", 30.0f);
BranchSpawnChance = settings.GetFloat("LightningBolt", "BranchSpawnChance", 10.0f);
DelayThunderSoundMultiplier = settings.GetFloat("LightningBolt", "DelaySoundMultiplier", 1.0f);
MinBoltSize = settings.GetInteger("LightningBolt", "MinSize", 35);
MaxBoltSize = settings.GetInteger("LightningBolt", "MaxSize", 500);
MinBoltFadeOutSpeed = settings.GetFloat("LightningBolt", "MinFadeOutSpeed", 1.0f);
MaxBoltFadeOutSpeed = settings.GetFloat("LightningBolt", "MaxFadeOutSpeed", 1.0f);
BoltColor = settings.GetVector3("LightningBolt", "ColorRGB", new Vector3(0.766f, 0.9f, 1.0f)).Clamp(0.0f, 1.0f);
CoronaSize = settings.GetFloat("LightningBolt", "CoronaSize", 1.0f);
SpawnHeight = settings.GetFloat("LightningBolt", "Height", 1.0f);

// Light
LightIntensity = settings.GetFloat("Light", "Intensity", 0.11f);
LightRange = settings.GetFloat("Light", "Range", 300f);

// Sky
AdditionalCloudBrightness = settings.GetFloat("Sky", "AdditionalCloudBrightness", 20f);

// Danger
EnableDangerousHeight = settings.GetBoolean("Danger", "EnableDangerousHeight", true);
DangerousHeight = settings.GetFloat("Danger", "DangerousHeight", 189f);
SpawnChanceWhenAboveDangerousHeight = settings.GetFloat("Danger", "SpawnChanceWhenAboveDangerousHeight", 3f);

EnableUmbrellaDanger = settings.GetBoolean("Danger", "EnableUmbrellaDanger", true);
SpawnChanceWhenHoldingUmbrella = settings.GetFloat("Danger", "SpawnChanceWhenHoldingUmbrella", 0.1f);

// Reactions
AllowPedReactions = settings.GetBoolean("Reactions", "AllowPedReactions", true);
ReactionChance = settings.GetFloat("Reactions", "ReactionChance", 25f);

// Explosion
CreateExplosions = settings.GetBoolean("Explosion", "CreateExplosions", true);
ExplosionType = settings.GetInteger("Explosion", "Type", 2);
ExplosionRadius = settings.GetFloat("Explosion", "Radius", 15f);
ExplosionCamShake = settings.GetFloat("Explosion", "CamShake", 1.0f);
}
}
}
28 changes: 28 additions & 0 deletions ProjectThunderIV/ProjectThunderIV/Classes/ScriptedLightning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Numerics;

using Newtonsoft.Json;

namespace ProjectThunderIV.Classes
{
internal class ScriptedLightning
{
[JsonIgnore] public bool ForceSpawn;
public bool LightningGrowsFromBottomToTop;
public bool CanHaveBranches;
public int OverrideLightningSize;
public Vector3 OverrideLightningColor;
public Vector3 OverrideSkyColor;
public float OverrideSkyBrightness;

public Vector3 SpawnPosition;
public float SpawnRadiusMin;
public float SpawnRadiusMax;

//public bool OnlyTriggerWhenPlayerIsWithinTriggerPosRadius;
public Vector3 TriggerPos;
public float TriggerDistance;

public int TheTrigger;
public float SpawnChance;
}
}
Loading

0 comments on commit a9add22

Please sign in to comment.