Skip to content

Commit 3c28016

Browse files
committed
Added a config to force SCP-956 to use the Capybara model.
1 parent 62bbdf5 commit 3c28016

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

‎LabExtended/Core/Configs/ApiConfig.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ namespace LabExtended.Core.Configs
99
/// </summary>
1010
public class ApiConfig
1111
{
12+
/// <summary>
13+
/// Gets or sets the probability of SCP-956 utilizing the Capybara model.
14+
/// </summary>
15+
[Description("Sets the chance of SCP-559 using the Capybara model.")]
16+
public float? Scp956CapybaraChance { get; set; } = null;
17+
1218
/// <summary>
1319
/// Gets or sets the configuration settings for file storage.
1420
/// </summary>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using HarmonyLib;
2+
3+
using LabExtended.Core;
4+
using LabExtended.Utilities;
5+
6+
using UnityEngine;
7+
8+
namespace LabExtended.Patches.Functions.Holidays
9+
{
10+
/// <summary>
11+
/// Implements the Scp956CapybaraChance config.
12+
/// </summary>
13+
public static class CapybaraChancePatch
14+
{
15+
/// <summary>
16+
/// The number which forces a Capybara model ...........
17+
/// </summary>
18+
public const byte CapybaraNumber = 67;
19+
20+
[HarmonyPatch(typeof(Scp956Pinata), nameof(Scp956Pinata.Network_carpincho), MethodType.Setter)]
21+
private static bool Prefix(Scp956Pinata __instance, ref byte value)
22+
{
23+
if (ApiLoader.ApiConfig?.Scp956CapybaraChance is null)
24+
return true;
25+
26+
var chance = Mathf.Clamp(ApiLoader.ApiConfig.Scp956CapybaraChance.Value, 0f, 100f);
27+
28+
if (!WeightUtils.GetBool(chance))
29+
{
30+
if (value == CapybaraNumber)
31+
{
32+
value = 1;
33+
}
34+
}
35+
else
36+
{
37+
value = CapybaraNumber;
38+
}
39+
40+
return true;
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)