Upload from upload_mods.ps1
This commit is contained in:
296
Harmony/Harmony_XUiC_ContainerStandardControls.cs
Normal file
296
Harmony/Harmony_XUiC_ContainerStandardControls.cs
Normal file
@@ -0,0 +1,296 @@
|
||||
namespace Harmony.XUiC
|
||||
{
|
||||
public class XUiC_ContainerStandardControlsPatches
|
||||
{
|
||||
/*[HarmonyPatch(typeof(XUiC_ContainerStandardControls))]
|
||||
[HarmonyPatch("LockedSlots")]
|
||||
[HarmonyPatch(MethodType.Getter)]
|
||||
public static class LockedSlotsPatch
|
||||
{
|
||||
public static void Postfix(XUiC_ContainerStandardControls __instance, bool[] __result)
|
||||
{
|
||||
if (__instance.xui.playerUI.entityPlayer.bag.LockedSlots != null)
|
||||
{
|
||||
for (int i = 0; i < __instance.xui.playerUI.entityPlayer.bag.LockedSlots.Length; i++)
|
||||
{
|
||||
if (__instance.xui.playerUI.entityPlayer.bag.LockedSlots[i])
|
||||
{
|
||||
Log.Out("XUiC_ContainerStandardControlsPatches-LockedSlots SLOT #" + (i + 1) + " IS LOCKED");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void QuickStackOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackOnClick START");
|
||||
|
||||
//bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
//bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
//bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isClient)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageQuickStack>().Setup(primaryPlayer.entityId, false), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, false);
|
||||
}
|
||||
/*if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackOnClick NOT Client");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, false);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackOnClick IS Client");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, false, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackOnClick IS P2P Host");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, false, true);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public static void QuickStackMineOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackMineOnClick START");
|
||||
|
||||
//bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
//bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
//bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isClient)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageQuickStack>().Setup(primaryPlayer.entityId, true), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, true);
|
||||
}
|
||||
/*if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackMineOnClick NOT Client");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, true);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackMineOnClick IS Client");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, true, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-QuickStackMineOnClick IS P2P Host");
|
||||
RebirthUtilities.QuickStackOnClick(primaryPlayer, true, true);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public static void DumpFollowerDownOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerDownOnClick START");
|
||||
|
||||
bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerDownOnClick NOT Client");
|
||||
RebirthUtilities.DumpFollowerDown(primaryPlayer);
|
||||
RebirthUtilities.DumpDroneDown(primaryPlayer);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerDownOnClick IS Client");
|
||||
RebirthUtilities.DumpFollowerDown(primaryPlayer, true);
|
||||
RebirthUtilities.DumpDroneDown(primaryPlayer, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerDownOnClick IS P2P Host");
|
||||
RebirthUtilities.DumpFollowerDown(primaryPlayer, true);
|
||||
RebirthUtilities.DumpDroneDown(primaryPlayer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DumpFollowerUpOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerUpOnClick START");
|
||||
|
||||
bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerUpOnClick NOT Client");
|
||||
RebirthUtilities.DumpFollowerUp(primaryPlayer);
|
||||
RebirthUtilities.DumpDroneUp(primaryPlayer);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerUpOnClick IS Client");
|
||||
RebirthUtilities.DumpFollowerUp(primaryPlayer, true);
|
||||
RebirthUtilities.DumpDroneUp(primaryPlayer, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpFollowerUpOnClick IS P2P Host");
|
||||
RebirthUtilities.DumpFollowerUp(primaryPlayer, true);
|
||||
RebirthUtilities.DumpDroneUp(primaryPlayer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DumpVehicleDownOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleDownOnClick START");
|
||||
|
||||
bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleDownOnClick NOT Client");
|
||||
RebirthUtilities.DumpVehicleDown(primaryPlayer);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleDownOnClick IS Client");
|
||||
RebirthUtilities.DumpVehicleDown(primaryPlayer, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleDownOnClick IS P2P Host");
|
||||
RebirthUtilities.DumpVehicleDown(primaryPlayer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DumpVehicleUpOnClick()
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleUpOnClick START");
|
||||
|
||||
bool isDedicated = GameManager.IsDedicatedServer;
|
||||
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
|
||||
bool isSinglePlayer = SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer;
|
||||
bool isServer = ConnectionManager.Instance.IsServer;
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (isSinglePlayer)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleUpOnClick NOT Client");
|
||||
RebirthUtilities.DumpVehicleUp(primaryPlayer);
|
||||
}
|
||||
else if (isClient)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleUpOnClick IS Client");
|
||||
RebirthUtilities.DumpVehicleUp(primaryPlayer, true);
|
||||
}
|
||||
else if (isServer && !isDedicated)
|
||||
{
|
||||
//Log.Out("XUiC_ContainerStandardControlsPatches-DumpVehicleUpOnClick IS P2P Host");
|
||||
RebirthUtilities.DumpVehicleUp(primaryPlayer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(XUiC_ContainerStandardControls))]
|
||||
[HarmonyPatch("Init")]
|
||||
public class InitPatch
|
||||
{
|
||||
public static void Postfix(XUiC_ContainerStandardControls __instance
|
||||
)
|
||||
{
|
||||
XUiController childById = __instance.GetChildById("btnMoveQuickStack");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
QuickStackOnClick();
|
||||
};
|
||||
}
|
||||
|
||||
childById = __instance.GetChildById("btnMoveQuickStackMine");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
QuickStackMineOnClick();
|
||||
};
|
||||
}
|
||||
|
||||
childById = __instance.GetChildById("btnMoveVehicleDown");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
DumpVehicleDownOnClick();
|
||||
};
|
||||
}
|
||||
|
||||
childById = __instance.GetChildById("btnMoveVehicleUp");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
DumpVehicleUpOnClick();
|
||||
};
|
||||
}
|
||||
|
||||
childById = __instance.GetChildById("btnMoveFollowerDown");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
DumpFollowerDownOnClick();
|
||||
};
|
||||
}
|
||||
|
||||
childById = __instance.GetChildById("btnMoveFollowerUp");
|
||||
if (childById != null)
|
||||
{
|
||||
childById.OnPress += delegate (XUiController _sender, int _args)
|
||||
{
|
||||
DumpFollowerUpOnClick();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user