Skip to content

Commit

Permalink
Merge pull request #168 from SubmergedAmongUs/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexejhero authored Aug 1, 2024
2 parents 9741a92 + 7f04e9b commit 89a07be
Show file tree
Hide file tree
Showing 3,035 changed files with 451,201 additions and 538 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 0 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
# Marks end of line as LF
* text=auto eol=lf

# Automatically resolve merge conflicts in contentModel.xml
**/.idea/contentModel.xml merge=union

# Treat unity files as binary files, so they don't get corrupted by merge conflicts
*.meta binary
*.prefab binary
*.unity binary
58 changes: 12 additions & 46 deletions .github/FOR MOD DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NOTICE

This document was written for Submerged version `v2022.5.1` and hasn't been updated since. Some information might be outdated, but most of it should be ok.
Some information in this document might be outdated, but most of it should be ok.

If you have any doubts check the source code or contact me on discord: `@alexejhero`

Expand Down Expand Up @@ -34,30 +34,26 @@ Submerged tries to patch as little as possible in order to allow other mods to b
- `143` - SubmarineSpawnInSystem
- `144` - SubmarineBoxCatSystem

# Commonly Conflicting Classes
# Important Classes

## `SubmergedDeadBody`
## `ElevatorMover`

<u>When playing on Submerged</u>, if a player dies their dead body receives a `SubmergedDeadBody` component. This component handles the shadow of the dead body as seen in Lower Central, and moving the dead body between floors if it is in an elevator.
<u>When playing on Submerged</u>, this component is added to dead bodies and shapeshifter evidences in order to allow them to be moved by elevators.

This system might conflict with mods that change the position of dead bodies (for example, an Undertaker role).
This system might conflict with mods that change the position of dead bodies (for example, an Undertaker role).

Location: `Submerged.Map.MonoBehaviours.SubmergedDeadBody`
Location: `Submerged.Elevators.Objects.ElevatorMover`

<br>

# Commonly Conflicting Patches
## GenericShadowBehaviour

## `float PlatformConsole.CanUse(GameData.PlayerInfo pc, out bool canUse, out bool couldUse)`
This compnent can be added to objects in order to make them cast a shadow from upper deck to lower deck. You might need to create custom shadow renderers to describe how the shadow needs to be drawn. These classes extend `RelativeShadowRenderer`

<u>When playing on Submerged</u>, this method is comptetely overwritten by the mod, as PlatformConsole is used for elevators.

This patch may conflict with mods that patch consoles in order to modify who can use them.

Location: `Submerged.Systems.CustomSystems.Elevator.Patches.PlatformConsole_CanUse_Patch`
Location: `Submerged.Floors.Objects.GenericShadowBehaviour`

<br>

# Commonly Conflicting Patches

## `float ShipStatus.CalculateLightRadius(GameData.PlayerInfo player)`

<u>When playing on Submerged</u>, the `float ShipStatus.CalculateLightRadius(GameData.PlayerInfo player)` method is patched to execute `float SubmarineStatus.CalculateLightRadius(GameData.PlayerInfo player)` instead of its default implementation. This method is used by the mod to play the light flicker animation when lights are sabotaged, and to play the sounds as well.
Expand All @@ -68,7 +64,7 @@ Location: `Submerged.Map.Patches.ShipStatus_CalculateLightRadius_Patch`

<br>

## `void ArrowBehaviour.Update()`
## `void ArrowBehaviour.UpdatePosition()`

<u>When playing on Submerged</u>, this method is completely overwritten by the mod to make arrows point to the nearest elevator if their target is on the other floor.

Expand All @@ -88,26 +84,6 @@ Location: `Submerged.Minigames.CustomMinigames.FixWiring.Patches.Console_Use_Pat

<br>

## `void ExileController.Begin(GameData.PlayerInfo exiled, bool tie)`

<u>When playing on Submerged</u>, this method is completely overwritten by the mod. Most of the code is the same, but there are some Submerged-specific calls which are added to the method.

This patch may conflict with mods that patch the exile cutscene in order to show the role name of the person who died.

Location: `Submerged.ExileCutscene.Patches.ExileController_Begin_Patch`

<br>

## `void PlatformConsole.Use()`

<u>When playing on Submerged</u>, this method is comptetely overwritten by the mod, as PlatformConsole is used for elevators.

This patch may conflict with mods that patch consoles in order to modify who can use them.

Location: `Submerged.Systems.CustomSystems.Elevator.Patches.PlatformConsole_Use_Patch`

<br>

## `void Vent.CanUse(GameData.PlayerInfo pc, out bool canUse, out bool couldUse)`

<u>When playing on Submerged</u>, this patch ensures that players cannot enter the one-way vent in Engines, and cannot exit the Central vents during the venting transition.
Expand All @@ -117,13 +93,3 @@ This patch may conflict with mods that patch consoles in order to modify who can
Location: `Submerged.Map.Patches.Vent_CanUse_Patch`

<br>

## `void Vent.MoveToVent(Vent otherVent)`

<u>When playing on Submerged</u>, this patch handles changing the floor when venting and offsetting the player camera when using either the Admin-Engines vents or the Central vents.

This patch may conflict with mods that have custom actions when venting.

**SUBMERGED AUTOMATICALLY HANDLES ANY CROSS-FLOOR VENTS, EVEN CUSTOM ONES!**

Location: `Submerged.Map.Patches.Vent_MoveToVent_Patch`
Binary file added .github/Images/Layout-LowerDeck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/Layout-UpperDeck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ Submerged is a mod for Among Us which adds a new map into the game.
- New mechanics
- Works on official servers

## Screenshots and Videos
## Images and Videos

<details>
<summary>Click to expand</summary>

### Map Guide

![Upper Deck Layout](./.github/Images/Layout-UpperDeck.png)
![Lower Deck Layout](./.github/Images/Layout-LowerDeck.png)

### Trailer

[![Submerged Trailer](http://img.youtube.com/vi/gAX_mDOX4Pc/0.jpg)](http://www.youtube.com/watch?v=gAX_mDOX4Pc "Submerged Trailer")

[See the trailer on YouTube](http://www.youtube.com/watch?v=gAX_mDOX4Pc)

### Screenshots

![Screenshot 1](./.github/Images/Screenshot-1.png)
![Screenshot 2](./.github/Images/Screenshot-2.png)
![Screenshot 3](./.github/Images/Screenshot-3.png)
Expand All @@ -40,7 +49,8 @@ The table below lists the most recent Submerged release for each Among Us versio

| Among Us Version | Submerged Version | Links |
|:---------------------------------------------------------------------------------------------:|:-----------------:|:-----------------------------------------------------------------------------------:|
| `v2024.3.5` | `v2024.3.25` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2024.3.25/) |
| `v2024.6.18` | `v2024.7.23` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2024.7.23/) |
| `v2024.3.5`<br>`v2024.6.4` | `v2024.3.25` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2024.3.25/) |
| `v2023.11.28` | `v2023.11.29` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2023.11.29/) |
| `v2023.10.24` | `v2023.11.2` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2023.11.2/) |
| `v2023.7.12`<br>`v2023.7.11` | `v2023.8.2` | [Download](https://github.com/SubmergedAmongUs/Submerged/releases/tag/v2023.8.2/) |
Expand All @@ -55,18 +65,21 @@ The table below lists the most recent Submerged release for each Among Us versio

Submerged depends on the following mods and modding tools in order to function properly:

| Mod | Version |
|----------------------------------------------------------------------------|:---------------:|
| [BepInEx](https://builds.bepinex.dev/projects/bepinex_be) (IL2CPP-win-x86) | `v6.0.0-be.688` |
| [Reactor](https://github.com/nuclearpowered/reactor) | `v2.2.0` |
| Mod | Version |
|-----------------------------------------------------------|--------------------------|
| [BepInEx](https://builds.bepinex.dev/projects/bepinex_be) | `v6.0.0-be.692` or later |
| [Reactor](https://github.com/nuclearpowered/reactor) | `v2.3.0` or later |

> [!Note]
> If you are using the Microsoft Store version of Among Us, you will need to download the `Unity (IL2CPP) for Windows (x64) games` version of BepInEx. Otherwise, you will need to download the `Unity (IL2CPP) for Windows (x86) games` version.
# Installation

**This mod is not compatible with mobile or console versions of Among Us.**

This mod is only guaranteed to work on Windows operating systems. We have no plans on ensuring compatibility with Linux-based operating systems or Mac.

This mod has been tested and works with the Steam, Epic and itch.io versions of Among Us. We do not support or endorse using a pirated version of Among Us with Submerged.
This mod has been tested and works with the Steam, Epic, itch.io and Microsoft Store versions of Among Us. We do not support or endorse using a pirated version of Among Us with Submerged.

## Installation Steps

Expand Down Expand Up @@ -151,15 +164,16 @@ For business inquiries, please contact us at `[email protected]`.
- [Sanae6](https://twitter.com/Sanae6k/)
- Additional Art
- [acronmd](https://twitter.com/acronmd/)
- [pb](https://twitter.com/QueenTamandua/)
- Translators
- [Dekokiyo](https://twitter.com/DekoKiyomori) - 日本語
- [ItsNiceCraft](https://bento.me/itsnicecraft) - Deutsch
- [MissJukebox](https://www.twitch.tv/missjukebox/) - Español
- Dekokiyo - 日本語
- ItsNiceCraft - Deutsch
- MissJukebox - Español
- Monid73 - Русский
- [PENGUN](https://youtube.com/@PENGUINWITHGUN) - Italiano
- [RevoLou](https://twitter.com/Psyco_Lou/) - Português do Brasil
- PENGUN - Italiano
- RevoLou - Português do Brasil
- RobinRMC - Nederlands
- [SPRLC](https://twitter.com/SuperLanceur) - Français
- [ねろちゃん](https://www.twitch.tv/zackdnerrr/) - 日本語
- SPRLC - Français
- ねろちゃん - 日本語
- 阿龍DragonTw - 繁體中文
- [黑客Hecker](https://www.twitch.tv/heckertv/) - 简体中文
- 黑客Hecker - 简体中文
2 changes: 1 addition & 1 deletion Submerged/BaseGame/BaseGameCodeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Submerged.BaseGame;
public enum LastChecked
{
// ReSharper disable InconsistentNaming
v2024_3_5
v2024_6_18,
// ReSharper restore InconsistentNaming
}

Expand Down
4 changes: 2 additions & 2 deletions Submerged/BaseGame/Extensions/Minigame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Submerged.BaseGame.Extensions;

public static class MinigameExtensions
{
[BaseGameCode(LastChecked.v2024_3_5, "Entire method is copied from base game because we can't call it from the base pointer since that causes an infinite loop.")]
[BaseGameCode(LastChecked.v2024_6_18, "Entire method is copied from base game because we can't call it from the base pointer since that causes an infinite loop.")]
public static void BaseClose(this Minigame self)
{
bool isComplete;
Expand All @@ -28,7 +28,7 @@ public static void BaseClose(this Minigame self)
self.amClosing = Minigame.CloseState.Closing;
self.logger.Info(string.Concat("Closing minigame ", self.GetType().Name));
IAnalyticsReporter analytics = DestroyableSingleton<DebugAnalytics>.Instance.Analytics;
GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
NetworkedPlayerInfo data = PlayerControl.LocalPlayer.Data;
TaskTypes taskType = self.TaskType;
float realtimeSinceStartup = Time.realtimeSinceStartup - self.timeOpened;
PlayerTask myTask = self.MyTask;
Expand Down
2 changes: 1 addition & 1 deletion Submerged/BaseGame/Interfaces/IDoorMinigame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ReSharper disable once InconsistentNaming
public sealed partial class AU
{
[BaseGameCode(LastChecked.v2024_3_5)]
[BaseGameCode(LastChecked.v2024_6_18)]
public interface IDoorMinigame
{
[UsedImplicitly]
Expand Down
2 changes: 1 addition & 1 deletion Submerged/BaseGame/Interfaces/ISystemType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Submerged.BaseGame.Interfaces;
// ReSharper disable once InconsistentNaming
public sealed partial class AU
{
[BaseGameCode(LastChecked.v2024_3_5)]
[BaseGameCode(LastChecked.v2024_6_18)]
public interface ISystemType
{
[UsedImplicitly]
Expand Down
4 changes: 2 additions & 2 deletions Submerged/BaseGame/Interfaces/IUsable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ReSharper disable once InconsistentNaming
public sealed partial class AU
{
[BaseGameCode(LastChecked.v2024_3_5)]
[BaseGameCode(LastChecked.v2024_6_18)]
public interface IUsable
{
[UsedImplicitly]
Expand All @@ -19,7 +19,7 @@ public interface IUsable
void SetOutline(bool on, bool mainTarget);

[UsedImplicitly]
float CanUse(GameData.PlayerInfo pc, out bool canUse, out bool couldUse);
float CanUse(NetworkedPlayerInfo pc, out bool canUse, out bool couldUse);

[UsedImplicitly]
void Use();
Expand Down
4 changes: 4 additions & 0 deletions Submerged/BaseGame/Interfaces/IUsableCooldown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
// ReSharper disable once InconsistentNaming
public sealed partial class AU
{
[BaseGameCode(LastChecked.v2024_6_18)]
public interface IUsableCoolDown : IUsable
{
[UsedImplicitly]
float CoolDown
{
get;
set;
}

[UsedImplicitly]
float MaxCoolDown
{
get;
}

[UsedImplicitly]
bool IsCoolingDown();
}
}
2 changes: 1 addition & 1 deletion Submerged/BaseGame/Patches/AirshipUploadGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class AirshipUploadGameUpdatePatches
{
[HarmonyPatch(typeof(AirshipUploadGame), nameof(AirshipUploadGame.Update))]
[HarmonyPrefix]
[BaseGameCode(LastChecked.v2024_3_5, "Patching the method with it's own code because C# > C++")]
[BaseGameCode(LastChecked.v2024_6_18, "Patching the method with it's own code because C# > C++")]
public static void Prefix(AirshipUploadGame __instance, out bool __runOriginal)
{
__runOriginal = false;
Expand Down
2 changes: 1 addition & 1 deletion Submerged/BaseGame/Patches/TextTranslatorTMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class TextTranslatorTMPPatches
{
[HarmonyPatch(typeof(TextTranslatorTMP), nameof(TextTranslatorTMP.ResetText))]
[HarmonyPrefix]
[BaseGameCode(LastChecked.v2024_3_5, "We are patching this with its own code to get rid of inlining that ruins our translation patches")]
[BaseGameCode(LastChecked.v2024_6_18, "We are patching this with its own code to get rid of inlining that ruins our translation patches")]
public static void ResetTextPatch(TextTranslatorTMP __instance, out bool __runOriginal)
{
__runOriginal = false;
Expand Down
20 changes: 20 additions & 0 deletions Submerged/Debugging/Tabs/ModdingTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using Submerged.Extensions;
using Submerged.KillAnimation.Patches;
using Submerged.Loading;
using Submerged.Map;
Expand Down Expand Up @@ -81,5 +82,24 @@ public void BuildGUI()

if (GUILayout.Button("Kill Dummy")) PlayerControl.LocalPlayer.RpcMurderPlayer(PlayerControl.AllPlayerControls.ToArray().First(p => p.isDummy), true);
if (GUILayout.Button("Dummy Kill Me")) PlayerControl.AllPlayerControls.ToArray().First(p => p.isDummy).RpcMurderPlayer(PlayerControl.LocalPlayer, true);

if (GUILayout.Button("Extract Map Sprites"))
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Map Sprites");
Directory.CreateDirectory(Path.GetFullPath(path));

Message("Saving to " + path);

SCG.HashSet<Texture2D> textures = [];

foreach (SpriteRenderer rend in ShipStatus.Instance.gameObject.GetComponentsInChildren<SpriteRenderer>())
{
if (rend.sprite && rend.sprite.texture && textures.Add(rend.sprite.texture))
{
byte[] bytes = rend.sprite.texture.GetReadable().EncodeToPNG();
File.WriteAllBytes(Path.Combine(path, rend.sprite.texture.name + ".png"), bytes);
}
}
}
}
}
2 changes: 1 addition & 1 deletion Submerged/Elevators/ElevatorConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public float UsableDistance

public ImageNames UseIcon => ImageNames.UseButton;

public float CanUse(GameData.PlayerInfo pc, out bool canUse, out bool couldUse)
public float CanUse(NetworkedPlayerInfo pc, out bool canUse, out bool couldUse)
{
float distance = float.MaxValue;
PlayerControl player = pc.Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public static void RemoveMourningPetPatch(PetBehaviour __instance)
{
if (!ShipStatus.Instance.IsSubmerged()) return;

// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
foreach (SubmarineElevator elevator in SubmarineStatus.instance.elevators)
{
Vector3 position = __instance.transform.position;
Expand Down
4 changes: 3 additions & 1 deletion Submerged/Elevators/SubmarineElevator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ public void OnDestroy()
[HideFromIl2Cpp]
public bool GetInElevator(PlayerControl player)
{
if (!player || !player.NetTransform) return false;

Vector3 pos;

if (player.AmOwner)
Expand Down Expand Up @@ -511,7 +513,7 @@ public void GetPlayersInElevator(List<PlayerControl> players)
{
players.Clear();

foreach (GameData.PlayerInfo playerInfo in GameData.Instance.AllPlayers.GetFastEnumerator())
foreach (NetworkedPlayerInfo playerInfo in GameData.Instance.AllPlayers.GetFastEnumerator())
{
if (playerInfo.IsDead || playerInfo.Disconnected) continue;
PlayerControl player = playerInfo.Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static class BaseGameResolvingPatches
public static void GetTextPatch(ExileController __instance)
{
LastExileText = __instance.completeString;
Message("Grabbing " + __instance + " from ExileController");
}

[HarmonyPatch(typeof(ExileController), nameof(ExileController.Begin))]
Expand Down
2 changes: 1 addition & 1 deletion Submerged/ExileCutscene/SubmergedExileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private IEnumerator HandleText()

// CLeanup this WrapUpAndSpawn method
[HideFromIl2Cpp]
[BaseGameCode(LastChecked.v2024_3_5, "Similar to AirshipExileController.WrapUpAndSpawn")]
[BaseGameCode(LastChecked.v2024_6_18, "Similar to AirshipExileController.WrapUpAndSpawn")]
public IEnumerator WrapUpAndSpawn()
{
if (exiled != null)
Expand Down
Loading

0 comments on commit 89a07be

Please sign in to comment.