updated to use reflection to call the method "Open" which enables power, lights etc #6
@ -1,12 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using BepInEx;
|
||||||
using BepInEx;
|
|
||||||
using UnityEngine;
|
|
||||||
using EFT.Interactive;
|
using EFT.Interactive;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using EFT;
|
using System.Reflection;
|
||||||
using EFT.UI;
|
using UnityEngine;
|
||||||
using Comfort.Common;
|
|
||||||
using RegexCMD = GClass2285;
|
|
||||||
|
|
||||||
namespace ValensHasThePower
|
namespace ValensHasThePower
|
||||||
{
|
{
|
||||||
@ -20,124 +17,53 @@ namespace ValensHasThePower
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PowerOn
|
public static class PowerOn
|
||||||
{
|
{
|
||||||
private static List<Switch> PowerSwitches = Object.FindObjectsOfType<Switch>().ToList();
|
|
||||||
|
|
||||||
private static GameWorld _gameWorld;
|
|
||||||
|
|
||||||
public static void Start()
|
public static void Start()
|
||||||
{
|
{
|
||||||
// Adds command to console, type test to enable the script In-Game
|
List<Switch> PowerSwitches = Object.FindObjectsOfType<Switch>().ToList();
|
||||||
// TODO: test with reserve as its the only method currently added to run on command!
|
|
||||||
ConsoleScreen.Commands.AddCommand(new RegexCMD("test", match =>
|
foreach (var switcher in PowerSwitches)
|
||||||
{
|
{
|
||||||
_gameWorld = Singleton<GameWorld>.Instance;
|
// interchange Power Station
|
||||||
if (_gameWorld == null)
|
if (switcher.Id == "Shopping_Mall_DesignStuff_00055" && switcher.name == "reserve_electric_switcher_lever")
|
||||||
{
|
{
|
||||||
string log = "in order to run this command, you have to be in raid";
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
PreloaderUI.Instance.Console.AddLog(" " + log, "[Valens HasThePower]:");
|
PowerSwitch(switcher);
|
||||||
}
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
else
|
|
||||||
{
|
|
||||||
string log = "Enabled!";
|
|
||||||
PreloaderUI.Instance.Console.AddLog(" " + log, "[Valens HasThePower]:");
|
|
||||||
PowerOn.Reserve();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
//PowerOn.Interchange();
|
|
||||||
//PowerOn.Customs();
|
|
||||||
//PowerOn.Reserve();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Interchange()
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var switches in PowerSwitches) // Turn the Power Station switch to On.
|
|
||||||
{
|
|
||||||
// Power to Mall
|
|
||||||
if (switches.Id == "Shopping_Mall_DesignStuff_00055" && switches.name == "reserve_electric_switcher_lever")
|
|
||||||
{
|
|
||||||
switches.DoorState = EDoorState.Open;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activation of Toilet Key Card Reader in Burger Stop
|
// interchange Secret Container
|
||||||
if (switches.name == "Node_Keycard_Saferoom")
|
if (switcher.Id == "Shopping_Mall_DesignStuff_00061" && switcher.Id == "reserve_electric_switcher_lever")
|
||||||
{
|
{
|
||||||
switches.DoorState = EDoorState.Open;
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
|
PowerSwitch(switcher);
|
||||||
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activation of OBJ21 Container
|
// Customs Power Switch
|
||||||
if (switches.Id == "Shopping_Mall_DesignStuff_00061" && switches.Id == "reserve_electric_switcher_lever")
|
if (switcher.Id == "custom_DesignStuff_00034" && switcher.name == "reserve_electric_switcher_lever")
|
||||||
{
|
{
|
||||||
switches.DoorState = EDoorState.Open;
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
|
PowerSwitch(switcher);
|
||||||
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reserve D2 Switch
|
||||||
|
if (switcher.Id == "autoId_00000_D2_LEVER" && switcher.name == "reserve_electric_switcher_lever")
|
||||||
|
{
|
||||||
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
|
PowerSwitch(switcher);
|
||||||
|
Debug.LogError($"{switcher.Id} {switcher.enabled}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Customs()
|
private static void PowerSwitch(Switch switcher)
|
||||||
{
|
{
|
||||||
|
switcher.GetType().GetMethod("Open", BindingFlags.NonPublic | BindingFlags.Instance)
|
||||||
foreach (var switches in PowerSwitches) // turns on power on customs
|
.Invoke(switcher, new object[0]);
|
||||||
{
|
|
||||||
if (switches.Id == "custom_DesignStuff_00034" && switches.name == "reserve_electric_switcher_lever")
|
|
||||||
{
|
|
||||||
var lamps = switches.Lamps.ToList();
|
|
||||||
var exfil = switches.ExfiltrationPoint;
|
|
||||||
|
|
||||||
// turns on lamps
|
|
||||||
foreach (var lamp in lamps)
|
|
||||||
{
|
|
||||||
lamp.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// turns on power
|
|
||||||
switches.DoorState = EDoorState.Open;
|
|
||||||
|
|
||||||
// turns on exfil
|
|
||||||
exfil.Status = EExfiltrationStatus.RegularMode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Reserve()
|
|
||||||
{
|
|
||||||
foreach (var switches in PowerSwitches) // turns on power on reserve
|
|
||||||
{
|
|
||||||
if (switches.Id == "autoId_00000_D2_LEVER" && switches.name == "reserve_electric_switcher_lever")
|
|
||||||
{
|
|
||||||
var lamps = switches.Lamps.ToList();
|
|
||||||
|
|
||||||
// turns on power
|
|
||||||
switches.DoorState = EDoorState.Open;
|
|
||||||
|
|
||||||
// turns on lamps
|
|
||||||
foreach (var lamp in lamps)
|
|
||||||
{
|
|
||||||
// finds LampControllers attached to Switch
|
|
||||||
Debug.LogError($"LampController Name: {lamp.name}");
|
|
||||||
var lights = lamp.Lights.ToList();
|
|
||||||
|
|
||||||
// finds all lights attached to the LampControllers
|
|
||||||
foreach (var light in lights)
|
|
||||||
{
|
|
||||||
// enables the lights
|
|
||||||
Debug.LogError($"BEFORE -- light Name: {light.name} | Enabled? {light.enabled}");
|
|
||||||
light.enabled = true;
|
|
||||||
Debug.LogError($"AFTER -- light Name: {light.name} | Enabled? {light.enabled}");
|
|
||||||
// TODO: this currently shows finding all the above and enabling the lights, put once in raid they are still not enabled in UE, so something might be running after
|
|
||||||
// as per the reason to try a command after load
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// turns on d2 extract button
|
|
||||||
if (switches.Id == "00453" && switches.name == "Node_GatesButton")
|
|
||||||
{
|
|
||||||
switches.DoorState = EDoorState.Shut;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user