Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
2.0.2
  • Loading branch information
KiraYamato94 authored Jun 10, 2022
1 parent aad8d35 commit 6850763
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 54 deletions.
206 changes: 167 additions & 39 deletions LasMonjas/Buttons.cs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions LasMonjas/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public class CustomOptionHolder {
// Global Settings
public static CustomOption globalSettings;
public static CustomOption activateRoles;
public static CustomOption nightVisionLightSabotage;
public static CustomOption activateSenseiMap;
public static CustomOption removeSwipeCard;
public static CustomOption removeAirshipDoors;
public static CustomOption removeAirshipDoors;
public static CustomOption nightVisionLightSabotage;
public static CustomOption screenShakeReactorSabotage;
public static CustomOption anonymousCommsSabotage;
public static CustomOption slowSpeedOxigenSabotage;
public static CustomOption hideVentAnimOnShadows;

// Modifiers
public static CustomOption activateModifiers;
Expand Down Expand Up @@ -408,6 +409,7 @@ public static void Load() {
screenShakeReactorSabotage = CustomOption.Create(9, cs(Detective.color, "Screen shake for reactor sabotage"), "setting", false, globalSettings);
anonymousCommsSabotage = CustomOption.Create(10, cs(Detective.color, "Anonymous players for comms sabotage"), "setting", false, globalSettings);
slowSpeedOxigenSabotage = CustomOption.Create(11, cs(Detective.color, "Decreaes speed for oxygen sabotage"), "setting", false, globalSettings);
hideVentAnimOnShadows = CustomOption.Create(12, cs(Detective.color, "Hide Vent Anim on Shadows"), "setting", false, globalSettings);

// Modifiers
activateModifiers = CustomOption.Create(15, cs(Modifiers.color, "Modifiers"), "setting", false, null, true);
Expand Down
57 changes: 48 additions & 9 deletions LasMonjas/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,25 @@ public static KeyValuePair<byte, int> MaxPair(this Dictionary<byte, int> self, o
}
return result;
}

public static bool hidePlayerName(PlayerControl source, PlayerControl target) {
if (Painter.painterTimer > 0f) return true; // No names are visible
else if (!MapOptions.hidePlayerNames) return false; // All names are visible
else if (source == null || target == null) return true;
else if (source == target) return false; // Player sees his own name
else if (source.Data.Role.IsImpostor && target.Data.Role.IsImpostor) return false; // Members of team Impostors see the names of Impostors
else if ((source == Modifiers.lover1 || source == Modifiers.lover2) && (target == Modifiers.lover1 || target == Modifiers.lover2)) return false; // Members of team Lovers see the names of each other
else if ((source == Renegade.renegade || source == Minion.minion) && (target == Renegade.renegade || target == Minion.minion || target == Renegade.fakeMinion)) return false; // Members of team Renegade see the names of each other
if (source == target) return false;
if (source == null || target == null) return true;
if (source.Data.IsDead) return false;
if (target.Data.IsDead) return true;
if (Painter.painterTimer > 0f) return true; // No names are visible
if (AmongUsClient.Instance.GameState == InnerNet.InnerNetClient.GameStates.Started && ShipStatus.Instance != null && source.transform != null && target.transform != null) {
float distMod = 1.025f;
float distance = Vector3.Distance(source.transform.position, target.transform.position);
bool anythingBetween = PhysicsHelpers.AnythingBetween(source.transform.position, target.transform.position, Constants.ShadowMask, false);

if (distance > ShipStatus.Instance.CalculateLightRadius(source.Data) * distMod || anythingBetween) return true;
}
if (!MapOptions.hidePlayerNames) return false; // All names are visible
if (source.Data.Role.IsImpostor && target.Data.Role.IsImpostor) return false; // Members of team Impostors see the names of Impostors
if (source.getPartner() == target) return false; // Members of team Lovers see the names of each other
if ((source == Renegade.renegade || source == Minion.minion) && (target == Renegade.renegade || target == Minion.minion || target == Renegade.fakeMinion)) return false; // Members of team Renegade see the names of each other
return true;
}
}

public static void setDefaultLook(this PlayerControl target) {
target.setLook(target.Data.PlayerName, target.Data.DefaultOutfit.ColorId, target.Data.DefaultOutfit.HatId, target.Data.DefaultOutfit.VisorId, target.Data.DefaultOutfit.SkinId, target.Data.DefaultOutfit.PetId);
Expand Down Expand Up @@ -476,5 +484,36 @@ public static bool AnySabotageActive(bool disableSubmergedMaskCheck = false) {
SubmergedCompatibility.DisableO2MaskCheckForEmergency = false;
return false;
}

public static void enableCursor(string mode) {
if (mode == "start") {
Sprite sprite = Helpers.loadSpriteFromResources("LasMonjas.Images.Cursor.png", 115f);
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
return;
}
if (LasMonjasPlugin.MonjaCursor.Value) {
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
else {
Sprite sprite = Helpers.loadSpriteFromResources("LasMonjas.Images.Cursor.png", 115f);
Cursor.SetCursor(sprite.texture, Vector2.zero, CursorMode.Auto);
}
}
public static void toggleZoom(bool reset = false) {
float zoomFactor = 4f;
if (HudManagerStartPatch.zoomOutStatus)
zoomFactor = 1 / zoomFactor;
else if (reset) return; // Dont zoom out if meant to reset.
HudManagerStartPatch.zoomOutStatus = !HudManagerStartPatch.zoomOutStatus;
Camera.main.orthographicSize *= zoomFactor;
foreach (var cam in Camera.allCameras) {
if (cam != null && cam.gameObject.name == "UI Camera") cam.orthographicSize *= zoomFactor; // The UI is scaled too, else we cant click the buttons. Downside: map is super small.
}

HudManagerStartPatch.zoomOutButton.Sprite = HudManagerStartPatch.zoomOutStatus ? Helpers.loadSpriteFromResources("LasMonjas.Images.PlusButton.png", 150f / zoomFactor * 2) : Helpers.loadSpriteFromResources("LasMonjas.Images.MinusButton.png", 150f);
HudManagerStartPatch.zoomOutButton.PositionOffset = HudManagerStartPatch.zoomOutStatus ? new Vector3(0f, 3f, 0) : new Vector3(0.4f, 2.8f, 0);
ResolutionManager.ResolutionChanged.Invoke((float)Screen.width / Screen.height); // This will move button positions to the correct position.
}

}
}
3 changes: 3 additions & 0 deletions LasMonjas/LasMonjas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static class LasMonjas

public static bool slowSpeedOxigen = CustomOptionHolder.slowSpeedOxigenSabotage.getBool();

public static bool hideVentAnim = CustomOptionHolder.hideVentAnimOnShadows.getBool();

public static void clearAndReloadRoles() {
Mimic.clearAndReload();
Painter.clearAndReload();
Expand Down Expand Up @@ -156,6 +158,7 @@ public static void clearAndReloadRoles() {
anonymousComms = CustomOptionHolder.anonymousCommsSabotage.getBool();
isHappeningAnonymousComms = false;
slowSpeedOxigen = CustomOptionHolder.slowSpeedOxigenSabotage.getBool();
hideVentAnim = CustomOptionHolder.hideVentAnimOnShadows.getBool();
}

}
Expand Down
2 changes: 1 addition & 1 deletion LasMonjas/LasMonjas.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>2.0.1</Version>
<Version>2.0.2</Version>
<Description>Las Monjas</Description>
<Authors>Allul</Authors>
</PropertyGroup>
Expand Down
7 changes: 6 additions & 1 deletion LasMonjas/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class LasMonjasPlugin : BasePlugin
{
public const string Id = "me.allul.lasmonjas";

public const string VersionString = "2.0.1";
public const string VersionString = "2.0.2";

public static System.Version Version = System.Version.Parse(VersionString);
internal static BepInEx.Logging.ManualLogSource Logger;
Expand All @@ -42,6 +42,7 @@ public class LasMonjasPlugin : BasePlugin
public static ConfigEntry<bool> ActivateMusic { get; set; }
public static ConfigEntry<bool> GhostsSeeRoles { get; set; }
public static ConfigEntry<bool> HorseMode { get; set; }
public static ConfigEntry<bool> MonjaCursor { get; set; }
public static ConfigEntry<string> IpCustom { get; set; }
public static ConfigEntry<ushort> PortCustom { get; set; }

Expand All @@ -68,6 +69,7 @@ public override void Load() {
ActivateMusic = Config.Bind("Custom", "Activate Music", true);
GhostsSeeRoles = Config.Bind("Custom", "Ghosts See Roles", true);
HorseMode = Config.Bind("Custom", "Horse Mode", false);
MonjaCursor = Config.Bind("Custom", "Monja Cursor", true);

IpCustom = Config.Bind("Custom", "Custom Server IP", "127.0.0.1");
PortCustom = Config.Bind("Custom", "Custom Server Port", (ushort)22023);
Expand All @@ -86,6 +88,9 @@ public override void Load() {
Harmony.PatchAll();
SubmergedCompatibility.Initialize();
AddComponent<ModUpdateBehaviour>();
if (MonjaCursor.Value) {
Helpers.enableCursor("start");
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions LasMonjas/MapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ static class MapOptions {
public static bool activateMusic = false;
public static bool ghostsSeeRoles = true;
public static bool horseMode = false;
public static bool monjaCursor = true;

// Updating values
public static List<SurvCamera> camerasToAdd = new List<SurvCamera>();
Expand All @@ -29,6 +30,7 @@ public static void clearAndReloadMapOptions() {
activateMusic = LasMonjasPlugin.ActivateMusic.Value;
ghostsSeeRoles = LasMonjasPlugin.GhostsSeeRoles.Value;
horseMode = LasMonjasPlugin.HorseMode.Value;
monjaCursor = LasMonjasPlugin.MonjaCursor.Value;
}

public static void checkMusic() {
Expand Down
42 changes: 40 additions & 2 deletions LasMonjas/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,7 @@ public static void challengerPerformDuel() {
// music stop and play duel music
changeMusic(8);
SoundManager.Instance.PlaySound(CustomMain.customAssets.challengerDuelMusic, false, 5f);
SoundManager.Instance.StopSound(CustomMain.customAssets.performerMusic);

foreach (PlayerControl player in PlayerControl.AllPlayerControls) {
if (player == PlayerControl.LocalPlayer) {
Expand Down Expand Up @@ -2150,7 +2151,9 @@ public static void timeTravelerRevive(byte playerId) {
}
if (Necromancer.necromancer != null && Necromancer.dragginBody) {
necromancerResetValues();
}
}
// Reset zoomed out ghosts
Helpers.toggleZoom(reset: true);
}
}

Expand Down Expand Up @@ -2438,6 +2441,9 @@ public static void spiritualistRevive(byte playerId, byte reviverId) {
}
}

// Reset zoomed out ghosts
Helpers.toggleZoom(reset: true);

if (Spiritualist.spiritualist != null && Spiritualist.spiritualist.PlayerId == reviverId) {
Spiritualist.preventReport = true;
murderSpiritualistIfReportWhileReviving();
Expand Down Expand Up @@ -2922,6 +2928,14 @@ public static void captureTheFlagWhoTookTheFlag(byte playerWhoStoleTheFlag, int
CaptureTheFlag.redPlayerWhoHasBlueFlag = player;
CaptureTheFlag.blueflag.transform.parent = player.transform;
CaptureTheFlag.blueflag.transform.localPosition = new Vector3(0f, 0f, -0.1f);
foreach (PlayerControl redplayer in CaptureTheFlag.redteamFlag) {
if (redplayer == PlayerControl.LocalPlayer && redplayer != null) {
new CustomMessage("<color=#0000FFFF>Blue Flag</color> stolen by <color=#FF0000FF>"+ CaptureTheFlag.redPlayerWhoHasBlueFlag.name + "</color>!", 5, -1, 1.6f, 4);
}
}
if (CaptureTheFlag.stealerPlayer != null && CaptureTheFlag.stealerPlayer == PlayerControl.LocalPlayer) {
new CustomMessage("<color=#0000FFFF>Blue Flag</color> stolen by <color=#FF0000FF>" + CaptureTheFlag.redPlayerWhoHasBlueFlag.name + "</color>!", 5, -1, 1.6f, 4);
}
}

// Alert red team players
Expand All @@ -2941,6 +2955,14 @@ public static void captureTheFlagWhoTookTheFlag(byte playerWhoStoleTheFlag, int
CaptureTheFlag.bluePlayerWhoHasRedFlag = player;
CaptureTheFlag.redflag.transform.parent = player.transform;
CaptureTheFlag.redflag.transform.localPosition = new Vector3(0f, 0f, -0.1f);
foreach (PlayerControl blueplayer in CaptureTheFlag.blueteamFlag) {
if (blueplayer == PlayerControl.LocalPlayer && blueplayer != null) {
new CustomMessage("<color=#FF0000FF>Red Flag</color> stolen by <color=#0000FFFF>" + CaptureTheFlag.bluePlayerWhoHasRedFlag.name + "</color>!", 5, -1, 1.6f, 4);
}
}
if (CaptureTheFlag.stealerPlayer != null && CaptureTheFlag.stealerPlayer == PlayerControl.LocalPlayer) {
new CustomMessage("<color=#FF0000FF>Red Flag</color> stolen by <color=#0000FFFF>" + CaptureTheFlag.bluePlayerWhoHasRedFlag.name + "</color>!", 5, -1, 1.3f, 4);
}
}

// Alert blue team players
Expand Down Expand Up @@ -3400,7 +3422,7 @@ public static void policeandThiefTakeJewel(byte thiefWhoTookATreasure, byte jewe
}

public static void policeandThiefDeliverJewel(byte thiefWhoTookATreasure, byte jewelId) {
// Red team
// Thief team
foreach (PlayerControl player in PoliceAndThief.thiefTeam) {
// Thief player steal a jewel
if (player.PlayerId == thiefWhoTookATreasure) {
Expand Down Expand Up @@ -4326,8 +4348,16 @@ public static void kingOfTheHillKills(byte targetId, int whichplayer) {
KingOfTheHill.greenkingaura.transform.parent = KingOfTheHill.greenKingplayer.transform;
if (PlayerControl.LocalPlayer == KingOfTheHill.greenKingplayer) {
new CustomMessage("You're the new <color=#00FF00FF>Green King</color>!", 5, -1, 1.6f, 11);
KingOfTheHill.localArrows[3].arrow.SetActive(false);
KingOfTheHill.localArrows[4].arrow.SetActive(false);
KingOfTheHill.localArrows[5].arrow.SetActive(false);
}
KingOfTheHill.greenKingplayer.MurderPlayer(KingOfTheHill.usurperPlayer);
if (PlayerControl.LocalPlayer == KingOfTheHill.usurperPlayer) {
KingOfTheHill.localArrows[3].arrow.SetActive(false);
KingOfTheHill.localArrows[4].arrow.SetActive(true);
KingOfTheHill.localArrows[5].arrow.SetActive(true);
}
}
else if (player.PlayerId == KingOfTheHill.yellowKingplayer.PlayerId) {
KingOfTheHill.yellowTeam.Remove(KingOfTheHill.yellowKingplayer);
Expand All @@ -4343,8 +4373,16 @@ public static void kingOfTheHillKills(byte targetId, int whichplayer) {
KingOfTheHill.yellowkingaura.transform.parent = KingOfTheHill.yellowKingplayer.transform;
if (PlayerControl.LocalPlayer == KingOfTheHill.yellowKingplayer) {
new CustomMessage("You're the new <color=#FFFF00FF>Yellow King</color>!", 5, -1, 1.6f, 11);
KingOfTheHill.localArrows[3].arrow.SetActive(false);
KingOfTheHill.localArrows[4].arrow.SetActive(false);
KingOfTheHill.localArrows[5].arrow.SetActive(false);
}
KingOfTheHill.yellowKingplayer.MurderPlayer(KingOfTheHill.usurperPlayer);
if (PlayerControl.LocalPlayer == KingOfTheHill.usurperPlayer) {
KingOfTheHill.localArrows[3].arrow.SetActive(false);
KingOfTheHill.localArrows[4].arrow.SetActive(true);
KingOfTheHill.localArrows[5].arrow.SetActive(true);
}
} else {
KingOfTheHill.usurperPlayer.MurderPlayer(player);
}
Expand Down

0 comments on commit 6850763

Please sign in to comment.