This commit is contained in:
LadyAliceMargatroid 2024-04-28 14:41:33 -07:00
parent 7a77b79dc5
commit cdadd75ee9
104 changed files with 9416 additions and 0 deletions

View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScarletMansionMimicsPatch", "ScarletMansionMimicsPatch\ScarletMansionMimicsPatch.csproj", "{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B882D00A-7717-487D-A2CE-1452D76BFEB5}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,115 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using BepInEx;
using HarmonyLib;
using Mimics;
using Mimics.API;
using System.Reflection;
using System.Reflection.Emit;
using DunGen;
using ScarletMansion.GamePatch.FixValues;
using UnityEngine.Events;
using GameNetcodeStuff;
using ScarletMansion.GamePatch.Components;
namespace ScarletMansion.ModPatch {
public class Patch {
public Patch() {
MimicsAPI.GetAPI().RegisterMimicEventHandler(new SDMMimicEventHandler());
Plugin.Instance.harmony.PatchAll(typeof(Patch));
}
public class SDMMimicEventHandler : MimicEventHandler
{
public override string ModGUID => Plugin.modGUID;
public override bool IsMyInteriorLoaded => DunGenPatch.Patch.active;
public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) {
var c = doorway.transform.parent.GetComponentInChildren<DunGenPatch.Doorways.DoorwayCleanup>();
if (c != null) {
c.overrideConnector = true;
c.overrideNoDoorway = true;
}
var fixfireexit = doorway.GetComponentInChildren<FixFireExit>(true);
fixfireexit.ForcefullyEnableDoorway();
var mimicDoorMesh = Utility.FindChildRecurvisely(mimicDoor.transform, "DoorMesh");
var mimicFrame = Utility.FindChildRecurvisely(mimicDoor.transform, "Frame");
var mimicLight = Utility.FindChildRecurvisely(mimicDoor.transform, "Light");
if (fixfireexit.EnableVanillaFireExit){
FixDoorwayForVanillaFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight);
} else {
FixDoorwayForSDMFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight);
}
Plugin.logger.LogInfo("Fixed a doorway for a mimic");
}
public override void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack) {
var doorway = mimicDoor.GetComponentInParent<Doorway>();
var fireexit = doorway.GetComponentInChildren<ScarletFireExit>();
fireexit?.DisableEnablePortal();
}
}
private static bool colorBlindModeLastValue;
[HarmonyPrefix]
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
public static void SetExitIDsPatchPrefix(){
colorBlindModeLastValue = Mimics.Mimics.ColorBlindMode;
}
[HarmonyPostfix]
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
public static void SetExitIDsPatchPostfix(){
Mimics.Mimics.ColorBlindMode = colorBlindModeLastValue;
}
private static void FixDoorwayForVanillaFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight){
if (mimicDoorMesh != null) {
mimicDoorMesh.localPosition = new Vector3(-0.07f, 0f, 0.06f);
var sc = mimicDoorMesh.localScale;
sc.y = -0.0002f;
sc.z = -0.000161f;
mimicDoorMesh.localScale = sc;
} else {
Plugin.logger.LogWarning("Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
}
if (mimicFrame != null) {
mimicFrame.localPosition = new Vector3(0f, -0.02f, 0.07f);
mimicFrame.localScale = new Vector3(1.08f, 1.008f, 1.02f);
} else {
Plugin.logger.LogWarning("Could not find Frame in mimic gameobject. It will look weird but nothing should break");
}
}
private static void FixDoorwayForSDMFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight){
Mimics.Mimics.ColorBlindMode = true;
fixFireExit.ForcefullyEnableSDMRender();
fixFireExit.sdmFireExit.enablePortalAnimation = true;
if (mimicDoorMesh != null) mimicDoorMesh.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
if (mimicFrame != null) mimicFrame.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find Frame in mimic gameobject. It will look weird but nothing should break");
if (mimicLight != null) mimicLight.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find Light in mimic gameobject. It will look weird but nothing should break");
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下を通して制御されます
// 制御されます。アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("ScarletMansionMimicsPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansionMimicsPatch")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("6aab73ec-489e-4baa-8bd1-7ca944359cec")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// リビジョン
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ScarletMansionMimicsPatch</RootNamespace>
<AssemblyName>ScarletMansionMimicsPatch</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\Libraries\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-publicized">
<HintPath>..\..\..\Libraries\Assembly-CSharp-publicized.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\Libraries\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Mimics">
<HintPath>..\..\..\Libraries\Mimics.dll</HintPath>
</Reference>
<Reference Include="ScarletMansion">
<HintPath>..\..\..\Libraries\ScarletMansion.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\Libraries\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\Libraries\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Patch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>