Merge pull request #28 from Zeo666/IntroTeam

Custom Intro Team Screen
This commit is contained in:
XtraCube authored and GitHub committed 2025-02-27 18:33:24 -05:00
commit 2159b6aa89
2 files changed
+22 -36

No files matched your search

+2 -36
View File
@@ -32,25 +32,8 @@ public static class IntroCutscenePatches
[HarmonyPrefix]
[HarmonyPatch(nameof(IntroCutscene.BeginImpostor))]
public static void BeginImpostorPatch(IntroCutscene __instance)
{
if (PlayerControl.LocalPlayer.Data.Role is not ICustomRole customRole)
{
return;
}
if (customRole.IntroConfiguration is { } introConfig)
{
__instance.BackgroundBar.material.SetColor(ShaderID.Color, introConfig.IntroTeamColor);
__instance.TeamTitle.color = introConfig.IntroTeamColor;
__instance.TeamTitle.text = introConfig.IntroTeamTitle;
__instance.ImpostorText.text = introConfig.IntroTeamDescription;
}
}
[HarmonyPrefix]
[HarmonyPatch(nameof(IntroCutscene.BeginCrewmate))]
public static bool BeginCrewmatePatch(IntroCutscene __instance)
public static bool BeginImpostorPatch(IntroCutscene __instance, [HarmonyArgument(0)] ref Il2CppSystem.Collections.Generic.List<PlayerControl> yourTeam)
{
if (PlayerControl.LocalPlayer.Data.Role is not ICustomRole customRole)
{
@@ -65,24 +48,7 @@ public static class IntroCutscenePatches
__instance.ImpostorText.text = introConfig.IntroTeamDescription;
}
if (customRole.Team is not ModdedRoleTeams.Custom)
{
return true;
}
var barTransform = __instance.BackgroundBar.transform;
var position = barTransform.position;
position.y -= 0.25f;
barTransform.position = position;
__instance.impostorScale = 1f;
__instance.ourCrewmate = __instance.CreatePlayer(
0,
Mathf.CeilToInt(7.5f),
PlayerControl.LocalPlayer.Data,
false);
return false;
return customRole.SetupIntroTeam(__instance, ref yourTeam);
}
/*
+20
View File
@@ -158,6 +158,26 @@ public interface ICustomRole
return (PlayerControl.LocalPlayer.Data.Role.IsImpostor && player.Data.Role.IsImpostor) || PlayerControl.LocalPlayer.Data.IsDead;
}
/// <summary>
/// Allows the role to specify who is shown on the intro team screen.
/// </summary>
/// <param name="instance">The intro cutscene instance.</param>
/// <param name="yourTeam">The reference to the list of player in the team.</param>
/// <returns>True to use the original team intro code, false to skip.</returns>
public virtual bool SetupIntroTeam(IntroCutscene instance, ref Il2CppSystem.Collections.Generic.List<PlayerControl> yourTeam)
{
if (Team == ModdedRoleTeams.Custom)
{
var team = new Il2CppSystem.Collections.Generic.List<PlayerControl>();
team.Add(PlayerControl.LocalPlayer);
yourTeam = team;
}
return true;
}
/// <summary>
/// This method runs on the HudManager.Update method ONLY when the LOCAL player has this role.
/// </summary>