Initial
This commit is contained in:
parent
7a77b79dc5
commit
cdadd75ee9
104 changed files with 9416 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
|
||||
public abstract class FixBaseClass<T> : MonoBehaviour where T: Component {
|
||||
|
||||
public T target;
|
||||
|
||||
void Reset(){
|
||||
target = GetComponent<T>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using DunGen;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixCeilingLightValue : FixBaseClass<LocalPropSet> {
|
||||
|
||||
public void Awake(){
|
||||
var weight = target.Props.Weights[1];
|
||||
var value = PluginConfig.Instance.ceilingLightsWeightValue;
|
||||
weight.MainPathWeight = value;
|
||||
weight.BranchPathWeight = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using ScarletMansion.GamePatch.Components;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixFireExit : FixBaseClass<SpawnSyncedObject> {
|
||||
|
||||
public bool vanillaSetup;
|
||||
|
||||
[Header("Targets")]
|
||||
public GameObject sdmGameObject;
|
||||
public GameObject vanillaGameObject;
|
||||
public List<GameObject> vanillaGameObjectGlobalPropTargets;
|
||||
|
||||
[Header("SDM Fire Exit")]
|
||||
public GameObject sdmRenderGameObject;
|
||||
public ScarletFireExit sdmFireExit;
|
||||
|
||||
[Header("Vanilla References")]
|
||||
public SpawnSyncedObject vanillaSpawnSyncedObject;
|
||||
public GameObject vanillaLightGameObject;
|
||||
public GameObject vanillaCube001GameObject;
|
||||
public GameObject vanillaCube002GameObject;
|
||||
|
||||
public bool EnableVanillaFireExit => !PluginConfig.Instance.useSDMFireExitsValue && vanillaSetup;
|
||||
|
||||
public void Awake(){
|
||||
if (EnableVanillaFireExit){
|
||||
sdmGameObject.SetActive(false);
|
||||
sdmRenderGameObject.SetActive(false);
|
||||
vanillaGameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDisable(){
|
||||
foreach(var t in vanillaGameObjectGlobalPropTargets)
|
||||
t.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnEnable(){
|
||||
foreach(var t in vanillaGameObjectGlobalPropTargets)
|
||||
t.SetActive(true);
|
||||
}
|
||||
|
||||
public void Setup(GameObject blocker){
|
||||
try {
|
||||
vanillaSpawnSyncedObject.spawnPrefab = blocker.GetComponentInChildren<SpawnSyncedObject>().spawnPrefab;
|
||||
CopyMeshAndRenderers("Light", vanillaLightGameObject);
|
||||
CopyMeshAndRenderers("Cube.001", vanillaCube001GameObject);
|
||||
CopyMeshAndRenderers("Cube.002", vanillaCube002GameObject);
|
||||
|
||||
void CopyMeshAndRenderers(string sourceName, GameObject target){
|
||||
var source = Utility.FindChildRecurvisely(blocker.transform, sourceName);
|
||||
target.GetComponent<MeshFilter>().sharedMesh = source.GetComponent<MeshFilter>().sharedMesh;
|
||||
target.GetComponent<MeshRenderer>().sharedMaterials = source.GetComponent<MeshRenderer>().sharedMaterials;
|
||||
}
|
||||
|
||||
vanillaSetup = true;
|
||||
//Plugin.logger.LogInfo("Vanilla fire exit set up");
|
||||
} catch (Exception e){
|
||||
Plugin.logger.LogInfo("Failed to setup vanilla fire exit. The 'Use SDM Fire Exits' config will be ignored");
|
||||
Plugin.logger.LogError(e.ToString());
|
||||
|
||||
vanillaSetup = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ForcefullyEnableDoorway(){
|
||||
gameObject.SetActive(true);
|
||||
sdmGameObject.SetActive(false);
|
||||
sdmRenderGameObject.SetActive(false);
|
||||
vanillaGameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ForcefullyEnableSDMRender(){
|
||||
sdmRenderGameObject.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using DunGen;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixHallwayLightValue : FixBaseClass<RandomPrefab> {
|
||||
|
||||
public void Awake(){
|
||||
var weight = target.Props.Weights[1];
|
||||
var value = PluginConfig.Instance.hallwayLightsWeightValue;
|
||||
weight.MainPathWeight = value;
|
||||
weight.BranchPathWeight = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixHoverIcon : MonoBehaviour {
|
||||
|
||||
public InteractTrigger trigger;
|
||||
|
||||
public void Awake(){
|
||||
trigger.hoverIcon = Assets.hoverIcon;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using DunGen;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixRandomMapObject : FixBaseClass<RandomMapObject> {
|
||||
|
||||
[Flags]
|
||||
public enum MapObject {
|
||||
None = 0,
|
||||
Turret = 1,
|
||||
Mine = 2,
|
||||
SpikeTrap = 4
|
||||
}
|
||||
|
||||
public MapObject mapObjectFlag;
|
||||
|
||||
public void Awake(){
|
||||
target.spawnablePrefabs = new List<GameObject>();
|
||||
if (!Assets.dungeonMapHazardFound) return;
|
||||
|
||||
if (mapObjectFlag.HasFlag(MapObject.Turret)) {
|
||||
target.spawnablePrefabs.Add(Assets.dungeonTurretMapHazard);
|
||||
}
|
||||
if (mapObjectFlag.HasFlag(MapObject.Mine)) {
|
||||
target.spawnablePrefabs.Add(Assets.dungeonMinesMapHazard);
|
||||
}
|
||||
if (mapObjectFlag.HasFlag(MapObject.SpikeTrap)) {
|
||||
target.spawnablePrefabs.Add(Assets.dungeonSpikeTrapMapHazard);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ScarletMansion.GamePatch.FixValues {
|
||||
public class FixSpawnItemGroup : FixBaseClass<RandomScrapSpawn> {
|
||||
|
||||
public enum ItemGroup {
|
||||
Null,
|
||||
Generic,
|
||||
Tabletop,
|
||||
Small
|
||||
}
|
||||
|
||||
public ItemGroup itemGroup;
|
||||
|
||||
public void Awake(){
|
||||
switch(itemGroup){
|
||||
case ItemGroup.Generic:
|
||||
target.spawnableItems = Assets.genericItemGroup;
|
||||
break;
|
||||
case ItemGroup.Tabletop:
|
||||
target.spawnableItems = Assets.tabletopItemGroup;
|
||||
break;
|
||||
case ItemGroup.Small:
|
||||
target.spawnableItems = Assets.smallItemGroup;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue