From 17c654d8895a227a16f7d6b847218389315fcf64 Mon Sep 17 00:00:00 2001 From: code002lover Date: Thu, 5 Jun 2025 01:11:30 +0200 Subject: [PATCH] add and fix a lot --- AfkSwap/AfkSwap.cs | 130 ++++++++++++ AfkSwap/AfkSwap.csproj | 43 ++++ CandySetting/CandySetting.csproj | 40 ++++ CandySetting/Class1.cs | 32 +++ CustomClasses/CustomClasses.cs | 239 +++++++++++++++++++++++ CustomClasses/CustomClasses.csproj | 46 +++++ CustomItemSpawn/CustomItemSpawn.cs | 80 ++++++++ CustomItemSpawn/CustomItemSpawn.csproj | 43 ++++ GamblingCoin/GamblingCoinConfig.cs | 6 +- GamblingCoin/GamblingCoinEventHandler.cs | 8 +- GrowingZombies/GrowingZombies.cs | 78 ++++++++ GrowingZombies/GrowingZombies.csproj | 46 +++++ KeycardButModern/KeycardButModern.cs | 8 +- SCPTeamHint/SCPTeamHint.cs | 119 +++++++---- ScpSwap/ScpSwap.cs | 23 +++ ScpSwap/ScpSwap.csproj | 43 ++++ ScpSwap/SwapCommand.cs | 81 ++++++++ SecretPluginLaboratories.sln | 48 +++++ ServerHints/ServerHints.cs | 51 +++++ ServerHints/ServerHints.csproj | 46 +++++ VisibleSpectators/VisibleSpectators.cs | 14 +- WarheadEvents/WarheadEvents.cs | 33 ++++ WarheadEvents/WarheadEvents.csproj | 43 ++++ 23 files changed, 1235 insertions(+), 65 deletions(-) create mode 100644 AfkSwap/AfkSwap.cs create mode 100644 AfkSwap/AfkSwap.csproj create mode 100644 CandySetting/CandySetting.csproj create mode 100644 CandySetting/Class1.cs create mode 100644 CustomClasses/CustomClasses.cs create mode 100644 CustomClasses/CustomClasses.csproj create mode 100644 CustomItemSpawn/CustomItemSpawn.cs create mode 100644 CustomItemSpawn/CustomItemSpawn.csproj create mode 100644 GrowingZombies/GrowingZombies.cs create mode 100644 GrowingZombies/GrowingZombies.csproj create mode 100644 ScpSwap/ScpSwap.cs create mode 100644 ScpSwap/ScpSwap.csproj create mode 100644 ScpSwap/SwapCommand.cs create mode 100644 ServerHints/ServerHints.cs create mode 100644 ServerHints/ServerHints.csproj create mode 100644 WarheadEvents/WarheadEvents.cs create mode 100644 WarheadEvents/WarheadEvents.csproj diff --git a/AfkSwap/AfkSwap.cs b/AfkSwap/AfkSwap.cs new file mode 100644 index 0000000..c7602a6 --- /dev/null +++ b/AfkSwap/AfkSwap.cs @@ -0,0 +1,130 @@ +using System.Collections; +using LabApi.Features; +using LabApi.Loader.Features.Plugins; +using LabApi.Events.Arguments.PlayerEvents; +using LabApi.Events.Handlers; +using LabApi.Features.Wrappers; +using PlayerRoles; +using Logger = LabApi.Features.Console.Logger; +using Version = System.Version; +using MEC; +using UnityEngine; + +namespace AfkSwap; + +public class AfkSwap : Plugin +{ + public override string Name => "AfkSwap"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Swaps AFK players with spectators after one minute."; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + private readonly Dictionary _playerSpawnTimes = new(); + private readonly Dictionary _playerPositions = new(); + private readonly Dictionary _afkPlayers = new(); + private const float AfkTimeLimit = 60; // 1 minute in seconds + + private readonly object _lock = new(); + + public override void Enable() + { + PlayerEvents.Spawned += OnPlayerSpawned; + + Timing.RunCoroutine(CheckAfkPlayers()); + } + + public override void Disable() + { + PlayerEvents.Spawned -= OnPlayerSpawned; + + lock (_lock) + { + _playerSpawnTimes.Clear(); + _playerPositions.Clear(); + _afkPlayers.Clear(); + } + } + + private void OnPlayerSpawned(PlayerSpawnedEventArgs ev) + { + var player = ev.Player; + Timing.CallDelayed(1, () => + { + lock (_lock) + { + _playerSpawnTimes[player] = DateTime.Now; + _playerPositions[player] = player.Position; + _afkPlayers[player] = DateTime.Now; + } + + Logger.Debug($"Player {player.DisplayName} spawned"); + }); + + } + + private IEnumerator CheckAfkPlayers() + { + Logger.Debug("Starting Afk Checking"); + while (true) + { + lock (_lock) + { + foreach (var playerTime in _playerSpawnTimes.ToList().Where(playerTime => (DateTime.Now - playerTime.Value).TotalSeconds >= AfkTimeLimit)) + { + if (playerTime.Key.Role is RoleTypeId.Spectator or RoleTypeId.Destroyed or RoleTypeId.Overwatch or RoleTypeId.Tutorial) + { + _playerSpawnTimes.Remove(playerTime.Key); + _playerPositions.Remove(playerTime.Key); + continue; + } + if (!_playerPositions[playerTime.Key].Equals(playerTime.Key.Position)) + { + _playerSpawnTimes.Remove(playerTime.Key); + _playerPositions.Remove(playerTime.Key); + continue; // Player has moved, don't swap + } + + _afkPlayers[playerTime.Key] = DateTime.Now; + SwapWithSpectator(playerTime.Key); + } + } + + yield return Timing.WaitForSeconds(1); + } + // ReSharper disable once IteratorNeverReturns + } + + private void SwapWithSpectator(Player afkPlayer) + { + var spectators = Player.ReadyList.Where(p => p.Role == RoleTypeId.Spectator && (DateTime.Now - _afkPlayers[p]).TotalSeconds > 10).ToList(); + if (!spectators.Any()) + { + Logger.Warn("No spectators to swap to"); + return; + } + var randomSpectator = spectators[UnityEngine.Random.Range(0, spectators.Count)]; + Logger.Debug($"Swapping {afkPlayer.DisplayName} with {randomSpectator.DisplayName}"); + + // Store the AFK player's position and role + var afkPosition = afkPlayer.Position; + var afkRole = afkPlayer.Role; + + // Give the spectator the AFK player's role and position + randomSpectator.Role = afkRole; + randomSpectator.Position = afkPosition; + + // Make the AFK player a spectator + afkPlayer.Role = RoleTypeId.Spectator; + + // Remove the AFK player from tracking + _playerSpawnTimes.Remove(afkPlayer); + _playerPositions.Remove(afkPlayer); + _playerSpawnTimes[randomSpectator] = DateTime.Now; + _playerPositions[randomSpectator] = randomSpectator.Position; + + // Broadcast the swap + afkPlayer.SendBroadcast($"You were swapped with {randomSpectator.DisplayName} due to inactivity.", 10); + randomSpectator.SendBroadcast($"You were swapped with {afkPlayer.DisplayName} due to them being AFK.", 5); + } +} \ No newline at end of file diff --git a/AfkSwap/AfkSwap.csproj b/AfkSwap/AfkSwap.csproj new file mode 100644 index 0000000..1883080 --- /dev/null +++ b/AfkSwap/AfkSwap.csproj @@ -0,0 +1,43 @@ + + + + net48 + enable + disable + 10 + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/CandySetting/CandySetting.csproj b/CandySetting/CandySetting.csproj new file mode 100644 index 0000000..1be96ee --- /dev/null +++ b/CandySetting/CandySetting.csproj @@ -0,0 +1,40 @@ + + + + net48 + enable + disable + 10 + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/CandySetting/Class1.cs b/CandySetting/Class1.cs new file mode 100644 index 0000000..580181e --- /dev/null +++ b/CandySetting/Class1.cs @@ -0,0 +1,32 @@ +using LabApi.Events.Arguments.PlayerEvents; +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Loader.Features.Plugins; + +namespace CandySetting; + +public class CandySetting : Plugin +{ + public override string Name => "CandySetting"; + public override string Author => "HoherGeist, Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Edits # of Candy you can take"; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + public int MaxUses { get; set; } = 6; + + public override void Enable() + { + PlayerEvents.InteractingScp330 += TakingCandy; + } + + public override void Disable() + { + PlayerEvents.InteractingScp330 -= TakingCandy; + } + + private void TakingCandy(PlayerInteractingScp330EventArgs ev) + { + ev.AllowPunishment = ev.Uses > MaxUses; + } +} \ No newline at end of file diff --git a/CustomClasses/CustomClasses.cs b/CustomClasses/CustomClasses.cs new file mode 100644 index 0000000..87d8aa9 --- /dev/null +++ b/CustomClasses/CustomClasses.cs @@ -0,0 +1,239 @@ +using System.Drawing; +using CommandSystem.Commands.RemoteAdmin.Inventory; +using Interactables.Interobjects.DoorUtils; +using InventorySystem.Items; +using LabApi.Events.Arguments.PlayerEvents; +using LabApi.Events.Arguments.ServerEvents; +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Features.Console; +using LabApi.Loader.Features.Plugins; +using PlayerRoles; +using LabApi.Features.Wrappers; +using MapGeneration; +using Vector3 = UnityEngine.Vector3; +using MEC; + +namespace CustomClasses; + +public class CustomClasses : Plugin +{ + public override string Name => "CustomClasses"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Adds custom classes to the game"; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + public JanitorConfig JanitorConfig { get; set; } = new(); + public ResearchSubjectConfig ResearchSubjectConfig { get; set; } = new(); + public HeadGuardConfig HeadGuardConfig { get; set; } = new(); + + private readonly CustomClassManager _classManager = new(); + + public override void Enable() + { + PlayerEvents.Spawned += OnPlayerSpawned; + ServerEvents.RoundEnded += OnRoundEnded; + } + + public override void Disable() + { + PlayerEvents.Spawned -= OnPlayerSpawned; + ServerEvents.RoundEnded -= OnRoundEnded; + } + + private void OnRoundEnded(RoundEndedEventArgs ev) + { + _classManager.ResetSpawnStates(); + } + + private void OnPlayerSpawned(PlayerSpawnedEventArgs ev) + { + if(_classManager.TryHandleSpawn(ev.Player, JanitorConfig, typeof(JanitorConfig))) return; + if(_classManager.TryHandleSpawn(ev.Player, ResearchSubjectConfig, typeof(ResearchSubjectConfig))) return; + if(_classManager.TryHandleSpawn(ev.Player, HeadGuardConfig, typeof(HeadGuardConfig))) return; + } +} + +public class CustomClassManager +{ + private readonly object _lock = new(); + private readonly Random _random = new(); + private readonly Dictionary _spawnStates = new(); + private readonly Dictionary _handlers = new(); + + public CustomClassManager() + { + // Register handlers + RegisterHandler(new JanitorHandler(this)); + RegisterHandler(new ResearchSubjectHandler(this)); + RegisterHandler(new HeadGuardHandler(this)); + } + + public void TeleportPlayerToAround(Player player, Vector3 position) + { + player.Position = position + new Vector3(0,1,0) + new Vector3((float)(_random.NextDouble() * 2), 0, + (float)(_random.NextDouble() * 2)); + } + + private void RegisterHandler(ICustomClassHandler handler) where T : CustomClassConfig + { + lock (_lock) + { + _spawnStates[typeof(T)] = new SpawnState(); + } + + _handlers[typeof(T)] = handler; + } + + public void ResetSpawnStates() + { + lock (_lock) + { + foreach (var key in _spawnStates.Keys.ToList()) + { + _spawnStates[key] = new SpawnState(); + } + } + } + + public bool TryHandleSpawn(Player player, CustomClassConfig config, Type configType) + { + if (player.Role != config.RequiredRole) return false; + if (Player.ReadyList.Count() <= config.MinPlayers) return false; + + lock (_lock) + { + var state = _spawnStates[configType]; + if (state.Spawns >= config.MaxSpawns) + { + Logger.Debug($"Max spawns reached {configType} - {player.Nickname}"); + return false; + } + + if (_random.NextDouble() > config.ChancePerPlayer) + { + Logger.Debug($"Chance not met {configType} - {player.Nickname}"); + return false; + } + + state.Spawns++; + + Logger.Debug($"Player spawning {configType} - {player.Nickname} - {state.Spawns} / {config.MaxSpawns}"); + + if (_handlers.TryGetValue(configType, out var handler)) + { + return handler.HandleSpawn(player, config, _random); + } + } + + return false; + } +} + +public interface ICustomClassHandler +{ + bool HandleSpawn(Player player, CustomClassConfig config, Random random); +} + +public class JanitorHandler(CustomClassManager manager) : ICustomClassHandler +{ + public bool HandleSpawn(Player player, CustomClassConfig config, Random random) + { + var scp914 = Map.Rooms.First(r => r.Name == RoomName.Lcz914); + Timing.CallDelayed(0.5f, () => + { + manager.TeleportPlayerToAround(player, scp914.Position); + + foreach (var spawnItem in config.Items) + { + player.AddItem(spawnItem, ItemAddReason.StartingItem); + Logger.Debug($"Gave player {player.Nickname} spawn item {spawnItem}"); + } + player.SendBroadcast("You're a Janitor!", 3); + }); + + return true; + } +} + +public class ResearchSubjectHandler(CustomClassManager manager) : ICustomClassHandler +{ + public bool HandleSpawn(Player player, CustomClassConfig config, Random random) + { + var scientist = Player.ReadyList.First(p => p.Role == RoleTypeId.Scientist); + Timing.CallDelayed(0.5f, () => + { + manager.TeleportPlayerToAround(player, scientist.Position); + + foreach (var spawnItem in config.Items) + { + player.AddItem(spawnItem, ItemAddReason.StartingItem); + Logger.Debug($"Gave player {player.Nickname} spawn item {spawnItem}"); + } + player.SendBroadcast("You're a Research Subject!", 3); + }); + + return true; + } +} + +public class HeadGuardHandler(CustomClassManager manager) : ICustomClassHandler +{ + public bool HandleSpawn(Player player, CustomClassConfig config, Random random) + { + Timing.CallDelayed(0.5f, () => + { + player.RemoveItem(ItemType.KeycardGuard); + + KeycardItem.CreateCustomKeycardTaskForce(player, "Head Guard Keycard", $"HG. {player.Nickname}", new KeycardLevels(1,1,2),UnityEngine.Color.blue,UnityEngine.Color.cyan, "1", 0); + + player.AddItem(ItemType.Adrenaline, ItemAddReason.StartingItem); + + player.RemoveItem(ItemType.ArmorLight); + player.AddItem(ItemType.ArmorCombat, ItemAddReason.StartingItem); + + player.RemoveItem(ItemType.GunFSP9); + + var pickup = Pickup.Create(ItemType.GunCrossvec, Vector3.one); + + if (pickup != null) player.AddItem(pickup); + + player.SetAmmo(ItemType.Ammo9x19, 120); + + player.SendBroadcast("You're a Head Guard!", 3); + }); + + return true; + } +} + +internal record SpawnState +{ + public int Spawns; +} + +public abstract class CustomClassConfig +{ + public virtual int MinPlayers { get; set; } = 4; + public virtual double ChancePerPlayer { get; set; } = 0.7; + public virtual int MaxSpawns { get; set; } = 1; + public virtual ItemType[] Items { get; set; } = []; + public virtual RoleTypeId RequiredRole { get; set; } = RoleTypeId.ClassD; +} + +public class ResearchSubjectConfig : CustomClassConfig; + +public class JanitorConfig : CustomClassConfig +{ + public override int MinPlayers { get; set; } = 5; + public override double ChancePerPlayer { get; set; } = 0.3; + public override int MaxSpawns { get; set; } = 2; + public override ItemType[] Items { get; set; } = [ItemType.KeycardJanitor]; +} + +public class HeadGuardConfig : CustomClassConfig +{ + public override int MinPlayers { get; set; } = 9; + public override RoleTypeId RequiredRole { get; set; } = RoleTypeId.FacilityGuard; +} \ No newline at end of file diff --git a/CustomClasses/CustomClasses.csproj b/CustomClasses/CustomClasses.csproj new file mode 100644 index 0000000..bdccf6e --- /dev/null +++ b/CustomClasses/CustomClasses.csproj @@ -0,0 +1,46 @@ + + + + net48 + enable + disable + latest + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\NorthwoodLib.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/CustomItemSpawn/CustomItemSpawn.cs b/CustomItemSpawn/CustomItemSpawn.cs new file mode 100644 index 0000000..0ca49f9 --- /dev/null +++ b/CustomItemSpawn/CustomItemSpawn.cs @@ -0,0 +1,80 @@ +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Features.Wrappers; +using LabApi.Loader.Features.Plugins; +using MEC; +using Logger = LabApi.Features.Console.Logger; +using Random = System.Random; +using Vector3 = UnityEngine.Vector3; + +namespace CustomItemSpawn; + +public class CustomItemSpawn : Plugin +{ + public override string Name => "CustomItemSpawn"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Spawns items in a custom location."; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + private static CustomItemSpawn _singleton; + + public override void Enable() + { + _singleton = this; + ServerEvents.RoundStarted += OnRoundStart; + } + + public override void Disable() + { + ServerEvents.RoundStarted -= OnRoundStart; + _singleton = null; + } + + private static void OnRoundStart() + { + Timing.CallDelayed(10,SpawnItems); + } + + private static void SpawnItems() + { + Random rng = new(); + + foreach (var pickup in from configPair in _singleton.Config!.Items + let itemType = configPair.Key + let config = configPair.Value + where rng.NextDouble() * 100f <= config.Chance + select Pickup.Create(itemType, config.Position + new Vector3(0, 1, 0))) + { + if (pickup == null) + { + Logger.Error("Could not create pickup."); + break; + } + + pickup.Spawn(); + Logger.Debug($"Spawned Pickup: {pickup.Base} @ {pickup.Position}"); + } + } +} + +public class ItemConfig +{ + public Dictionary Items { get; set; } = new() + { + { + ItemType.GunAK, + new SpecificConfig + { + Position = new Vector3(0, 0, 0), + Chance = 100f + } + } + }; +} + +public class SpecificConfig +{ + public Vector3 Position { get; set; } + public float Chance { get; set; } = 100f; +} \ No newline at end of file diff --git a/CustomItemSpawn/CustomItemSpawn.csproj b/CustomItemSpawn/CustomItemSpawn.csproj new file mode 100644 index 0000000..1883080 --- /dev/null +++ b/CustomItemSpawn/CustomItemSpawn.csproj @@ -0,0 +1,43 @@ + + + + net48 + enable + disable + 10 + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/GamblingCoin/GamblingCoinConfig.cs b/GamblingCoin/GamblingCoinConfig.cs index 5abfbec..6ef1f3c 100644 --- a/GamblingCoin/GamblingCoinConfig.cs +++ b/GamblingCoin/GamblingCoinConfig.cs @@ -148,12 +148,12 @@ namespace GamblingCoin public AdvancedEffectSettings AdvancedNegative { get; set; } = new() { - Effects = new[] { nameof(InsufficientLighting), nameof(AmnesiaVision) }, + Effects = new[] { nameof(InsufficientLighting), nameof(AmnesiaVision), nameof(Burned) }, Settings = new Dictionary { - { nameof(InsufficientLighting), new EffectSettings(1, 20f, true) }, + { nameof(InsufficientLighting), new EffectSettings(1, 30f, true) }, { nameof(AmnesiaVision), new EffectSettings(3, 30f, true) }, - { nameof(Bleeding), new EffectSettings(3, 40f, true) }, + { nameof(Burned), new EffectSettings(3, 60f, true) }, } }; } diff --git a/GamblingCoin/GamblingCoinEventHandler.cs b/GamblingCoin/GamblingCoinEventHandler.cs index 2bdad5b..2a5e4a8 100644 --- a/GamblingCoin/GamblingCoinEventHandler.cs +++ b/GamblingCoin/GamblingCoinEventHandler.cs @@ -147,11 +147,7 @@ namespace GamblingCoin { x.Player.SendBroadcast(configMessages.PocketDimensionMessage, configGameplay.BroadcastDuration); - var newPos = Map.Rooms.First(roomIdentifier => roomIdentifier.Zone==FacilityZone.Other).Position; - - x.Player.ReferenceHub.playerEffectsController.ChangeState(nameof(Corroding),1, 999, true); - - x.Player.Position = newPos + new UnityEngine.Vector3(0, configGameplay.TeleportHeightOffset, 0); + PocketDimension.ForceInside(x.Player); }, configChances.PocketDimensionChance) .AddAction(x => @@ -232,7 +228,7 @@ namespace GamblingCoin Player[] GetPlayers() { - return Player.Dictionary.Values.ToArray(); + return Player.ReadyList.ToArray(); } } diff --git a/GrowingZombies/GrowingZombies.cs b/GrowingZombies/GrowingZombies.cs new file mode 100644 index 0000000..1d29fbc --- /dev/null +++ b/GrowingZombies/GrowingZombies.cs @@ -0,0 +1,78 @@ +using CustomPlayerEffects; +using LabApi.Events.Arguments.Scp0492Events; +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Loader.Features.Plugins; +using InventorySystem.Items.Usables.Scp330; +using LabApi.Events.Arguments.PlayerEvents; +using LabApi.Events.Arguments.ServerEvents; +using LabApi.Features.Wrappers; + +namespace GrowingZombies; + +public class GrowingZombies : Plugin +{ + public override string Name => "GrowingZombies"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Makes zombies grow stronger as they eat more"; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + private readonly Dictionary _zombieCorpseCount = new(); + + public override void Enable() + { + Scp0492Events.ConsumedCorpse += OnZombieEat; + ServerEvents.RoundEnded += OnRoundEnd; + PlayerEvents.Left += OnPlayerLeave; + } + + public override void Disable() + { + Scp0492Events.ConsumedCorpse -= OnZombieEat; + ServerEvents.RoundEnded -= OnRoundEnd; + PlayerEvents.Left -= OnPlayerLeave; + _zombieCorpseCount.Clear(); + } + + private void OnRoundEnd(RoundEndedEventArgs ev) + { + _zombieCorpseCount.Clear(); + } + + private void OnPlayerLeave(PlayerLeftEventArgs ev) + { + _zombieCorpseCount.Remove(ev.Player); + } + + private void OnZombieEat(Scp0492ConsumedCorpseEventArgs ev) + { + if (!ev?.Player.ReferenceHub.playerEffectsController) + return; + + // Increment corpse count for this zombie + if (!_zombieCorpseCount.ContainsKey(ev.Player)) + _zombieCorpseCount[ev.Player] = 0; + _zombieCorpseCount[ev.Player]++; + + var corpsesEaten = _zombieCorpseCount[ev.Player]; + + ev.Player.MaxHealth += 50; + + var movementBoostIntensity = (byte)Math.Min(1 + corpsesEaten * 0.1f, 3f); + ev.Player.ReferenceHub.playerEffectsController.ChangeState(movementBoostIntensity, 30); + + // Add damage resistance after eating multiple corpses + var damageResistance = (byte)Math.Min(0.5 - corpsesEaten * 0.5f, 2f); + if (corpsesEaten >= 3) + { + ev.Player.ReferenceHub.playerEffectsController.ChangeState(damageResistance, 20); + } + + // Add regeneration effect after eating multiple corpses + if (corpsesEaten < 5) return; + var regenIntensity = Math.Min(1 + corpsesEaten * 0.2f, 3f); + + Scp330Bag.AddSimpleRegeneration(ev.Player.ReferenceHub, regenIntensity, 15f); + } +} \ No newline at end of file diff --git a/GrowingZombies/GrowingZombies.csproj b/GrowingZombies/GrowingZombies.csproj new file mode 100644 index 0000000..bb5e31b --- /dev/null +++ b/GrowingZombies/GrowingZombies.csproj @@ -0,0 +1,46 @@ + + + + net48 + enable + disable + latest + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\NorthwoodLib.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/KeycardButModern/KeycardButModern.cs b/KeycardButModern/KeycardButModern.cs index c2edc93..c1ced0a 100644 --- a/KeycardButModern/KeycardButModern.cs +++ b/KeycardButModern/KeycardButModern.cs @@ -45,7 +45,7 @@ namespace KeycardButModern foreach (var playerItem in ev.Player.Items) { //is keycard? - if (playerItem.Type > ItemType.KeycardO5) continue; + if (playerItem.Type is > ItemType.KeycardO5 and < ItemType.KeycardCustomTaskForce) continue; if (playerItem.Base is not KeycardItem keycardItem) { continue; @@ -83,7 +83,7 @@ namespace KeycardButModern foreach (var playerItem in ev.Player.Items) { //is keycard? - if (playerItem.Type > ItemType.KeycardO5) continue; + if (playerItem.Type is > ItemType.KeycardO5 and < ItemType.KeycardCustomTaskForce) continue; if (playerItem.Base is not KeycardItem keycardItem) { continue; @@ -117,7 +117,7 @@ namespace KeycardButModern foreach (var playerItem in ev.Player.Items) { //is keycard? - if (playerItem.Type > ItemType.KeycardO5) continue; + if (playerItem.Type is > ItemType.KeycardO5 and < ItemType.KeycardCustomTaskForce) continue; if (playerItem.Base is not KeycardItem keycardItem) { continue; @@ -140,7 +140,7 @@ namespace KeycardButModern foreach (var playerItem in ev.Player.Items) { //is keycard? - if (playerItem.Type > ItemType.KeycardO5) continue; + if (playerItem.Type is > ItemType.KeycardO5 and < ItemType.KeycardCustomTaskForce) continue; if (playerItem.Base is not KeycardItem keycardItem) { continue; diff --git a/SCPTeamHint/SCPTeamHint.cs b/SCPTeamHint/SCPTeamHint.cs index 8764664..a9ecaf8 100644 --- a/SCPTeamHint/SCPTeamHint.cs +++ b/SCPTeamHint/SCPTeamHint.cs @@ -23,12 +23,14 @@ namespace SCPTeamHint public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); private Timer _timer; + private readonly object _hintsLock = new(); private readonly Dictionary _spectatorHints = new(); public override void Enable() { Logger.Debug("Apple juice"); PlayerEvents.Joined += OnJoin; + PlayerEvents.Left += OnLeft; _timer = new Timer(1000); _timer.Elapsed += (_,_) => UpdateHints(); @@ -37,84 +39,117 @@ namespace SCPTeamHint public override void Disable() { - PlayerEvents.Joined -= OnJoin; - _timer.Stop(); + PlayerEvents.Joined -= OnJoin; + PlayerEvents.Left -= OnLeft; + _timer?.Stop(); + _timer?.Dispose(); + _timer = null; } private void UpdateHints() { var hintTexts = new List(); - - foreach (var player in Player.List) + + lock (_hintsLock) { - if (player.IsDummy || player.IsHost) continue; - if (!player.IsSCP) continue; - var text = $" {player.RoleBase.RoleName} | {player.HumeShield} | {player.Health} | {player.Zone} "; - - switch (player.RoleBase) + + foreach (var player in Player.ReadyList.Where(x => !x.IsHost && !x.IsDummy && x.IsSCP)) { - case Scp096Role scp: - text += "\n"; + var text = + $" {player.RoleBase.RoleName} | {player.HumeShield} | {player.Health} | {player.Zone} "; - scp.SubroutineModule.TryGetSubroutine(out Scp096TargetsTracker tracker); - - text += $"Targets: {tracker.Targets.Count}"; - break; - case Scp3114Role scp3114: + switch (player.RoleBase) { - text += "\n"; + case Scp096Role scp: + text += "\n"; - var stolenRole = scp3114.CurIdentity.StolenRole; - - text += $" {stolenRole}"; - break; + scp.SubroutineModule.TryGetSubroutine(out Scp096TargetsTracker tracker); + + if(!tracker) break; + + text += $"Targets: {tracker.Targets.Count}"; + break; + case Scp3114Role scp3114: + { + text += "\n"; + + var stolenRole = scp3114.CurIdentity.StolenRole; + + text += $" {stolenRole}"; + break; + } + case Scp079Role scp079: + text = + $" {player.RoleBase.RoleName} | {scp079.CurrentCamera.Room.Zone} "; + text += "\n"; + + scp079.SubroutineModule.TryGetSubroutine(out Scp079AuxManager auxManager); + scp079.SubroutineModule.TryGetSubroutine(out Scp079TierManager tierManager); + + if(!auxManager || !tierManager) break; + + text += + $" AUX: {auxManager.CurrentAuxFloored} / {auxManager.MaxAux} | Level {tierManager.AccessTierLevel}"; + break; } - case Scp079Role scp079: - text = - $" {player.RoleBase.RoleName} | {scp079.CurrentCamera.Room.Zone} "; - text += "\n"; - scp079.SubroutineModule.TryGetSubroutine(out Scp079AuxManager auxManager); - scp079.SubroutineModule.TryGetSubroutine(out Scp079TierManager tierManager); - - text += $" AUX: {auxManager.CurrentAuxFloored} / {auxManager.MaxAux} Level: {tierManager.AccessTierLevel}"; - break; + hintTexts.Add(text); } - hintTexts.Add(text); - } - - foreach (var player in Player.List.Where(x=>!x.IsHost)) - { - Logger.Debug($"Updating hint for {player.DisplayName}"); - UpdateHint(player, string.Join("\n", hintTexts)); + var hintText = string.Join("\n", hintTexts); + + foreach (var player in Player.ReadyList.Where(x => !x.IsHost && !x.IsDummy)) + { + Logger.Debug($"Updating hint for {player.DisplayName}"); + UpdateHint(player, hintText); + } } } private void UpdateHint(Player player, string hintText) { - var hint = _spectatorHints[player]; + if (!_spectatorHints.TryGetValue(player, out var hint)) + { + Logger.Debug($"No hint found for player {player.DisplayName}"); + return; + } Logger.Debug($"Player {player.Nickname} is on team {player.RoleBase.Team} | hide: {player.RoleBase.Team != Team.SCPs}"); hint.Hide = player.RoleBase.Team != Team.SCPs; - - hint.Text = hintText; + if (!hint.Hide) + { + hint.Text = hintText; + } } private void OnJoin(PlayerJoinedEventArgs ev) { + if(ev.Player.IsDummy || ev.Player.IsHost) return; var hint = new Hint { - Text = "Apfelsaft", Alignment = HintAlignment.Left, YCoordinate = 100, Hide = true + Text = "", Alignment = HintAlignment.Left, YCoordinate = 100, Hide = true }; var playerDisplay = PlayerDisplay.Get(ev.Player); playerDisplay.AddHint(hint); - _spectatorHints[ev.Player] = hint; + lock (_hintsLock) + { + _spectatorHints[ev.Player] = hint; + } } + + private void OnLeft(PlayerLeftEventArgs ev) + { + if(ev.Player.IsDummy || ev.Player.IsHost) return; + + lock (_hintsLock) + { + _spectatorHints.Remove(ev.Player); + } + } } } \ No newline at end of file diff --git a/ScpSwap/ScpSwap.cs b/ScpSwap/ScpSwap.cs new file mode 100644 index 0000000..858c3a2 --- /dev/null +++ b/ScpSwap/ScpSwap.cs @@ -0,0 +1,23 @@ +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Loader.Features.Plugins; + +namespace ScpSwap; + +public class ScpSwap : Plugin +{ + public override string Name => "ScpSwap"; + public override string Author => "HoherGeist, Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Swap SCPs."; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + public override void Enable() + { + } + + public override void Disable() + { + + } +} \ No newline at end of file diff --git a/ScpSwap/ScpSwap.csproj b/ScpSwap/ScpSwap.csproj new file mode 100644 index 0000000..c0290e1 --- /dev/null +++ b/ScpSwap/ScpSwap.csproj @@ -0,0 +1,43 @@ + + + + net48 + enable + disable + latest + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\CommandSystem.Core.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/ScpSwap/SwapCommand.cs b/ScpSwap/SwapCommand.cs new file mode 100644 index 0000000..a8edf3f --- /dev/null +++ b/ScpSwap/SwapCommand.cs @@ -0,0 +1,81 @@ +using CommandSystem; +using LabApi.Features.Wrappers; +using PlayerRoles; + +namespace ScpSwap; + +[CommandHandler(typeof(ClientCommandHandler))] +public class SwapCommand : ICommand +{ + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (arguments.Count != 1) + { + response = "Usage: .scpswap "; + return false; + } + + if (!Player.TryGet(sender, out var player)) + { + response = "You must be a player to use this command!"; + return false; + } + + if (Round.Duration.TotalSeconds > 120) + { + response = "You can't swap SCPs during a round!"; + return false; + } + + if (!player.IsSCP) + { + response = "You must be an SCP to use this command!"; + return false; + } + + List validScp = + [ + "049", + "079", + "096", + "106", + "173", + "939", + ]; + + var arg = arguments.First(); + + if (!validScp.Contains(arg)) + { + response = "Invalid SCP number."; + return false; + } + + if (Player.List.Where(x=>x.IsSCP).Select(x=>x.RoleBase).Any(playerRole => playerRole.RoleName == "SCP-" + arg)) + { + response = "Already exists"; + return false; + } + + var role = arg switch + { + "049" => RoleTypeId.Scp049, + "079" => RoleTypeId.Scp079, + "096" => RoleTypeId.Scp096, + "106" => RoleTypeId.Scp106, + "173" => RoleTypeId.Scp173, + "939" => RoleTypeId.Scp939, + _ => throw new ArgumentOutOfRangeException() + }; + + player.SetRole(role); + + response = "Swapping..."; + + return true; + } + + public string Command { get; } = "scpswap"; + public string[] Aliases { get; } = ["ss"]; + public string Description { get; } = "Swaps SCPs"; +} \ No newline at end of file diff --git a/SecretPluginLaboratories.sln b/SecretPluginLaboratories.sln index 5964e99..eeba33d 100644 --- a/SecretPluginLaboratories.sln +++ b/SecretPluginLaboratories.sln @@ -18,6 +18,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan.Tests", "RangeBan. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CuffedFrenemies", "CuffedFrenemies\CuffedFrenemies.csproj", "{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CandySetting", "CandySetting\CandySetting.csproj", "{DF3E3243-BD16-4484-BA01-020170FFC871}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScpSwap", "ScpSwap\ScpSwap.csproj", "{B56CA1D5-0927-4542-B967-5E7F5B092E50}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomItemSpawn", "CustomItemSpawn\CustomItemSpawn.csproj", "{887DC217-999F-400B-8918-6737B7694BEE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AfkSwap", "AfkSwap\AfkSwap.csproj", "{A21DBED5-2B6C-4298-B2CC-DE8F4BAC9766}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WarheadEvents", "WarheadEvents\WarheadEvents.csproj", "{83EB26E9-C1EB-43C9-B010-BBE0F7F05EE9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomClasses", "CustomClasses\CustomClasses.csproj", "{234E0C4B-5CD2-4FEB-8222-950959E6C082}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerHints", "ServerHints\ServerHints.csproj", "{146AC6C6-AFE6-4EEA-B2F4-6403AD7189D9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrowingZombies", "GrowingZombies\GrowingZombies.csproj", "{5751F8D6-7A8D-4C2C-B7E9-A8A3DB324329}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,5 +76,37 @@ Global {C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.Build.0 = Release|Any CPU + {DF3E3243-BD16-4484-BA01-020170FFC871}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF3E3243-BD16-4484-BA01-020170FFC871}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF3E3243-BD16-4484-BA01-020170FFC871}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF3E3243-BD16-4484-BA01-020170FFC871}.Release|Any CPU.Build.0 = Release|Any CPU + {B56CA1D5-0927-4542-B967-5E7F5B092E50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B56CA1D5-0927-4542-B967-5E7F5B092E50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B56CA1D5-0927-4542-B967-5E7F5B092E50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B56CA1D5-0927-4542-B967-5E7F5B092E50}.Release|Any CPU.Build.0 = Release|Any CPU + {887DC217-999F-400B-8918-6737B7694BEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {887DC217-999F-400B-8918-6737B7694BEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {887DC217-999F-400B-8918-6737B7694BEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {887DC217-999F-400B-8918-6737B7694BEE}.Release|Any CPU.Build.0 = Release|Any CPU + {A21DBED5-2B6C-4298-B2CC-DE8F4BAC9766}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A21DBED5-2B6C-4298-B2CC-DE8F4BAC9766}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A21DBED5-2B6C-4298-B2CC-DE8F4BAC9766}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A21DBED5-2B6C-4298-B2CC-DE8F4BAC9766}.Release|Any CPU.Build.0 = Release|Any CPU + {83EB26E9-C1EB-43C9-B010-BBE0F7F05EE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83EB26E9-C1EB-43C9-B010-BBE0F7F05EE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83EB26E9-C1EB-43C9-B010-BBE0F7F05EE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83EB26E9-C1EB-43C9-B010-BBE0F7F05EE9}.Release|Any CPU.Build.0 = Release|Any CPU + {234E0C4B-5CD2-4FEB-8222-950959E6C082}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {234E0C4B-5CD2-4FEB-8222-950959E6C082}.Debug|Any CPU.Build.0 = Debug|Any CPU + {234E0C4B-5CD2-4FEB-8222-950959E6C082}.Release|Any CPU.ActiveCfg = Release|Any CPU + {234E0C4B-5CD2-4FEB-8222-950959E6C082}.Release|Any CPU.Build.0 = Release|Any CPU + {146AC6C6-AFE6-4EEA-B2F4-6403AD7189D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {146AC6C6-AFE6-4EEA-B2F4-6403AD7189D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {146AC6C6-AFE6-4EEA-B2F4-6403AD7189D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {146AC6C6-AFE6-4EEA-B2F4-6403AD7189D9}.Release|Any CPU.Build.0 = Release|Any CPU + {5751F8D6-7A8D-4C2C-B7E9-A8A3DB324329}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5751F8D6-7A8D-4C2C-B7E9-A8A3DB324329}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5751F8D6-7A8D-4C2C-B7E9-A8A3DB324329}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5751F8D6-7A8D-4C2C-B7E9-A8A3DB324329}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/ServerHints/ServerHints.cs b/ServerHints/ServerHints.cs new file mode 100644 index 0000000..b29fec4 --- /dev/null +++ b/ServerHints/ServerHints.cs @@ -0,0 +1,51 @@ +using LabApi.Events.Handlers; +using LabApi.Features; +using LabApi.Features.Wrappers; +using LabApi.Loader.Features.Plugins; +using MEC; + +namespace ServerHints; + +public class ServerHints: Plugin +{ + public override string Name => "ServerHints"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Adds hints for custom features."; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + public string[] Hints { get; set; } = + [ + "Man kann gegnerische Einheiten festnehmen, um sie zu seiner Seite zu bringen.", + "Als Hausmeister beginnst du in der Nähe von SCP-914.", + "Du kannst als SCP mit .scpswap deine Rolle tauschen. (Ö)", + "Es gibt auf der Surface versteckte Items.", + "Man kann mehr als 2 Candies nehmen.", + "Man braucht seine Karte nicht in der Hand zu halten.", + "Man kann Türen aufschießen", + "Wenn man Granaten anschießt, explodieren sie sofort." + ]; + + public override void Enable() + { + ServerEvents.RoundStarted += OnRoundStarted; + } + + + public override void Disable() + { + ServerEvents.RoundStarted -= OnRoundStarted; + } + private void OnRoundStarted() + { + var random = new Random(); + var hint = Hints[random.Next(Hints.Length)]; + Timing.CallDelayed(1, () => + { + foreach (var player in Player.ReadyList) + { + player.SendBroadcast($"{hint}", 3); + } + }); + } +} \ No newline at end of file diff --git a/ServerHints/ServerHints.csproj b/ServerHints/ServerHints.csproj new file mode 100644 index 0000000..de77391 --- /dev/null +++ b/ServerHints/ServerHints.csproj @@ -0,0 +1,46 @@ + + + + net48 + enable + disable + latest + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\NorthwoodLib.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + + diff --git a/VisibleSpectators/VisibleSpectators.cs b/VisibleSpectators/VisibleSpectators.cs index 421d4da..8f7b7e0 100644 --- a/VisibleSpectators/VisibleSpectators.cs +++ b/VisibleSpectators/VisibleSpectators.cs @@ -65,8 +65,6 @@ namespace VisibleSpectators private void AddPlayerHint(Player player) { - if (player == null) return; - var hint = new Hint { Text = $"{Config!.HeaderMessage}\n{Config!.NoSpectatorsMessage}", @@ -118,6 +116,7 @@ namespace VisibleSpectators private static string PlayerToDisplay(Player player) { if (player == null) return ""; + if (!player.IsReady) return ""; // Default color if GroupColor is null or not found in the map const string defaultColor = "FFFFFF"; @@ -143,11 +142,6 @@ namespace VisibleSpectators private void UpdateSpectators(Player player) { - if (player == null) - { - return; - } - // Safety check - if player doesn't have a hint, create one if (!_spectatorHints.ContainsKey(player)) { @@ -185,7 +179,7 @@ namespace VisibleSpectators private static Player[] GetPlayers() { - return Player.Dictionary.Values.Where(x=>!x.IsHost).ToArray(); + return Player.ReadyList.Where(IsNotOverwatch).ToArray(); } private static void OnSpectate(PlayerChangedSpectatorEventArgs ev) @@ -203,7 +197,7 @@ namespace VisibleSpectators public class SpectatorConfig { - public string HeaderMessage => "Spectators:"; - public string NoSpectatorsMessage => "No spectators"; + public string HeaderMessage { get; set; } = "Spectators:"; + public string NoSpectatorsMessage { get; set; } = "No spectators"; } } \ No newline at end of file diff --git a/WarheadEvents/WarheadEvents.cs b/WarheadEvents/WarheadEvents.cs new file mode 100644 index 0000000..991fc8b --- /dev/null +++ b/WarheadEvents/WarheadEvents.cs @@ -0,0 +1,33 @@ +using Interactables.Interobjects.DoorUtils; +using LabApi.Events.Arguments.WarheadEvents; +using LabApi.Features; +using LabApi.Features.Wrappers; +using LabApi.Loader.Features.Plugins; + +namespace WarheadEvents; + +public class WarheadEvents : Plugin +{ + public override string Name => "WarheadEvents"; + public override string Author => "Code002Lover"; + public override Version Version { get; } = new(1, 0, 0); + public override string Description => "Misc. stuff for after the Warhead explosion."; + public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); + + public override void Enable() + { + LabApi.Events.Handlers.WarheadEvents.Detonated += OnExplode; + } + + public override void Disable() + { + + } + + private static void OnExplode(WarheadDetonatedEventArgs ev) + { + var door = Door.Get(DoorVariant.AllDoors.First(x=>x.DoorName.ToUpper() == "ESCAPE_FINAL")); + + door.IsOpened = true; + } +} \ No newline at end of file diff --git a/WarheadEvents/WarheadEvents.csproj b/WarheadEvents/WarheadEvents.csproj new file mode 100644 index 0000000..085e80b --- /dev/null +++ b/WarheadEvents/WarheadEvents.csproj @@ -0,0 +1,43 @@ + + + + net48 + enable + disable + 10 + + + + true + true + full + + + + true + false + none + + + + + ..\dependencies\Assembly-CSharp.dll + + + ..\dependencies\Assembly-CSharp-firstpass.dll + + + ..\dependencies\Mirror.dll + + + ..\dependencies\Pooling.dll + + + ..\dependencies\UnityEngine.CoreModule.dll + + + + + + +