-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Project Overhaul Stylecop, moved to using a component, moved and added patches, redid method class and contained methods, rewrote and added commands, rewrote and added configs. * Proper Versioning * Add Win Conditions Win with tutorials config, brought back a revamped version of the old EndingRound event handler. * Remove OnlyMimicSpawned Option that was stupid * Self Damage, Ranged Notifications, Proper Destruction * Performance for Ranged Notification Removed a few GetComponent calls. * ReadMe update, config sorting Updated readme to account for ranged notification, moved ranged notification down in the name config to be in alphabetical order, updated description of enabled option in ranged notification.
- Loading branch information
BuildBoy12
authored
Mar 10, 2021
1 parent
42c0170
commit 5885281
Showing
44 changed files
with
1,825 additions
and
1,357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scp035", "Scp035\Scp035.csproj", "{2CF3F5CA-6207-47DC-9168-1F35AEAE8435}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2CF3F5CA-6207-47DC-9168-1F35AEAE8435}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2CF3F5CA-6207-47DC-9168-1F35AEAE8435}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2CF3F5CA-6207-47DC-9168-1F35AEAE8435}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2CF3F5CA-6207-47DC-9168-1F35AEAE8435}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="API.cs" company="Build and Cyanox"> | ||
// Copyright (c) Build and Cyanox. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Scp035 | ||
{ | ||
#pragma warning disable SA1135 | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Components; | ||
using Exiled.API.Features; | ||
|
||
/// <summary> | ||
/// The main API class to get and manipulate data. | ||
/// </summary> | ||
public static class API | ||
{ | ||
/// <summary> | ||
/// Gets all active Scp035 instances. | ||
/// </summary> | ||
public static IEnumerable<Player> AllScp035 => Player.List.Where(player => player.SessionVariables.ContainsKey("IsScp035")); | ||
|
||
/// <summary> | ||
/// Determines if a given <see cref="Player"/> is a Scp035. | ||
/// </summary> | ||
/// <param name="player">The <see cref="Player"/> to check for being a Scp035 instance.</param> | ||
/// <returns>A value indicating whether the <see cref="Player"/> is a Scp035 instance.</returns> | ||
public static bool IsScp035(Player player) => player.SessionVariables.ContainsKey("IsScp035"); | ||
|
||
/// <summary> | ||
/// Spawns a user as a Scp035 instance. | ||
/// </summary> | ||
/// <param name="player">The <see cref="Player"/> to spawn in as a Scp035 instance.</param> | ||
/// <param name="toReplace">The <see cref="Player"/> to replace.</param> | ||
public static void Spawn035(Player player, Player toReplace = null) => player.GameObject.AddComponent<Scp035Component>().AwakeFunc(toReplace); | ||
|
||
/// <summary> | ||
/// Spawns the specified amount of Scp035 item instances. | ||
/// </summary> | ||
/// <param name="amount">The amount of items to spawn.</param> | ||
/// <returns>All <see cref="Pickup"/>s that were spawned as Scp035 item instances.</returns> | ||
public static IEnumerable<Pickup> SpawnItems(int amount) => Methods.SpawnPickups(amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="Scp035Parent.cs" company="Build and Cyanox"> | ||
// Copyright (c) Build and Cyanox. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Scp035.Commands | ||
{ | ||
#pragma warning disable SA1101 | ||
#pragma warning disable SA1135 | ||
|
||
using System; | ||
using System.Text; | ||
using CommandSystem; | ||
using NorthwoodLib.Pools; | ||
using SubCommands; | ||
|
||
/// <summary> | ||
/// The command which all Scp035 commands are run off of. | ||
/// </summary> | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
public class Scp035Parent : ParentCommand | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Scp035Parent"/> class. | ||
/// </summary> | ||
public Scp035Parent() => LoadGeneratedCommands(); | ||
|
||
/// <inheritdoc/> | ||
public override string Command { get; } = "035"; | ||
|
||
/// <inheritdoc/> | ||
public override string[] Aliases { get; } = Array.Empty<string>(); | ||
|
||
/// <inheritdoc/> | ||
public override string Description { get; } = "Parent command for Scp035"; | ||
|
||
/// <inheritdoc/> | ||
public sealed override void LoadGeneratedCommands() | ||
{ | ||
RegisterCommand(new Kill()); | ||
RegisterCommand(new List()); | ||
RegisterCommand(new Spawn()); | ||
RegisterCommand(new SpawnItems()); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
StringBuilder stringBuilder = StringBuilderPool.Shared.Rent(); | ||
foreach (var command in AllCommands) | ||
{ | ||
stringBuilder.AppendLine(command.Aliases.Length > 0 | ||
? $"{command.Command} | Aliases: {string.Join(", ", command.Aliases)}" | ||
: command.Command); | ||
} | ||
|
||
response = $"Please enter a valid subcommand! Available:\n{StringBuilderPool.Shared.ToStringReturn(stringBuilder)}"; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="Kill.cs" company="Build and Cyanox"> | ||
// Copyright (c) Build and Cyanox. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Scp035.Commands.SubCommands | ||
{ | ||
using System; | ||
using CommandSystem; | ||
using Exiled.Permissions.Extensions; | ||
|
||
/// <summary> | ||
/// A command which kills all active Scp035 instances. | ||
/// </summary> | ||
public class Kill : ICommand | ||
{ | ||
/// <inheritdoc/> | ||
public string Command { get; } = "kill"; | ||
|
||
/// <inheritdoc/> | ||
public string[] Aliases { get; } = { "k" }; | ||
|
||
/// <inheritdoc/> | ||
public string Description { get; } = "Kills all alive Scp035s."; | ||
|
||
/// <inheritdoc/> | ||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!sender.CheckPermission("035.kill")) | ||
{ | ||
response = "Insufficient permission. Required: 035.kill"; | ||
return false; | ||
} | ||
|
||
foreach (var player in API.AllScp035) | ||
{ | ||
player.Kill(); | ||
} | ||
|
||
response = "Killed all Scp035 users successfully."; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="List.cs" company="Build and Cyanox"> | ||
// Copyright (c) Build and Cyanox. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Scp035.Commands.SubCommands | ||
{ | ||
using System; | ||
using System.Linq; | ||
using CommandSystem; | ||
using Exiled.Permissions.Extensions; | ||
|
||
/// <summary> | ||
/// A command which lists all active Scp035 instances. | ||
/// </summary> | ||
public class List : ICommand | ||
{ | ||
/// <inheritdoc/> | ||
public string Command { get; } = "list"; | ||
|
||
/// <inheritdoc/> | ||
public string[] Aliases { get; } = { "l" }; | ||
|
||
/// <inheritdoc/> | ||
public string Description { get; } = "Lists all active Scp035 instances."; | ||
|
||
/// <inheritdoc/> | ||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!sender.CheckPermission("035.list")) | ||
{ | ||
response = "Insufficient permission. Required: 035.list"; | ||
return false; | ||
} | ||
|
||
response = $"Alive Scp035 Instances: {string.Join(", ", API.AllScp035.Select(player => player.Nickname))}"; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="Spawn.cs" company="Build and Cyanox"> | ||
// Copyright (c) Build and Cyanox. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Scp035.Commands.SubCommands | ||
{ | ||
using System; | ||
using CommandSystem; | ||
using Exiled.API.Features; | ||
using Exiled.Permissions.Extensions; | ||
using RemoteAdmin; | ||
|
||
/// <summary> | ||
/// A command which spawns an active Scp035 instance. | ||
/// </summary> | ||
public class Spawn : ICommand | ||
{ | ||
/// <inheritdoc/> | ||
public string Command { get; } = "spawn"; | ||
|
||
/// <inheritdoc/> | ||
public string[] Aliases { get; } = { "s" }; | ||
|
||
/// <inheritdoc/> | ||
public string Description { get; } = "Spawns a user as an instance of Scp035."; | ||
|
||
/// <inheritdoc/> | ||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!sender.CheckPermission("035.spawn")) | ||
{ | ||
response = "Insufficient permission. Required: 035.spawn"; | ||
return false; | ||
} | ||
|
||
Player player = Player.Get((sender as PlayerCommandSender)?.ReferenceHub); | ||
if (arguments.Count > 0) | ||
{ | ||
if (!(Player.Get(arguments.At(0)) is Player ply)) | ||
{ | ||
response = "Could not find the referenced user."; | ||
return false; | ||
} | ||
|
||
player = ply; | ||
} | ||
|
||
if (API.IsScp035(player)) | ||
{ | ||
response = $"{player.Nickname} is already a Scp035!"; | ||
return false; | ||
} | ||
|
||
if (!player.IsAlive || player.IsScp) | ||
{ | ||
player.Role = RoleType.ClassD; | ||
} | ||
|
||
API.Spawn035(player); | ||
response = $"Spawned {player.Nickname} as a Scp035."; | ||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.