Skip to content

refactor: rewrite CustomScpTermination #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 38 additions & 17 deletions EXILED/Exiled.API/Features/Cassie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ namespace Exiled.API.Features

using Respawning;

using CustomFirearmHandler = DamageHandlers.FirearmDamageHandler;
using CustomHandlerBase = DamageHandlers.DamageHandlerBase;
using CustomHandler = DamageHandlers.CustomDamageHandler;

/// <summary>
/// A set of tools to use in-game C.A.S.S.I.E.
Expand Down Expand Up @@ -140,25 +139,47 @@ public static void ScpTermination(Player scp, DamageHandlerBase info)
=> NineTailedFoxAnnouncer.AnnounceScpTermination(scp.ReferenceHub, info);

/// <summary>
/// Announces the termination of a custom SCP name.
/// Announces the termination of a custom SCP Number.
/// </summary>
/// <param name="scpName">SCP Name. Note that for larger numbers, C.A.S.S.I.E will pronounce the place (eg. "457" -> "four hundred fifty seven"). Spaces can be used to prevent this behavior.</param>
/// <param name="scpNumber">SCP Number. Note that for larger numbers, C.A.S.S.I.E will pronounce the place (eg. "457" -> "four hundred fifty seven"). Spaces can be used to prevent this behavior.</param>
/// <param name="info">Hit Information.</param>
public static void CustomScpTermination(string scpName, CustomHandlerBase info)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking change

public static void CustomScpTermination(string scpNumber, CustomHandler info)
{
string result = scpName;
if (info.Is(out MicroHidDamageHandler _))
result += " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM";
else if (info.Is(out WarheadDamageHandler _))
result += " SUCCESSFULLY TERMINATED BY ALPHA WARHEAD";
else if (info.Is(out UniversalDamageHandler _))
result += " LOST IN DECONTAMINATION SEQUENCE";
else if (info.BaseIs(out CustomFirearmHandler firearmDamageHandler) && firearmDamageHandler.Attacker is Player attacker)
result += " CONTAINEDSUCCESSFULLY " + ConvertTeam(attacker.Role.Team, attacker.UnitName);

// result += "To be changed";
if (info is null)
throw new System.ArgumentNullException(nameof(info));

string result = "SCP " + scpNumber;
if (info.Attacker is null)
{
if (info.Type is Enums.DamageType.Warhead)
result += " SUCCESSFULLY TERMINATED BY ALPHA WARHEAD";
else if (info.Type is Enums.DamageType.Decontamination)
result += " LOST IN DECONTAMINATION SEQUENCE";
else if (info.Type is Enums.DamageType.Tesla)
result += " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM";
else
result += " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED";
}
else
result += " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED";
{
if (info.Attacker.Role.Team is Team.SCPs)
{
string attacker_name = string.Join(" ", info.Attacker.Role.Name.Remove(0, 4).ToCharArray());
result += " TERMINATED BY SCP " + attacker_name;
}
else if (info.Attacker.Role.Team is Team.Flamingos)
{
result += " TERMINATED BY SCP 1 5 0 7";
}
else if (info.Attacker.Role.Team is Team.OtherAlive || info.Attacker.Role.Team is Team.Dead)
{
result += " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED";
}
else
{
result += " CONTAINEDSUCCESSFULLY " + ConvertTeam(info.Attacker.Role.Team, info.Attacker.UnitName);
}
}

float num = AlphaWarheadController.TimeUntilDetonation <= 0f ? 3.5f : 1f;
GlitchyMessage(result, UnityEngine.Random.Range(0.1f, 0.14f) * num, UnityEngine.Random.Range(0.07f, 0.08f) * num);
Expand Down
Loading