mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
fix pls????
This commit is contained in:
1 parent
09ce9f7cfb
commit
0b36939858
3 files changed
+18
-9
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
using MiraAPI.GameOptions;
|
using MiraAPI.GameOptions;
|
||||||
using MiraAPI.GameOptions.OptionTypes;
|
using MiraAPI.GameOptions.OptionTypes;
|
||||||
|
using Reactor.Utilities;
|
||||||
|
|
||||||
namespace MiraAPI.Example.Options;
|
namespace MiraAPI.Example.Options;
|
||||||
|
|
||||||
@@ -11,17 +12,20 @@ public class ExampleOptions2 : AbstractOptionGroup
|
|||||||
|
|
||||||
public ModdedToggleOption ToggleOpt2 { get; } = new("Toggle Option 2", false)
|
public ModdedToggleOption ToggleOpt2 { get; } = new("Toggle Option 2", false)
|
||||||
{
|
{
|
||||||
Visible = () => OptionGroupSingleton<ExampleOptions2>.Instance.ToggleOpt1.Value
|
Visible = () => OptionGroupSingleton<ExampleOptions2>.Instance.ToggleOpt1.Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
public ModdedStringOption StringOpt { get; } = new("String Opt", 0, ["Choice 1", "Choice 2", "Choice 3"]);
|
public ModdedStringOption StringOpt { get; } = new("String Opt", 0, ["Choice 1", "Choice 2", "Choice 3"]);
|
||||||
|
|
||||||
public ModdedEnumOption EnumOpt { get; } = new("Enum Opt", 0, typeof(TestingEnum));
|
public ModdedEnumOption EnumOpt { get; } = new("Enum Opt", 0, typeof(TestingData))
|
||||||
|
{
|
||||||
|
ChangedEvent = x => Logger<ExamplePlugin>.Info($"changed Enum Opt to {x}"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TestingEnum
|
public enum TestingData
|
||||||
{
|
{
|
||||||
Happy,
|
Happy,
|
||||||
Sad,
|
Sad,
|
||||||
Neutral
|
Neutral,
|
||||||
}
|
}
|
||||||
@@ -20,4 +20,4 @@ public class TeleporterOptions : AbstractOptionGroup
|
|||||||
|
|
||||||
[ModdedNumberOption("Zoom Distance", 4, 15)]
|
[ModdedNumberOption("Zoom Distance", 4, 15)]
|
||||||
public float ZoomDistance { get; set; } = 6;
|
public float ZoomDistance { get; set; } = 6;
|
||||||
}
|
}
|
||||||
@@ -140,9 +140,9 @@ public static class ModifierManager
|
|||||||
{
|
{
|
||||||
var data = new List<NetData>();
|
var data = new List<NetData>();
|
||||||
|
|
||||||
foreach (var player in GameData.Instance.AllPlayers)
|
foreach (var player in PlayerControl.AllPlayerControls)
|
||||||
{
|
{
|
||||||
data.Add(GetPlayerModifiers(player.Object));
|
data.Add(GetPlayerModifiers(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rpc<SyncModifiersRpc>.Instance.SendTo(PlayerControl.LocalPlayer, targetId, [.. data]);
|
Rpc<SyncModifiersRpc>.Instance.SendTo(PlayerControl.LocalPlayer, targetId, [.. data]);
|
||||||
@@ -178,8 +178,13 @@ public static class ModifierManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NetData GetPlayerModifiers(PlayerControl player)
|
private static NetData GetPlayerModifiers(PlayerControl? player)
|
||||||
{
|
{
|
||||||
|
if (player == null || !player)
|
||||||
|
{
|
||||||
|
return new NetData(0, []);
|
||||||
|
}
|
||||||
|
|
||||||
List<byte> bytes = [];
|
List<byte> bytes = [];
|
||||||
var modifierComponent = player.GetComponent<ModifierComponent>();
|
var modifierComponent = player.GetComponent<ModifierComponent>();
|
||||||
if (modifierComponent == null || !modifierComponent)
|
if (modifierComponent == null || !modifierComponent)
|
||||||
|
|||||||
Reference in new issue
Block a user