Moved dungen code to DunGenPlus

Added critical damage as a mechanic
Maid knife feed deals critical damage, then kills on second time
Added concept of treasure room with kitchen
Frames now only start at the player when not being looked
New attempt at snowglobe animations, it broke though
Added concept of indoor weathers
LethalConfig compability now changes the color of configs that my presets touch
Added jukebox
Changed modGUID
Removed AC compability
Falling into void deals critical damage and teleports, then kills on second time
Maid spawns revenant ghost on death
This commit is contained in:
LadyAliceMargatroid 2024-08-02 08:56:09 -07:00
parent faa391c309
commit 056cac8df1
63 changed files with 976 additions and 2061 deletions

View file

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
namespace ScarletMansion.ModPatch {
public class AdvancedCompanyPatch : ModPatch {
public override string warningMessage => "AC compability will stay but if it breaks in the future, I'm not fixing it. Apologies.";
public AdvancedCompanyPatch(string guid) : base(guid) { }
public override void AddPatch() {
try {
var desiredTypeString = "AdvancedCompany.Game.Manager+Moons, AdvancedCompany";
var moonManagerType = System.Type.GetType(desiredTypeString);
var GetInsideEnemiesAC = moonManagerType.GetMethod("GetInsideEnemies", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
var GetLootTableAC = moonManagerType.GetMethod("GetLootTable", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
var GetScrapAmountAC = moonManagerType.GetMethod("GetScrapAmountModifier", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
GamePatch.LoadAssetsIntoLevelPatch.enemiesInjection.instructions.Add(new CodeInstruction(OpCodes.Call, GetInsideEnemiesAC));
//GamePatch.LoadAssetsIntoLevelPatch.itemsInjection.instructions.Add(new CodeInstruction(OpCodes.Call, GetLootTableAC));
GamePatch.RoundManagerPatch.scrapInjection.instructions.Add(new CodeInstruction(OpCodes.Call, GetScrapAmountAC));
} catch (System.Exception e) {
Plugin.logger.LogError("Failed to setup patching for Advanced Company. Custom enemies and items for SDM will not spawn, but bugs should not happen maybe possibly?");
Plugin.logger.LogError(e);
}
}
}
}

View file

@ -14,27 +14,27 @@ using ConfigEntryBundleInt = ScarletMansion.PluginConfig.ConfigEntryBundle<int>;
using ConfigEntryBundleFloat = ScarletMansion.PluginConfig.ConfigEntryBundle<float>;
using ConfigEntryBundleString = ScarletMansion.PluginConfig.ConfigEntryBundle<string>;
using ConfigEntryBundleBool = ScarletMansion.PluginConfig.ConfigEntryBundle<bool>;
using HarmonyLib;
using LethalConfig.MonoBehaviours.Components;
using UnityEngine.UI;
using LethalConfig.MonoBehaviours;
namespace ScarletMansion.ModPatch {
public class LethalConfigPatch : ModPatch {
public const string section = "_Presets";
public const string descriptionPrefix = "These are a set of preset config values for your convience. Your config values will automatically update to these preset values every time SDM is loaded. To disable this feature, set this value to Custom.";
public const string descriptionPrefix = "These are a set of preset config values for your convience. Your config values will automatically update to these preset values every time SDM is loaded. These config values are a brighter shade of red. To disable this feature, set this value to Custom.";
public const string requiresNewLobby = "Requires a lobby restart for the values to be updated.";
public override string version => "1.4.2";
public LethalConfigPatch(string guid) : base(guid) { }
public static void ForceUIUpdate(){
try {
var desiredTypeString = "LethalConfig.MonoBehaviours.ConfigMenu, LethalConfig";
var configMenuType = Type.GetType(desiredTypeString);
var configMenuObject = GameObject.FindObjectOfType(configMenuType);
var closeFunction = configMenuType.GetMethod("Close", BindingFlags.Instance | BindingFlags.Public);
var openFunction = configMenuType.GetMethod("Open", BindingFlags.Instance | BindingFlags.Public);
closeFunction.Invoke(configMenuObject, new object[] {false} );
openFunction.Invoke(configMenuObject, new object[] {} );
var configMenuObject = GameObject.FindObjectOfType<ConfigMenu>();
configMenuObject.Close(false);
configMenuObject.Open();
} catch (Exception e) {
Plugin.logger.LogWarning("Could not force Lethal Config UI update");
Plugin.logger.LogError(e.ToString());
@ -151,6 +151,41 @@ namespace ScarletMansion.ModPatch {
CreatePresetConfig(PluginConfig.lcDungeonLightingPreset.config, PresetConfig.dungeonLightingChangeList);
AutoGenerateConfigs(PluginConfig.lcDungeonGenerationPreset, PluginConfig.lcDungeonLightingPreset);
try {
Plugin.Instance.harmony.PatchAll(typeof(LethalConfigPatch));
} catch (Exception e) {
Plugin.logger.LogWarning("Tried to HarmonyPatch LethalConfig but failed. Nothing bad will happen but report this bug to dev.");
Plugin.logger.LogError(e.ToString());
}
}
[HarmonyPatch(typeof(LethalConfig.MonoBehaviours.ConfigList), "LoadConfigsForMod")]
[HarmonyPostfix]
public static void LoadConfigsForModPatch(ref LethalConfig.MonoBehaviours.ConfigList __instance, ref LethalConfig.Mods.Mod mod) {
try {
if (mod.ModInfo.Guid == Plugin.modGUID) {
var genChanges = PresetConfig.defaultGeneration.GetAllConfigEntries();
var lightChanges = PresetConfig.defaultLighting.GetAllConfigEntries();
foreach(Transform child in __instance.listContainerObject.transform){
var controller = child.GetComponentInChildren<ModConfigController>();
if (controller == null) continue;
var config = controller.BaseConfigItem.BaseConfigEntry;
if (genChanges.Contains(config) || lightChanges.Contains(config)) {
foreach(var image in controller.GetComponentsInChildren<Graphic>()) {
image.color = Utility.BrightenColor(image.color, new Color(0.2f, 0.05f, 0.05f));
}
}
}
}
} catch (Exception e) {
Plugin.logger.LogWarning("Tried to change the label colors of LethalConfig but failed. Nothing bad will happen but report this bug to dev.");
Plugin.logger.LogError(e.ToString());
}
}
}

View file

@ -9,13 +9,13 @@ using BepInEx.Bootstrap;
namespace ScarletMansion.ModPatch {
public class ModCompability {
public const string advancedCompanyGuid = "com.potatoepet.AdvancedCompany";
//public const string advancedCompanyGuid = "com.potatoepet.AdvancedCompany";
public const string lethalConfigGuid = "ainavt.lc.lethalconfig";
public const string facilityMeldownGuid = "me.loaforc.facilitymeltdown";
public const string reserveFlashlightGuid = "FlipMods.ReservedFlashlightSlot";
public static readonly ModPatch[] modPatches = new ModPatch[] {
new AdvancedCompanyPatch(advancedCompanyGuid),
//new AdvancedCompanyPatch(advancedCompanyGuid),
new LethalConfigPatch(lethalConfigGuid),
new FacilityMeltdownPatch(facilityMeldownGuid),
new ReservedItemSlotPatch(reserveFlashlightGuid)