Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Commit

Permalink
fixed randomly dissappearing kill button
Browse files Browse the repository at this point in the history
fixed kill button in lobby bug  caused by previous fix
fixed ability to kill on start screen
improved cosmetic
  • Loading branch information
Galster-dev committed Jan 11, 2021
1 parent f585ccd commit 36244cb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Warning!
This mod has a lot of bugs for now, i don't recommend using it
This mod still in pre-release, so it may have some bugs. So please understand it and report any bugs you found in [issues](https://github.com/Galster2010/CrowdedSheriff/issues)

# CrowdedSherrif

Very small [BepInEx](https://github.com/BepInEx/BepInEx/) plugin adding Sheriff role in the game\
Also this codebase *isn't perfect* because it was written for less than 24 hours

Expand All @@ -18,7 +17,7 @@ Also this codebase *isn't perfect* because it was written for less than 24 hours

# How to use
1. Everyone in the lobby *must* have this mod
2. Build [server](https://github.com/Galster2010/Impostor/) or [get latest release](https://github.com/Galster2010/Impostor/releases/latest) and set it up
2. Your server has to be patched (as for now) to allow non-impostors to kill. To do this build [this server](https://github.com/Galster2010/Impostor/) or [get latest release](https://github.com/Galster2010/Impostor/releases/latest) and set it up
3. Connect to server via [CustomServersClient](https://github.com/andruzzzhka/CustomServersClient/) or [these instructions](https://impostor.github.io/Impostor/)
4. Enjoy the game

Expand Down
6 changes: 2 additions & 4 deletions src/GenericPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ static void Postfix(ref VersionShower __instance)
[HarmonyPatch(typeof(PingTracker), nameof(PingTracker.Update))]
static class PingTracker_Update
{
static bool Prefix(ref PingTracker __instance)
static void Postfix(ref PingTracker __instance)
{
__instance.text.Text = $"Discord:\nsleepyut#0710";
__instance.text.Color = Color.green;
return false;
__instance.text.Text += "\n[FFA500FF]CrowdedSheriff";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/OptionsPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static bool Prefix(ref NumberOption __instance)
TranslationController_GetString.Prefix(__instance.Title, ref smh);
__instance.TitleText.Text = smh;
__instance.OnValueChanged = new Action<OptionBehaviour>(GameOptionsMenu_Start.OnValueChanged);
__instance.Value = 1f;
__instance.Value = sheriffCount;
__instance.enabled = true;

return false;
Expand Down
37 changes: 19 additions & 18 deletions src/RolePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Pallete = LOCPGOACAJF;
using PhysicsHelper = LBKBHDOOGHL;
using Constants = CAMOCHFAHMA;
using DeathReason = DBLJKMDLJIF;
using EndGameManager = ABNGEPFHMHP;
using KeyboardJoystick = ADEHDODPMHJ;
using GameData = EGLJNOMOGNP;
using PlayerInfo = EGLJNOMOGNP.DCJMABDDJCF;
Expand Down Expand Up @@ -85,25 +85,26 @@ static bool Prefix(ref IntroCutScene __instance)

__instance.Title.Text = "The Sheriff";
__instance.Title.Color = Pallete.HPMGFCCJLIF;
__instance.Title.scale /= 2;
__instance.Title.scale /= 1.5f; // the sheriff is too big
__instance.BackgroundBar.material.SetColor("_Color", Pallete.HPMGFCCJLIF);

var poolablePlayer = UnityEngine.Object.Instantiate(__instance.PlayerPrefab, __instance.transform);
var data = PlayerControl.LocalPlayer.JLGGIOLCDFC;

poolablePlayer.SetFlipX(false);
poolablePlayer.transform.localPosition = new Vector3(0, __instance.BaseY - 0.25f, -8);
var vec = new Vector3(1.8f, 1.8f, 1.8f);
var vec = new Vector3(1.5f, 1.5f, 1.5f);
poolablePlayer.transform.localScale = vec;
PlayerControl.SetPlayerMaterialColors(data.EHAHBDFODKC, poolablePlayer.Body);
HatManager.IAINKLDJAGC.HCAEGGFGECL(poolablePlayer.SkinSlot, data.HPAMBHFDLEH);
poolablePlayer.HatSlot.SetHat(data.AFEJLMBMKCJ, 0);
poolablePlayer.HatSlot.SetHat(data.AFEJLMBMKCJ, data.EHAHBDFODKC);
PlayerControl.SetPetImage(data.AJIBCNMKNPM, data.EHAHBDFODKC, poolablePlayer.PetSlot);
poolablePlayer.NameText.gameObject.SetActive(true);
poolablePlayer.NameText.Text = data.EIGEKHDAKOH;
poolablePlayer.NameText.Color = Pallete.HPMGFCCJLIF;
//poolablePlayer.NameText.Color = Pallete.HPMGFCCJLIF;
//poolablePlayer.NameText.transform.localScale = vec;
PlayerControl.LocalPlayer.nameText.Color = Pallete.HPMGFCCJLIF;
HudManager.IAINKLDJAGC.KillButton.gameObject.SetActive(true);
//HudManager.IAINKLDJAGC.KillButton.gameObject.SetActive(true);

return false;
}
Expand Down Expand Up @@ -141,25 +142,25 @@ static PlayerControl FindClosestTarget(ref PlayerControl local)
}
static void Postfix(ref PlayerControl __instance)
{
if(__instance.LGDCIDJJHMC && IsSheriff(__instance.PlayerId) && __instance.GEBLLBHGHLD && !__instance.JLGGIOLCDFC.DLPCKPBIJOE)
// AmOwner && isSheriff && canMove && !isDead
if(__instance.LGDCIDJJHMC && IsSheriff(__instance.PlayerId) && __instance.GEBLLBHGHLD)
// AmOwner && isSheriff && canMove
{
__instance.SetKillTimer(Mathf.Max(0f, __instance.killTimer - Time.fixedDeltaTime));
HudManager.IAINKLDJAGC.KillButton.SetTarget(FindClosestTarget(ref __instance));
if (!__instance.JLGGIOLCDFC.DLPCKPBIJOE)
{
__instance.SetKillTimer(Mathf.Max(0f, __instance.killTimer - Time.fixedDeltaTime));
HudManager.IAINKLDJAGC.KillButton.SetTarget(FindClosestTarget(ref __instance));
}
HudManager.IAINKLDJAGC.KillButton.gameObject.SetActive(!__instance.JLGGIOLCDFC.DLPCKPBIJOE);
}
}
}

[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.Die), new Type[] { typeof(DeathReason) })]
static class PlayerControl_Die
[HarmonyPatch(typeof(EndGameManager), nameof(EndGameManager.Start))]
static class EndGameManager_Start
{
static void Postfix(ref PlayerControl __instance)
static void Prefix()
{
if(__instance.LGDCIDJJHMC)
{
HudManager.IAINKLDJAGC.KillButton.gameObject.SetActive(false);
HudManager.IAINKLDJAGC.ReportButton.gameObject.SetActive(false); // why not
}
sheriffs.Clear();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/SheriffPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace CrowdedSheriff
public class SheriffPlugin : BasePlugin
{
public const string id = "ru.galster.sheriffmod";
public const string version = "0.3.1";
public const string version = "0.3.9";
public static ManualLogSource Logger;
public Harmony Harmony { get; } = new Harmony(id);

Expand Down

0 comments on commit 36244cb

Please sign in to comment.