Skip to content

Commit 7fef4cb

Browse files
authored
Merge pull request #49 from sillyscp/meow-jailbird
2 parents c62e4d6 + 7cfb46a commit 7fef4cb

File tree

10 files changed

+88
-15
lines changed

10 files changed

+88
-15
lines changed

.idea/.idea.SillySCP/.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SillySCP/API/Features/ExclusiveColorSetting.cs renamed to SillySCP/API/Settings/ExclusiveColorSetting.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using SecretAPI.Features.UserSettings;
44
using SillySCP.API.Modules;
55

6-
namespace SillySCP.API.Features
6+
namespace SillySCP.API.Settings
77
{
88
public class ExclusiveColorSetting : CustomDropdownSetting
99
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using LabApi.Features.Wrappers;
2+
using SecretAPI.Features.UserSettings;
3+
using SillySCP.API.Modules;
4+
5+
namespace SillySCP.API.Settings
6+
{
7+
public class JailbirdSetting : CustomTwoButtonSetting
8+
{
9+
public const int SettingId = 837;
10+
11+
public JailbirdSetting()
12+
: base(SettingId, "Meow on Jailbird swing", "Yes", "No", hint: "When you or someone else swings the jailbird, should you hear the meow?")
13+
{}
14+
15+
protected override CustomSetting CreateDuplicate() => new JailbirdSetting();
16+
17+
public override CustomHeader Header { get; } = SSSSModule.Header;
18+
19+
protected override void HandleSettingUpdate(Player player)
20+
{}
21+
}
22+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using Player = LabApi.Features.Wrappers.Player;
1818
using Scp3114Role = Exiled.API.Features.Roles.Scp3114Role;
1919

20-
namespace SillySCP.API.Features
20+
namespace SillySCP.API.Settings
2121
{
2222
public class StruggleSetting : CustomKeybindSetting
2323
{

SillySCP/Handlers/SSSSHandler.cs

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
using Exiled.Events.EventArgs.Player;
1+
using Exiled.API.Enums;
2+
using Exiled.API.Extensions;
3+
using Exiled.API.Features;
4+
using Exiled.Events.EventArgs.Item;
5+
using Exiled.Events.EventArgs.Player;
6+
using PlayerRoles.PlayableScps.Scp079.Cameras;
27
using SecretAPI.Features.UserSettings;
3-
using SillySCP.API.Features;
48
using SillySCP.API.Interfaces;
59
using SillySCP.API.Modules;
10+
using SillySCP.API.Settings;
11+
using UnityEngine;
612
using UserSettings.ServerSpecific;
13+
using Camera = Exiled.API.Features.Camera;
714

815
namespace SillySCP.Handlers
916
{
@@ -14,12 +21,51 @@ public void Init()
1421
Exiled.Events.Handlers.Player.Verified += OnVerified;
1522
ServerSpecificSettingsSync.ServerOnSettingValueReceived += SettingRecieved;
1623

17-
CustomSetting.Register(new ExclusiveColorSetting(), new StruggleSetting());
24+
CustomSetting.Register(new ExclusiveColorSetting(), new StruggleSetting(), new JailbirdSetting());
25+
26+
// jailbird handler
27+
28+
Exiled.Events.Handlers.Item.Swinging += OnJailbirdSwing;
29+
30+
string sillyAudiosLocation = Path.Combine(Paths.Configs, "Silly Audios");
31+
32+
AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "kali 1.ogg"), "meow 1");
33+
AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "kali 2.ogg"), "meow 2");
34+
AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "cyn 1.ogg"), "meow 3");
35+
AudioClipStorage.LoadClip(Path.Combine(sillyAudiosLocation, "cyn 2.ogg"), "meow 4");
1836
}
1937

2038
public void Unregister()
2139
{
2240
Exiled.Events.Handlers.Player.Verified -= OnVerified;
41+
42+
Exiled.Events.Handlers.Item.Swinging -= OnJailbirdSwing;
43+
}
44+
45+
private void OnJailbirdEvent(Exiled.API.Features.Player player)
46+
{
47+
AudioPlayer audioPlayer = AudioPlayer.CreateOrGet($"Jailbird {player.Nickname}",
48+
condition: hub =>
49+
{
50+
LabApi.Features.Wrappers.Player plr = LabApi.Features.Wrappers.Player.Get(hub);
51+
if (plr == null) return true;
52+
JailbirdSetting setting = CustomSetting.GetPlayerSetting<JailbirdSetting>(JailbirdSetting.SettingId, plr);
53+
return setting == null || setting.IsOptionA;
54+
},
55+
onIntialCreation: p =>
56+
{
57+
p.transform.parent = player.Transform;
58+
Speaker speaker = p.AddSpeaker("Jailbird Speaker", isSpatial: true, minDistance: 5f, maxDistance: 15f);
59+
speaker.transform.parent = player.Transform;
60+
speaker.transform.localPosition = Vector3.zero;
61+
}
62+
);
63+
audioPlayer.AddClip(AudioClipStorage.AudioClips.Values.GetRandomValue(data => data.Name.Contains("meow")).Name, 3);
64+
}
65+
66+
private void OnJailbirdSwing(SwingingEventArgs ev)
67+
{
68+
OnJailbirdEvent(ev.Player);
2369
}
2470

2571
private void OnVerified(VerifiedEventArgs ev)

SillySCP/Patches/RueISendHint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using HarmonyLib;
22
using Hints;
33
using RueI;
4-
using SillySCP.API.Features;
4+
using SillySCP.API.Settings;
55

66
namespace SillySCP.Patches
77
{

SillySCP/Patches/SkeletonDamageStrangle.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using HarmonyLib;
22
using PlayerRoles.PlayableScps.Scp3114;
33
using SillySCP.API.Features;
4+
using SillySCP.API.Settings;
45

56
namespace SillySCP.Patches
67
{

SillySCP/Patches/SkeletonStrangle.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
using CustomPlayerEffects;
2-
using Exiled.API.Features;
3-
using HarmonyLib;
1+
using HarmonyLib;
42
using LabApi.Features.Wrappers;
53
using PlayerRoles.PlayableScps.Scp3114;
6-
using PlayerRoles.Subroutines;
7-
using RueI.Elements;
84
using SecretAPI.Features.UserSettings;
9-
using SillySCP.API.Features;
10-
using Utils.NonAllocLINQ;
5+
using SillySCP.API.Settings;
116
using Player = LabApi.Features.Wrappers.Player;
127

138
namespace SillySCP.Patches

SillySCP/Patches/SnakePatch.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using InventorySystem.Items.Keycards.Snake;
88
using static HarmonyLib.AccessTools;
99
using MEC;
10-
using Mirror;
1110

1211
namespace SillySCP.Patches
1312
{

SillySCP/SillySCP.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@
1212
<DebugType>embedded</DebugType>
1313
</PropertyGroup>
1414
<ItemGroup>
15+
<!-- All can be got from Exiled references: https://exslmod-team.github.io/SL-References/Dev.zip -->
1516
<Reference Include="Assembly-CSharp-firstpass" HintPath="$(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll" Private="false" />
1617
<Reference Include="Pooling" HintPath="$(EXILED_REFERENCES)\Pooling.dll" Private="false" />
1718
<Reference Include="Mirror" HintPath="$(EXILED_REFERENCES)\Mirror.dll" Private="false" />
1819
<Reference Include="Snake" HintPath="$(EXILED_REFERENCES)\Snake.dll" Private="false" />
1920
<Reference Include="UnityEngine" HintPath="$(EXILED_REFERENCES)\UnityEngine.dll" Private="false" />
2021
<Reference Include="UnityEngine.CoreModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.CoreModule.dll" Private="false" />
2122
<Reference Include="UnityEngine.PhysicsModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.PhysicsModule.dll" Private="false" />
22-
<Reference Include="SecretAPI" HintPath="$(EXILED_REFERENCES)\SecretAPI.dll" Private="false" />
2323
<Reference Include="LabApi" HintPath="$(EXILED_REFERENCES)\LabApi.dll" Private="false" />
24+
25+
<!-- Can be got from: https://github.com/Misfiy/SecretAPI -->
26+
<Reference Include="SecretAPI" HintPath="$(EXILED_REFERENCES)\SecretAPI.dll" Private="false" />
27+
<!-- Can be got from: https://github.com/Killers0992/AudioPlayerApi -->
28+
<Reference Include="AudioPlayerApi" HintPath="$(EXILED_REFERENCES)\AudioPlayerApi.dll" Private="false" />
2429
</ItemGroup>
2530
<ItemGroup>
2631
<PackageReference Include="Costura.Fody" Version="6.0.0-beta0000" PrivateAssets="All" />

0 commit comments

Comments
 (0)