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

feat: Speaker Toy #250

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
17c64b3
Merge branch 'ExMod-Team:scpsl14' into scpsl14
NotZer0Two Nov 27, 2024
269c2be
FIrst
NotZer0Two Nov 28, 2024
3498248
Completed the Speaker API Wrapper w/ NotZer0Two
NotZer0Two Nov 29, 2024
511a504
Merge pull request #1 from Site-12/toysupdate
NotZer0Two Nov 30, 2024
9532760
dwadadad
SticksDeveloper Nov 30, 2024
7b71da0
IT WORKS
SticksDeveloper Nov 30, 2024
34110a4
Merge pull request #2 from Site-12/toysupdate
NotZer0Two Nov 30, 2024
222778b
Made isPlaying public for everyone to see
SticksDeveloper Dec 1, 2024
55f3ffa
Outdated Documentation
SticksDeveloper Dec 1, 2024
4c7d237
Merge pull request #3 from Site-12/toysupdate
NotZer0Two Dec 1, 2024
61e15a6
Fixes
NotZer0Two Dec 1, 2024
bc7e84b
Merge remote-tracking branch 'origin/toysupdate' into toysupdate
NotZer0Two Dec 1, 2024
a1186bc
Fixes
NotZer0Two Dec 1, 2024
e723806
BroadcastTo and removed Info Messages
NotZer0Two Dec 1, 2024
9e4575c
Made all the required changes
SticksDeveloper Dec 5, 2024
1a39261
Merge pull request #4 from Site-12/toysupdate
NotZer0Two Dec 6, 2024
461ce94
Speaker Prefab
NotZer0Two Dec 8, 2024
5321aa9
Hoping i fixed them
NotZer0Two Dec 8, 2024
4ae034f
Hoping that i fixed it
NotZer0Two Dec 8, 2024
c9ae12c
Merge branch 'scpsl14' into toysupdate
NotZer0Two Dec 8, 2024
f323cef
Conflits + Error Build Solved
NotZer0Two Dec 8, 2024
3614921
Removed Round.IsEnded
NotZer0Two Dec 10, 2024
1a0f639
Round Restarting For admintoys
NotZer0Two Dec 10, 2024
6fc52e8
Build Error fixed
NotZer0Two Dec 10, 2024
391846b
Updated the Create method, we don't need to have Scale, or Rotation.
SticksDeveloper Dec 10, 2024
da25416
Merge pull request #5 from Site-12/toysupdate
NotZer0Two Dec 10, 2024
7f7d066
Merge branch 'scpsl14' into toysupdate
VALERA771 Dec 22, 2024
8c69fdf
Merge Dev Branch To PR/250
louis1706 Dec 30, 2024
0ee371c
Apply suggestions from code review
louis1706 Dec 30, 2024
b81d2e3
fix
louis1706 Dec 30, 2024
e95b978
ReAdd This Method
louis1706 Dec 30, 2024
3b34af6
Merge branch 'dev' into toysupdate
VALERA771 Jan 1, 2025
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
40 changes: 40 additions & 0 deletions EXILED/Exiled.API/Features/Toys/Speaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
// </copyright>
// -----------------------------------------------------------------------

using System.IO;

Check failure on line 8 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)

Check failure on line 8 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)
using UnityEngine;

Check failure on line 9 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Check failure on line 9 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)

Check failure on line 9 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Check failure on line 9 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)
using VoiceChat;

Check failure on line 10 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)

Check failure on line 10 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)
using VoiceChat.Networking;

Check failure on line 11 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)
using VoiceChat.Playbacks;

Check failure on line 12 in EXILED/Exiled.API/Features/Toys/Speaker.cs

View workflow job for this annotation

GitHub Actions / build

Using directive should appear within a namespace declaration (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md)

namespace Exiled.API.Features.Toys
{
using AdminToys;
Expand Down Expand Up @@ -80,5 +86,39 @@
get => Base.NetworkMinDistance;
set => Base.NetworkMinDistance = value;
}

/// <summary>
/// Creates a new <see cref="Speaker"/>.
/// </summary>
/// <param name="position">The position of the <see cref="Speaker"/>.</param>
/// <param name="rotation">The rotation of the <see cref="Speaker"/>.</param>
/// <param name="scale">The scale of the <see cref="Speaker"/>.</param>
/// <param name="spawn">Whether the <see cref="Speaker"/> should be initially spawned.</param>
/// <returns>The new <see cref="Speaker"/>.</returns>
public static Speaker Create(Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/)
{
Speaker speaker = new(UnityEngine.Object.Instantiate(ToysHelper.Speaker))
{
Position = position ?? Vector3.zero,
Rotation = Quaternion.Euler(rotation ?? Vector3.zero),
Scale = scale ?? Vector3.one,
};

if (spawn)
speaker.Spawn();

speaker.Base.Playback = new SpeakerToyPlaybackBase();
speaker.Base.Playback.Buffer = new PlaybackBuffer();

return speaker;
}

/// <summary>
/// Todo.
/// </summary>
public void Play()
{
// TODO
}
}
}
24 changes: 24 additions & 0 deletions EXILED/Exiled.API/Features/Toys/ToysHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static class ToysHelper
private static ShootingTarget sportShootingTargetObject;
private static ShootingTarget dboyShootingTargetObject;
private static ShootingTarget binaryShootingTargetObject;
private static SpeakerToy speakerObject;

/// <summary>
/// Gets the base <see cref="PrimitiveObjectToy"/> to instantiate when creating a new primitive.
Expand Down Expand Up @@ -138,5 +139,28 @@ public static ShootingTarget BinaryShootingTargetObject
return binaryShootingTargetObject;
}
}

/// <summary>
/// Gets the base <see cref="Speaker"/> to instantiate when creating a new speaker.
/// </summary>
public static SpeakerToy Speaker
{
get
{
if (speakerObject is null)
{
foreach (GameObject gameObject in NetworkClient.prefabs.Values)
{
if ((gameObject.name == "SpeakerToy") && gameObject.TryGetComponent(out SpeakerToy shootingTarget))
NotZer0Two marked this conversation as resolved.
Show resolved Hide resolved
{
speakerObject = shootingTarget;
break;
}
}
}

return speakerObject;
}
}
}
}