mirror of
https://github.com/TheJordanDev/PEAK-JordanMod.git
synced 2026-10-17 08:05:25 +02:00
0.1.6 | Added: StashedBugle
This commit is contained in:
@@ -28,3 +28,8 @@
|
|||||||
|
|
||||||
- Added OpenMesaModule and OpenMesaPatch
|
- Added OpenMesaModule and OpenMesaPatch
|
||||||
- OpenMesaPatch makes it so that the Mesa biome is open no matter the seed.
|
- OpenMesaPatch makes it so that the Mesa biome is open no matter the seed.
|
||||||
|
|
||||||
|
# v0.1.6 | Stashed Bugle
|
||||||
|
|
||||||
|
- Added StashedBugleModule
|
||||||
|
- StashedBugleModule adds a new keybind to toggle give / remove a Bugle.
|
||||||
@@ -13,6 +13,9 @@ public static class ConfigHandler
|
|||||||
// Better Airport
|
// Better Airport
|
||||||
public static ConfigEntry<float> ConveyorSpeedModifier { get; private set; } = null!;
|
public static ConfigEntry<float> ConveyorSpeedModifier { get; private set; } = null!;
|
||||||
|
|
||||||
|
// Stashed Bugle settings
|
||||||
|
public static ConfigEntry<KeyCode> ToggleBugle { get; private set; } = null!;
|
||||||
|
|
||||||
public static void Initialize(ConfigFile configFile)
|
public static void Initialize(ConfigFile configFile)
|
||||||
{
|
{
|
||||||
Config = configFile;
|
Config = configFile;
|
||||||
@@ -35,6 +38,14 @@ public static class ConfigHandler
|
|||||||
new AcceptableValueRange<float>(0.1f, 100f)
|
new AcceptableValueRange<float>(0.1f, 100f)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Stashed Bugle settings
|
||||||
|
ToggleBugle = Config.Bind(
|
||||||
|
"Control",
|
||||||
|
"ToggleBugle",
|
||||||
|
KeyCode.V,
|
||||||
|
new ConfigDescription("Give / destroy Bugle")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<!-- This is the display name of your mod. Example: BepInEx Template -->
|
<!-- This is the display name of your mod. Example: BepInEx Template -->
|
||||||
<AssemblyTitle>JordanMod</AssemblyTitle>
|
<AssemblyTitle>JordanMod</AssemblyTitle>
|
||||||
<!-- This is the version number of your mod. -->
|
<!-- This is the version number of your mod. -->
|
||||||
<Version>0.1.5</Version>
|
<Version>0.1.6</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
61
src/JordanMod/modules/stashed_bugle/StashedBugleModule.cs
Normal file
61
src/JordanMod/modules/stashed_bugle/StashedBugleModule.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using Zorro.Core;
|
||||||
|
|
||||||
|
namespace JordanMod.Modules.StashedBugle;
|
||||||
|
|
||||||
|
[Module(Enabled = true)]
|
||||||
|
class StashedBugleModule : Module
|
||||||
|
{
|
||||||
|
public override string ModuleName => "Stashed Bugle Module";
|
||||||
|
|
||||||
|
private readonly string _bugleItemName = "Bugle";
|
||||||
|
private readonly string _megaphoneItemName = "Megaphone";
|
||||||
|
|
||||||
|
private float? lastPressTime = null;
|
||||||
|
|
||||||
|
public override void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(ConfigHandler.ToggleBugle.Value)) ToggleBugle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleBugle()
|
||||||
|
{
|
||||||
|
if (lastPressTime == null || Time.time - lastPressTime > 1f) lastPressTime = Time.time;
|
||||||
|
else return;
|
||||||
|
|
||||||
|
Character localCharacter = Character.localCharacter;
|
||||||
|
if (localCharacter == null) return;
|
||||||
|
|
||||||
|
Item heldItem = localCharacter.data.currentItem;
|
||||||
|
if (heldItem != null)
|
||||||
|
{
|
||||||
|
if (heldItem.UIData.itemName == _bugleItemName)
|
||||||
|
{
|
||||||
|
localCharacter.refs.items.DestroyHeldItemRpc();
|
||||||
|
localCharacter.player.EmptySlot(localCharacter.refs.items.currentSelectedSlot);
|
||||||
|
localCharacter.player.RPCRemoveItemFromSlot(localCharacter.refs.items.currentSelectedSlot.Value);
|
||||||
|
|
||||||
|
localCharacter.refs.items.SpawnItemInHand(_megaphoneItemName);
|
||||||
|
}
|
||||||
|
else if (heldItem.UIData.itemName == _megaphoneItemName)
|
||||||
|
{
|
||||||
|
localCharacter.refs.items.DestroyHeldItemRpc();
|
||||||
|
localCharacter.player.EmptySlot(localCharacter.refs.items.currentSelectedSlot);
|
||||||
|
localCharacter.player.RPCRemoveItemFromSlot(localCharacter.refs.items.currentSelectedSlot.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (heldItem == null)
|
||||||
|
{
|
||||||
|
ItemSlot? withBugleSlot = null;
|
||||||
|
for (int i = 0; i < CharacterItems.MAX_SLOT; i++)
|
||||||
|
{
|
||||||
|
ItemSlot itemSlot = localCharacter.player.GetItemSlot((byte)i);
|
||||||
|
if (itemSlot == null || itemSlot.prefab == null || itemSlot.prefab.UIData == null || itemSlot.prefab.UIData.itemName != _bugleItemName) continue;
|
||||||
|
withBugleSlot = itemSlot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (withBugleSlot == null) localCharacter.refs.items.SpawnItemInHand(_bugleItemName);
|
||||||
|
else localCharacter.refs.items.EquipSlot(Optionable<byte>.Some(withBugleSlot.itemSlotID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user