Skip to content

Commit df9ba4e

Browse files
committed
v2.1.6
1 parent 7960f0c commit df9ba4e

File tree

10 files changed

+149
-18
lines changed

10 files changed

+149
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ SourceCode/bin
22
SourceCode/obj
33

44
MapOptions/plugins/
5+
MapOptions/region_names*
56
MapOptions.zip
67
steam_description.txt
78

MapOptions/modinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "MapOptions",
33
"name": "MapOptions",
4-
"version": "2.1.5",
4+
"version": "2.1.6",
55
"authors": "SchuhBaum",
66
"description": "Adds options to configure the map.",
77
"requirements": [],

MapOptions/workshopdata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Title": "MapOptions",
33
"Description": "Adds options to configure the map.",
44
"ID": "MapOptions",
5-
"Version": "2.1.5",
5+
"Version": "2.1.6",
66
"TargetGameVersion": "",
77
"Requirements": "",
88
"RequirementNames": "",

ReadMe.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
## MapOptions
2-
###### Version: 2.1.5
2+
###### Version: 2.1.6
33
This is a mod for Rain World v1.9.
44

55
### Description
66
Adds options to configure the map:
77
- `(Map Zoom)` The zoom can be adjusted (50%-150%).
88
- `(Aerial Map)` When disabled, the default map shader is used in Chimney Canopy and Sky Islands.
9+
- `(Clear Expedition Maps)` When enabled, clears the map progress for each new expedition run. Warning: Map progress is saved even without completing a full cycle.
910
- `(Creature Symbols)` These symbols display what creature types are present in each room.
11+
- `(Discover Multiplier)` Can be used to decrease or increase the map discover range around slugcat. Warning: This deletes your map progress first. The game tries to recover it but you might gain (or lose) map progress.
1012
- `(Item Tracker)` Tracked key items are shown on the map even when the option 'Slug Senses' is disabled. The option 'Key item tracking' needs to be enabled in Rain World Remix.
1113
- `(Layer Focus)` Only the active layer is displayed on the map.
1214
- `(Shadow Sprites)` Draws shadows for creature and slugcat symbols.
1315
- `(Skip Fade In/Out)` Pressing the map button shows the map with no delay.
1416
- `(Slugcat Symbols)` Draws a slugcat sprite on the map instead of a red circle. When Jolly Co-Op Mod is enabled, draws a sprite for each player.
15-
- `(Uncover Region)` Once loaded into the game the whole region map gets uncovered.
17+
- `(Uncover Region)` Once loaded into the game the whole region map gets uncovered. Warning: Map progress is saved even without completing a full cycle.
1618
- `(Uncover Room)` When the player enters a room the whole room gets uncovered instead of just the area around slugcat.
1719
- `(Reveal Speed Multiplier)` For a given value X the map is revealed X-times as fast. If the maximum value is selected then opening the map displays known areas instantly instead of revealing them gradually.
1820

1921
### Installation
2022
0. Update Rain World to version 1.9 if needed.
21-
1. Download the file `MapOptions.zip` from [Releases](https://github.com/SchuhBaum/MapOptions/releases/tag/v2.1.5).
23+
1. Download the file `MapOptions.zip` from [Releases](https://github.com/SchuhBaum/MapOptions/releases/tag/v2.1.6).
2224
2. Extract its content in the folder `[Steam]\SteamApps\common\Rain World\RainWorld_Data\StreamingAssets\mods`.
2325
3. Start the game as normal. In the main menu select `Remix` and enable the mod.
2426

@@ -34,14 +36,15 @@ There are two licenses available - MIT and Unlicense. You can choose which one y
3436

3537
### Changelog
3638
#### (Rain World v1.9)
37-
v2.1.5:
39+
v2.1.6:
3840
- Fixed a bug that could lag the game when you would try to open the map while an in-game text message is displayed.
3941
- (creature symbols) Fixed a bug where slugcat npc symbols would have the same color as the player.
4042
- (creature symbols) Fixed a bug where a NullReference exeption was thrown when the room of the creature could not be found.
4143
- (creature symbols) Removed that symbols are shown in shelters. Vanilla already shows symbols for items and creatures in shelters.
4244
- Changed the hook initialization logic. This should reduce the log spam from IL hooks. Instead of doing it every cycle while in-game they are initialized when starting the game or when changing the options.
4345
- (discover multiplier) Added a slider to change the map discover radius around slugcat.
4446
- (uncover room) Potentially fixed an issue where adjacent non-overlapping rooms were partly getting uncovered as well.
47+
- (clear expedition maps) Added this options (disabled by default). Clears the map progress for each new expedition run.
4548

4649
v2.1.0:
4750
- Added support for Rain World 1.9.

SourceCode/ExpeditionMod.cs

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
using System.Collections.Generic;
2+
using System.IO;
3+
using UnityEngine;
4+
using static ProcessManager;
5+
using static MapOptions.MainMod;
6+
using RWCustom;
7+
8+
namespace MapOptions;
9+
10+
public static class ExpeditionMod {
11+
//
12+
// variables
13+
//
14+
15+
public static List<string>? region_names_of_cleared_maps = null;
16+
17+
//
18+
//
19+
//
20+
21+
internal static void On_Config_Changed() {
22+
On.Menu.CharacterSelectPage.Singal -= Menu_CharacterSelectPage_Singal;
23+
On.PlayerProgression.LoadMapTexture -= PlayerProgression_LoadMapTexture;
24+
On.ProcessManager.RequestMainProcessSwitch_ProcessID -= ProcessManager_RequestMainProcessSwitch;
25+
26+
if (Option_ClearExpeditionMaps) {
27+
On.Menu.CharacterSelectPage.Singal += Menu_CharacterSelectPage_Singal;
28+
On.PlayerProgression.LoadMapTexture += PlayerProgression_LoadMapTexture;
29+
On.ProcessManager.RequestMainProcessSwitch_ProcessID += ProcessManager_RequestMainProcessSwitch;
30+
}
31+
}
32+
33+
//
34+
// public
35+
//
36+
37+
public static void Load_Region_Names_Of_Cleared_Maps() {
38+
string file_path = mod_directory_path + "region_names_of_cleared_maps" + Custom.rainWorld.options.saveSlot + ".json";
39+
if (!File.Exists(file_path)) {
40+
region_names_of_cleared_maps = null;
41+
return;
42+
}
43+
44+
try {
45+
Debug.Log("MapOptions: Load the variable region_names_of_cleared_maps for save slot " + Custom.rainWorld.options.saveSlot + ".");
46+
List<object> file_content = (List<object>)Json.Deserialize(File.ReadAllText(file_path));
47+
region_names_of_cleared_maps = new();
48+
49+
foreach (object obj in file_content) {
50+
region_names_of_cleared_maps.Add(obj.ToString());
51+
}
52+
} catch { }
53+
return;
54+
}
55+
56+
public static void Save_Region_Names_Of_Cleared_Maps() {
57+
if (region_names_of_cleared_maps == null) return;
58+
try {
59+
Debug.Log("MapOptions: Save the variable region_names_of_cleared_maps for save slot " + Custom.rainWorld.options.saveSlot + ".");
60+
string file_path = mod_directory_path + "region_names_of_cleared_maps" + Custom.rainWorld.options.saveSlot + ".json";
61+
File.WriteAllText(file_path, Json.Serialize(region_names_of_cleared_maps));
62+
} catch { }
63+
}
64+
65+
//
66+
// private
67+
//
68+
69+
private static void Menu_CharacterSelectPage_Singal(On.Menu.CharacterSelectPage.orig_Singal orig, Menu.CharacterSelectPage character_select_page, Menu.MenuObject sender, string message) {
70+
orig(character_select_page, sender, message);
71+
if (sender != character_select_page.confirmExpedition) return;
72+
73+
if (message == "NEW") {
74+
// the variable is saved when entering the game by the process_manager;
75+
Debug.Log("MapOptions: Start new expedition.");
76+
region_names_of_cleared_maps = new();
77+
return;
78+
}
79+
80+
if (message == "LOAD") {
81+
Debug.Log("MapOptions: Load expedition.");
82+
Load_Region_Names_Of_Cleared_Maps();
83+
return;
84+
}
85+
}
86+
87+
private static void PlayerProgression_LoadMapTexture(On.PlayerProgression.orig_LoadMapTexture orig, PlayerProgression player_progression, string region_name) {
88+
// the function orig() might return early without loading the map; but the function
89+
// map.Update() calls this function only once; it only has once chance to load =>
90+
// reset map progress in any case;
91+
orig(player_progression, region_name);
92+
if (region_names_of_cleared_maps == null) return;
93+
if (region_names_of_cleared_maps.Contains(region_name)) return;
94+
Debug.Log("MapOptions: Clear expedition map progress for region " + region_name + ".");
95+
96+
// this would not work for visited rooms; the game recovers the progress in that
97+
// case; it's okay here since for each new run there are no visited rooms;
98+
player_progression.mapDiscoveryTextures[region_name] = null;
99+
region_names_of_cleared_maps.Add(region_name);
100+
}
101+
102+
private static void ProcessManager_RequestMainProcessSwitch(On.ProcessManager.orig_RequestMainProcessSwitch_ProcessID orig, ProcessManager process_manager, ProcessID next_process_id) {
103+
orig(process_manager, next_process_id);
104+
if (next_process_id == ProcessID.Game) {
105+
Save_Region_Names_Of_Cleared_Maps();
106+
return;
107+
}
108+
109+
if (next_process_id == ProcessID.MainMenu) {
110+
Save_Region_Names_Of_Cleared_Maps();
111+
region_names_of_cleared_maps = null;
112+
return;
113+
}
114+
}
115+
}

SourceCode/MainMod.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using BepInEx;
22
using MonoMod.Cil;
3+
using System.IO;
4+
using System.Reflection;
35
using System.Security.Permissions;
46
using UnityEngine;
57
using static MapOptions.MainModOptions;
@@ -11,29 +13,31 @@
1113

1214
namespace MapOptions;
1315

14-
[BepInPlugin("SchuhBaum.MapOptions", "MapOptions", "2.1.5")]
16+
[BepInPlugin("SchuhBaum.MapOptions", "MapOptions", "2.1.6")]
1517
public class MainMod : BaseUnityPlugin {
1618
//
1719
// meta data
1820
//
1921

2022
public static readonly string mod_id = "MapOptions";
2123
public static readonly string author = "SchuhBaum";
22-
public static readonly string version = "2.1.5";
24+
public static readonly string version = "2.1.6";
25+
public static readonly string mod_directory_path = Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName + Path.DirectorySeparatorChar;
2326

2427
//
2528
// options
2629
//
2730

2831
public static bool Option_AerialMap => aerial_map.Value;
32+
public static bool Option_ClearExpeditionMaps => clear_expedition_maps.Value;
2933
public static bool Option_CreatureSymbols => creature_symbols.Value;
3034
public static bool Option_ItemTracker => item_tracker.Value;
3135

3236
public static bool Option_LayerFocus => layer_focus.Value;
3337
public static bool Option_ShadowSprites => shadow_sprites.Value;
3438
public static bool Option_SkipFade => skip_fade.Value;
35-
3639
public static bool Option_SlugcatSymbols => slugcat_symbols.Value;
40+
3741
public static bool Option_UncoverRegion => uncover_region.Value;
3842
public static bool Option_UncoverRoom => uncover_room.Value;
3943

SourceCode/MainModOptions.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,28 @@ public class MainModOptions : OptionInterface {
1515
//
1616

1717
public static Configurable<bool> aerial_map = main_mod_options.config.Bind("aerial_map", defaultValue: false, new ConfigurableInfo("The default map shader is used in Chimney Canopy and Sky Islands instead of the aerial map shader.", null, "", "Aerial Map"));
18+
public static Configurable<bool> clear_expedition_maps = main_mod_options.config.Bind("clear_expedition_maps", defaultValue: false, new ConfigurableInfo("Clears the map progress for each new expedition run.\nWARNING: This progress is lost even without completing a full cycle.", null, "", "Clear Expedition Maps"));
1819
public static Configurable<bool> creature_symbols = main_mod_options.config.Bind("creature_symbols", defaultValue: true, new ConfigurableInfo("Creature symbols are added to the map. These symbols display what creature types are present in each room.", null, "", "Creature Symbols"));
1920
public static Configurable<bool> item_tracker = main_mod_options.config.Bind("item_tracker", defaultValue: true, new ConfigurableInfo("Tracked key items are shown on the map even when the option 'Slug Senses' is disabled. The option 'Key item tracking' needs to be enabled in Rain World Remix.", null, "", "Item Tracker"));
2021

2122
public static Configurable<bool> layer_focus = main_mod_options.config.Bind("layer_focus", defaultValue: false, new ConfigurableInfo("Only the active layer is displayed on the map.", null, "", "Layer Focus"));
2223
public static Configurable<bool> shadow_sprites = main_mod_options.config.Bind("shadow_sprites", defaultValue: false, new ConfigurableInfo("Draws shadows for creature and slugcat symbols.", null, "", "Shadow Sprites"));
2324
public static Configurable<bool> skip_fade = main_mod_options.config.Bind("skip_fade", defaultValue: false, new ConfigurableInfo("Pressing the map button shows the map with no delay.", null, "", "Skip Fade In/Out"));
24-
2525
public static Configurable<bool> slugcat_symbols = main_mod_options.config.Bind("slugcat_symbols", defaultValue: true, new ConfigurableInfo("Draws a slugcat sprite on the map instead of a red circle. When Jolly Co-Op is enabled, draws a sprite for each player.", null, "", "Slugcat Symbols"));
26-
public static Configurable<bool> uncover_region = main_mod_options.config.Bind("uncover_region", defaultValue: false, new ConfigurableInfo("Once loaded into the game the whole region map gets uncovered.\nWARNING: This progress is saved (even without completing a cycle). Turning this option off after saving will *not* remove the gained progress.", null, "", "Uncover Region"));
26+
27+
public static Configurable<bool> uncover_region = main_mod_options.config.Bind("uncover_region", defaultValue: false, new ConfigurableInfo("Once loaded into the game the whole region map gets uncovered.\nWARNING: This progress is saved even without completing a full cycle.", null, "", "Uncover Region"));
2728
public static Configurable<bool> uncover_room = main_mod_options.config.Bind("uncover_room", defaultValue: true, new ConfigurableInfo("When the player enters a room the whole room gets uncovered instead of just the area around slugcat.", null, "", "Uncover Room"));
2829

29-
public static Configurable<int> zoom_slider = main_mod_options.config.Bind("zoom_slider", defaultValue: 10, new ConfigurableInfo("The default value is 100% (10) zoom. Each value (5-15) corresponds to 10*value% (50%-150%) zoom..", new ConfigAcceptableRange<int>(5, 15), "", "Zoom Level (10)"));
30+
//
31+
//
32+
//
33+
3034
public static Configurable<int> creature_symbol_scale = main_mod_options.config.Bind("creature_symbol_scale", defaultValue: 10, new ConfigurableInfo("The default value is 100% (10). Each value (5-20) corresponds to 10*value% (50%-200%).", new ConfigAcceptableRange<int>(5, 20), "", "Creature Symbol Size (10)"));
35+
public static Configurable<int> discover_multiplier = main_mod_options.config.Bind("discover_multiplier", defaultValue: 2, new ConfigurableInfo("The default value is two. For a given value X the map around slugcat is discovered (X/2)-times as far.\nWARNING: This will delete and change the size of any loaded region discover texture. The game tries to recover your map progress based on visited rooms.", new ConfigAcceptableRange<int>(1, 10), "", "Discover Multiplier (2)"));
3136
public static Configurable<int> slugcat_symbol_scale = main_mod_options.config.Bind("slugcat_symbol_scale", defaultValue: 10, new ConfigurableInfo("The default value is 100% (10). Each value (5-20) corresponds to 10*value% (50%-200%).", new ConfigAcceptableRange<int>(5, 20), "", "Slugcat Symbol Size (10)"));
3237

33-
public static Configurable<int> discover_multiplier = main_mod_options.config.Bind("discover_multiplier", defaultValue: 2, new ConfigurableInfo("The default value is two. For a given value X the map around slugcat is discovered (X/2)-times as far.\nWARNING: This will delete and change the size of any loaded region discover texture. The game tries to recover your map progress based on visited rooms.", new ConfigAcceptableRange<int>(1, 10), "", "Discover Multiplier (2)"));
3438
public static Configurable<int> reveal_speed_multiplier = main_mod_options.config.Bind("reveal_speed_multiplier", defaultValue: 1, new ConfigurableInfo("The default value is one. For a given value X the map is revealed X-times as fast.\nIf the maximum value is selected then opening the map displays known areas instantly instead of revealing them gradually.", new ConfigAcceptableRange<int>(1, 10), "", "Reveal Speed Multiplier (1)"));
39+
public static Configurable<int> zoom_slider = main_mod_options.config.Bind("zoom_slider", defaultValue: 10, new ConfigurableInfo("The default value is 100% (10) zoom. Each value (5-15) corresponds to 10*value% (50%-150%) zoom..", new ConfigAcceptableRange<int>(5, 15), "", "Zoom Level (10)"));
3540

3641
//
3742
// parameters
@@ -205,6 +210,7 @@ public override void Initialize() {
205210
DrawTextLabels(ref Tabs[tab_index]);
206211
AddNewLine();
207212

213+
AddCheckBox(clear_expedition_maps, (string)clear_expedition_maps.info.Tags[0]);
208214
AddCheckBox(uncover_region, (string)uncover_region.info.Tags[0]);
209215
DrawCheckBoxes(ref Tabs[tab_index]);
210216

@@ -227,13 +233,14 @@ public void Log_All_Options() {
227233

228234
Debug.Log(mod_id + ": Option_AerialMap " + Option_AerialMap);
229235
Debug.Log(mod_id + ": Option_CreatureSymbols " + Option_CreatureSymbols);
236+
Debug.Log(mod_id + ": Option_ClearExpeditionMaps " + Option_ClearExpeditionMaps);
230237
Debug.Log(mod_id + ": Option_ItemTracker " + Option_ItemTracker);
231238

232239
Debug.Log(mod_id + ": Option_LayerFocus " + Option_LayerFocus);
233240
Debug.Log(mod_id + ": Option_ShadowSprites " + Option_ShadowSprites);
234241
Debug.Log(mod_id + ": Option_SkipFade " + Option_SkipFade);
235-
236242
Debug.Log(mod_id + ": Option_SlugcatSymbols " + Option_SlugcatSymbols);
243+
237244
Debug.Log(mod_id + ": Option_UncoverRegion " + Option_UncoverRegion);
238245
Debug.Log(mod_id + ": Option_UncoverRoom " + Option_UncoverRoom);
239246
}

SourceCode/MapMod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using HUD;
2-
using IL;
32
using MonoMod.Cil;
43
using MoreSlugcats;
54
using RWCustom;
@@ -9,6 +8,7 @@
98
using static HUD.Map;
109
using static MapOptions.MainMod;
1110
using static MapOptions.MainModOptions;
11+
using static MapOptions.PlayerMod;
1212

1313
namespace MapOptions;
1414

@@ -226,7 +226,7 @@ public static void Initialize_Creature_Symbols(Map map, RainWorldGame game) {
226226

227227
foreach (AbstractCreature abstract_player in game.Players) {
228228
if (abstract_player.realizedCreature is Player player) {
229-
PlayerMod.Remove_ObjectInStomach_Symbol(player);
229+
Remove_ObjectInStomach_Symbol(player);
230230
}
231231
}
232232
}

SourceCode/MapOptions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net48</TargetFramework>
5-
<Version>2.1.5</Version>
5+
<Version>2.1.6</Version>
66
<Nullable>enable</Nullable>
77
<LangVersion>10.0</LangVersion>
88
</PropertyGroup>

SourceCode/ProcessManagerMod.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ public static void Initialize_Option_Specific_Hooks() {
2424

2525
main_mod_options.Log_All_Options();
2626
Debug.Log(mod_id + ": Initialize option specific hooks.");
27-
2827
can_log_il_hooks = true;
28+
2929
AbstractCreatureMod.On_Config_Changed();
3030
AbstractRoomMod.On_Config_Changed();
31+
ExpeditionMod.On_Config_Changed();
3132
MapMod.On_Config_Changed();
3233

3334
OverWorldMod.On_Config_Changed();

0 commit comments

Comments
 (0)