diff --git a/.idea/.idea.SillySCP/.idea/codeStyles/codeStyleConfig.xml b/.idea/.idea.SillySCP/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/.idea.SillySCP/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/SillySCP/API/Features/ExclusiveColorSetting.cs b/SillySCP/API/Settings/ExclusiveColorSetting.cs similarity index 97% rename from SillySCP/API/Features/ExclusiveColorSetting.cs rename to SillySCP/API/Settings/ExclusiveColorSetting.cs index e1bd6bf..71b7735 100644 --- a/SillySCP/API/Features/ExclusiveColorSetting.cs +++ b/SillySCP/API/Settings/ExclusiveColorSetting.cs @@ -3,7 +3,7 @@ using SecretAPI.Features.UserSettings; using SillySCP.API.Modules; -namespace SillySCP.API.Features +namespace SillySCP.API.Settings { public class ExclusiveColorSetting : CustomDropdownSetting { diff --git a/SillySCP/API/Settings/JailbirdSetting.cs b/SillySCP/API/Settings/JailbirdSetting.cs new file mode 100644 index 0000000..7a31d81 --- /dev/null +++ b/SillySCP/API/Settings/JailbirdSetting.cs @@ -0,0 +1,22 @@ +using LabApi.Features.Wrappers; +using SecretAPI.Features.UserSettings; +using SillySCP.API.Modules; + +namespace SillySCP.API.Settings +{ + public class JailbirdSetting : CustomTwoButtonSetting + { + public const int SettingId = 837; + + public JailbirdSetting() + : base(SettingId, "Meow on Jailbird swing", "Yes", "No", hint: "When you or someone else swings the jailbird, should you hear the meow?") + {} + + protected override CustomSetting CreateDuplicate() => new JailbirdSetting(); + + public override CustomHeader Header { get; } = SSSSModule.Header; + + protected override void HandleSettingUpdate(Player player) + {} + } +} \ No newline at end of file diff --git a/SillySCP/API/Features/StruggleSetting.cs b/SillySCP/API/Settings/StruggleSetting.cs similarity index 99% rename from SillySCP/API/Features/StruggleSetting.cs rename to SillySCP/API/Settings/StruggleSetting.cs index 9e9ed24..be3ad3c 100644 --- a/SillySCP/API/Features/StruggleSetting.cs +++ b/SillySCP/API/Settings/StruggleSetting.cs @@ -17,7 +17,7 @@ using Player = LabApi.Features.Wrappers.Player; using Scp3114Role = Exiled.API.Features.Roles.Scp3114Role; -namespace SillySCP.API.Features +namespace SillySCP.API.Settings { public class StruggleSetting : CustomKeybindSetting { diff --git a/SillySCP/Handlers/SSSSHandler.cs b/SillySCP/Handlers/SSSSHandler.cs index fcd9551..789c031 100644 --- a/SillySCP/Handlers/SSSSHandler.cs +++ b/SillySCP/Handlers/SSSSHandler.cs @@ -1,9 +1,16 @@ -using Exiled.Events.EventArgs.Player; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Player; +using PlayerRoles.PlayableScps.Scp079.Cameras; using SecretAPI.Features.UserSettings; -using SillySCP.API.Features; using SillySCP.API.Interfaces; using SillySCP.API.Modules; +using SillySCP.API.Settings; +using UnityEngine; using UserSettings.ServerSpecific; +using Camera = Exiled.API.Features.Camera; namespace SillySCP.Handlers { @@ -14,12 +21,51 @@ public void Init() Exiled.Events.Handlers.Player.Verified += OnVerified; ServerSpecificSettingsSync.ServerOnSettingValueReceived += SettingRecieved; - CustomSetting.Register(new ExclusiveColorSetting(), new StruggleSetting()); + CustomSetting.Register(new ExclusiveColorSetting(), new StruggleSetting(), new JailbirdSetting()); + + // jailbird handler + + Exiled.Events.Handlers.Item.Swinging += OnJailbirdSwing; + + string sillyAudiosLocation = Path.Combine(Paths.Configs, "Silly Audios"); + + AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "kali 1.ogg"), "meow 1"); + AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "kali 2.ogg"), "meow 2"); + AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "cyn 1.ogg"), "meow 3"); + AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "cyn 2.ogg"), "meow 4"); } public void Unregister() { Exiled.Events.Handlers.Player.Verified -= OnVerified; + + Exiled.Events.Handlers.Item.Swinging -= OnJailbirdSwing; + } + + private void OnJailbirdEvent(Exiled.API.Features.Player player) + { + AudioPlayer audioPlayer = AudioPlayer.CreateOrGet($"Jailbird {player.Nickname}", + condition: hub => + { + LabApi.Features.Wrappers.Player plr = LabApi.Features.Wrappers.Player.Get(hub); + if (plr == null) return true; + JailbirdSetting setting = CustomSetting.GetPlayerSetting(JailbirdSetting.SettingId, plr); + return setting == null || setting.IsOptionA; + }, + onIntialCreation: p => + { + p.transform.parent = player.Transform; + Speaker speaker = p.AddSpeaker("Jailbird Speaker", isSpatial: true, minDistance: 5f, maxDistance: 15f); + speaker.transform.parent = player.Transform; + speaker.transform.localPosition = Vector3.zero; + } + ); + audioPlayer.AddClip(AudioClipStorage.AudioClips.Values.GetRandomValue(data => data.Name.Contains("meow")).Name, 3); + } + + private void OnJailbirdSwing(SwingingEventArgs ev) + { + OnJailbirdEvent(ev.Player); } private void OnVerified(VerifiedEventArgs ev) diff --git a/SillySCP/Patches/RueISendHint.cs b/SillySCP/Patches/RueISendHint.cs index 4a5a1d8..c6a51ee 100644 --- a/SillySCP/Patches/RueISendHint.cs +++ b/SillySCP/Patches/RueISendHint.cs @@ -1,7 +1,7 @@ using HarmonyLib; using Hints; using RueI; -using SillySCP.API.Features; +using SillySCP.API.Settings; namespace SillySCP.Patches { diff --git a/SillySCP/Patches/SkeletonDamageStrangle.cs b/SillySCP/Patches/SkeletonDamageStrangle.cs index a4c1003..befcea0 100644 --- a/SillySCP/Patches/SkeletonDamageStrangle.cs +++ b/SillySCP/Patches/SkeletonDamageStrangle.cs @@ -1,6 +1,7 @@ using HarmonyLib; using PlayerRoles.PlayableScps.Scp3114; using SillySCP.API.Features; +using SillySCP.API.Settings; namespace SillySCP.Patches { diff --git a/SillySCP/Patches/SkeletonStrangle.cs b/SillySCP/Patches/SkeletonStrangle.cs index 1bb25d1..dcb2c3f 100644 --- a/SillySCP/Patches/SkeletonStrangle.cs +++ b/SillySCP/Patches/SkeletonStrangle.cs @@ -1,13 +1,8 @@ -using CustomPlayerEffects; -using Exiled.API.Features; -using HarmonyLib; +using HarmonyLib; using LabApi.Features.Wrappers; using PlayerRoles.PlayableScps.Scp3114; -using PlayerRoles.Subroutines; -using RueI.Elements; using SecretAPI.Features.UserSettings; -using SillySCP.API.Features; -using Utils.NonAllocLINQ; +using SillySCP.API.Settings; using Player = LabApi.Features.Wrappers.Player; namespace SillySCP.Patches diff --git a/SillySCP/Patches/SnakePatch.cs b/SillySCP/Patches/SnakePatch.cs index 9cad20f..e5b38a1 100644 --- a/SillySCP/Patches/SnakePatch.cs +++ b/SillySCP/Patches/SnakePatch.cs @@ -7,7 +7,6 @@ using InventorySystem.Items.Keycards.Snake; using static HarmonyLib.AccessTools; using MEC; -using Mirror; namespace SillySCP.Patches { diff --git a/SillySCP/SillySCP.csproj b/SillySCP/SillySCP.csproj index a410644..4da7d45 100644 --- a/SillySCP/SillySCP.csproj +++ b/SillySCP/SillySCP.csproj @@ -12,6 +12,7 @@ embedded + @@ -19,8 +20,12 @@ - + + + + +