-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Switched to BepInEx - Simplified code following vanilla changes - Added translations
- Loading branch information
1 parent
15ecddd
commit 46121e7
Showing
20 changed files
with
184 additions
and
308 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
QMods/StorageInfo/Languages/English.json → ...lugins/StorageInfo/Languages/English.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"ContainerEmpty": "empty", | ||
"ContainerOneItem": "1 item (not full)", | ||
"ContainerFull": "full", | ||
"ContainerNonempty": "{0} items (not full)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ContainerEmpty": "vide", | ||
"ContainerFull": "plein", | ||
"ContainerNonempty": "{0} objets (pas plein)" | ||
} |
1 change: 0 additions & 1 deletion
1
QMods/StorageInfo/Languages/German.json → ...plugins/StorageInfo/Languages/German.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"ContainerEmpty": "Leer", | ||
"ContainerOneItem": "1 Gegenstand", | ||
"ContainerFull": "Voll", | ||
"ContainerNonempty": "{0} Gegenstände" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ContainerEmpty": "puste", | ||
"ContainerFull": "pełne", | ||
"ContainerNonempty": "{0} przedmioty/ów (nie pełne)" | ||
} |
1 change: 0 additions & 1 deletion
1
StorageInfo/Languages/Russian.json → ...lugins/StorageInfo/Languages/Russian.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"ContainerEmpty": "Пусто", | ||
"ContainerOneItem": "Заполнено 1 предметом", | ||
"ContainerFull": "Полностью заполнено", | ||
"ContainerNonempty": "Заполнено {0} предметами" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using HarmonyLib; | ||
using SMLHelper.V2.Utility; | ||
|
||
namespace StorageInfo | ||
{ | ||
public class HarmonyPatches | ||
{ | ||
private static void Patch_OnHandHover_Postfix(StorageContainer __instance) | ||
{ | ||
ItemsContainer itemStorage = __instance.container; | ||
|
||
if (itemStorage != null) | ||
{ | ||
SetCustomInteractText(itemStorage); | ||
} | ||
} | ||
|
||
private static void Patch_SetCurrentLanguage_Postfix() | ||
{ | ||
Translation.ReloadLanguage(); | ||
} | ||
|
||
internal static void InitializeHarmony() | ||
{ | ||
Harmony harmony = new Harmony("Dingo.Harmony.StorageInfo"); | ||
|
||
/* Remove original SetInteractText and inject SetCustomInteractText */ | ||
// Patch: StorageContainer.OnHandHover | ||
harmony.Patch( | ||
original: AccessTools.Method(typeof(StorageContainer), nameof(StorageContainer.OnHandHover)), | ||
postfix: new HarmonyMethod(typeof(HarmonyPatches), nameof(HarmonyPatches.Patch_OnHandHover_Postfix))); | ||
|
||
/* Reset language cache on game language change */ | ||
// Patch: Language.SetCurrentLanguage | ||
harmony.Patch( | ||
original: AccessTools.Method(typeof(Language), nameof(Language.SetCurrentLanguage)), | ||
postfix: new HarmonyMethod(typeof(HarmonyPatches), nameof(HarmonyPatches.Patch_SetCurrentLanguage_Postfix))); | ||
} | ||
|
||
public static void SetCustomInteractText(ItemsContainer itemStorage) | ||
{ | ||
string customSubscriptText = string.Empty; | ||
|
||
if (itemStorage != null) | ||
{ | ||
if (itemStorage.IsEmpty()) | ||
{ | ||
customSubscriptText = "ContainerEmpty".Translate(); | ||
} | ||
|
||
else if (itemStorage.IsFull()) | ||
{ | ||
customSubscriptText = "ContainerFull".Translate(); | ||
} | ||
|
||
else | ||
{ | ||
customSubscriptText = "ContainerNonempty".FormatTranslate(itemStorage.count.ToString()); | ||
} | ||
} | ||
|
||
HandReticle.main.SetText(HandReticle.TextType.HandSubscript, customSubscriptText, false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using BepInEx; | ||
using UnityEngine; | ||
|
||
namespace StorageInfo | ||
{ | ||
[BepInPlugin(modGUID, modName, modVersion)] | ||
public class ModPlugin : BaseUnityPlugin | ||
{ | ||
private const string modGUID = "Dingo.SN.StorageInfo"; | ||
internal const string modName = "Storage Info"; | ||
private const string modVersion = "2.0.0"; | ||
|
||
internal static void LogMessage(string message) | ||
{ | ||
Debug.Log($"{modName} :: " + message); | ||
} | ||
|
||
public void Start() | ||
{ | ||
HarmonyPatches.InitializeHarmony(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,39 @@ | ||
## **Storage Info by Dingo** | ||
# **Storage Info for Subnautica** | ||
|
||
#### **Description:** | ||
In Subnautica, only empty containers relay their status to the player. With this mod containers will always show if they are: | ||
* Empty | ||
* Full | ||
* Have a certain amount of items, but aren't full | ||
### **Description:** | ||
|
||
#### **Installation:** | ||
1) Install [QMods](https://www.nexusmods.com/subnautica/mods/201) if you haven't already | ||
2) Install [SMLHelper (Modding Helper)](https://www.nexusmods.com/subnautica/mods/113) | ||
3) Download the zip file from the [Files tab](https://www.nexusmods.com/subnautica/mods/229/?tab=files) | ||
4) Unzip the contents of the zip to the game's main directory (where Subnautica.exe can be found) | ||
In Subnautica, only empty containers relay their status to the player. With this mod containers will always show if they are: | ||
- Empty | ||
- Full | ||
- Have a certain amount of items, but aren't full | ||
|
||
#### **(Optional) Translation:** | ||
If you want to contribute a translation for this mod, please follow these steps: | ||
1) Look at the file *"English.json"* in *QMods\StorageInfo\Languages* | ||
2) Copy that file and change the file name to your language. It needs to match the file name in *Subnautica\SNUnmanagedData\LanguageFiles* | ||
3) Translate the file. Do not touch the keys ("ContainerFull"), only the translated values ("completely full") | ||
4) Share the file with me, preferrably over GitHub, a Nexus private message or (if you must) a comment | ||
### **Installation:** | ||
|
||
#### **FAQ:** | ||
1. Install [BepInEx for Subnautica](https://www.nexusmods.com/subnautica/mods/1108) | ||
2. Install [SMLHelper (Modding Helper)](https://www.nexusmods.com/subnautica/mods/113) | ||
3. Download the latest zip file from the [Files tab](https://www.nexusmods.com/subnautica/mods/229/?tab=files) | ||
4. Unzip the contents of the zip to the game's main directory (where Subnautica.exe can be found) | ||
|
||
* **Q. Is this mod safe to add or remove from an existing save file?** | ||
* A. Perfectly safe. | ||
* **Q. Does this mod have any known conflicts?** | ||
* A. No, unless some other mod patches *StorageContainer.OnHandHover* and doesn't play nice. | ||
### **(Optional) Translation:** | ||
|
||
[Source code can be found here.](https://github.com/DingoDjango/snStorageInfo) | ||
1. Navigate to *...\Subnautica\BepInEx\plugins\StorageInfo\Languages* | ||
2. Copy *English.json* and change the file name to match your language | ||
> Valid language names are found in *...\Subnautica\Subnautica_Data\StreamingAssets\SNUnmanagedData\LanguageFiles* | ||
3. Translate the file. Do not touch the keys ("ContainerFull"), only the values ("full") | ||
4. Share the file with me on GitHub or in a Nexus private message | ||
|
||
#### **Credits:** | ||
- Powered by [Harmony](https://github.com/pardeike/Harmony) | ||
- Made for the [QMods Subnautica Mod System](https://www.nexusmods.com/subnautica/mods/201) | ||
- Using [SMLHelper](https://www.nexusmods.com/subnautica/mods/113) | ||
- German translation by [acidscorch](https://github.com/acidscorch) | ||
- Russian translation by [mstislavovich](https://forums.nexusmods.com/index.php?/user/23416669-mstislavovich/) | ||
### **FAQ:** | ||
|
||
- **Q. Does this mod support the latest Subnautica update?** | ||
- A. Tested on Subnautica version Dec-2022 71137 (Living Large update) | ||
- **Q. Is this mod safe to add or remove from an existing save?** | ||
- A. Yes | ||
- **Q. Does this mod have any known conflicts?** | ||
- A. No, unless some other mod patches *StorageContainer.OnHandHover* and doesn't play nice | ||
|
||
2019-03-17 - v1.0.4 | ||
- Added Russian translation by mstislavovich | ||
[Source code can be found here.](https://github.com/DingoDjango/snStorageInfo) | ||
|
||
2019-03-16 - v1.0.3 | ||
- Small refactor to language loading | ||
|
||
2019-03-16 - v1.0.2 | ||
- Added German translation by acidscorch | ||
- Some refactoring to load languages properly | ||
- Internal mod structure changes | ||
|
||
2019-03-15 - v1.0.1 | ||
- Bug fixes | ||
|
||
2019-03-15 - v1.0.0 | ||
- Initial mod release | ||
### **Credits:** | ||
- Powered by [Harmony](https://github.com/pardeike/Harmony) | ||
- Using [SMLHelper](https://www.nexusmods.com/subnautica/mods/113) | ||
- Translations by [acidscorch](https://github.com/acidscorch), [mstislavovich](https://forums.nexusmods.com/index.php?/user/23416669-mstislavovich/), [Yanuut](https://github.com/Yanuut), [Zemogiter](https://github.com/Zemogiter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.