mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Added ability for users to provide their own barriers in the .ini
This commit is contained in:
parent
a816967255
commit
55056cc1f3
2 changed files with 19 additions and 9 deletions
|
|
@ -2,8 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Rage;
|
using Rage;
|
||||||
using RAGENativeUI;
|
using RAGENativeUI;
|
||||||
using RAGENativeUI.Elements;
|
using RAGENativeUI.Elements;
|
||||||
|
|
@ -14,10 +12,9 @@ namespace SceneManager
|
||||||
{
|
{
|
||||||
public static UIMenu barrierMenu { get; private set; }
|
public static UIMenu barrierMenu { get; private set; }
|
||||||
public static List<Barrier> barriers = new List<Barrier>();
|
public static List<Barrier> barriers = new List<Barrier>();
|
||||||
//public static List<Rage.Object> barriers = new List<Rage.Object>() { };
|
private static UIMenuListScrollerItem<string> barrierList = new UIMenuListScrollerItem<string>("Select Barrier", "", Settings.barrierKeys);
|
||||||
|
//private static UIMenuListScrollerItem<string> barrierList = new UIMenuListScrollerItem<string>("Select Barrier", "", new[] { "Large Striped Cone", "Large Cone", "Medium Striped Cone", "Medium Cone", "Roadpole A", "Roadpole B", "Police Barrier", "Road Barrier", "Flare" });
|
||||||
private static UIMenuListScrollerItem<string> barrierList = new UIMenuListScrollerItem<string>("Select Barrier", "", new[] { "Large Striped Cone", "Large Cone", "Medium Striped Cone", "Medium Cone", "Roadpole A", "Roadpole B", "Police Barrier", "Road Barrier", "Flare" });
|
//private static string[] barrierObjectNames = new string[] { "prop_mp_cone_01", "prop_roadcone01c", "prop_mp_cone_02", "prop_mp_cone_03", "prop_roadpole_01a", "prop_roadpole_01b", "prop_barrier_work05", "prop_barrier_work06a", "prop_flare_01b" };
|
||||||
private static string[] barrierObjectNames = new string[] { "prop_mp_cone_01", "prop_roadcone01c", "prop_mp_cone_02", "prop_mp_cone_03", "prop_roadpole_01a", "prop_roadpole_01b", "prop_barrier_work05", "prop_barrier_work06a", "prop_flare_01b" };
|
|
||||||
private static UIMenuNumericScrollerItem<int> rotateBarrier = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "", 0, 350, 10);
|
private static UIMenuNumericScrollerItem<int> rotateBarrier = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "", 0, 350, 10);
|
||||||
private static UIMenuListScrollerItem<string> removeBarrierOptions = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" });
|
private static UIMenuListScrollerItem<string> removeBarrierOptions = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" });
|
||||||
private static UIMenuItem resetBarriers = new UIMenuItem("Reset Barriers", "Reset all spawned barriers to their original position and rotation");
|
private static UIMenuItem resetBarriers = new UIMenuItem("Reset Barriers", "Reset all spawned barriers to their original position and rotation");
|
||||||
|
|
@ -62,7 +59,8 @@ namespace SceneManager
|
||||||
if (shadowBarrier)
|
if (shadowBarrier)
|
||||||
shadowBarrier.Delete();
|
shadowBarrier.Delete();
|
||||||
|
|
||||||
shadowBarrier = new Rage.Object(barrierObjectNames[barrierList.Index], TracePlayerView(15, TraceFlags.IntersectEverything).HitPosition, rotateBarrier.Index);
|
shadowBarrier = new Rage.Object(Settings.barrierValues[barrierList.Index], TracePlayerView(15, TraceFlags.IntersectEverything).HitPosition, rotateBarrier.Index);
|
||||||
|
//shadowBarrier = new Rage.Object(barrierObjectNames[barrierList.Index], TracePlayerView(15, TraceFlags.IntersectEverything).HitPosition, rotateBarrier.Index);
|
||||||
Rage.Native.NativeFunction.Natives.PLACE_OBJECT_ON_GROUND_PROPERLY(shadowBarrier);
|
Rage.Native.NativeFunction.Natives.PLACE_OBJECT_ON_GROUND_PROPERLY(shadowBarrier);
|
||||||
shadowBarrier.IsGravityDisabled = true;
|
shadowBarrier.IsGravityDisabled = true;
|
||||||
shadowBarrier.IsCollisionEnabled = false;
|
shadowBarrier.IsCollisionEnabled = false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Rage;
|
using Rage;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SceneManager
|
namespace SceneManager
|
||||||
|
|
@ -29,12 +30,12 @@ namespace SceneManager
|
||||||
internal static bool EnableHints = true;
|
internal static bool EnableHints = true;
|
||||||
internal static SpeedUnits SpeedUnit = SpeedUnits.MPH;
|
internal static SpeedUnits SpeedUnit = SpeedUnits.MPH;
|
||||||
internal static float BarrierPlacementDistance = 30f;
|
internal static float BarrierPlacementDistance = 30f;
|
||||||
internal static Object[] barriers;
|
internal static List<string> barrierKeys = new List<string>();
|
||||||
|
internal static List<string> barrierValues = new List<string>();
|
||||||
|
|
||||||
internal static void LoadSettings()
|
internal static void LoadSettings()
|
||||||
{
|
{
|
||||||
Game.LogTrivial("Loading SceneManager.ini settings");
|
Game.LogTrivial("Loading SceneManager.ini settings");
|
||||||
//InitializationFile ini = new InitializationFile("Plugins/SceneManager.ini");
|
|
||||||
ini.Create();
|
ini.Create();
|
||||||
|
|
||||||
ToggleKey = ini.ReadEnum("Keybindings", "ToggleKey", Keys.T);
|
ToggleKey = ini.ReadEnum("Keybindings", "ToggleKey", Keys.T);
|
||||||
|
|
@ -46,6 +47,17 @@ namespace SceneManager
|
||||||
EnableHints = ini.ReadBoolean("Other Settings", "EnableHints", true);
|
EnableHints = ini.ReadBoolean("Other Settings", "EnableHints", true);
|
||||||
SpeedUnit = ini.ReadEnum("Other Settings", "SpeedUnits", SpeedUnits.MPH);
|
SpeedUnit = ini.ReadEnum("Other Settings", "SpeedUnits", SpeedUnits.MPH);
|
||||||
BarrierPlacementDistance = ini.ReadInt32("Other Settings", "BarrierPlacementDistance", 30);
|
BarrierPlacementDistance = ini.ReadInt32("Other Settings", "BarrierPlacementDistance", 30);
|
||||||
|
|
||||||
|
foreach(string key in ini.GetKeyNames("Barriers"))
|
||||||
|
{
|
||||||
|
//Game.LogTrivial($"Key: {key.Trim()}");
|
||||||
|
//Game.LogTrivial($"Value: {ini.ReadString("Barriers",key)}");
|
||||||
|
barrierKeys.Add(key.Trim());
|
||||||
|
var m = new Model(ini.ReadString("Barriers", key));
|
||||||
|
if (m.IsValid)
|
||||||
|
barrierValues.Add(m.Name);
|
||||||
|
//barrierValues.Add(ini.ReadString("Barriers", key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void UpdateSettings(bool threeDWaypointsEnabled, bool mapBlipsEnabled, bool hintsEnabled, SpeedUnits unit, float distance)
|
internal static void UpdateSettings(bool threeDWaypointsEnabled, bool mapBlipsEnabled, bool hintsEnabled, SpeedUnits unit, float distance)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue