Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXILED::API] Adding SpawnMice #2765

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static class Map
internal static readonly List<AdminToy> ToysValue = new();

private static AmbientSoundPlayer ambientSoundPlayer;
private static SqueakSpawner squeakSpawner;

/// <summary>
/// Gets a value indicating whether decontamination has begun in the light containment zone.
Expand Down Expand Up @@ -99,6 +100,11 @@ public static int Seed
/// </summary>
public static AmbientSoundPlayer AmbientSoundPlayer => ambientSoundPlayer ??= ReferenceHub.HostHub.GetComponent<AmbientSoundPlayer>();

/// <summary>
/// Gets the <see cref="global::SqueakSpawner"/>.
/// </summary>
public static SqueakSpawner SqueakSpawner => squeakSpawner ??= Object.FindObjectOfType<SqueakSpawner>();

/// <summary>
/// Broadcasts a message to all <see cref="Player">players</see>.
/// </summary>
Expand Down Expand Up @@ -353,6 +359,19 @@ public static void PlayGunSound(Vector3 position, ItemType firearmType, byte max
msg.SendToAuthenticated();
}

/// <summary>
/// Spawns mice inside the <see cref="RoomType.EzShelter"/>.
/// </summary>
/// <param name="mice">The type of mice you want to spawn..</param>
public static void SpawnMice(byte mice = 1)
{
if (mice > SqueakSpawner.mice.Length)
throw new ArgumentOutOfRangeException($"Mouse type must be between 1 and {SqueakSpawner.mice.Length}.");

SqueakSpawner.NetworksyncSpawn = mice;
SqueakSpawner.SyncMouseSpawn(0, SqueakSpawner.NetworksyncSpawn);
}

/// <summary>
/// Clears the lazy loading game object cache.
/// </summary>
Expand Down
Loading