Skip to content

Commit

Permalink
Added some walls to CSL. Room rando logic fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nerthul11 committed Jan 14, 2025
1 parent 97cc3a4 commit 1603125
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 6 deletions.
35 changes: 33 additions & 2 deletions BreakableWallRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BreakableWallRandomizer
public class BreakableWallRandomizer : Mod, IGlobalSettings<BWR_Settings>
{
new public string GetName() => "Breakable Wall Randomizer";
public override string GetVersion() => "3.0.3.1";
public override string GetVersion() => "3.0.4.0";
public BWR_Settings GS { get; set; } = new();
private static BreakableWallRandomizer _instance;
public BreakableWallRandomizer() : base()
Expand All @@ -33,7 +33,7 @@ public override void Initialize()
BWR_Manager.Hook();

if (ModHooks.GetMod("FStatsMod") is Mod)
FStats_Interop.Hook();
FStats_Interop.Hook();

if (ModHooks.GetMod("Randomizer 4") is Mod)
{
Expand All @@ -43,6 +43,37 @@ public override void Initialize()
if (ModHooks.GetMod("RandoSettingsManager") is Mod)
RSM_Interop.Hook();
}

CondensedSpoilerLogger.AddCategory("Grub Walls", () => BWR_Manager.Settings.Enabled,
[
"Dive_Floor-Basin_Grub",
"Wall-Catacombs_Grub",
"Wall-Crossroads_Grub",
"Wall-Deepnest_Mimics",
"Wall-Deepnest_Springs_Grub",
"Wall-Edge_Camp_Grub",
"Wall-Peak_Mimic",
"Wall-Waterways_Grub"
]
);

CondensedSpoilerLogger.AddCategory("Access Walls", () => BWR_Manager.Settings.Enabled,
[
"Dive_Floor-Flukemarm",
"Dive_Floor-Peak_Entrance",
"Plank-Colo_Shortcut",
"Plank-Edge_Tram_Exit",
"Plank-Hive_Exit",
"Plank-Nailsmith",
"Wall-Hidden_Station",
"Wall-Junk_Pit_Entrance",
"Wall-Lower_Hive_Entrance",
"Wall-Path_of_Pain_Entrance",
"Wall-Pleasure_House",
"Wall-Shade_Soul_Shortcut",
"Wall-Weaver's_Den_Entrance"
]
);
Log("Initialized.");
}
public void OnLoadGlobal(BWR_Settings s) => GS = s;
Expand Down
4 changes: 2 additions & 2 deletions BreakableWallRandomizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<Product>BreakableWallRandomizer</Product>
<Description>A Randomizer add-on for wall and floor objects.</Description>
<Copyright>Copyright ©2023</Copyright>
<AssemblyVersion>3.0.3.1</AssemblyVersion>
<FileVersion>3.0.3.1</FileVersion>
<AssemblyVersion>3.0.4.0</AssemblyVersion>
<FileVersion>3.0.4.0</FileVersion>
<OutputPath>bin\$(Configuration)\</OutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
28 changes: 28 additions & 0 deletions Interop/CondensedSpoilerLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using MonoMod.ModInterop;
using System;
using System.Collections.Generic;

namespace BreakableWallRandomizer.Interop;
internal static class CondensedSpoilerLogger
{
[ModImportName("CondensedSpoilerLogger")]
private static class CondensedSpoilerLoggerImport
{
public static Action<string, Func<bool>, List<string>> AddCategorySafe = null;
}

static CondensedSpoilerLogger()
{
typeof(CondensedSpoilerLoggerImport).ModInterop();
}

/// <summary>
/// Add a category to the condensed spoiler log.
/// </summary>
/// <param name="categoryName">The title to give the category.</param>
/// <param name="test">Return false to skip adding this category to the log. The category will automatically
/// be skipped if no items in the list are randomized.</param>
/// <param name="entries">A list of items to log in the category.</param>
public static void AddCategory(string categoryName, Func<bool> test, List<string> entries)
=> CondensedSpoilerLoggerImport.AddCategorySafe?.Invoke(categoryName, test, entries);
}
7 changes: 7 additions & 0 deletions Interop/FStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using FStats;
using FStats.StatControllers;
using FStats.Util;
using ItemChanger;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand All @@ -25,6 +26,7 @@ private static void GenerateStats(Action<StatController> generateStats)
if (!BWR_Manager.Settings.Enabled)
return;

ItemChangerMod.Modules.GetOrAdd<BreakableWallModule>();
generateStats(new BreakableWallStats());

Assembly assembly = Assembly.GetExecutingAssembly();
Expand All @@ -46,6 +48,11 @@ public override void Initialize()
BreakableWallModule.Instance.OnAchievedBreakableWall += AddMarks;
}

public override void Unload()
{
BreakableWallModule.Instance.OnAchievedBreakableWall -= AddMarks;
}

private void AddMarks(List<string> marks)
{
foreach (string mark in marks)
Expand Down
2 changes: 1 addition & 1 deletion Manager/ItemHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private static void AddWalls(RequestBuilder rb)
if (wall.name.Contains("King's_Pass"))
include = BWR_Manager.Settings.KingsPass;
include = include && !(wall.exit && BWR_Manager.Settings.ExcludeWallsWhichMaySoftlockYou);
include = include && (!wall.name.Contains("Godhome") || !wall.name.Contains("Eternal_Ordeal") || BWR_Manager.Settings.GodhomeWalls);
include = include && (!(wall.name.Contains("Godhome") || wall.name.Contains("Eternal_Ordeal")) || BWR_Manager.Settings.GodhomeWalls);

if (include)
{
Expand Down
1 change: 1 addition & 0 deletions Modules/BreakableWallModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class BreakableWallModule : Module
public List<string> UnlockedDives = [];
public override void Initialize()
{
BreakableWallRandomizer.Instance.Log("BWR Module Init");
On.HutongGames.PlayMaker.Actions.ActivateGameObject.OnEnter += VanillaTracker;
if (ItemChangerMod.Modules?.Get<InventoryTracker>() is InventoryTracker it)
it.OnGenerateFocusDesc += AddWallProgress;
Expand Down
5 changes: 4 additions & 1 deletion Resources/Data/BreakableWallObjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@
"group": "",
"logic": "Deepnest_39[door1] | (Deepnest_39[left1] | Deepnest_39[top1] | Deepnest_39[right1] + (FULLCLAW | WINGS + ANYCLAW | ENEMYPOGOS + (ANYCLAW | WINGS))) + ((LANTERN | (NOLANTERN ? FALSE)) | DARKROOMS) + (RIGHTDASH | WINGS | RIGHTCLAW + (RIGHTSUPERDASH | SPELLAIRSTALL + $CASTSPELL[1,1,before:ROOMSOUL,after:ROOMSOUL]))",
"logicOverrides": {
"Deepnest_39[door1]": "(ORIG) + Wall-Weaver's_Den_Entrance"
"Deepnest_39[door1]": "Deepnest_39[door1] | (ORIG) + Wall-Weaver's_Den_Entrance"
},
"logicSubstitutions": {
"Deepnest_39": {
Expand Down Expand Up @@ -1030,6 +1030,9 @@
},
"Deepnest_East_02": {
"Deepnest_East_02[right1]": "Deepnest_East_02[right1] + Plank-Edge_Tram_Exit"
},
"Soul_Totem-Lower_Kingdom's_Edge_2": {
"Deepnest_East_02[right1]": "Deepnest_East_02[right1] + Plank-Edge_Tram_Exit"
}
}
},
Expand Down
21 changes: 21 additions & 0 deletions Resources/Logic/ConnectionOverrides.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[
{
"name": "Bathhouse-Hot_Spring",
"logicOverride": "",
"logicSubstitutions": {
"Ruins_Bathhouse[right1]": "Ruins_Bathhouse[right1] + Wall-Pleasure_House"
}
},
{
"name": "Chandelier-Watcher_Knights",
"logicOverride": "ORIG + Wall-Chandelier",
Expand All @@ -11,6 +18,13 @@
"RestingGrounds_10": "(RestingGrounds_10 | RestingGrounds_10[left1] + Plank-Catacombs_Elevator | RestingGrounds_10[top1] | RestingGrounds_10[top2] + Wall-Catacombs_Grey_Mourner)"
}
},
{
"name": "Ghost_Essence-Marissa",
"logicOverride": "",
"logicSubstitutions": {
"Ruins_Bathhouse[right1]": "Ruins_Bathhouse[right1] + Wall-Pleasure_House"
}
},
{
"name": "Gorb_Grave",
"logicOverride": "",
Expand Down Expand Up @@ -49,6 +63,13 @@
"logicOverride": "Ruins1_32[right2] | (ORIG) + Dive_Floor-Inner_Sanctum_2 + (Dive_Floor-Inner_Sanctum_Grub + Dive_Floor-Inner_Sanctum_Bottom | Dive_Floor-Inner_Sanctum_Seal + Dive_Floor-Inner_Sanctum_Lever + Lever-Sanctum_West_Lower)",
"logicSubstitutions": {}
},
{
"name": "Marissa",
"logicOverride": "",
"logicSubstitutions": {
"Ruins_Bathhouse[right1]": "Ruins_Bathhouse[right1] + Wall-Pleasure_House"
}
},
{
"name": "Mr_Mushroom-Kingdom's_Edge",
"logicOverride": "",
Expand Down

0 comments on commit 1603125

Please sign in to comment.