mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Bug fixes and new teleport button
This commit is contained in:
1 parent
acf1d44b52
commit
2f09baa371
5 files changed
+22
-7
No files matched your search
@@ -19,7 +19,7 @@ public class TeleportButton : CustomActionButton
|
||||
|
||||
public override int MaxUses => 0;
|
||||
|
||||
public override LoadableAsset<Sprite> Sprite => ExampleAssets.ExampleButton;
|
||||
public override LoadableAsset<Sprite> Sprite => ExampleAssets.TeleportButton;
|
||||
public static bool IsZoom { get; private set; }
|
||||
|
||||
public override bool Enabled(RoleBehaviour role)
|
||||
|
||||
@@ -5,5 +5,8 @@ namespace MiraAPI.Example;
|
||||
public static class ExampleAssets
|
||||
{
|
||||
public static LoadableResourceAsset ExampleButton { get; } = new("MiraAPI.Example.Resources.ExampleButton.png");
|
||||
|
||||
// Credit to EpicHorrors for the teleport button asset.
|
||||
public static LoadableResourceAsset TeleportButton { get; } = new("MiraAPI.Example.Resources.TeleportButton.png");
|
||||
public static LoadableResourceAsset Banner { get; } = new("MiraAPI.Example.Resources.FortniteBanner.jpeg");
|
||||
}
|
||||
@@ -9,6 +9,9 @@
|
||||
<Description>Example mod for Mira API</Description>
|
||||
<Authors>Angxl, XtraCube</Authors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\TeleportButton.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Reactor" Version="2.3.1" />
|
||||
@@ -28,6 +31,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\ExampleButton.png" />
|
||||
<EmbeddedResource Include="Resources\FortniteBanner.jpeg" />
|
||||
<EmbeddedResource Include="Resources\TeleportButton.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -36,16 +36,24 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
|
||||
public void FixedUpdate()
|
||||
{
|
||||
if (ActiveModifiers is null) return;
|
||||
|
||||
foreach (var modifier in ActiveModifiers)
|
||||
{
|
||||
if (modifier is null) continue;
|
||||
|
||||
modifier.FixedUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (ActiveModifiers is null) return;
|
||||
|
||||
foreach (var modifier in ActiveModifiers)
|
||||
{
|
||||
if (modifier is null) continue;
|
||||
|
||||
modifier.Update();
|
||||
}
|
||||
|
||||
@@ -81,7 +89,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
Logger<MiraApiPlugin>.Error($"Cannot remove modifier {type.Name} because it is not active.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RemoveModifier(modifier);
|
||||
}
|
||||
|
||||
@@ -99,7 +107,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
Logger<MiraApiPlugin>.Error($"Cannot remove modifier with id {modifierId} because it is not active.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RemoveModifier(modifier);
|
||||
}
|
||||
|
||||
@@ -110,7 +118,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
Logger<MiraApiPlugin>.Error($"Cannot remove modifier {modifier.ModifierName} because it is not active on this player.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
modifier.OnDeactivate();
|
||||
ActiveModifiers.Remove(modifier);
|
||||
|
||||
@@ -127,7 +135,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
Logger<MiraApiPlugin>.Error($"Player already has modifier with id {modifier.ModifierId}!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
ActiveModifiers.Add(modifier);
|
||||
modifier.Player = player;
|
||||
modifier.ModifierId = ModifierManager.TypeToIdModifiers[modifier.GetType()];
|
||||
@@ -156,7 +164,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ActiveModifiers.Find(x=>x.ModifierId == modifierId) != null)
|
||||
if (ActiveModifiers.Find(x => x.ModifierId == modifierId) != null)
|
||||
{
|
||||
Logger<MiraApiPlugin>.Error($"Player already has modifier with id {modifierId}!");
|
||||
return null;
|
||||
@@ -171,7 +179,7 @@ public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
}
|
||||
|
||||
AddModifier(modifier);
|
||||
|
||||
|
||||
return modifier;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user