Compare commits
1 Commits
83a9cb9c47
...
18fad25807
Author | SHA1 | Date | |
---|---|---|---|
|
18fad25807 |
@ -1,11 +1,8 @@
|
|||||||
using CustomPlayerEffects;
|
|
||||||
using InventorySystem.Items.Usables.Scp330;
|
|
||||||
using LabApi.Events.Handlers;
|
using LabApi.Events.Handlers;
|
||||||
using LabApi.Features.Wrappers;
|
using LabApi.Features.Wrappers;
|
||||||
using MEC;
|
using MEC;
|
||||||
using PlayerRoles.FirstPersonControl;
|
using PlayerRoles.FirstPersonControl;
|
||||||
using PlayerRoles.PlayableScps.Scp939;
|
using PlayerRoles.PlayableScps.Scp939;
|
||||||
using static LabApi.Features.Wrappers.Server;
|
|
||||||
using Logger = LabApi.Features.Console.Logger;
|
using Logger = LabApi.Features.Console.Logger;
|
||||||
using Random = System.Random;
|
using Random = System.Random;
|
||||||
|
|
||||||
@ -35,6 +32,8 @@ public class BloodFueledStaminaEffect : CustomPlayerEffect, IStaminaModifier
|
|||||||
|
|
||||||
public class BloodFueledManager
|
public class BloodFueledManager
|
||||||
{
|
{
|
||||||
|
private readonly CustomClasses _plugin;
|
||||||
|
|
||||||
public static bool IsBloodFueled(Player player)
|
public static bool IsBloodFueled(Player player)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -47,8 +46,9 @@ public class BloodFueledManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BloodFueledManager()
|
public BloodFueledManager(CustomClasses plugin)
|
||||||
{
|
{
|
||||||
|
_plugin = plugin;
|
||||||
PlayerEvents.Hurt += ev =>
|
PlayerEvents.Hurt += ev =>
|
||||||
{
|
{
|
||||||
if (ev.DamageHandler is not Scp939DamageHandler damageHandler) return;
|
if (ev.DamageHandler is not Scp939DamageHandler damageHandler) return;
|
||||||
@ -56,13 +56,6 @@ public class BloodFueledManager
|
|||||||
if (attacker == null) return;
|
if (attacker == null) return;
|
||||||
if (!IsBloodFueled(attacker)) return;
|
if (!IsBloodFueled(attacker)) return;
|
||||||
|
|
||||||
var isAffectedByBloodCloud = Scp939AmnesticCloudInstance.ActiveInstances.Where(x=>x.Owner && x.Owner == ev.Attacker?.ReferenceHub).Any(x=>x.AffectedPlayers.Contains(ev.Player.ReferenceHub));
|
|
||||||
|
|
||||||
if (isAffectedByBloodCloud)
|
|
||||||
{
|
|
||||||
attacker.Heal(10);
|
|
||||||
attacker.StaminaRemaining += 0.1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ev.Player.Health <= 0)
|
if (ev.Player.Health <= 0)
|
||||||
{
|
{
|
||||||
@ -76,34 +69,6 @@ public class BloodFueledManager
|
|||||||
};
|
};
|
||||||
|
|
||||||
Timing.RunCoroutine(DrainBlood());
|
Timing.RunCoroutine(DrainBlood());
|
||||||
|
|
||||||
PlayerEvents.EnteringHazard += ev =>
|
|
||||||
{
|
|
||||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
|
||||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
|
||||||
|
|
||||||
ev.Player.EnableEffect<Invigorated>(1, float.PositiveInfinity);
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerEvents.StayingInHazard += ev =>
|
|
||||||
{
|
|
||||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
|
||||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
|
||||||
|
|
||||||
foreach (var affectedPlayer in ev.AffectedPlayers)
|
|
||||||
{
|
|
||||||
// ReSharper disable once PossibleLossOfFraction
|
|
||||||
affectedPlayer.Heal(10 / MaxTps);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerEvents.LeavingHazard += ev =>
|
|
||||||
{
|
|
||||||
if (ev.Hazard is not AmnesticCloudHazard amnesticCloud) return;
|
|
||||||
if (amnesticCloud.Owner == null || !IsBloodFueled(amnesticCloud.Owner)) return;
|
|
||||||
|
|
||||||
ev.Player.DisableEffect<Invigorated>();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerator<float> DrainBlood()
|
public static IEnumerator<float> DrainBlood()
|
||||||
@ -134,8 +99,8 @@ public class BloodFueledHandler : CustomClassHandler
|
|||||||
{
|
{
|
||||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||||
{
|
{
|
||||||
player.SendBroadcast("You are SCP-939-<color=#C50000>Blood Fueled</color> \n Your stamina bar has been replaced by a <color=#C50000>blood meter</color>. \n You refill it by <color=#C50000>damaging</color> or <color=#C50000>killing</color> Humans. \n <color=#C50000><b>Don't let it run out.</color></b>", CustomClasses.BroadcastDuration);
|
player.SendBroadcast("You are the <color=#6e2e99>Blood Fueled</color>!", CustomClasses.BroadcastDuration);
|
||||||
const string customInfo = "<color=#C50000>Blood Fueled</color>";
|
const string customInfo = "<color=#A0A0A0>Blood Fueled</color>";
|
||||||
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
if (!Player.ValidateCustomInfo(customInfo, out var reason))
|
||||||
{
|
{
|
||||||
Logger.Error($"Invalid custom info for Blood Fueled: {reason}");
|
Logger.Error($"Invalid custom info for Blood Fueled: {reason}");
|
||||||
|
@ -17,6 +17,7 @@ using LabApi.Loader.Features.Plugins;
|
|||||||
using MapGeneration;
|
using MapGeneration;
|
||||||
using MEC;
|
using MEC;
|
||||||
using PlayerRoles;
|
using PlayerRoles;
|
||||||
|
using PlayerRoles.PlayableScps.Scp106;
|
||||||
using Scp914.Processors;
|
using Scp914.Processors;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = LabApi.Features.Console.Logger;
|
using Logger = LabApi.Features.Console.Logger;
|
||||||
@ -34,7 +35,7 @@ public sealed class CustomClasses : Plugin
|
|||||||
public readonly CustomClassManager ClassManager = new();
|
public readonly CustomClassManager ClassManager = new();
|
||||||
public SerpentsHandManager SerpentsHandManager;
|
public SerpentsHandManager SerpentsHandManager;
|
||||||
public NegromancerManager NegromancerManager;
|
public NegromancerManager NegromancerManager;
|
||||||
public BloodFueledManager BloodFueledManager = new();
|
public BloodFueledManager BloodFueledManager;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override string Name => "CustomClasses";
|
public override string Name => "CustomClasses";
|
||||||
@ -159,6 +160,7 @@ public sealed class CustomClasses : Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
NegromancerManager = new NegromancerManager(this);
|
NegromancerManager = new NegromancerManager(this);
|
||||||
|
BloodFueledManager = new BloodFueledManager(this);
|
||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
}
|
}
|
||||||
@ -221,7 +223,8 @@ public sealed class CustomClasses : Plugin
|
|||||||
{
|
{
|
||||||
if (random.Next(0, 100) > SerpentsHandConfig.BaseChance + state.ExtraChance)
|
if (random.Next(0, 100) > SerpentsHandConfig.BaseChance + state.ExtraChance)
|
||||||
{
|
{
|
||||||
SerpentsHandManager.SpawnSerpentWave();
|
state.SetSpawned();
|
||||||
|
state.SetWillSpawn();
|
||||||
|
|
||||||
ClassManager.TryHandleSpawn(spectator, ScoutConfig, typeof(ScoutConfig), () =>
|
ClassManager.TryHandleSpawn(spectator, ScoutConfig, typeof(ScoutConfig), () =>
|
||||||
{
|
{
|
||||||
@ -367,7 +370,7 @@ public class CustomClassManager
|
|||||||
/// <param name="position">The base position.</param>
|
/// <param name="position">The base position.</param>
|
||||||
public void TeleportPlayerToAround(Player player, Vector3 position)
|
public void TeleportPlayerToAround(Player player, Vector3 position)
|
||||||
{
|
{
|
||||||
player.Position = position + new Vector3(0, 0.5f, 0) + new Vector3((float)(_random.NextDouble() * 2 - 1), 0, (float)(_random.NextDouble() * 2 - 1));
|
player.Position = position + new Vector3(0, 1, 0) + new Vector3((float)(_random.NextDouble() * 2 - 1), 0, (float)(_random.NextDouble() * 2 - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
using PlayerRoles;
|
|
||||||
|
|
||||||
namespace CustomClasses;
|
|
||||||
|
|
||||||
public abstract class ExtendedClass: PlayerRoleBase
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
using AdminToys;
|
|
||||||
using CommandSystem;
|
using CommandSystem;
|
||||||
using CustomPlayerEffects;
|
using CustomPlayerEffects;
|
||||||
using HintServiceMeow.Core.Enum;
|
using HintServiceMeow.Core.Enum;
|
||||||
@ -10,29 +9,16 @@ using LabApi.Events.Handlers;
|
|||||||
using LabApi.Features.Permissions;
|
using LabApi.Features.Permissions;
|
||||||
using LabApi.Features.Wrappers;
|
using LabApi.Features.Wrappers;
|
||||||
using MEC;
|
using MEC;
|
||||||
using Mirror;
|
|
||||||
using PlayerRoles;
|
using PlayerRoles;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using LightSourceToy = LabApi.Features.Wrappers.LightSourceToy;
|
|
||||||
using Logger = LabApi.Features.Console.Logger;
|
using Logger = LabApi.Features.Console.Logger;
|
||||||
using PrimitiveObjectToy = LabApi.Features.Wrappers.PrimitiveObjectToy;
|
|
||||||
using Random = System.Random;
|
using Random = System.Random;
|
||||||
|
|
||||||
namespace CustomClasses;
|
namespace CustomClasses;
|
||||||
|
|
||||||
public class SerpentsHandManager
|
public class SerpentsHandManager
|
||||||
{
|
{
|
||||||
public static bool IsSerpentsHand(Player player)
|
public static bool IsSerpentsHand(Player player) => player.CustomInfo.Contains("SerpentsHand");
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return player.CustomInfo.Contains("SerpentsHand");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly CustomClasses _customClasses;
|
private readonly CustomClasses _customClasses;
|
||||||
public SerpentsHandManager(CustomClasses customClasses)
|
public SerpentsHandManager(CustomClasses customClasses)
|
||||||
@ -128,6 +114,8 @@ public class SerpentsHandManager
|
|||||||
{
|
{
|
||||||
yield return Timing.WaitForSeconds(1);
|
yield return Timing.WaitForSeconds(1);
|
||||||
|
|
||||||
|
RoundSummary.singleton.ExtraTargets = Player.ReadyList.Count(IsSerpentsHand);
|
||||||
|
|
||||||
if (_customClasses.ClassManager.GetSpawnState(typeof(SerpentsHandConfig)) is not SerpentsHandState state) continue;
|
if (_customClasses.ClassManager.GetSpawnState(typeof(SerpentsHandConfig)) is not SerpentsHandState state) continue;
|
||||||
|
|
||||||
foreach (var player in Player.ReadyList)
|
foreach (var player in Player.ReadyList)
|
||||||
@ -150,63 +138,19 @@ public class SerpentsHandManager
|
|||||||
}
|
}
|
||||||
// ReSharper disable once IteratorNeverReturns
|
// ReSharper disable once IteratorNeverReturns
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpawnSerpentWave()
|
|
||||||
{
|
|
||||||
var state = (SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(typeof(SerpentsHandConfig));
|
|
||||||
|
|
||||||
var serpentsHandConfig = _customClasses.SerpentsHandConfig;
|
|
||||||
|
|
||||||
state.SetSpawned();
|
|
||||||
state.SetWillSpawn();
|
|
||||||
|
|
||||||
var possibleLocations = (Vector3[])serpentsHandConfig.SpawnLocations.Clone();
|
|
||||||
|
|
||||||
possibleLocations.ShuffleListSecure();
|
|
||||||
|
|
||||||
var spawnLocation = possibleLocations[0];
|
|
||||||
|
|
||||||
foreach (var possibleLocation in possibleLocations)
|
|
||||||
{
|
|
||||||
if (Player.ReadyList.Any(p => (p.Position - possibleLocation).SqrMagnitudeIgnoreY() < 400))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
spawnLocation = possibleLocation;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.SpawnLocation = spawnLocation;
|
|
||||||
|
|
||||||
var light = LightSourceToy.Create(spawnLocation + new Vector3(0, 2, 0), Quaternion.identity);
|
|
||||||
light.Color = Color.blue;
|
|
||||||
light.Intensity = 3;
|
|
||||||
light.Range = 40;
|
|
||||||
|
|
||||||
var spaceTimeHole = PrimitiveObjectToy.Create(spawnLocation + new Vector3(0, 2, 0), Quaternion.identity);
|
|
||||||
spaceTimeHole.Color = new Color(44.7f, 73.7f, 83.1f, 0.5f);
|
|
||||||
spaceTimeHole.Flags = PrimitiveFlags.Visible;
|
|
||||||
spaceTimeHole.Scale *= 2;
|
|
||||||
|
|
||||||
Timing.CallDelayed(20, () =>
|
|
||||||
{
|
|
||||||
spaceTimeHole.Destroy();
|
|
||||||
light.Destroy();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed record SerpentsHandState: SpawnState
|
public sealed record SerpentsHandState: SpawnState
|
||||||
{
|
{
|
||||||
public bool HasSpawned => _hasSpawned || Warhead.IsDetonated;
|
public bool HasSpawned => _hasSpawned || PanicDisable || Warhead.IsDetonated;
|
||||||
public float ExtraChance;
|
public float ExtraChance;
|
||||||
public int Points;
|
public int Points;
|
||||||
public bool WillSpawn => _willSpawn && !Warhead.IsDetonated;
|
public bool WillSpawn => _willSpawn && !PanicDisable && !Warhead.IsDetonated;
|
||||||
|
|
||||||
private bool _hasSpawned;
|
private bool _hasSpawned;
|
||||||
private bool _willSpawn;
|
private bool _willSpawn;
|
||||||
public Vector3? SpawnLocation;
|
|
||||||
|
public bool PanicDisable;
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
@ -215,7 +159,6 @@ public sealed record SerpentsHandState: SpawnState
|
|||||||
ExtraChance = 0f;
|
ExtraChance = 0f;
|
||||||
Points = 0;
|
Points = 0;
|
||||||
_willSpawn = false;
|
_willSpawn = false;
|
||||||
SpawnLocation = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSpawned()
|
public void SetSpawned()
|
||||||
@ -241,9 +184,7 @@ public sealed class SerpentsHandConfig : CustomClassConfig
|
|||||||
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Tutorial;
|
public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.Tutorial;
|
||||||
public override ItemType[] Items { get; set; } = [ItemType.Painkillers, ItemType.Medkit, ItemType.ArmorCombat];
|
public override ItemType[] Items { get; set; } = [ItemType.Painkillers, ItemType.Medkit, ItemType.ArmorCombat];
|
||||||
|
|
||||||
public const float BaseChance = 90f;
|
public const float BaseChance = 20f;
|
||||||
|
|
||||||
public readonly Vector3[] SpawnLocations = [new(0.22f, 300.96f, -0.31f), new(123.921f, 288.792f, 20.929f)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SerpentsHandHandler : SimpleAddItemHandler
|
public class SerpentsHandHandler : SimpleAddItemHandler
|
||||||
@ -252,11 +193,9 @@ public class SerpentsHandHandler : SimpleAddItemHandler
|
|||||||
{
|
{
|
||||||
base.HandleSpawn(player, config, random);
|
base.HandleSpawn(player, config, random);
|
||||||
|
|
||||||
var spawnLocation = ((SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(
|
// player.Position = new Vector3(123.921f + (float)(random.NextDouble() * 2 - 1), 288.792f, 20.929f + (float)(random.NextDouble() * 2 - 1));
|
||||||
typeof(SerpentsHandConfig))).SpawnLocation;
|
|
||||||
if (spawnLocation !=
|
player.Position = new Vector3(0.22f + (float)(random.NextDouble() * 2 - 1), 300.96f, -0.31f + (float)(random.NextDouble() * 2 - 1));
|
||||||
null)
|
|
||||||
CustomClasses.Instance.ClassManager.TeleportPlayerToAround(player, (Vector3)spawnLocation);
|
|
||||||
|
|
||||||
ItemType[] guns = [ItemType.GunAK, ItemType.GunE11SR, ItemType.GunCrossvec];
|
ItemType[] guns = [ItemType.GunAK, ItemType.GunE11SR, ItemType.GunCrossvec];
|
||||||
var gun = guns[random.Next(0, guns.Length-1)];
|
var gun = guns[random.Next(0, guns.Length-1)];
|
||||||
@ -294,37 +233,52 @@ public class SerpentsHandHandler : SimpleAddItemHandler
|
|||||||
player.EnableEffect<MovementBoost>(20, 30);
|
player.EnableEffect<MovementBoost>(20, 30);
|
||||||
|
|
||||||
player.SendBroadcast("You're a <color=#2E8B57>Serpent's Hand</color> member!", CustomClasses.BroadcastDuration);
|
player.SendBroadcast("You're a <color=#2E8B57>Serpent's Hand</color> member!", CustomClasses.BroadcastDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.EnableEffect<SpawnProtected>(1, 20f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandHandler(typeof(RemoteAdminCommandHandler))]
|
[CommandHandler(typeof(RemoteAdminCommandHandler))]
|
||||||
[CommandHandler(typeof(ClientCommandHandler))]
|
public class PanicDisableRemoteAdminCommand : ICommand
|
||||||
public class SpawnSerpentsCommand : ICommand
|
|
||||||
{
|
{
|
||||||
public string Command => "spsh";
|
public string Command => "panicdisableserpentshand";
|
||||||
public string[] Aliases => [];
|
public string[] Aliases => [];
|
||||||
public string Description => "Makes sure serpents hand spawns";
|
public string Description => "Panic disable Serpents Hand.";
|
||||||
|
|
||||||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
|
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
|
||||||
{
|
{
|
||||||
var executor = Player.Get(sender);
|
var state = (SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(typeof(SerpentsHandConfig));
|
||||||
if (executor == null)
|
state.PanicDisable = true;
|
||||||
|
|
||||||
|
response = "Serpents Hand has been disabled.";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CommandHandler(typeof(ClientCommandHandler))]
|
||||||
|
public class PanicDisableCommand : ICommand
|
||||||
|
{
|
||||||
|
public string Command => "panicdisableserpentshand";
|
||||||
|
public string[] Aliases => [];
|
||||||
|
public string Description => "Panic disable Serpents Hand.";
|
||||||
|
|
||||||
|
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
|
||||||
|
{
|
||||||
|
if (!Player.TryGet(sender, out var player))
|
||||||
{
|
{
|
||||||
response = "You must be a player to use this command!";
|
response = "You must be a player to use this command!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!executor.HasPermissions("customclasses.setcustomclass"))
|
if (!player.HasPermissions("panicdisable.serpentshand") && player.UserId != "76561198372587687@steam")
|
||||||
{
|
{
|
||||||
response = "You do not have permission to use this command!";
|
response = "You must have the permission to use this command!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomClasses.Instance.SerpentsHandManager.SpawnSerpentWave();
|
var state = (SerpentsHandState)CustomClasses.Instance.ClassManager.GetSpawnState(typeof(SerpentsHandConfig));
|
||||||
|
state.PanicDisable = true;
|
||||||
|
|
||||||
response = "success";
|
response = "Serpents Hand has been disabled.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
./build.sh
|
|
||||||
./deploy.sh
|
|
Loading…
x
Reference in New Issue
Block a user