|
@@ -1,7 +1,6 @@
|
|
|
using GadgetCore.API;
|
|
using GadgetCore.API;
|
|
|
using GadgetCore.API.ConfigMenu;
|
|
using GadgetCore.API.ConfigMenu;
|
|
|
using ScrapYard.API;
|
|
using ScrapYard.API;
|
|
|
-using System;
|
|
|
|
|
using System.Collections;
|
|
using System.Collections;
|
|
|
using System.Reflection;
|
|
using System.Reflection;
|
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
@@ -9,12 +8,15 @@ using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
namespace StasisPod
|
|
namespace StasisPod
|
|
|
{
|
|
{
|
|
|
- [Gadget("StasisPod", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" })]
|
|
|
|
|
|
|
+ [Gadget("StasisPod", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" }, RequiredOnClients: true)]
|
|
|
public class StasisPod : Gadget<StasisPod>
|
|
public class StasisPod : Gadget<StasisPod>
|
|
|
{
|
|
{
|
|
|
- public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
|
|
|
|
|
|
|
+ public const string MOD_VERSION = "1.1"; // Set this to the version of your mod.
|
|
|
public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
|
|
public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
|
|
|
|
|
|
|
|
|
|
+ public const string RPCSetPodInUse = "SetPodInUse";
|
|
|
|
|
+ public const string RPCBeam = "Beam";
|
|
|
|
|
+
|
|
|
public override IGadgetConfigMenu GetConfigMenu() { return null; }
|
|
public override IGadgetConfigMenu GetConfigMenu() { return null; }
|
|
|
protected override void LoadConfig() { Config.Reset(); Config.Save(); }
|
|
protected override void LoadConfig() { Config.Reset(); Config.Save(); }
|
|
|
|
|
|
|
@@ -39,7 +41,7 @@ namespace StasisPod
|
|
|
|
|
|
|
|
tile.OnInteract += OnInteractPod;
|
|
tile.OnInteract += OnInteractPod;
|
|
|
|
|
|
|
|
- GadgetCoreAPI.RegisterCustomRPC("SetPodInUse", delegate (object[] args)
|
|
|
|
|
|
|
+ GadgetCoreAPI.RegisterCustomRPC(RPCSetPodInUse, delegate (object[] args)
|
|
|
{
|
|
{
|
|
|
StasisPodScript.CallEventSetRPC(args);
|
|
StasisPodScript.CallEventSetRPC(args);
|
|
|
});
|
|
});
|
|
@@ -84,7 +86,6 @@ namespace StasisPod
|
|
|
public static readonly FieldInfo interactingField = typeof(PlayerScript).GetField("interacting", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
public static readonly FieldInfo interactingField = typeof(PlayerScript).GetField("interacting", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
public static readonly FieldInfo rField = typeof(PlayerScript).GetField("r", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
public static readonly FieldInfo rField = typeof(PlayerScript).GetField("r", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
public static readonly FieldInfo tField = typeof(PlayerScript).GetField("t", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
public static readonly FieldInfo tField = typeof(PlayerScript).GetField("t", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
- //public static readonly FieldInfo interactingField = typeof(PlayerScript).GetField("interacting", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
|
|
|
|
|
private IEnumerator OnInteractPod()
|
|
private IEnumerator OnInteractPod()
|
|
|
{
|
|
{
|
|
@@ -96,13 +97,12 @@ namespace StasisPod
|
|
|
var setUse = !PlayerScript.beamed;
|
|
var setUse = !PlayerScript.beamed;
|
|
|
PlayerScript.beamed = setUse;
|
|
PlayerScript.beamed = setUse;
|
|
|
InstanceTracker.PlayerScript.GetComponent<Collider>().enabled = !setUse;
|
|
InstanceTracker.PlayerScript.GetComponent<Collider>().enabled = !setUse;
|
|
|
- podScript.StartCallSet(setUse);
|
|
|
|
|
|
|
+ podScript.UpdateInUse(setUse);
|
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).detectCollisions = !setUse;
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).detectCollisions = !setUse;
|
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).useGravity = !setUse;
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).useGravity = !setUse;
|
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).velocity = new Vector3(0f, 0f, 0f);
|
|
((Rigidbody)rField.GetValue(InstanceTracker.PlayerScript)).velocity = new Vector3(0f, 0f, 0f);
|
|
|
((Transform)tField.GetValue(InstanceTracker.PlayerScript)).position = new Vector3(PlayerScript.curInteractObj.transform.position.x, PlayerScript.curInteractObj.transform.position.y, 0f);
|
|
((Transform)tField.GetValue(InstanceTracker.PlayerScript)).position = new Vector3(PlayerScript.curInteractObj.transform.position.x, PlayerScript.curInteractObj.transform.position.y, 0f);
|
|
|
- //InstanceTracker.PlayerScript.playerTrigger.portal = null;
|
|
|
|
|
- InstanceTracker.PlayerScript.GetComponent<NetworkView>().RPC("Beam", RPCMode.All, new object[] { setUse ? 0 : 1 });
|
|
|
|
|
|
|
+ InstanceTracker.PlayerScript.GetComponent<NetworkView>().RPC(RPCBeam, RPCMode.All, new object[] { setUse ? 0 : 1 });
|
|
|
InstanceTracker.PlayerScript.w.SetActive(true);
|
|
InstanceTracker.PlayerScript.w.SetActive(true);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|