mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
CanKill -> UseVanillaKillButton
ICustomRole changes to clear up confusion Add KillButtonOutlineColor to ICustomRole
This commit is contained in:
1 parent
dc483adc1c
commit
cb943c2173
4 files changed
+32
-16
No files matched your search
@@ -11,7 +11,7 @@ public class NeutralKillerRole : ImpostorRole, ICustomRole
|
|||||||
public string RoleLongDescription => RoleDescription;
|
public string RoleLongDescription => RoleDescription;
|
||||||
public Color RoleColor => Color.magenta;
|
public Color RoleColor => Color.magenta;
|
||||||
public ModdedRoleTeams Team => ModdedRoleTeams.Neutral;
|
public ModdedRoleTeams Team => ModdedRoleTeams.Neutral;
|
||||||
public bool CanUseKill => true;
|
public bool UseVanillaKillButton => true;
|
||||||
public bool CanGetKilled => true;
|
public bool CanGetKilled => true;
|
||||||
public bool CanUseVent => true;
|
public bool CanUseVent => true;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ namespace MiraAPI.Patches.Roles;
|
|||||||
[HarmonyPatch(typeof(KillButton))]
|
[HarmonyPatch(typeof(KillButton))]
|
||||||
public static class KillButtonPatches
|
public static class KillButtonPatches
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SetTarget for custom roles.
|
||||||
|
/// </summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(nameof(KillButton.SetTarget))]
|
[HarmonyPatch(nameof(KillButton.SetTarget))]
|
||||||
public static bool SetTargetPrefix(KillButton __instance, PlayerControl target)
|
public static bool SetTargetPrefix(KillButton __instance, PlayerControl target)
|
||||||
@@ -33,7 +36,7 @@ public static class KillButtonPatches
|
|||||||
__instance.currentTarget = target;
|
__instance.currentTarget = target;
|
||||||
if (__instance.currentTarget)
|
if (__instance.currentTarget)
|
||||||
{
|
{
|
||||||
__instance.currentTarget.cosmetics.SetOutline(true, new Nullable<Color>(customRole.RoleColor));
|
__instance.currentTarget.cosmetics.SetOutline(true, new Nullable<Color>(customRole.KillButtonOutlineColor));
|
||||||
__instance.SetEnabled();
|
__instance.SetEnabled();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -42,6 +45,9 @@ public static class KillButtonPatches
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Use Custom Murder if player is custom role.
|
||||||
|
/// </summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(nameof(KillButton.DoClick))]
|
[HarmonyPatch(nameof(KillButton.DoClick))]
|
||||||
public static bool DoClickPrefix(KillButton __instance)
|
public static bool DoClickPrefix(KillButton __instance)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public static class CustomRoleManager
|
|||||||
roleBehaviour.BlurbNameLong = CustomStringName.CreateAndRegister(customRole.RoleLongDescription);
|
roleBehaviour.BlurbNameLong = CustomStringName.CreateAndRegister(customRole.RoleLongDescription);
|
||||||
roleBehaviour.AffectedByLightAffectors = customRole.AffectedByLightOnAirship;
|
roleBehaviour.AffectedByLightAffectors = customRole.AffectedByLightOnAirship;
|
||||||
roleBehaviour.CanBeKilled = customRole.CanGetKilled;
|
roleBehaviour.CanBeKilled = customRole.CanGetKilled;
|
||||||
roleBehaviour.CanUseKillButton = customRole.CanUseKill;
|
roleBehaviour.CanUseKillButton = customRole.UseVanillaKillButton;
|
||||||
roleBehaviour.TasksCountTowardProgress = customRole.TasksCountForProgress;
|
roleBehaviour.TasksCountTowardProgress = customRole.TasksCountForProgress;
|
||||||
roleBehaviour.CanVent = customRole.CanUseVent;
|
roleBehaviour.CanVent = customRole.CanUseVent;
|
||||||
roleBehaviour.DefaultGhostRole = customRole.GhostRole;
|
roleBehaviour.DefaultGhostRole = customRole.GhostRole;
|
||||||
|
|||||||
@@ -57,30 +57,20 @@ public interface ICustomRole
|
|||||||
[HideFromIl2Cpp]
|
[HideFromIl2Cpp]
|
||||||
LoadableAsset<Sprite> Icon => MiraAssets.Empty;
|
LoadableAsset<Sprite> Icon => MiraAssets.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the BepInEx ConfigDefinition for the amount of players that can have this role.
|
|
||||||
/// </summary>
|
|
||||||
ConfigDefinition NumConfigDefinition => new("Roles", $"Num {GetType().FullName}");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the BepInEx ConfigDefinition for the chance of this role being selected.
|
|
||||||
/// </summary>
|
|
||||||
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance {GetType().FullName}");
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the role is affected by light affectors on Airship.
|
/// Gets a value indicating whether the role is affected by light affectors on Airship.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool AffectedByLightOnAirship => Team == ModdedRoleTeams.Crewmate;
|
bool AffectedByLightOnAirship => Team == ModdedRoleTeams.Crewmate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the role can be killed by others.
|
/// Gets a value indicating whether the role can be killed by vanilla murder system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool CanGetKilled => Team == ModdedRoleTeams.Crewmate;
|
bool CanGetKilled => Team == ModdedRoleTeams.Crewmate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the role can kill others.
|
/// Gets a value indicating whether the role should use the vanilla kill button.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool CanUseKill => Team == ModdedRoleTeams.Impostor;
|
bool UseVanillaKillButton => Team == ModdedRoleTeams.Impostor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the role can use vents.
|
/// Gets a value indicating whether the role can use vents.
|
||||||
@@ -102,6 +92,16 @@ public interface ICustomRole
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
bool HideSettings => IsGhostRole;
|
bool HideSettings => IsGhostRole;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the outline color for the KillButton if <see cref="UseVanillaKillButton"/> is true.
|
||||||
|
/// </summary>
|
||||||
|
Color KillButtonOutlineColor => Team switch
|
||||||
|
{
|
||||||
|
ModdedRoleTeams.Impostor => Palette.ImpostorRed,
|
||||||
|
ModdedRoleTeams.Crewmate => Palette.CrewmateBlue,
|
||||||
|
_ => RoleColor,
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the role hint style. See <see cref="RoleHintType"/> enum for all options.
|
/// Gets the role hint style. See <see cref="RoleHintType"/> enum for all options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -112,6 +112,16 @@ public interface ICustomRole
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
RoleTypes GhostRole => Team == ModdedRoleTeams.Impostor ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost;
|
RoleTypes GhostRole => Team == ModdedRoleTeams.Impostor ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the BepInEx ConfigDefinition for the amount of players that can have this role.
|
||||||
|
/// </summary>
|
||||||
|
ConfigDefinition NumConfigDefinition => new("Roles", $"Num {GetType().FullName}");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the BepInEx ConfigDefinition for the chance of this role being selected.
|
||||||
|
/// </summary>
|
||||||
|
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance {GetType().FullName}");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the parent mod of this role.
|
/// Gets the parent mod of this role.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in new issue
Block a user