HudManager.Instance.StartCoroutine(Effects.Lerp(Portal.teleportDuration, new Action<float>((p) => { // Delayed action
PlayerControl.LocalPlayer.moveable = false;
PlayerControl.LocalPlayer.NetTransform.Halt();
- if (p >= 0.5f && p <= 0.53f && !didTeleport) {
+ if (p >= 0.5f && p <= 0.53f && !didTeleport && !MeetingHud.Instance) {
if (SubmergedCompatibility.isSubmerged()) {
SubmergedCompatibility.ChangeFloor(exit.y > -7);
}
if (Medium.target == null || Medium.target.player == null) return;
string msg = "";
- int randomNumber = TheOtherRoles.rnd.Next(4);
+ int randomNumber = Medium.target.killerIfExisting?.PlayerId == Mini.mini?.PlayerId ? TheOtherRoles.rnd.Next(3) : TheOtherRoles.rnd.Next(4);
string typeOfColor = Helpers.isLighterColor(Medium.target.killerIfExisting.Data.DefaultOutfit.ColorId) ? "lighter" : "darker";
float timeSinceDeath = ((float)(Medium.meetingStartTime - Medium.target.timeOfDeath).TotalMilliseconds);
string name = " (" + Medium.target.player.Data.PlayerName + ")";
if (randomNumber == 0) msg = "What is your role? My role is " + RoleInfo.GetRolesString(Medium.target.player, false) + name;
else if (randomNumber == 1) msg = "What is your killer`s color type? My killer is a " + typeOfColor + " color" + name;
else if (randomNumber == 2) msg = "When did you die? I have died " + Math.Round(timeSinceDeath / 1000) + "s before meeting started" + name;
- else msg = "What is your killer`s role? My killer is " + RoleInfo.GetRolesString(Medium.target.killerIfExisting, false) + name;
+ else msg = "What is your killer`s role? My killer is " + RoleInfo.GetRolesString(Medium.target.killerIfExisting, true) + name;
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{msg}");
public class TheOtherRolesPlugin : BasePlugin
{
public const string Id = "me.eisbison.theotherroles";
- public const string VersionString = "4.1.0";
+ public const string VersionString = "4.1.1";
public static Version Version = Version.Parse(VersionString);
internal static BepInEx.Logging.ManualLogSource Logger;
LastPosition = new Vector3(MinX, MinY);
lastAspect = aspect;
setLastPosition = true;
+ if (Scroller != null) Scroller.ContentXBounds = new FloatRange(MinX, MinX);
}
CreateScroller(__instance);
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (scene.name != "MainMenu") return;
- if (RequiredUpdateData is null) return;
+ if (RequiredUpdateData is null) {
+ showPopUp = false;
+ return;
+ }
var template = GameObject.Find("ExitGameButton");
if (!template) return;
var isSubmerged = TORUpdate == null;
var announcement = $"<size=150%>A new <color=#FC0303>{(isSubmerged ? "Submerged" : "THE OTHER ROLES")}</color> update to {(isSubmerged ? SubmergedUpdate.Tag : TORUpdate.Tag)} is available</size>\n{(isSubmerged ? SubmergedUpdate.Content : TORUpdate.Content)}";
var mgr = FindObjectOfType<MainMenuManager>(true);
+ if (isSubmerged && !SubmergedCompatibility.Loaded) showPopUp = false;
if (showPopUp) mgr.StartCoroutine(CoShowAnnouncement(announcement));
showPopUp = false;
}
{
var torUpdateCheck = Task.Run(() => Instance.GetGithubUpdate("Eisbison", "TheOtherRoles"));
while (!torUpdateCheck.IsCompleted) yield return null;
+ Announcement.updateData = torUpdateCheck.Result;
if (torUpdateCheck.Result != null && torUpdateCheck.Result.IsNewer(Version.Parse(TheOtherRolesPlugin.VersionString)))
{
Instance.TORUpdate = torUpdateCheck.Result;
if (downloadURI.Length == 0) return false;
var res = await client.GetAsync(downloadURI, HttpCompletionOption.ResponseContentRead);
- string codeBase = (isSubmerged ? SubmergedCompatibility.Assembly : Assembly.GetExecutingAssembly()).CodeBase;
+ string codeBase = "";
+ if (!isSubmerged)
+ codeBase = Assembly.GetExecutingAssembly().CodeBase;
+ else if (SubmergedCompatibility.Loaded)
+ codeBase = SubmergedCompatibility.Assembly.CodeBase;
+ else {
+ Uri pluginsFolder = new Uri(new Uri(Assembly.GetExecutingAssembly().CodeBase), ".");
+ codeBase = pluginsFolder.OriginalString + "/Submerged.dll";
+ }
+
UriBuilder uri = new UriBuilder(codeBase);
string fullname = Uri.UnescapeDataString(uri.Path);
if (File.Exists(fullname + ".old")) File.Delete(fullname + ".old");
- File.Move(fullname, fullname + ".old");
+ if (File.Exists(fullname)) File.Move(fullname, fullname + ".old");
await using var responseStream = await res.Content.ReadAsStreamAsync();
await using var fileStream = File.Create(fullname);
});
}
}
+
+ [HarmonyPatch(typeof(AnnouncementPopUp), nameof(AnnouncementPopUp.UpdateAnnounceText))]
+ public static class Announcement
+ {
+ public static ModUpdateBehaviour.UpdateData updateData = null;
+ public static bool Prefix(AnnouncementPopUp __instance)
+ {
+ if (ModUpdateBehaviour.showPopUp || updateData == null) return true;
+
+ var text = __instance.AnnounceTextMeshPro;
+ text.text = $"<size=150%><color=#FC0303>THE OTHER ROLES </color> {(updateData.Tag)}\n{(updateData.Content)}";
+
+ return false;
+ }
+ }
}
\ No newline at end of file
}
static void updateImpostorKillButton(HudManager __instance) {
- if (!PlayerControl.LocalPlayer.Data.Role.IsImpostor || MeetingHud.Instance) return;
+ if (!PlayerControl.LocalPlayer.Data.Role.IsImpostor) return;
+ if (MeetingHud.Instance) {
+ __instance.KillButton.Hide();
+ return;
+ }
bool enabled = true;
if (Vampire.vampire != null && Vampire.vampire == PlayerControl.LocalPlayer)
enabled = false;
}
+ static void updateUseButton(HudManager __instance) {
+ if (MeetingHud.Instance) __instance.UseButton.Hide();
+ }
+
+ static void updateSabotageButton(HudManager __instance) {
+ if (MeetingHud.Instance) __instance.SabotageButton.Hide();
+ }
+
static void Postfix(HudManager __instance)
{
if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) return;
// Deputy Sabotage, Use and Vent Button Disabling
updateReportButton(__instance);
updateVentButton(__instance);
+ // Meeting hide buttons if needed (used for the map usage, because closing the map would show buttons)
+ updateSabotageButton(__instance);
+ updateUseButton(__instance);
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
- <Version>4.0.0</Version>
+ <Version>4.1.1</Version>
<Description>TheOtherRoles</Description>
<Authors>Eisbison</Authors>
<LangVersion>latest</LangVersion>
<Reference Include="$(AmongUs)/BepInEx/unhollowed/*.dll" />
</ItemGroup>
- <ItemGroup>
- <None Remove="Resources\Blood1.png" />
- <None Remove="Resources\Blood2.png" />
- <None Remove="Resources\Blood3.png" />
- </ItemGroup>
-
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<Message Text="Second occurrence" />
<Copy SourceFiles="$(ProjectDir)\bin\$(Configuration)\netstandard2.1\TheOtherRoles.dll" DestinationFolder="$(AmongUsLatest)/BepInEx/plugins/" />