Added BrachTileBoost system
Added the new coilhead behaviour to the knight Added treasure room puzzle for bedroom Changed many LogInfo into LogDebug Removed jank animator override stuff (no offense) Changed how treasure rooms lock their doors to work in multiplayer Removed basement scripts
This commit is contained in:
parent
e9152782aa
commit
523e7ed898
|
@ -176,7 +176,7 @@ namespace ScarletMansion {
|
||||||
if (resourceNames.Length >= 1) {
|
if (resourceNames.Length >= 1) {
|
||||||
var name = resourceNames[0];
|
var name = resourceNames[0];
|
||||||
using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) {
|
using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) {
|
||||||
Plugin.logger.LogInfo($"Loading resource {name}");
|
Plugin.logger.LogDebug($"Loading resource {name}");
|
||||||
MainAssetBundle = AssetBundle.LoadFromStream(assetStream);
|
MainAssetBundle = AssetBundle.LoadFromStream(assetStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ namespace ScarletMansion {
|
||||||
globalItems.Add(entry);
|
globalItems.Add(entry);
|
||||||
|
|
||||||
Items.RegisterItem(i);
|
Items.RegisterItem(i);
|
||||||
Plugin.logger.LogInfo($"Global Item {i.itemName} registered");
|
Plugin.logger.LogDebug($"Global Item {i.itemName} registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var i in networkObjectList.scrapItems) {
|
foreach(var i in networkObjectList.scrapItems) {
|
||||||
|
@ -223,7 +223,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
Items.RegisterScrap(i, 0, Levels.LevelTypes.None);
|
Items.RegisterScrap(i, 0, Levels.LevelTypes.None);
|
||||||
NetworkPrefabs.RegisterNetworkPrefab(i.spawnPrefab);
|
NetworkPrefabs.RegisterNetworkPrefab(i.spawnPrefab);
|
||||||
Plugin.logger.LogInfo($"Scrap Item {i.itemName} registered");
|
Plugin.logger.LogDebug($"Scrap Item {i.itemName} registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
flashlight = new Flashlight("Pro Flashlight", 0);
|
flashlight = new Flashlight("Pro Flashlight", 0);
|
||||||
|
@ -268,7 +268,7 @@ namespace ScarletMansion {
|
||||||
var missingasset = asset == null;
|
var missingasset = asset == null;
|
||||||
|
|
||||||
if (missingasset || onlyReportErrors == true) {
|
if (missingasset || onlyReportErrors == true) {
|
||||||
logger.LogInfo($"Loading asset {name}");
|
logger.LogDebug($"Loading asset {name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missingasset) {
|
if (missingasset) {
|
||||||
|
|
|
@ -21,12 +21,12 @@ namespace ScarletMansion.DunGenPatch {
|
||||||
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
|
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
public static void DungeonGeneratorGenerate_PrefixPrefix(){
|
public static void DungeonGeneratorGenerate_PrefixPrefix(){
|
||||||
Plugin.logger.LogInfo("Disabling SDM logic");
|
Plugin.logger.LogDebug("Disabling SDM logic");
|
||||||
Patch.Deactivate();
|
Patch.Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GeneratePatch(RoundManager roundManager){
|
public static void GeneratePatch(RoundManager roundManager){
|
||||||
Plugin.logger.LogInfo("Loading Scarlet Mansion map so we are activating the alt. dungen scripts");
|
Plugin.logger.LogDebug("Loading Scarlet Mansion map so we are activating the alt. dungen scripts");
|
||||||
Patch.Activate(roundManager.dungeonGenerator.Generator);
|
Patch.Activate(roundManager.dungeonGenerator.Generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ScarletMansion.DunGenPatch {
|
||||||
var scale = generator.LengthMultiplier;
|
var scale = generator.LengthMultiplier;
|
||||||
|
|
||||||
var mainPathLength = generator.DungeonFlow.Length;
|
var mainPathLength = generator.DungeonFlow.Length;
|
||||||
Plugin.logger.LogInfo($"Length of main path be: {GetLength(mainPathLength, scale)}");
|
Plugin.logger.LogDebug($"Length of main path be: {GetLength(mainPathLength, scale)}");
|
||||||
|
|
||||||
GamePatch.LoadAssetsIntoLevelPatch.ModifyLevel(StartOfRound.Instance.currentLevel);
|
GamePatch.LoadAssetsIntoLevelPatch.ModifyLevel(StartOfRound.Instance.currentLevel);
|
||||||
}
|
}
|
||||||
|
@ -60,17 +60,13 @@ namespace ScarletMansion.DunGenPatch {
|
||||||
|
|
||||||
public static void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) {
|
public static void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) {
|
||||||
props.MainPathCount = PluginConfig.Instance.mainPathCountValue;
|
props.MainPathCount = PluginConfig.Instance.mainPathCountValue;
|
||||||
if (PluginConfig.Instance.disableBasementValue) {
|
|
||||||
props.MainPathCount = Mathf.Min(props.MainPathCount, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
var mayorTileSet = PluginConfig.Instance.disableBasementValue ? Assets.networkObjectList.mayorVanillaTileset : Assets.networkObjectList.mayorRegularTileset;
|
|
||||||
Assets.dungeon.Nodes[1].TileSets = new List<DunGen.TileSet>() { mayorTileSet };
|
|
||||||
props.MainRoomTilePrefab = mayorTileSet.TileWeights.Weights[0].Value;
|
|
||||||
|
|
||||||
props.DungeonSizeBase = new Vector3(PluginConfig.Instance.dunGenWidthBaseValue, props.DungeonSizeBase.y, PluginConfig.Instance.dunGenLengthBaseValue);
|
props.DungeonSizeBase = new Vector3(PluginConfig.Instance.dunGenWidthBaseValue, props.DungeonSizeBase.y, PluginConfig.Instance.dunGenLengthBaseValue);
|
||||||
props.DungeonSizeFactor = new Vector3(PluginConfig.Instance.dunGenWidthMultiFactorValue, props.DungeonSizeFactor.y, PluginConfig.Instance.dunGenLengthMultiFactorValue);
|
props.DungeonSizeFactor = new Vector3(PluginConfig.Instance.dunGenWidthMultiFactorValue, props.DungeonSizeFactor.y, PluginConfig.Instance.dunGenLengthMultiFactorValue);
|
||||||
|
|
||||||
|
props.UseBranchLoopBoost = PluginConfig.Instance.branchLoopBoostValue;
|
||||||
|
props.BranchLoopBoostTileSearch = PluginConfig.Instance.branchLoopBoostTileSearchValue;
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while(i < 3) {
|
while(i < 3) {
|
||||||
PluginConfig.Instance.branchPathSectionOneValue.UpdateValues(props.LineRandomizerArchetypes[i]);
|
PluginConfig.Instance.branchPathSectionOneValue.UpdateValues(props.LineRandomizerArchetypes[i]);
|
||||||
|
|
|
@ -19,7 +19,10 @@ namespace ScarletMansion {
|
||||||
var anyChanges = true;
|
var anyChanges = true;
|
||||||
while(anyChanges) {
|
while(anyChanges) {
|
||||||
anyChanges = false;
|
anyChanges = false;
|
||||||
foreach(var c in children) anyChanges = anyChanges | c.UpdateRender();
|
foreach(var c in children) {
|
||||||
|
var lastChanges = c.UpdateRender();
|
||||||
|
anyChanges|= lastChanges;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace ScarletMansion {
|
||||||
var dist = Vector3.SqrMagnitude(transform.position - player.transform.position);
|
var dist = Vector3.SqrMagnitude(transform.position - player.transform.position);
|
||||||
if (dist <= minSqrDistance) {
|
if (dist <= minSqrDistance) {
|
||||||
KnightSpawnManager.Instance.lastKnightSeenPlayer = index;
|
KnightSpawnManager.Instance.lastKnightSeenPlayer = index;
|
||||||
Plugin.logger.LogInfo($"Knight {index} has noticed player {player.playerUsername}");
|
Plugin.logger.LogDebug($"Knight {index} has noticed player {player.playerUsername}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
|
|
||||||
var reference = new EnemyReferenceSpawnLogic(enemyType, i, spawnValue);
|
var reference = new EnemyReferenceSpawnLogic(enemyType, i, spawnValue);
|
||||||
spawnableEnemiesTrueList.Add(reference);
|
spawnableEnemiesTrueList.Add(reference);
|
||||||
Plugin.logger.LogInfo($"Added {reference.ToString()} to bedroom event");
|
Plugin.logger.LogDebug($"Added {reference.ToString()} to bedroom event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
|
|
||||||
var index = sysRandom.Next(spawnableEnemiesTrueList.Count);
|
var index = sysRandom.Next(spawnableEnemiesTrueList.Count);
|
||||||
var enemy = spawnableEnemiesTrueList[index];
|
var enemy = spawnableEnemiesTrueList[index];
|
||||||
Plugin.logger.LogInfo($"Selected enemy to spawn {enemy.ToString()}");
|
Plugin.logger.LogDebug($"Selected enemy to spawn {enemy.ToString()}");
|
||||||
return enemy;
|
return enemy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
bonusEnemy.ApplySpawnLogic();
|
bonusEnemy.ApplySpawnLogic();
|
||||||
|
|
||||||
roundmanager.currentEnemyPower += enemy.PowerLevel;
|
roundmanager.currentEnemyPower += enemy.PowerLevel;
|
||||||
var spawnedEnemy = ScarletNetworkManagerUtility.CreateEnemyWithRef(bonusEnemy, vent.transform.position, y);
|
var spawnedEnemy = ScarletNetworkManagerUtility.CreateEnemyWithRef(bonusEnemy, pos, y);
|
||||||
|
|
||||||
ScarletNetworkManager.Instance.RequestEvilSkinApply(spawnedEnemy, enemy.name.ToLowerInvariant());
|
ScarletNetworkManager.Instance.RequestEvilSkinApply(spawnedEnemy, enemy.name.ToLowerInvariant());
|
||||||
}
|
}
|
||||||
|
@ -238,14 +238,5 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
bonusEnemy = GetRandomEnemy(sysRandom);
|
bonusEnemy = GetRandomEnemy(sysRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTriggerEnter(Collider other){
|
|
||||||
Plugin.logger.LogInfo(other.gameObject.tag);
|
|
||||||
if (other.gameObject.tag == "Player"){
|
|
||||||
var player = other.gameObject.GetComponent<PlayerControllerB>();
|
|
||||||
if (player && player.IsLocalPlayer){
|
|
||||||
HUDManager.Instance.DisplayTip("SDM Dungeon Events", "Paintings fetch a good price, if you are daring...", false, true, "SDM_Bedroom");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,10 +106,10 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
public void HourlySelfDestroyCheck(){
|
public void HourlySelfDestroyCheck(){
|
||||||
if (stop || timerTillDestroyed > 0) return;
|
if (stop || timerTillDestroyed > 0) return;
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Hourly clock self-destroy check");
|
Plugin.logger.LogDebug("Hourly clock self-destroy check");
|
||||||
if (UnityEngine.Random.value < chanceEveryHourToDestroy) {
|
if (UnityEngine.Random.value < chanceEveryHourToDestroy) {
|
||||||
timerTillDestroyed = UnityEngine.Random.value * 60f + 15f;
|
timerTillDestroyed = UnityEngine.Random.value * 60f + 15f;
|
||||||
Plugin.logger.LogInfo($"Clock offing itself in {timerTillDestroyed} sec");
|
Plugin.logger.LogDebug($"Clock offing itself in {timerTillDestroyed} sec");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
public class ScarletDoor : NetworkBehaviour {
|
public class ScarletDoor : NetworkBehaviour {
|
||||||
|
|
||||||
[Header("Door Reference")]
|
[Header("Door Reference")]
|
||||||
public DoorLock door;
|
public ScarletDoorLock door;
|
||||||
public bool doorState;
|
public bool doorState;
|
||||||
public bool overrideLock;
|
public bool overrideLock;
|
||||||
public bool overrideUnlock;
|
public bool overrideUnlock;
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
{ typeof(PufferAI), (e) => e.currentBehaviourStateIndex == 0 },
|
{ typeof(PufferAI), (e) => e.currentBehaviourStateIndex == 0 },
|
||||||
{ typeof(SandSpiderAI), (e) => e.currentBehaviourStateIndex <= 1 },
|
{ typeof(SandSpiderAI), (e) => e.currentBehaviourStateIndex <= 1 },
|
||||||
{ typeof(SpringManAI), (e) => e.currentBehaviourStateIndex == 0 },
|
{ typeof(SpringManAI), (e) => e.currentBehaviourStateIndex == 0 },
|
||||||
{ typeof(KnightVariant), (e) => e.currentBehaviourStateIndex == 0 },
|
{ typeof(KnightV2Variant), (e) => e.currentBehaviourStateIndex == 0 },
|
||||||
{ typeof(ButlerEnemyAI), (e) => e.currentBehaviourStateIndex <= 1 },
|
{ typeof(ButlerEnemyAI), (e) => e.currentBehaviourStateIndex <= 1 },
|
||||||
{ typeof(MaidVariant), (e) => e.currentBehaviourStateIndex <= 1 },
|
{ typeof(MaidVariant), (e) => e.currentBehaviourStateIndex <= 1 },
|
||||||
{ typeof(KnightGhostVariant), (e) => false }
|
{ typeof(KnightGhostVariant), (e) => false }
|
||||||
|
@ -105,7 +105,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
{ typeof(PufferAI), 25f },
|
{ typeof(PufferAI), 25f },
|
||||||
{ typeof(SandSpiderAI), 25f },
|
{ typeof(SandSpiderAI), 25f },
|
||||||
{ typeof(SpringManAI), 12.5f },
|
{ typeof(SpringManAI), 12.5f },
|
||||||
{ typeof(KnightVariant), 12.5f },
|
{ typeof(KnightV2Variant), 12.5f },
|
||||||
{ typeof(ButlerEnemyAI), 50f },
|
{ typeof(ButlerEnemyAI), 50f },
|
||||||
{ typeof(MaidVariant), 50f },
|
{ typeof(MaidVariant), 50f },
|
||||||
{ typeof(KnightGhostVariant), 9999f }
|
{ typeof(KnightGhostVariant), 9999f }
|
||||||
|
@ -148,7 +148,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
|
|
||||||
[ServerRpc(RequireOwnership = false)]
|
[ServerRpc(RequireOwnership = false)]
|
||||||
public void DestroyAndOpenDoorServerRpc(Vector3 direction){
|
public void DestroyAndOpenDoorServerRpc(Vector3 direction){
|
||||||
Plugin.logger.LogInfo("Destro time");
|
Plugin.logger.LogDebug("Destro time");
|
||||||
OpenDoorAsEnemyClientRpc();
|
OpenDoorAsEnemyClientRpc();
|
||||||
DestroyDoorClientRpc(direction);
|
DestroyDoorClientRpc(direction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
public PlayerControllerB player;
|
public PlayerControllerB player;
|
||||||
|
|
||||||
// animation
|
// animation
|
||||||
public AnimatorOverrideController playerOverrideController;
|
//public AnimatorOverrideController playerOverrideController;
|
||||||
|
|
||||||
// second-chance states
|
// second-chance states
|
||||||
public bool stabbedSelf;
|
public bool stabbedSelf;
|
||||||
|
@ -61,7 +61,7 @@ namespace ScarletMansion.GamePatch.Components {
|
||||||
var newFlashlightHelmetIndex = helmetLights.Count;
|
var newFlashlightHelmetIndex = helmetLights.Count;
|
||||||
|
|
||||||
if (flashlight.scarletHelmetIndex != newFlashlightHelmetIndex)
|
if (flashlight.scarletHelmetIndex != newFlashlightHelmetIndex)
|
||||||
Plugin.logger.LogInfo($"Created helmet light for scarlet flashlight {index}. Updated index from {flashlight.scarletHelmetIndex} to {newFlashlightHelmetIndex}");
|
Plugin.logger.LogDebug($"Created helmet light for scarlet flashlight {index}. Updated index from {flashlight.scarletHelmetIndex} to {newFlashlightHelmetIndex}");
|
||||||
|
|
||||||
flashlight.scarletHelmetIndex = newFlashlightHelmetIndex;
|
flashlight.scarletHelmetIndex = newFlashlightHelmetIndex;
|
||||||
helmetLights.Add(gameObj.GetComponent<Light>());
|
helmetLights.Add(gameObj.GetComponent<Light>());
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace ScarletMansion {
|
||||||
if (!prewarm){
|
if (!prewarm){
|
||||||
OpenVentClientRpc();
|
OpenVentClientRpc();
|
||||||
prewarm = true;
|
prewarm = true;
|
||||||
Plugin.logger.LogInfo("Prewarming particles by forcing it emit now lmao");
|
Plugin.logger.LogDebug("Prewarming particles by forcing it emit now lmao");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ namespace ScarletMansion.GamePatch.Components
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comp.CheckConditionsForSinkingInQuicksand()){
|
if (comp.CheckConditionsForSinkingInQuicksand()){
|
||||||
Debug.Log("Set local player to sinking");
|
|
||||||
sinkingLocalPlayer = true;
|
sinkingLocalPlayer = true;
|
||||||
comp.sourcesCausingSinking++;
|
comp.sourcesCausingSinking++;
|
||||||
comp.isMovementHindered++;
|
comp.isMovementHindered++;
|
||||||
|
@ -76,28 +75,28 @@ namespace ScarletMansion.GamePatch.Components
|
||||||
|
|
||||||
public void OnExit(Collider other){
|
public void OnExit(Collider other){
|
||||||
if (!sinkingLocalPlayer) {
|
if (!sinkingLocalPlayer) {
|
||||||
Debug.Log("Yukari is not sinking local player");
|
Plugin.logger.LogDebug("Yukari is not sinking local player");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("Yukari is sinking something");
|
Plugin.logger.LogDebug("Yukari is sinking something");
|
||||||
var otherGameObject = other.gameObject;
|
var otherGameObject = other.gameObject;
|
||||||
if (!otherGameObject.CompareTag("Player")){
|
if (!otherGameObject.CompareTag("Player")){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("Yukari is sinking a player");
|
Plugin.logger.LogDebug("Yukari is sinking a player");
|
||||||
var comp = otherGameObject.GetComponent<PlayerControllerB>();
|
var comp = otherGameObject.GetComponent<PlayerControllerB>();
|
||||||
if (comp != GameNetworkManager.Instance.localPlayerController) return;
|
if (comp != GameNetworkManager.Instance.localPlayerController) return;
|
||||||
|
|
||||||
Debug.Log("Yukari is sinking local player");
|
Plugin.logger.LogDebug("Yukari is sinking local player");
|
||||||
StopSinkingLocalPlayer(comp);
|
StopSinkingLocalPlayer(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopSinkingLocalPlayer(PlayerControllerB player) {
|
private void StopSinkingLocalPlayer(PlayerControllerB player) {
|
||||||
if (!sinkingLocalPlayer) return;
|
if (!sinkingLocalPlayer) return;
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Stopping");
|
Plugin.logger.LogDebug("Stopping");
|
||||||
|
|
||||||
sinkingLocalPlayer = false;
|
sinkingLocalPlayer = false;
|
||||||
player.sourcesCausingSinking = Mathf.Clamp(player.sourcesCausingSinking - 1, 0, 100);
|
player.sourcesCausingSinking = Mathf.Clamp(player.sourcesCausingSinking - 1, 0, 100);
|
||||||
|
|
|
@ -29,11 +29,13 @@ namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
if (CanOpen()) {
|
if (CanOpen()) {
|
||||||
foreach(var d in treasureDoorLocks){
|
foreach(var d in treasureDoorLocks){
|
||||||
d.LockDoorOverrideClientRpc(false);
|
d.LockDoorOverrideClientRpc(false);
|
||||||
|
d.door?.DestroyDoorClientRpc(d.transform.forward);
|
||||||
}
|
}
|
||||||
opened = true;
|
opened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public abstract bool CanOpen();
|
public abstract bool CanOpen();
|
||||||
public virtual int GetDoorStatusValue() => 0;
|
public virtual int GetDoorStatusValue() => 0;
|
||||||
|
|
||||||
|
@ -83,20 +85,25 @@ namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
var dunRandom = DunGenPatch.Patch.generatorInstance.RandomStream;
|
var dunRandom = DunGenPatch.Patch.generatorInstance.RandomStream;
|
||||||
randomStream = new System.Random((int)(dunRandom.NextDouble() * int.MaxValue));
|
randomStream = new System.Random((int)(dunRandom.NextDouble() * int.MaxValue));
|
||||||
|
|
||||||
StartCoroutine(LockTreasureDoor(targetDoorways));
|
Plugin.logger.LogInfo($"Adding treasure room event {GetType().ToString()}");
|
||||||
|
DunGenPlus.Managers.DoorwayManager.onMainEntranceTeleportSpawnedEvent.AddTemporaryEvent("TreasureRoom", () => LockTreasureDoor(targetDoorways));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual IEnumerator LockTreasureDoor(List<Doorway> doorways){
|
protected virtual void LockTreasureDoor(List<Doorway> doorways){
|
||||||
if (!StartOfRound.Instance.IsHost) yield break;
|
if (!StartOfRound.Instance.IsHost) return;
|
||||||
|
|
||||||
yield return new WaitForSecondsRealtime(4f);
|
|
||||||
Plugin.logger.LogInfo("Setting up lock for treasure room");
|
|
||||||
|
|
||||||
|
Plugin.logger.LogDebug($"Setting up lock for treasure room ({GetType().ToString()})");
|
||||||
treasureDoorLocks = new List<ScarletDoor>();
|
treasureDoorLocks = new List<ScarletDoor>();
|
||||||
foreach(var d in doorways){
|
foreach(var d in doorways){
|
||||||
var doorLock = AngerManager.Instance.GetScarletDoor(d.transform.position);
|
if (d == null) {
|
||||||
|
Plugin.logger.LogWarning("For some reason, a doorway is null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var doorPosition = d.transform.position;
|
||||||
|
var doorLock = AngerManager.Instance.GetScarletDoor(doorPosition);
|
||||||
doorLock.LockDoorOverrideClientRpc(true);
|
doorLock.LockDoorOverrideClientRpc(true);
|
||||||
treasureDoorLocks.Add(doorLock);
|
treasureDoorLocks.Add(doorLock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
public override bool CanOpen() {
|
public override bool CanOpen() {
|
||||||
var ready = switches.All(s => s.pulled);
|
var ready = switches.All(s => s.pulled);
|
||||||
if (ready) {
|
if (ready) {
|
||||||
Plugin.logger.LogInfo($"Opening cause all books pulled");
|
Plugin.logger.LogDebug($"Opening cause all books pulled");
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -32,13 +32,12 @@ namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
return switches.Count(s => s.pulled);
|
return switches.Count(s => s.pulled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerator LockTreasureDoor(List<Doorway> doorways) {
|
protected override void LockTreasureDoor(List<Doorway> doorways) {
|
||||||
|
base.LockTreasureDoor(doorways);
|
||||||
yield return base.LockTreasureDoor(doorways);
|
|
||||||
|
|
||||||
if (StartOfRound.Instance.IsHost) {
|
if (StartOfRound.Instance.IsHost) {
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Creating book switches");
|
Plugin.logger.LogDebug("HOST: Creating book switches");
|
||||||
|
|
||||||
switches = new TreasureRoomBookSwitch[3];
|
switches = new TreasureRoomBookSwitch[3];
|
||||||
var switchOrdered = zones.Where(z => z != null && z.gameObject.activeInHierarchy).OrderBy(s => randomStream.NextDouble());
|
var switchOrdered = zones.Where(z => z != null && z.gameObject.activeInHierarchy).OrderBy(s => randomStream.NextDouble());
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
using DunGen;
|
||||||
|
using ScarletMansion.GamePatch.Items;
|
||||||
|
using ScarletMansion.GamePatch.Managers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Unity.Netcode;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
|
public class TreasureRoomPaintingGrabEvent : TreasureRoom {
|
||||||
|
|
||||||
|
public ScarletPainting paintingTarget;
|
||||||
|
|
||||||
|
public override bool CanOpen() {
|
||||||
|
var ready = paintingTarget && !paintingTarget.isAttached;
|
||||||
|
if (ready) {
|
||||||
|
Plugin.logger.LogDebug($"Opening cause painting grabbed");
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LockTreasureDoor(List<Doorway> doorways) {
|
||||||
|
base.LockTreasureDoor(doorways);
|
||||||
|
|
||||||
|
var bedroomEvent = GetComponentInParent<Tile>().GetComponentInChildren<ScarletBedroom>(true);
|
||||||
|
|
||||||
|
Plugin.logger.LogDebug("Moving vent to inside of the treasure room");
|
||||||
|
var firstDoorway = doorways.FirstOrDefault();
|
||||||
|
var treasureRoomCenterTransform = firstDoorway.ConnectedDoorway.Tile.transform;
|
||||||
|
var bedroomEventVent = bedroomEvent.vent.transform;
|
||||||
|
Plugin.logger.LogInfo($"{bedroomEventVent.position} -> {treasureRoomCenterTransform.position}");
|
||||||
|
bedroomEventVent.position = treasureRoomCenterTransform.position;
|
||||||
|
bedroomEventVent.rotation = treasureRoomCenterTransform.rotation;
|
||||||
|
|
||||||
|
if (StartOfRound.Instance.IsHost) {
|
||||||
|
Plugin.logger.LogDebug("HOST: Translocating an avaiable painting");
|
||||||
|
|
||||||
|
// grab random painting to use
|
||||||
|
var paintingTransform = bedroomEvent.paintingSpawnTransform;
|
||||||
|
var allPaintings = FindObjectsOfType<ScarletPainting>();
|
||||||
|
var firstAvailablePainting = allPaintings.Where(p => !p.grabbedByEvent)
|
||||||
|
.OrderBy(p => Vector3.SqrMagnitude(paintingTransform.position - p.transform.position))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (firstAvailablePainting) {
|
||||||
|
paintingTarget = firstAvailablePainting;
|
||||||
|
paintingTarget.RepositionClientRpc(paintingTransform.position, paintingTransform.rotation);
|
||||||
|
} else {
|
||||||
|
Plugin.logger.LogWarning($"Bedroom treasure room failed since there's no available paintings to grab");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using Unity.Netcode;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
|
@ -26,28 +27,37 @@ namespace ScarletMansion.GamePatch.Components.TreasureRoom {
|
||||||
var time = Utility.GetTime();
|
var time = Utility.GetTime();
|
||||||
var ready = time.hours > hourSelected || (time.hours >= hourSelected && time.minutes >= mintuesSelected);
|
var ready = time.hours > hourSelected || (time.hours >= hourSelected && time.minutes >= mintuesSelected);
|
||||||
if (ready) {
|
if (ready) {
|
||||||
Plugin.logger.LogInfo($"Opening cause {time.hours}:{time.minutes} > {hourSelected}:{mintuesSelected}");
|
Plugin.logger.LogDebug($"Opening cause {time.hours}:{time.minutes} > {hourSelected}:{mintuesSelected}");
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerator LockTreasureDoor(List<Doorway> doorways) {
|
protected override void LockTreasureDoor(List<Doorway> doorways) {
|
||||||
Plugin.logger.LogInfo("Setting up treasure room (kitchen)");
|
base.LockTreasureDoor(doorways);
|
||||||
|
|
||||||
hourSelected = randomStream.Next(hourRange.x, hourRange.y);
|
hourSelected = randomStream.Next(hourRange.x, hourRange.y);
|
||||||
mintuesSelected = randomStream.Next(0, 3) * 15;
|
mintuesSelected = randomStream.Next(0, 3) * 15;
|
||||||
Plugin.logger.LogInfo($"Opening at {hourSelected}:{mintuesSelected:D2}");
|
Plugin.logger.LogDebug($"Opening at {hourSelected}:{mintuesSelected:D2}");
|
||||||
|
|
||||||
timeClockSpawnTransformIndex = randomStream.Next(timeClockSpawnTransforms.Length);
|
timeClockSpawnTransformIndex = randomStream.Next(timeClockSpawnTransforms.Length);
|
||||||
var parent = timeClockSpawnTransforms[timeClockSpawnTransformIndex];
|
var parent = timeClockSpawnTransforms[timeClockSpawnTransformIndex];
|
||||||
var copy = Instantiate(timeClockPrefab, parent);
|
var copy = Instantiate(timeClockPrefab, parent);
|
||||||
|
|
||||||
|
if (StartOfRound.Instance.IsHost) {
|
||||||
|
Plugin.logger.LogDebug("HOST: Creating clock");
|
||||||
|
|
||||||
|
var spawnSyncedObject = copy.GetComponentInChildren<SpawnSyncedObject>();
|
||||||
|
var mapPropsContainer = GetMapPropsContainer();
|
||||||
|
var spawnedObject = Instantiate(spawnSyncedObject.spawnPrefab, spawnSyncedObject.transform.position, spawnSyncedObject.transform.rotation, mapPropsContainer.transform);
|
||||||
|
|
||||||
|
var networkObject = spawnedObject.GetComponent<NetworkObject>();
|
||||||
|
networkObject.Spawn(true);
|
||||||
|
}
|
||||||
|
|
||||||
var textMesh = copy.GetComponentInChildren<TextMeshPro>();
|
var textMesh = copy.GetComponentInChildren<TextMeshPro>();
|
||||||
textMesh.text = $"{hourSelected}:{mintuesSelected:D2}";
|
textMesh.text = $"{hourSelected}:{mintuesSelected:D2}";
|
||||||
RandomizeCharacters(textMesh);
|
RandomizeCharacters(textMesh);
|
||||||
|
|
||||||
yield return base.LockTreasureDoor(doorways);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RandomizeCharacters(TextMeshPro textMesh){
|
private void RandomizeCharacters(TextMeshPro textMesh){
|
||||||
|
|
|
@ -50,6 +50,10 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
var targetLookingAtMe = !Physics.Linecast(transform.position + Vector3.up * 0.5f, targetPlayer.gameplayCamera.transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(base.transform.position, targetPlayer.transform.position) < 30f;
|
var targetLookingAtMe = !Physics.Linecast(transform.position + Vector3.up * 0.5f, targetPlayer.gameplayCamera.transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(base.transform.position, targetPlayer.transform.position) < 30f;
|
||||||
var newBehaviourState = targetLookingAtMe ? 1 : 0;
|
var newBehaviourState = targetLookingAtMe ? 1 : 0;
|
||||||
|
if (targetLookingAtMe) {
|
||||||
|
targetPlayer.JumpToFearLevel(0.75f, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (newBehaviourState != currentBehaviourStateIndex) {
|
if (newBehaviourState != currentBehaviourStateIndex) {
|
||||||
SwitchToBehaviourState(newBehaviourState);
|
SwitchToBehaviourState(newBehaviourState);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +90,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
public void SyncKnightReplacementClientRpc(int index){
|
public void SyncKnightReplacementClientRpc(int index){
|
||||||
Plugin.logger.LogInfo($"Spawning ghost knight at {index}");
|
Plugin.logger.LogDebug($"Spawning ghost knight at {index}");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var target = KnightSpawnManager.Instance.GetSpawnPointTransform(index);
|
var target = KnightSpawnManager.Instance.GetSpawnPointTransform(index);
|
||||||
|
@ -130,7 +134,7 @@ namespace ScarletMansion {
|
||||||
public void TunnelPlayerClientRpc(NetworkBehaviourReference playerRef){
|
public void TunnelPlayerClientRpc(NetworkBehaviourReference playerRef){
|
||||||
if (playerRef.TryGet<PlayerControllerB>(out var player)){
|
if (playerRef.TryGet<PlayerControllerB>(out var player)){
|
||||||
targetPlayer = player;
|
targetPlayer = player;
|
||||||
Plugin.logger.LogInfo($"Targeting {player.playerUsername} for death");
|
Plugin.logger.LogDebug($"Targeting {player.playerUsername} for death");
|
||||||
|
|
||||||
if (targetPlayer.IsOwner) return;
|
if (targetPlayer.IsOwner) return;
|
||||||
|
|
||||||
|
@ -147,7 +151,7 @@ namespace ScarletMansion {
|
||||||
public void CallDisappear(){
|
public void CallDisappear(){
|
||||||
if (calledDisappear) return;
|
if (calledDisappear) return;
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Killing ghost knight");
|
Plugin.logger.LogDebug("Killing ghost knight");
|
||||||
|
|
||||||
calledDisappear = true;
|
calledDisappear = true;
|
||||||
mainCollider.enabled = false;
|
mainCollider.enabled = false;
|
||||||
|
|
|
@ -0,0 +1,428 @@
|
||||||
|
using GameNetcodeStuff;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Unity.Netcode;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AI;
|
||||||
|
|
||||||
|
namespace ScarletMansion.GamePatch.Enemies {
|
||||||
|
|
||||||
|
public class KnightV2Variant : EnemyAI {
|
||||||
|
|
||||||
|
public AISearchRoutine searchForPlayers;
|
||||||
|
private float checkLineOfSightInterval;
|
||||||
|
private bool hasEnteredChaseMode;
|
||||||
|
private bool stoppingMovement;
|
||||||
|
private bool hasStopped;
|
||||||
|
|
||||||
|
public AnimationStopPoints animStopPoints;
|
||||||
|
private float currentChaseSpeed = 14.5f * 0.9f;
|
||||||
|
private float currentAnimSpeed = 1f;
|
||||||
|
private PlayerControllerB previousTarget;
|
||||||
|
private bool wasOwnerLastFrame;
|
||||||
|
private float stopAndGoMinimumInterval;
|
||||||
|
private float hitPlayerTimer;
|
||||||
|
|
||||||
|
public AudioClip[] springNoises;
|
||||||
|
public AudioClip enterCooldownSFX;
|
||||||
|
public Collider mainCollider;
|
||||||
|
private float loseAggroTimer;
|
||||||
|
private float timeSinceHittingPlayer;
|
||||||
|
private bool movingOnOffMeshLink;
|
||||||
|
private Coroutine offMeshLinkCoroutine;
|
||||||
|
private float stopMovementTimer;
|
||||||
|
|
||||||
|
public float timeSpentMoving;
|
||||||
|
public float onCooldownPhase;
|
||||||
|
private bool setOnCooldown;
|
||||||
|
public float timeAtLastCooldown;
|
||||||
|
|
||||||
|
// Token: 0x04000F2A RID: 3882
|
||||||
|
private bool inCooldownAnimation;
|
||||||
|
|
||||||
|
public override void Start(){
|
||||||
|
base.Start();
|
||||||
|
|
||||||
|
if (IsOwner && KnightSpawnManager.Instance) {
|
||||||
|
var index = KnightSpawnManager.Instance.GetSpawnPointIndex();
|
||||||
|
if (index == -1) return;
|
||||||
|
|
||||||
|
SyncKnightReplacementClientRpc(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ServerRpc(RequireOwnership = false)]
|
||||||
|
public void SetCoilheadOnCooldownServerRpc(bool setTrue) {
|
||||||
|
SetCoilheadOnCooldownClientRpc(setTrue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F6F RID: 3951 RVA: 0x000942FC File Offset: 0x000924FC
|
||||||
|
[ClientRpc]
|
||||||
|
public void SetCoilheadOnCooldownClientRpc(bool setTrue) {
|
||||||
|
timeSpentMoving = 0f;
|
||||||
|
if (setTrue) {
|
||||||
|
onCooldownPhase = 20f;
|
||||||
|
setOnCooldown = true;
|
||||||
|
inCooldownAnimation = true;
|
||||||
|
SwitchToBehaviourStateOnLocalClient(0);
|
||||||
|
creatureVoice.PlayOneShot(enterCooldownSFX);
|
||||||
|
|
||||||
|
if (animStopPoints.animationPosition == 1) creatureAnimator.SetTrigger("springBoing");
|
||||||
|
else creatureAnimator.SetTrigger("springBoingPosition2");
|
||||||
|
creatureAnimator.SetFloat("walkSpeed", 0f);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onCooldownPhase = 0f;
|
||||||
|
setOnCooldown = false;
|
||||||
|
timeAtLastCooldown = Time.realtimeSinceStartup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F70 RID: 3952 RVA: 0x0009443C File Offset: 0x0009263C
|
||||||
|
public override void DoAIInterval() {
|
||||||
|
base.DoAIInterval();
|
||||||
|
if (StartOfRound.Instance.allPlayersDead) return;
|
||||||
|
if (isEnemyDead) return;
|
||||||
|
|
||||||
|
var currentBehaviourStateIndex = this.currentBehaviourStateIndex;
|
||||||
|
if (currentBehaviourStateIndex != 0) {
|
||||||
|
if (currentBehaviourStateIndex != 1) return;
|
||||||
|
if (searchForPlayers.inProgress) StopSearch(searchForPlayers, true);
|
||||||
|
|
||||||
|
if (TargetClosestPlayer(1.5f, false, 70f)) {
|
||||||
|
if (previousTarget != targetPlayer) {
|
||||||
|
previousTarget = targetPlayer;
|
||||||
|
ChangeOwnershipOfEnemy(targetPlayer.actualClientId);
|
||||||
|
}
|
||||||
|
if (Time.realtimeSinceStartup - timeSinceHittingPlayer > 7f && !stoppingMovement) {
|
||||||
|
if (Vector3.Distance(targetPlayer.transform.position, transform.position) <= 40f || CheckLineOfSightForPosition(targetPlayer.gameplayCamera.transform.position, 180f, 140, -1f, null)) {
|
||||||
|
loseAggroTimer = 0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loseAggroTimer += AIIntervalTime;
|
||||||
|
if (loseAggroTimer > 4.5f) {
|
||||||
|
SwitchToBehaviourState(0);
|
||||||
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var flag = false;
|
||||||
|
for (var i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) {
|
||||||
|
if (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 0.3f, 68f, 60, -1f) || StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
loseAggroTimer += AIIntervalTime;
|
||||||
|
if (loseAggroTimer > 1f) {
|
||||||
|
SwitchToBehaviourState(0);
|
||||||
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!IsServer) {
|
||||||
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onCooldownPhase > 0f) {
|
||||||
|
agent.speed = 0f;
|
||||||
|
SetDestinationToPosition(transform.position, false);
|
||||||
|
onCooldownPhase -= AIIntervalTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setOnCooldown) {
|
||||||
|
setOnCooldown = false;
|
||||||
|
SetCoilheadOnCooldownClientRpc(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
loseAggroTimer = 0f;
|
||||||
|
for (var j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) {
|
||||||
|
if (PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[j], false, false)) {
|
||||||
|
if (StartOfRound.Instance.allPlayerScripts[j].HasLineOfSightToPosition(transform.position + Vector3.up * 0.3f, 60f, 20, -1f)) {
|
||||||
|
targetPlayer = StartOfRound.Instance.allPlayerScripts[j];
|
||||||
|
SwitchToBehaviourState(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PathIsIntersectedByLineOfSight(StartOfRound.Instance.allPlayerScripts[j].transform.position, false, false, false) && !Physics.Linecast(transform.position + Vector3.up * 0.5f, StartOfRound.Instance.allPlayerScripts[j].gameplayCamera.transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(transform.position, StartOfRound.Instance.allPlayerScripts[j].transform.position) < 30f) {
|
||||||
|
SwitchToBehaviourState(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.speed = 6f;
|
||||||
|
if (!searchForPlayers.inProgress) {
|
||||||
|
movingTowardsTargetPlayer = false;
|
||||||
|
SetDestinationToPosition(transform.position, false);
|
||||||
|
StartSearch(transform.position, searchForPlayers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F71 RID: 3953 RVA: 0x00094882 File Offset: 0x00092A82
|
||||||
|
private IEnumerator Parabola(NavMeshAgent agent, float height, float duration) {
|
||||||
|
var data = agent.currentOffMeshLinkData;
|
||||||
|
var startPos = agent.transform.position;
|
||||||
|
var endPos = data.endPos + Vector3.up * agent.baseOffset;
|
||||||
|
var normalizedTime = 0f;
|
||||||
|
|
||||||
|
while (normalizedTime < 1f && data.valid && data.activated && IsOwner) {
|
||||||
|
var num = height * 4f * (normalizedTime - normalizedTime * normalizedTime);
|
||||||
|
|
||||||
|
agent.transform.position = Vector3.Lerp(startPos, endPos, normalizedTime) + num * Vector3.up;
|
||||||
|
normalizedTime += Time.deltaTime / duration;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.CompleteOffMeshLink();
|
||||||
|
offMeshLinkCoroutine = null;
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F72 RID: 3954 RVA: 0x000948A8 File Offset: 0x00092AA8
|
||||||
|
private void StopOffMeshLinkMovement() {
|
||||||
|
if (offMeshLinkCoroutine != null) {
|
||||||
|
StopCoroutine(offMeshLinkCoroutine);
|
||||||
|
offMeshLinkCoroutine = null;
|
||||||
|
var currentOffMeshLinkData = agent.currentOffMeshLinkData;
|
||||||
|
agent.CompleteOffMeshLink();
|
||||||
|
if (currentOffMeshLinkData.valid) {
|
||||||
|
if (Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.startPos) < Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.endPos)) {
|
||||||
|
agent.Warp(currentOffMeshLinkData.startPos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
agent.Warp(currentOffMeshLinkData.endPos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F73 RID: 3955 RVA: 0x000949B0 File Offset: 0x00092BB0
|
||||||
|
private void DoSpringAnimation(bool springPopUp = false) {
|
||||||
|
if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(transform.position, 70f, 25, -1f)) {
|
||||||
|
var num = Vector3.Distance(transform.position, GameNetworkManager.Instance.localPlayerController.transform.position);
|
||||||
|
if (num < 4f) {
|
||||||
|
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.9f, true);
|
||||||
|
} else if (num < 9f) {
|
||||||
|
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.4f, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentAnimSpeed > 2f || springPopUp) {
|
||||||
|
RoundManager.PlayRandomClip(creatureVoice, springNoises, false, 1f, 0, 1000);
|
||||||
|
if (animStopPoints.animationPosition == 1) creatureAnimator.SetTrigger("springBoing");
|
||||||
|
else creatureAnimator.SetTrigger("springBoingPosition2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F74 RID: 3956 RVA: 0x00094AA4 File Offset: 0x00092CA4
|
||||||
|
public override void Update() {
|
||||||
|
base.Update();
|
||||||
|
if (isEnemyDead) return;
|
||||||
|
if (hitPlayerTimer >= 0f) hitPlayerTimer -= Time.deltaTime;
|
||||||
|
|
||||||
|
if (!IsOwner) {
|
||||||
|
stopMovementTimer = 5f;
|
||||||
|
loseAggroTimer = 0f;
|
||||||
|
if (offMeshLinkCoroutine != null) StopCoroutine(offMeshLinkCoroutine);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsOwner) {
|
||||||
|
if (agent.isOnOffMeshLink) {
|
||||||
|
if (!stoppingMovement && agent.currentOffMeshLinkData.activated) {
|
||||||
|
if (offMeshLinkCoroutine == null) offMeshLinkCoroutine = StartCoroutine(Parabola(agent, 0.6f, 0.5f));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
StopOffMeshLinkMovement();
|
||||||
|
}
|
||||||
|
} else if (offMeshLinkCoroutine != null) {
|
||||||
|
StopOffMeshLinkMovement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
creatureAnimator.SetBool("OnCooldown", setOnCooldown);
|
||||||
|
if (setOnCooldown) {
|
||||||
|
mainCollider.isTrigger = true;
|
||||||
|
stoppingMovement = true;
|
||||||
|
hasStopped = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentBehaviourStateIndex = this.currentBehaviourStateIndex;
|
||||||
|
if (currentBehaviourStateIndex == 0) {
|
||||||
|
agent.autoTraverseOffMeshLink = false;
|
||||||
|
creatureAnimator.SetFloat("walkSpeed", 2.5f);
|
||||||
|
stoppingMovement = false;
|
||||||
|
hasStopped = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentBehaviourStateIndex != 1) return;
|
||||||
|
|
||||||
|
if (IsOwner) {
|
||||||
|
if (onCooldownPhase > 0f) {
|
||||||
|
SwitchToBehaviourState(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopAndGoMinimumInterval > 0f) stopAndGoMinimumInterval -= Time.deltaTime;
|
||||||
|
if (!wasOwnerLastFrame) {
|
||||||
|
wasOwnerLastFrame = true;
|
||||||
|
if (!stoppingMovement && hitPlayerTimer < 0.12f) agent.speed = currentChaseSpeed;
|
||||||
|
else agent.speed = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
var flag = false;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 0.25f, 68f, 60, -1f) || StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) && Vector3.Distance(StartOfRound.Instance.allPlayerScripts[i].gameplayCamera.transform.position, eye.position) > 0.3f) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stunNormalizedTimer > 0f) flag = true;
|
||||||
|
if (flag != stoppingMovement && stopAndGoMinimumInterval <= 0f) {
|
||||||
|
stopAndGoMinimumInterval = 0.15f;
|
||||||
|
if (flag) SetAnimationStopServerRpc();
|
||||||
|
else SetAnimationGoServerRpc();
|
||||||
|
stoppingMovement = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stoppingMovement) {
|
||||||
|
if (!animStopPoints.canAnimationStop && stopMovementTimer <= 0.27f) {
|
||||||
|
stopMovementTimer += Time.deltaTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasStopped) {
|
||||||
|
hasStopped = true;
|
||||||
|
DoSpringAnimation(false);
|
||||||
|
} else if (inCooldownAnimation) {
|
||||||
|
inCooldownAnimation = false;
|
||||||
|
DoSpringAnimation(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainCollider.isTrigger && Vector3.Distance(GameNetworkManager.Instance.localPlayerController.transform.position, transform.position) > 0.3f) {
|
||||||
|
mainCollider.isTrigger = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
creatureAnimator.SetFloat("walkSpeed", 0f);
|
||||||
|
currentAnimSpeed = 0f;
|
||||||
|
if (IsOwner) {
|
||||||
|
agent.speed = 0f;
|
||||||
|
movingTowardsTargetPlayer = false;
|
||||||
|
SetDestinationToPosition(transform.position, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stopMovementTimer = 0f;
|
||||||
|
if (hasStopped) {
|
||||||
|
hasStopped = false;
|
||||||
|
mainCollider.isTrigger = true;
|
||||||
|
}
|
||||||
|
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, currentChaseSpeed * 0.4597f, 5f * Time.deltaTime);
|
||||||
|
creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
|
||||||
|
inCooldownAnimation = false;
|
||||||
|
|
||||||
|
if (IsServer) {
|
||||||
|
timeSpentMoving += Time.deltaTime;
|
||||||
|
if (timeSpentMoving > 20f)
|
||||||
|
{
|
||||||
|
onCooldownPhase = 20f;
|
||||||
|
setOnCooldown = true;
|
||||||
|
inCooldownAnimation = true;
|
||||||
|
SetCoilheadOnCooldownClientRpc(true);
|
||||||
|
SwitchToBehaviourStateOnLocalClient(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsOwner) {
|
||||||
|
agent.speed = Mathf.Lerp(agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
|
||||||
|
movingTowardsTargetPlayer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F75 RID: 3957 RVA: 0x00094F98 File Offset: 0x00093198
|
||||||
|
[ServerRpc]
|
||||||
|
public void SetAnimationStopServerRpc() {
|
||||||
|
SetAnimationStopClientRpc();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F76 RID: 3958 RVA: 0x000950AC File Offset: 0x000932AC
|
||||||
|
[ClientRpc]
|
||||||
|
public void SetAnimationStopClientRpc() {
|
||||||
|
stoppingMovement = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F77 RID: 3959 RVA: 0x0009517C File Offset: 0x0009337C
|
||||||
|
[ServerRpc]
|
||||||
|
public void SetAnimationGoServerRpc() {
|
||||||
|
SetAnimationGoClientRpc();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F78 RID: 3960 RVA: 0x00095290 File Offset: 0x00093490
|
||||||
|
[ClientRpc]
|
||||||
|
public void SetAnimationGoClientRpc() {
|
||||||
|
stoppingMovement = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token: 0x06000F79 RID: 3961 RVA: 0x00095360 File Offset: 0x00093560
|
||||||
|
public override void OnCollideWithPlayer(Collider other) {
|
||||||
|
base.OnCollideWithPlayer(other);
|
||||||
|
if (stoppingMovement || currentBehaviourStateIndex != 1 || hitPlayerTimer >= 0f || setOnCooldown || (Time.realtimeSinceStartup - timeAtLastCooldown) < 0.45f) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var playerControllerB = MeetsStandardPlayerCollisionConditions(other, false, false);
|
||||||
|
if (playerControllerB != null) {
|
||||||
|
hitPlayerTimer = 0.2f;
|
||||||
|
playerControllerB.DamagePlayer(90, true, true, CauseOfDeath.Mauling, 0);
|
||||||
|
playerControllerB.JumpToFearLevel(1f, true);
|
||||||
|
timeSinceHittingPlayer = Time.realtimeSinceStartup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ClientRpc]
|
||||||
|
public void SyncKnightReplacementClientRpc(int index){
|
||||||
|
SyncKnightReplacement(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SyncKnightReplacement(int index){
|
||||||
|
Plugin.logger.LogDebug($"Spawning knight at {index}");
|
||||||
|
|
||||||
|
try {
|
||||||
|
var target = KnightSpawnManager.Instance.GetSpawnPointTransform(index);
|
||||||
|
target.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
transform.position = target.position;
|
||||||
|
transform.rotation = target.rotation;
|
||||||
|
serverPosition = target.position;
|
||||||
|
|
||||||
|
if (agent == null) agent = GetComponentInChildren<NavMeshAgent>();
|
||||||
|
agent.Warp(target.position);
|
||||||
|
|
||||||
|
if (IsOwner) {
|
||||||
|
SyncPositionToClients();
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
Plugin.logger.LogError($"Tried to knight spawn at {index}, but completely failed");
|
||||||
|
Plugin.logger.LogError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -221,7 +221,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SyncKnightReplacement(int index){
|
public void SyncKnightReplacement(int index){
|
||||||
Plugin.logger.LogInfo($"Spawning knight at {index}");
|
Plugin.logger.LogDebug($"Spawning knight at {index}");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var target = KnightSpawnManager.Instance.GetSpawnPointTransform(index);
|
var target = KnightSpawnManager.Instance.GetSpawnPointTransform(index);
|
||||||
|
|
|
@ -319,8 +319,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
case 0:
|
case 0:
|
||||||
// run away from crime scene
|
// run away from crime scene
|
||||||
if (killedLastTarget && !startedCrimeSceneTimer) {
|
if (killedLastTarget && !startedCrimeSceneTimer) {
|
||||||
Debug.Log("Starting leave crime scene timer");
|
|
||||||
Debug.Log(string.Format("Target player: {0}", targetPlayer.playerClientId));
|
|
||||||
startedCrimeSceneTimer = true;
|
startedCrimeSceneTimer = true;
|
||||||
leaveCrimeSceneTimer = 15f;
|
leaveCrimeSceneTimer = 15f;
|
||||||
movingTowardsTargetPlayer = false;
|
movingTowardsTargetPlayer = false;
|
||||||
|
@ -352,13 +350,11 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
if (playerControllerB != null) {
|
if (playerControllerB != null) {
|
||||||
targetPlayer = playerControllerB;
|
targetPlayer = playerControllerB;
|
||||||
SwitchOwnershipAndSetToStateServerRpc(2, targetPlayer.actualClientId, berserkModeTimer);
|
SwitchOwnershipAndSetToStateServerRpc(2, targetPlayer.actualClientId, berserkModeTimer);
|
||||||
Debug.Log("State 2, changing ownership A");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise try to run away
|
// otherwise try to run away
|
||||||
Debug.Log("State 2, Switching to state 0, killed target");
|
|
||||||
SyncKilledLastTargetServerRpc((int)targetPlayer.playerClientId);
|
SyncKilledLastTargetServerRpc((int)targetPlayer.playerClientId);
|
||||||
SwitchToBehaviourState(0);
|
SwitchToBehaviourState(0);
|
||||||
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
|
@ -388,7 +384,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
loseInChaseTimer += AIIntervalTime;
|
loseInChaseTimer += AIIntervalTime;
|
||||||
if (loseInChaseTimer > 12f) {
|
if (loseInChaseTimer > 12f) {
|
||||||
targetedPlayerAlonePreviously = this.targetPlayer;
|
targetedPlayerAlonePreviously = this.targetPlayer;
|
||||||
Debug.Log("State 2, Switching to state 0, lost in chase");
|
|
||||||
SwitchToBehaviourState(0);
|
SwitchToBehaviourState(0);
|
||||||
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
return;
|
return;
|
||||||
|
@ -406,7 +401,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
// they no longer alone, whoops!
|
// they no longer alone, whoops!
|
||||||
if (berserkModeTimer <= 0f) {
|
if (berserkModeTimer <= 0f) {
|
||||||
targetedPlayerAlonePreviously = this.targetPlayer;
|
targetedPlayerAlonePreviously = this.targetPlayer;
|
||||||
Debug.Log("State 2, Switching to state 0, found another player or multiple players 1");
|
|
||||||
SwitchToBehaviourState(0);
|
SwitchToBehaviourState(0);
|
||||||
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
return;
|
return;
|
||||||
|
@ -428,7 +422,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
// who wasn't our og target, whoops!
|
// who wasn't our og target, whoops!
|
||||||
if ((x2 != targetPlayer || playersInVicinity > 1) && berserkModeTimer <= 0f) {
|
if ((x2 != targetPlayer || playersInVicinity > 1) && berserkModeTimer <= 0f) {
|
||||||
targetedPlayerAlonePreviously = targetPlayer;
|
targetedPlayerAlonePreviously = targetPlayer;
|
||||||
Debug.Log("State 2, Switching to state 0, found another player or multiple players 2");
|
|
||||||
SwitchToBehaviourState(0);
|
SwitchToBehaviourState(0);
|
||||||
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
|
||||||
return;
|
return;
|
||||||
|
@ -472,7 +465,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
|
|
||||||
SwitchKillerState(false);
|
SwitchKillerState(false);
|
||||||
SyncKilledLastTargetFalseClientRpc();
|
SyncKilledLastTargetFalseClientRpc();
|
||||||
Debug.Log("Exiting leave crime scene mode, 0");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,11 +507,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
startedCrimeSceneTimer = false;
|
startedCrimeSceneTimer = false;
|
||||||
SwitchToBehaviourStateOnLocalClient(2);
|
SwitchToBehaviourStateOnLocalClient(2);
|
||||||
SwitchOwnershipAndSetToStateServerRpc(2, targetPlayer.actualClientId, -1f);
|
SwitchOwnershipAndSetToStateServerRpc(2, targetPlayer.actualClientId, -1f);
|
||||||
Debug.Log("Found a player; Caught red-handed, entering murder state");
|
|
||||||
|
|
||||||
for (int i = 0; i < this.seenPlayers.Length; i++) {
|
|
||||||
Debug.Log(string.Format("Seen player {0}: {1}", i, this.seenPlayers[i]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// no one saw nothing, we bounce
|
// no one saw nothing, we bounce
|
||||||
else {
|
else {
|
||||||
|
@ -750,10 +737,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
switch (currentBehaviourStateIndex) {
|
switch (currentBehaviourStateIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
if (previousBehaviourState != currentBehaviourStateIndex) {
|
if (previousBehaviourState != currentBehaviourStateIndex) {
|
||||||
if (targetPlayer != null) {
|
|
||||||
Debug.Log(string.Format("Target player: {0}; is dead?: {1}", targetPlayer.playerClientId, targetPlayer.isPlayerDead));
|
|
||||||
}
|
|
||||||
|
|
||||||
creatureSFX.PlayOneShot(enemyType.audioClips[1]);
|
creatureSFX.PlayOneShot(enemyType.audioClips[1]);
|
||||||
WalkieTalkie.TransmitOneShotAudio(creatureSFX, enemyType.audioClips[1], 1f);
|
WalkieTalkie.TransmitOneShotAudio(creatureSFX, enemyType.audioClips[1], 1f);
|
||||||
checkedForTargetedPlayerPosition = false;
|
checkedForTargetedPlayerPosition = false;
|
||||||
|
@ -931,7 +914,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
public void SyncKilledLastTargetFalseClientRpc() {
|
public void SyncKilledLastTargetFalseClientRpc() {
|
||||||
if (IsServer) return;
|
if (IsServer) return;
|
||||||
Debug.Log("Client received sync killed last target false client rpc");
|
|
||||||
killedLastTarget = false;
|
killedLastTarget = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +967,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
timeSinceCheckingForMultiplePlayers = 0f;
|
timeSinceCheckingForMultiplePlayers = 0f;
|
||||||
timeUntilNextCheck = Random.Range(8f, 11f);
|
timeUntilNextCheck = Random.Range(8f, 11f);
|
||||||
TurnAndCheckForPlayers();
|
TurnAndCheckForPlayers();
|
||||||
Debug.Log("Butler: Checking for players");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token: 0x060000F8 RID: 248 RVA: 0x0000CB20 File Offset: 0x0000AD20
|
// Token: 0x060000F8 RID: 248 RVA: 0x0000CB20 File Offset: 0x0000AD20
|
||||||
|
@ -1052,8 +1033,6 @@ namespace ScarletMansion.GamePatch.Enemies {
|
||||||
timeToLook *= 0.5f;
|
timeToLook *= 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("Butler: pinged attention to position");
|
|
||||||
Debug.DrawLine(eye.position, attentionPosition, Color.yellow, timeToLook);
|
|
||||||
focusLevel = newFocusLevel;
|
focusLevel = newFocusLevel;
|
||||||
pingAttentionTimer = timeToLook;
|
pingAttentionTimer = timeToLook;
|
||||||
pingAttentionPosition = attentionPosition;
|
pingAttentionPosition = attentionPosition;
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
|
|
||||||
var comp = __instance.GetComponent<ScarletVent>();
|
var comp = __instance.GetComponent<ScarletVent>();
|
||||||
if (comp) {
|
if (comp) {
|
||||||
Plugin.logger.LogInfo("Doing scalet open vent");
|
Plugin.logger.LogDebug("Doing scalet open vent");
|
||||||
comp.OpenVentClientRpc();
|
comp.OpenVentClientRpc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace ScarletMansion.GamePatch.FixValues {
|
||||||
vanillaSetup = true;
|
vanillaSetup = true;
|
||||||
//Plugin.logger.LogInfo("Vanilla fire exit set up");
|
//Plugin.logger.LogInfo("Vanilla fire exit set up");
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Plugin.logger.LogInfo("Failed to setup vanilla fire exit. The 'Use SDM Fire Exits' config will be ignored");
|
Plugin.logger.LogDebug("Failed to setup vanilla fire exit. The 'Use SDM Fire Exits' config will be ignored");
|
||||||
Plugin.logger.LogError(e.ToString());
|
Plugin.logger.LogError(e.ToString());
|
||||||
|
|
||||||
vanillaSetup = false;
|
vanillaSetup = false;
|
||||||
|
|
|
@ -17,20 +17,21 @@ using System.Security.Cryptography;
|
||||||
using ScarletMansion.GamePatch.Enemies;
|
using ScarletMansion.GamePatch.Enemies;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using ScarletMansion.GamePatch.Items;
|
using ScarletMansion.GamePatch.Items;
|
||||||
|
using DunGenPlus.Managers;
|
||||||
|
|
||||||
namespace ScarletMansion.GamePatch {
|
namespace ScarletMansion.GamePatch {
|
||||||
|
|
||||||
public class InitPatch {
|
public class InitPatch {
|
||||||
|
|
||||||
private static void CreateNetworkManager(StartOfRound __instance){
|
private static void CreateNetworkManager(StartOfRound __instance){
|
||||||
Plugin.logger.LogInfo($"IsServer: {__instance.IsServer}");
|
Plugin.logger.LogDebug($"IsServer: {__instance.IsServer}");
|
||||||
if (__instance.IsServer) {
|
if (__instance.IsServer) {
|
||||||
if (ScarletNetworkManager.Instance == null) {
|
if (ScarletNetworkManager.Instance == null) {
|
||||||
var prefab = Assets.networkObjectList.scarletNetworkManager;
|
var prefab = Assets.networkObjectList.scarletNetworkManager;
|
||||||
var obj = GameObject.Instantiate(prefab);
|
var obj = GameObject.Instantiate(prefab);
|
||||||
var comp = obj.GetComponent<NetworkObject>();
|
var comp = obj.GetComponent<NetworkObject>();
|
||||||
comp.Spawn(false);
|
comp.Spawn(false);
|
||||||
Plugin.logger.LogInfo("Created Scarlet Network Manager. We in");
|
Plugin.logger.LogDebug("Created Scarlet Network Manager. We in");
|
||||||
} else {
|
} else {
|
||||||
Plugin.logger.LogWarning("Scarlet Network Manager already exists? Probably scary");
|
Plugin.logger.LogWarning("Scarlet Network Manager already exists? Probably scary");
|
||||||
}
|
}
|
||||||
|
@ -49,6 +50,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
public static void StartOfRound_Start(ref StartOfRound __instance) {
|
public static void StartOfRound_Start(ref StartOfRound __instance) {
|
||||||
ScarletYukariTrigger.audioClipIndex = -1;
|
ScarletYukariTrigger.audioClipIndex = -1;
|
||||||
ScarletPlayerControllerB.InitializeScarletScripts();
|
ScarletPlayerControllerB.InitializeScarletScripts();
|
||||||
|
DoorwayManager.onMainEntranceTeleportSpawnedEvent.ClearTemporaryActionList();
|
||||||
|
|
||||||
__instance.StartCoroutine(WaitForNetworkObject(__instance, CreateNetworkManager));
|
__instance.StartCoroutine(WaitForNetworkObject(__instance, CreateNetworkManager));
|
||||||
|
|
||||||
|
@ -236,7 +238,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
var scarletTieMesh = scarletTie.GetComponent<MeshRenderer>();
|
var scarletTieMesh = scarletTie.GetComponent<MeshRenderer>();
|
||||||
var refTieMesh = refTie.GetComponent<MeshRenderer>();
|
var refTieMesh = refTie.GetComponent<MeshRenderer>();
|
||||||
if (scarletTieMesh && refTieMesh) {
|
if (scarletTieMesh && refTieMesh) {
|
||||||
Plugin.logger.LogInfo("Fixed tie of bb flashlight");
|
Plugin.logger.LogDebug("Fixed tie of bb flashlight");
|
||||||
CopyAndPasteMeshFilterAndRenderer(scarletTieMesh, refTieMesh);
|
CopyAndPasteMeshFilterAndRenderer(scarletTieMesh, refTieMesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,7 +352,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
prefabFixList[4].GetComponent<FixValues.FixFireExit>().Setup(fireProp.gameObject);
|
prefabFixList[4].GetComponent<FixValues.FixFireExit>().Setup(fireProp.gameObject);
|
||||||
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Plugin.logger.LogInfo("Failed to setup vanilla fire exit. The 'Use SDM Fire Exits' config will be ignored");
|
Plugin.logger.LogDebug("Failed to setup vanilla fire exit. The 'Use SDM Fire Exits' config will be ignored");
|
||||||
Plugin.logger.LogError(e.ToString());
|
Plugin.logger.LogError(e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +384,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
PluginConfig.Instance.paintingCountValue
|
PluginConfig.Instance.paintingCountValue
|
||||||
);
|
);
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Set networked config values");
|
Plugin.logger.LogDebug("Set networked config values");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
for(var i = 0; i < items.Length; ++i){
|
for(var i = 0; i < items.Length; ++i){
|
||||||
var item = items[i] as FlashlightItem;
|
var item = items[i] as FlashlightItem;
|
||||||
if (item != null && Assets.GetFlashlight(item.itemProperties) != null) {
|
if (item != null && Assets.GetFlashlight(item.itemProperties) != null) {
|
||||||
Plugin.logger.LogInfo($"Flashlight slot {i}");
|
Plugin.logger.LogDebug($"Flashlight slot {i}");
|
||||||
return (item, i);
|
return (item, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,14 +81,14 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator WaitForRealFlashlightID(){
|
public IEnumerator WaitForRealFlashlightID(){
|
||||||
Plugin.logger.LogInfo("Waiting for real helmet index for scarlet flashlight");
|
Plugin.logger.LogDebug("Waiting for real helmet index for scarlet flashlight");
|
||||||
var t = Time.realtimeSinceStartup + 8f;
|
var t = Time.realtimeSinceStartup + 8f;
|
||||||
while(true) {
|
while(true) {
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
var flashlight = Assets.GetFlashlight(itemProperties);
|
var flashlight = Assets.GetFlashlight(itemProperties);
|
||||||
if (flashlight != null && flashlight.scarletHelmetIndex != -1) {
|
if (flashlight != null && flashlight.scarletHelmetIndex != -1) {
|
||||||
Plugin.logger.LogInfo("Got real helmet index for scarlet flashlight");
|
Plugin.logger.LogDebug("Got real helmet index for scarlet flashlight");
|
||||||
flashlightTypeID = flashlight.scarletHelmetIndex;
|
flashlightTypeID = flashlight.scarletHelmetIndex;
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
|
|
||||||
public ScarletBedroom bedroom;
|
public ScarletBedroom bedroom;
|
||||||
public bool isAttached = true;
|
public bool isAttached = true;
|
||||||
|
public bool grabbedByEvent = true;
|
||||||
|
|
||||||
[Header("Variations")]
|
[Header("Variations")]
|
||||||
public int variation;
|
public int variation;
|
||||||
|
@ -49,11 +50,12 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
if (isAttached){
|
if (isAttached){
|
||||||
bedroom = AngerManager.Instance.GetBedroomWithPainting(transform.position);
|
bedroom = AngerManager.Instance.GetBedroomWithPainting(transform.position);
|
||||||
scrapValue = PluginConfig.Instance.paintingValueValue;
|
scrapValue = PluginConfig.Instance.paintingValueValue;
|
||||||
|
grabbedByEvent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EquipItem() {
|
public override void EquipItem() {
|
||||||
Plugin.logger.LogInfo($"Scarlet painting was grabbed. Is owner: {IsOwner}");
|
Plugin.logger.LogDebug($"Scarlet painting was grabbed. Is owner: {IsOwner}");
|
||||||
if (isAttached) {
|
if (isAttached) {
|
||||||
if (bedroom) bedroom.Anger(playerHeldBy.transform);
|
if (bedroom) bedroom.Anger(playerHeldBy.transform);
|
||||||
isAttached = false;
|
isAttached = false;
|
||||||
|
@ -62,6 +64,15 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
base.EquipItem();
|
base.EquipItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ClientRpc]
|
||||||
|
public void RepositionClientRpc(Vector3 position, Quaternion rotation){
|
||||||
|
transform.position = position;
|
||||||
|
transform.rotation = rotation;
|
||||||
|
bedroom = AngerManager.Instance.GetBedroomWithPainting(position);
|
||||||
|
|
||||||
|
grabbedByEvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public override void ItemActivate(bool used, bool buttonDown = true) {
|
public override void ItemActivate(bool used, bool buttonDown = true) {
|
||||||
base.ItemActivate(used, buttonDown);
|
base.ItemActivate(used, buttonDown);
|
||||||
|
|
|
@ -19,11 +19,11 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
public ParticleSystemRenderer snowRenderer;
|
public ParticleSystemRenderer snowRenderer;
|
||||||
public AudioSource musicAS;
|
public AudioSource musicAS;
|
||||||
|
|
||||||
|
//public PlayerControllerB previouslyHeldBy;
|
||||||
[Header("Extra")]
|
[Header("Extra")]
|
||||||
public PlayerControllerB previouslyHeldBy;
|
|
||||||
public Transform prefabPivot;
|
public Transform prefabPivot;
|
||||||
public ScanNodeProperties scanNode;
|
public ScanNodeProperties scanNode;
|
||||||
public AnimationClip SnowGlobeOverrideHoldClip;
|
//public AnimationClip SnowGlobeOverrideHoldClip;
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class SnowGlobeType {
|
public class SnowGlobeType {
|
||||||
|
@ -61,6 +61,8 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
scanNode.headerText = $"{currentType.name} Snow Globe";
|
scanNode.headerText = $"{currentType.name} Snow Globe";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
public override void GrabItem() {
|
public override void GrabItem() {
|
||||||
base.GrabItem();
|
base.GrabItem();
|
||||||
previouslyHeldBy = playerHeldBy;
|
previouslyHeldBy = playerHeldBy;
|
||||||
|
@ -88,10 +90,12 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
}
|
}
|
||||||
base.DiscardItem();
|
base.DiscardItem();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
public void ReplaceOrPutBackAnimationClip(PlayerControllerB player, bool _override) {
|
public void ReplaceOrPutBackAnimationClip(PlayerControllerB player, bool _override) {
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
var playerOverrideController = ScarletPlayerControllerB.GetScarletPlayerScript(player).playerOverrideController;
|
var playerOverrideController = ScarletPlayerControllerB.GetScarletPlayerScript(player).playerOverrideController;
|
||||||
if (playerOverrideController == null) return;
|
if (playerOverrideController == null) return;
|
||||||
|
|
||||||
|
@ -113,6 +117,7 @@ namespace ScarletMansion.GamePatch.Items {
|
||||||
playerOverrideController["HoldLungApparatice"] = SnowGlobeOverrideHoldClip;
|
playerOverrideController["HoldLungApparatice"] = SnowGlobeOverrideHoldClip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
public override void ItemActivate(bool used, bool buttonDown = true) {
|
public override void ItemActivate(bool used, bool buttonDown = true) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
public static void StartPatch(ref JesterAI __instance){
|
public static void StartPatch(ref JesterAI __instance){
|
||||||
if (DunGenPatch.Patch.active && active && __instance.IsOwner) {
|
if (DunGenPatch.Patch.active && active && __instance.IsOwner) {
|
||||||
Plugin.logger.LogInfo("Activing kill order for Jester");
|
Plugin.logger.LogDebug("Activing kill order for Jester");
|
||||||
__instance.SwitchToBehaviourState(1);
|
__instance.SwitchToBehaviourState(1);
|
||||||
}
|
}
|
||||||
active = false;
|
active = false;
|
||||||
|
|
|
@ -113,10 +113,10 @@ namespace ScarletMansion.GamePatch {
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (target == null){
|
if (target == null){
|
||||||
Plugin.logger.LogInfo($"No enemy {targetEnemyName} in level, using default rarity of {minBaseWeight}.");
|
Plugin.logger.LogDebug($"No enemy {targetEnemyName} in level, using default rarity of {minBaseWeight}.");
|
||||||
var entry = enemy.GetItemEntry(baseWeight + minBaseWeight);
|
var entry = enemy.GetItemEntry(baseWeight + minBaseWeight);
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Adding enemy {sourceEnemyName} with weight {entry.rarity}");
|
Plugin.logger.LogDebug($"Adding enemy {sourceEnemyName} with weight {entry.rarity}");
|
||||||
currentEnemiesRarity.Add(entry);
|
currentEnemiesRarity.Add(entry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -129,8 +129,8 @@ namespace ScarletMansion.GamePatch {
|
||||||
|
|
||||||
var newEntry = enemy.GetItemEntry(baseWeight + entryRarity);
|
var newEntry = enemy.GetItemEntry(baseWeight + entryRarity);
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Adding enemy {sourceEnemyName} with weight {newEntry.rarity}");
|
Plugin.logger.LogDebug($"Adding enemy {sourceEnemyName} with weight {newEntry.rarity}");
|
||||||
Plugin.logger.LogInfo($"Setting enemy {targetEnemyName} with weight {prevEntry.rarity}");
|
Plugin.logger.LogDebug($"Setting enemy {targetEnemyName} with weight {prevEntry.rarity}");
|
||||||
currentEnemiesRarity.Add(newEntry);
|
currentEnemiesRarity.Add(newEntry);
|
||||||
currentEnemiesRarity.Add(prevEntry);
|
currentEnemiesRarity.Add(prevEntry);
|
||||||
}
|
}
|
||||||
|
@ -146,13 +146,13 @@ namespace ScarletMansion.GamePatch {
|
||||||
var entry = i.GetItemRarity();
|
var entry = i.GetItemRarity();
|
||||||
|
|
||||||
if (entry.rarity > 0) {
|
if (entry.rarity > 0) {
|
||||||
Plugin.logger.LogInfo($"Adding item {entry.spawnableItem.itemName} with weight {entry.rarity}");
|
Plugin.logger.LogDebug($"Adding item {entry.spawnableItem.itemName} with weight {entry.rarity}");
|
||||||
currentItemsRarity.Add(entry);
|
currentItemsRarity.Add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Loaded custom enemies and items for {level.sceneName}");
|
Plugin.logger.LogDebug($"Loaded custom enemies and items for {level.sceneName}");
|
||||||
Components.ScarletBedroom.CreateRandomEnemyList(currentEnemiesRarity);
|
Components.ScarletBedroom.CreateRandomEnemyList(currentEnemiesRarity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace ScarletMansion.GamePatch.Managers {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public void Anger(int angerAmount = 1){
|
public void Anger(int angerAmount = 1){
|
||||||
Plugin.logger.LogInfo($"Raising anger from {level} to {level + angerAmount}");
|
Plugin.logger.LogDebug($"Raising anger from {level} to {level + angerAmount}");
|
||||||
var manager = RoundManager.Instance;
|
var manager = RoundManager.Instance;
|
||||||
manager.minEnemiesToSpawn += angerAmount;
|
manager.minEnemiesToSpawn += angerAmount;
|
||||||
level += angerAmount;
|
level += angerAmount;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
unusedSpawnPoints = points.ToList();
|
unusedSpawnPoints = points.ToList();
|
||||||
Plugin.logger.LogInfo($"Found {spawnPoints.Count} spawn points for the knight");
|
Plugin.logger.LogDebug($"Found {spawnPoints.Count} spawn points for the knight");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetSpawnPointIndex(){
|
public int GetSpawnPointIndex(){
|
||||||
|
@ -45,7 +45,7 @@ namespace ScarletMansion {
|
||||||
if (lastKnightSeenPlayer >= 0){
|
if (lastKnightSeenPlayer >= 0){
|
||||||
var tempitem = spawnPoints[lastKnightSeenPlayer];
|
var tempitem = spawnPoints[lastKnightSeenPlayer];
|
||||||
if (tempitem.gameObject.activeInHierarchy){
|
if (tempitem.gameObject.activeInHierarchy){
|
||||||
Plugin.logger.LogInfo($"Using the last knight {tempitem.index} that saw a player");
|
Plugin.logger.LogDebug($"Using the last knight {tempitem.index} that saw a player");
|
||||||
unusedSpawnPoints.Remove(tempitem);
|
unusedSpawnPoints.Remove(tempitem);
|
||||||
lastKnightSeenPlayer = -1;
|
lastKnightSeenPlayer = -1;
|
||||||
return tempitem.index;
|
return tempitem.index;
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace ScarletMansion {
|
||||||
[ServerRpc(RequireOwnership = false)]
|
[ServerRpc(RequireOwnership = false)]
|
||||||
public void DestroyPlayerItemInSlotServerRpc(NetworkBehaviourReference playerRef, int itemSlot, ServerRpcParams callParams = default(ServerRpcParams)){
|
public void DestroyPlayerItemInSlotServerRpc(NetworkBehaviourReference playerRef, int itemSlot, ServerRpcParams callParams = default(ServerRpcParams)){
|
||||||
if (playerRef.TryGet<PlayerControllerB>(out var player)){
|
if (playerRef.TryGet<PlayerControllerB>(out var player)){
|
||||||
Plugin.logger.LogInfo($"P{player.OwnerClientId}, S{callParams.Receive.SenderClientId}");
|
Plugin.logger.LogDebug($"P{player.OwnerClientId}, S{callParams.Receive.SenderClientId}");
|
||||||
|
|
||||||
DestroyPlayerItemInSlotClientRpc(playerRef, itemSlot);
|
DestroyPlayerItemInSlotClientRpc(playerRef, itemSlot);
|
||||||
return;
|
return;
|
||||||
|
@ -291,7 +291,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
var enemyName = enemy.name;
|
var enemyName = enemy.name;
|
||||||
try {
|
try {
|
||||||
Plugin.logger.LogInfo($"Applying evil material to {enemyName}");
|
Plugin.logger.LogDebug($"Applying evil material to {enemyName}");
|
||||||
ApplyMaterialToRenderers(enemy.GetComponentsInChildren<SkinnedMeshRenderer>());
|
ApplyMaterialToRenderers(enemy.GetComponentsInChildren<SkinnedMeshRenderer>());
|
||||||
ApplyMaterialToRenderers(enemy.GetComponentsInChildren<MeshRenderer>());
|
ApplyMaterialToRenderers(enemy.GetComponentsInChildren<MeshRenderer>());
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
@ -454,14 +454,14 @@ namespace ScarletMansion {
|
||||||
// better safe and slow then sorry
|
// better safe and slow then sorry
|
||||||
if (GameNetworkManager.Instance.localPlayerController == null || NetworkManager.Singleton == null || NetworkManager.Singleton.ShutdownInProgress) return;
|
if (GameNetworkManager.Instance.localPlayerController == null || NetworkManager.Singleton == null || NetworkManager.Singleton.ShutdownInProgress) return;
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Destroying player {player.playerUsername}:{player.actualClientId}'s item in slot {itemSlot}");
|
Plugin.logger.LogDebug($"Destroying player {player.playerUsername}:{player.actualClientId}'s item in slot {itemSlot}");
|
||||||
|
|
||||||
var heldObj = player.currentlyHeldObjectServer;
|
var heldObj = player.currentlyHeldObjectServer;
|
||||||
var heldObjString = heldObj ? heldObj.itemProperties.itemName : "NULL";
|
var heldObjString = heldObj ? heldObj.itemProperties.itemName : "NULL";
|
||||||
var grabObj = player.ItemSlots[itemSlot];
|
var grabObj = player.ItemSlots[itemSlot];
|
||||||
var grabObjString = grabObj ? grabObj.itemProperties.itemName : "NULL";
|
var grabObjString = grabObj ? grabObj.itemProperties.itemName : "NULL";
|
||||||
Plugin.logger.LogInfo($"Held item {player.currentItemSlot}:{heldObjString}");
|
Plugin.logger.LogDebug($"Held item {player.currentItemSlot}:{heldObjString}");
|
||||||
Plugin.logger.LogInfo($"Target item {itemSlot}:{grabObjString}");
|
Plugin.logger.LogDebug($"Target item {itemSlot}:{grabObjString}");
|
||||||
|
|
||||||
// fix weight and values
|
// fix weight and values
|
||||||
player.carryWeight -= Mathf.Clamp(grabObj.itemProperties.weight - 1f, 0f, 10f);
|
player.carryWeight -= Mathf.Clamp(grabObj.itemProperties.weight - 1f, 0f, 10f);
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
public static void AwakePatch(ref PlayerControllerB __instance){
|
public static void AwakePatch(ref PlayerControllerB __instance){
|
||||||
var currentComp = __instance.GetComponent<ScarletPlayerControllerB>();
|
var currentComp = __instance.GetComponent<ScarletPlayerControllerB>();
|
||||||
if (currentComp == null) {
|
if (currentComp == null) {
|
||||||
Plugin.logger.LogInfo($"Adding Scarlet player script to player {__instance.playerClientId}");
|
Plugin.logger.LogDebug($"Adding Scarlet player script to player {__instance.playerClientId}");
|
||||||
var comp = __instance.gameObject.AddComponent<ScarletPlayerControllerB>();
|
var comp = __instance.gameObject.AddComponent<ScarletPlayerControllerB>();
|
||||||
comp.Initialize(__instance);
|
comp.Initialize(__instance);
|
||||||
comp.Register();
|
comp.Register();
|
||||||
|
@ -26,6 +26,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
|
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
public static void UpdatePatch(ref PlayerControllerB __instance) {
|
public static void UpdatePatch(ref PlayerControllerB __instance) {
|
||||||
|
@ -36,6 +37,7 @@ namespace ScarletMansion.GamePatch {
|
||||||
__instance.playerBodyAnimator.runtimeAnimatorController = controller.playerOverrideController;
|
__instance.playerBodyAnimator.runtimeAnimatorController = controller.playerOverrideController;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ScarletMansion.GamePatch.Props {
|
||||||
var b = GetBounds();
|
var b = GetBounds();
|
||||||
var layerMask = LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" });
|
var layerMask = LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" });
|
||||||
if (Physics.CheckBox(b.center, b.extents, transform.rotation, layerMask)){
|
if (Physics.CheckBox(b.center, b.extents, transform.rotation, layerMask)){
|
||||||
Plugin.logger.LogInfo("Disabling fire exit potential spawn due to overlapping space");
|
Plugin.logger.LogDebug("Disabling fire exit potential spawn due to overlapping space");
|
||||||
target.SetActive(false);
|
target.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ScarletMansion.GamePatch.Props {
|
||||||
var currentY = tile.transform.position.y;
|
var currentY = tile.transform.position.y;
|
||||||
|
|
||||||
var floor = Mathf.RoundToInt((currentY - baseY) / 8f);
|
var floor = Mathf.RoundToInt((currentY - baseY) / 8f);
|
||||||
Plugin.logger.LogInfo($"F{floor}");
|
Plugin.logger.LogDebug($"F{floor}");
|
||||||
// fuck it im lazy
|
// fuck it im lazy
|
||||||
GameObject p;
|
GameObject p;
|
||||||
if (floor == 0) {
|
if (floor == 0) {
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace ScarletMansion.GamePatch.Props {
|
||||||
public static int cycle = 0;
|
public static int cycle = 0;
|
||||||
|
|
||||||
public static void UpdateCycle(int value){
|
public static void UpdateCycle(int value){
|
||||||
Plugin.logger.LogInfo($"Updating RandomPrefab cylce to {value}");
|
Plugin.logger.LogDebug($"Updating RandomPrefab cylce to {value}");
|
||||||
cycle = value;
|
cycle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Process(RandomStream randomStream, Tile tile) {
|
public override void Process(RandomStream randomStream, Tile tile) {
|
||||||
if (props.Count <= 0) return;
|
if (props.Count <= 0) return;
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Cycle {cycle}");
|
Plugin.logger.LogDebug($"Cycle {cycle}");
|
||||||
var cycleValue = cycle++;
|
var cycleValue = cycle++;
|
||||||
var index = cycleValue % props.Count;
|
var index = cycleValue % props.Count;
|
||||||
var prefab = props[index];
|
var prefab = props[index];
|
||||||
|
|
|
@ -40,13 +40,13 @@ namespace ScarletMansion.GamePatch {
|
||||||
|
|
||||||
public static float ModifyScrapCount(float count){
|
public static float ModifyScrapCount(float count){
|
||||||
if (DunGenPatch.Patch.active == false) return count;
|
if (DunGenPatch.Patch.active == false) return count;
|
||||||
Plugin.logger.LogInfo($"Scrap: {count} -> {count * PluginConfig.Instance.lootMultiplierValue}");
|
Plugin.logger.LogDebug($"Scrap: {count} -> {count * PluginConfig.Instance.lootMultiplierValue}");
|
||||||
return count * PluginConfig.Instance.lootMultiplierValue;
|
return count * PluginConfig.Instance.lootMultiplierValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float ModifyMapCount(float count){
|
public static float ModifyMapCount(float count){
|
||||||
if (DunGenPatch.Patch.active == false) return count;
|
if (DunGenPatch.Patch.active == false) return count;
|
||||||
Plugin.logger.LogInfo($"Map Hazards: {count} -> {count * PluginConfig.Instance.mapHazardsMultiplierValue}");
|
Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * PluginConfig.Instance.mapHazardsMultiplierValue}");
|
||||||
return count * PluginConfig.Instance.mapHazardsMultiplierValue;
|
return count * PluginConfig.Instance.mapHazardsMultiplierValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace ScarletMansion.GamePatch.Weathers {
|
||||||
rainAudioSource.clip = rainGameObject.GetComponentInChildren<AudioSource>().clip;
|
rainAudioSource.clip = rainGameObject.GetComponentInChildren<AudioSource>().clip;
|
||||||
rainAudioSource.Play();
|
rainAudioSource.Play();
|
||||||
|
|
||||||
Plugin.logger.LogInfo("Fixed Rainy weather references");
|
Plugin.logger.LogDebug("Fixed Rainy weather references");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
[BepInDependency("imabatby.lethallevelloader", "1.2.0.3")]
|
[BepInDependency("imabatby.lethallevelloader", "1.2.0.3")]
|
||||||
[BepInDependency("evaisa.lethallib", "0.13.2")]
|
[BepInDependency("evaisa.lethallib", "0.13.2")]
|
||||||
[BepInDependency("dev.ladyalice.dungenplus", "1.0.3")]
|
[BepInDependency("dev.ladyalice.dungenplus", "1.0.5")]
|
||||||
|
|
||||||
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
|
@ -34,7 +34,7 @@ namespace ScarletMansion {
|
||||||
public class Plugin : BaseUnityPlugin {
|
public class Plugin : BaseUnityPlugin {
|
||||||
public const string modGUID = "dev.ladyalice.scarletmansion";
|
public const string modGUID = "dev.ladyalice.scarletmansion";
|
||||||
private const string modName = "Scarlet Mansion";
|
private const string modName = "Scarlet Mansion";
|
||||||
private const string modVersion = "1.3.23";
|
private const string modVersion = "1.3.24";
|
||||||
|
|
||||||
public readonly Harmony harmony = new Harmony(modGUID);
|
public readonly Harmony harmony = new Harmony(modGUID);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace ScarletMansion {
|
||||||
public const string dungeonGenerationBoundingBoxPrefix = "DunGen Bounding Box";
|
public const string dungeonGenerationBoundingBoxPrefix = "DunGen Bounding Box";
|
||||||
|
|
||||||
public const string dungeonGenerationMPathsPrefix = "DunGen Main Path";
|
public const string dungeonGenerationMPathsPrefix = "DunGen Main Path";
|
||||||
|
public const string dungeonGenerationBPathPrefix = "DunGen Branching Path";
|
||||||
public const string dungeonGenerationBPathOnePrefix = "DunGen Branching Path 1";
|
public const string dungeonGenerationBPathOnePrefix = "DunGen Branching Path 1";
|
||||||
public const string dungeonGenerationBPathTwoPrefix = "DunGen Branching Path 2";
|
public const string dungeonGenerationBPathTwoPrefix = "DunGen Branching Path 2";
|
||||||
public const string dungeonGenerationBPathThreePrefix = "DunGen Branching Path 3";
|
public const string dungeonGenerationBPathThreePrefix = "DunGen Branching Path 3";
|
||||||
|
@ -169,27 +170,38 @@ namespace ScarletMansion {
|
||||||
dungeonGenerationMPathsPrefix,
|
dungeonGenerationMPathsPrefix,
|
||||||
"Main Path Length Min",
|
"Main Path Length Min",
|
||||||
"Main Path Length Max",
|
"Main Path Length Max",
|
||||||
|
3,
|
||||||
4,
|
4,
|
||||||
5,
|
|
||||||
$"The minimum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
|
$"The minimum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
|
||||||
$"The maximum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
|
$"The maximum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
|
||||||
null,
|
null,
|
||||||
new AcceptableValueRange<int>(3, 20)
|
new AcceptableValueRange<int>(3, 20)
|
||||||
);
|
);
|
||||||
|
|
||||||
public static ConfigEntryBundle<bool> disableBasement = new ConfigEntryBundle<bool>(
|
|
||||||
dungeonGenerationMPathsPrefix,
|
|
||||||
"Disable Mayor Basement",
|
|
||||||
false,
|
|
||||||
"Removes the basement section of the mayor tile. Forces the Main Path Count to a maximum of 2."
|
|
||||||
);
|
|
||||||
|
|
||||||
public int mainPathCountValue;
|
public int mainPathCountValue;
|
||||||
public IntRange mainPathLengthValue = new IntRange("main path length");
|
public IntRange mainPathLengthValue = new IntRange("main path length");
|
||||||
public bool disableBasementValue;
|
|
||||||
|
|
||||||
|
|
||||||
// branching path
|
// branching path
|
||||||
|
public static ConfigEntryBundle<bool> branchLoopBoost = new ConfigEntryBundle<bool>(
|
||||||
|
dungeonGenerationBPathPrefix,
|
||||||
|
"Use Branch Loop Prioritization",
|
||||||
|
true,
|
||||||
|
"If enabled, the dungeon generation will prioritize branch tiles that connect to already generated tiles.\nThis increases the chance of circular/looping paths. Slows dungeon generation times a bit at the end.",
|
||||||
|
null
|
||||||
|
);
|
||||||
|
public static ConfigEntryBundle<int> branchLoopBoostTileSearch = new ConfigEntryBundle<int>(
|
||||||
|
dungeonGenerationBPathPrefix,
|
||||||
|
"Tile Search Count",
|
||||||
|
10,
|
||||||
|
"The maximum number of valid branch tiles that the dungeon generation will consider before choosing the best tile.\nIncreasing this value gives the dungeon generation a higher chance of finding a good tile but impacts dungeon generation times. Decreasing this value gives the dungeon generation a lower chance of finding a good tile but also lessens the impact to dungeon generation times.",
|
||||||
|
null,
|
||||||
|
new AcceptableValueRange<int>(1, 20)
|
||||||
|
);
|
||||||
|
|
||||||
|
public bool branchLoopBoostValue;
|
||||||
|
public int branchLoopBoostTileSearchValue;
|
||||||
|
|
||||||
|
// branching path mini sections
|
||||||
private static string _branchPathBranchCountMessage(int section, string minmax, string middleSection) => $"The {minmax} amount of branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostCountMessage}";
|
private static string _branchPathBranchCountMessage(int section, string minmax, string middleSection) => $"The {minmax} amount of branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostCountMessage}";
|
||||||
private static string _branchPathBranchDepthMessage(int section, string minmax, string middleSection) => $"The {minmax} length of the branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostDepthMessage}";
|
private static string _branchPathBranchDepthMessage(int section, string minmax, string middleSection) => $"The {minmax} length of the branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostDepthMessage}";
|
||||||
|
|
||||||
|
@ -570,7 +582,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void VerifyLightingValues(PluginConfig instance){
|
public static void VerifyLightingValues(PluginConfig instance){
|
||||||
Plugin.logger.LogInfo("Verifying lightsSpawn 0/1/2 values");
|
Plugin.logger.LogDebug("Verifying lightsSpawn 0/1/2 values");
|
||||||
if (instance.lightsSpawnZeroWeightValue == 0f && instance.lightsSpawnOneWeightValue == 0f && instance.lightsSpawnTwoWeightValue == 0f){
|
if (instance.lightsSpawnZeroWeightValue == 0f && instance.lightsSpawnOneWeightValue == 0f && instance.lightsSpawnTwoWeightValue == 0f){
|
||||||
instance.lightsSpawnZeroWeightValue = 1;
|
instance.lightsSpawnZeroWeightValue = 1;
|
||||||
}
|
}
|
||||||
|
@ -585,8 +597,8 @@ namespace ScarletMansion {
|
||||||
var bytes = SerializeToBytes(Instance);
|
var bytes = SerializeToBytes(Instance);
|
||||||
var copy = DeserializeFromBytes(bytes);
|
var copy = DeserializeFromBytes(bytes);
|
||||||
|
|
||||||
Plugin.logger.LogInfo($"Inst: {Instance.ToString()}");
|
Plugin.logger.LogDebug($"Inst: {Instance.ToString()}");
|
||||||
Plugin.logger.LogInfo($"Copy: {copy.ToString()}");
|
Plugin.logger.LogDebug($"Copy: {copy.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Verify(){
|
public virtual void Verify(){
|
||||||
Plugin.logger.LogInfo($"Verifying min/max for {name}");
|
Plugin.logger.LogDebug($"Verifying min/max for {name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
@ -177,7 +177,7 @@ namespace ScarletMansion {
|
||||||
public override void Bind(ConfigFile cfg, PluginConfig instance, FieldPropertyInfo memberInfo, object memberTarget) {
|
public override void Bind(ConfigFile cfg, PluginConfig instance, FieldPropertyInfo memberInfo, object memberTarget) {
|
||||||
config = cfg.Bind(definition, defaultValue, description);
|
config = cfg.Bind(definition, defaultValue, description);
|
||||||
config.SettingChanged += (obj, args) => {
|
config.SettingChanged += (obj, args) => {
|
||||||
Plugin.logger.LogInfo($"Config settings {config.Definition.Key} changed");
|
Plugin.logger.LogDebug($"Config settings {config.Definition.Key} changed");
|
||||||
memberInfo.SetValue(memberTarget, config.Value);
|
memberInfo.SetValue(memberTarget, config.Value);
|
||||||
extra.CallAction(instance, false);
|
extra.CallAction(instance, false);
|
||||||
};
|
};
|
||||||
|
@ -189,7 +189,7 @@ namespace ScarletMansion {
|
||||||
public void Bind(ConfigFile cfg, PluginConfig instance){
|
public void Bind(ConfigFile cfg, PluginConfig instance){
|
||||||
config = cfg.Bind(definition, defaultValue, description);
|
config = cfg.Bind(definition, defaultValue, description);
|
||||||
config.SettingChanged += (obj, args) => {
|
config.SettingChanged += (obj, args) => {
|
||||||
Plugin.logger.LogInfo($"Config settings {config.Definition.Key} changed");
|
Plugin.logger.LogDebug($"Config settings {config.Definition.Key} changed");
|
||||||
extra.CallAction(instance, false);
|
extra.CallAction(instance, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
public static void OnRequestSync(ulong clientId, FastBufferReader _){
|
public static void OnRequestSync(ulong clientId, FastBufferReader _){
|
||||||
if (!IsHost) return;
|
if (!IsHost) return;
|
||||||
logger.LogInfo($"Config sync request received from client: {clientId}");
|
logger.LogDebug($"Config sync request received from client: {clientId}");
|
||||||
|
|
||||||
var array = SerializeToBytes(Instance);
|
var array = SerializeToBytes(Instance);
|
||||||
var value = array.Length;
|
var value = array.Length;
|
||||||
|
@ -56,7 +56,7 @@ namespace ScarletMansion {
|
||||||
var data = new byte[val];
|
var data = new byte[val];
|
||||||
reader.ReadBytesSafe(ref data, val);
|
reader.ReadBytesSafe(ref data, val);
|
||||||
SyncInstance(data);
|
SyncInstance(data);
|
||||||
logger.LogInfo("Successfully synced config with host.");
|
logger.LogDebug("Successfully synced config with host.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "ConnectClientToPlayerObject")]
|
[HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "ConnectClientToPlayerObject")]
|
||||||
|
|
|
@ -32,7 +32,6 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
new ChangeInt ( PluginConfig.mainPathCount ),
|
new ChangeInt ( PluginConfig.mainPathCount ),
|
||||||
new ChangeMinMaxInt ( PluginConfig.mainPathLength ),
|
new ChangeMinMaxInt ( PluginConfig.mainPathLength ),
|
||||||
new ChangeBool( PluginConfig.disableBasement ),
|
|
||||||
|
|
||||||
new ChangeBranchingPath( PluginConfig.branchPathSectionOne ),
|
new ChangeBranchingPath( PluginConfig.branchPathSectionOne ),
|
||||||
new ChangeBranchingPath( PluginConfig.branchPathSectionTwo ),
|
new ChangeBranchingPath( PluginConfig.branchPathSectionTwo ),
|
||||||
|
@ -112,7 +111,6 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
new ChangeInt ( PluginConfig.mainPathCount, 1 ),
|
new ChangeInt ( PluginConfig.mainPathCount, 1 ),
|
||||||
new ChangeMinMaxInt ( PluginConfig.mainPathLength, 6, 9 ),
|
new ChangeMinMaxInt ( PluginConfig.mainPathLength, 6, 9 ),
|
||||||
new ChangeBool( PluginConfig.disableBasement, true ),
|
|
||||||
|
|
||||||
new ChangeBranchingPath( PluginConfig.branchPathSectionOne, 4, 6, 3, 4 ),
|
new ChangeBranchingPath( PluginConfig.branchPathSectionOne, 4, 6, 3, 4 ),
|
||||||
new ChangeBranchingPath( PluginConfig.branchPathSectionTwo, 2, 3, 2, 3 ),
|
new ChangeBranchingPath( PluginConfig.branchPathSectionTwo, 2, 3, 2, 3 ),
|
||||||
|
@ -227,7 +225,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateChanges(){
|
public void UpdateChanges(){
|
||||||
Plugin.logger.LogInfo($"Updating config values with preset {name}");
|
Plugin.logger.LogDebug($"Updating config values with preset {name}");
|
||||||
foreach(var c in changes){
|
foreach(var c in changes){
|
||||||
c.Update();
|
c.Update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
var spacing = new string(' ', index);
|
var spacing = new string(' ', index);
|
||||||
Plugin.logger.LogInfo($"{spacing}[{o.ToString()}]");
|
Plugin.logger.LogDebug($"{spacing}[{o.ToString()}]");
|
||||||
|
|
||||||
var props = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
|
var props = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
foreach(var pi in props){
|
foreach(var pi in props){
|
||||||
|
@ -52,14 +52,14 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
for(var i = 0; i < count; ++i) {
|
for(var i = 0; i < count; ++i) {
|
||||||
var value = pi.GetValue(o, new object[] { i } );
|
var value = pi.GetValue(o, new object[] { i } );
|
||||||
Plugin.logger.LogInfo($"{spacing}{pi.Name}[{i}]: {GetObjectString(value)}");
|
Plugin.logger.LogDebug($"{spacing}{pi.Name}[{i}]: {GetObjectString(value)}");
|
||||||
PrintObject(value, index + 1, depth + 1, ignoreList);
|
PrintObject(value, index + 1, depth + 1, ignoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var value = pi.GetValue(o);
|
var value = pi.GetValue(o);
|
||||||
Plugin.logger.LogInfo($"{spacing}{pi.Name}: {GetObjectString(value)}");
|
Plugin.logger.LogDebug($"{spacing}{pi.Name}: {GetObjectString(value)}");
|
||||||
PrintObject(value, index + 1, depth + 1, ignoreList);
|
PrintObject(value, index + 1, depth + 1, ignoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,26 +68,26 @@ namespace ScarletMansion {
|
||||||
var fields = o.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
|
var fields = o.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
foreach(var fi in fields){
|
foreach(var fi in fields){
|
||||||
var value = fi.GetValue(o);
|
var value = fi.GetValue(o);
|
||||||
Plugin.logger.LogInfo($"{spacing}{fi.Name}: {GetObjectString(value)}");
|
Plugin.logger.LogDebug($"{spacing}{fi.Name}: {GetObjectString(value)}");
|
||||||
PrintObject(value, index + 1, depth + 1, ignoreList);
|
PrintObject(value, index + 1, depth + 1, ignoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o is GameObject){
|
if (o is GameObject){
|
||||||
var gameobject = o as GameObject;
|
var gameobject = o as GameObject;
|
||||||
var comps = gameobject.GetComponents<Component>();
|
var comps = gameobject.GetComponents<Component>();
|
||||||
Plugin.logger.LogInfo("--- Components --- ");
|
Plugin.logger.LogDebug("--- Components --- ");
|
||||||
foreach(var c in comps){
|
foreach(var c in comps){
|
||||||
PrintObject(c, index, depth, ignoreList);
|
PrintObject(c, index, depth, ignoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin.logger.LogInfo("--- Children --- ");
|
Plugin.logger.LogDebug("--- Children --- ");
|
||||||
foreach(Transform t in gameobject.transform){
|
foreach(Transform t in gameobject.transform){
|
||||||
PrintObject(t.gameObject, index + 1, depth + 1, ignoreList);
|
PrintObject(t.gameObject, index + 1, depth + 1, ignoreList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Plugin.logger.LogInfo("");
|
Plugin.logger.LogDebug("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintIEnumerable(object o, int index, int depth, params Type[] ignoreList){
|
public static void PrintIEnumerable(object o, int index, int depth, params Type[] ignoreList){
|
||||||
|
@ -97,7 +97,7 @@ namespace ScarletMansion {
|
||||||
var list = o as IEnumerable;
|
var list = o as IEnumerable;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach(var item in list){
|
foreach(var item in list){
|
||||||
Plugin.logger.LogInfo($"{spacing}[IEnumerable {i}]: {GetObjectString(item)}");
|
Plugin.logger.LogDebug($"{spacing}[IEnumerable {i}]: {GetObjectString(item)}");
|
||||||
PrintObject(item, index + 1, depth + 1, ignoreList);
|
PrintObject(item, index + 1, depth + 1, ignoreList);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,10 +176,12 @@
|
||||||
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookSwitch.cs" />
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookSwitch.cs" />
|
||||||
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookZone.cs" />
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookZone.cs" />
|
||||||
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomDoorStatus.cs" />
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomDoorStatus.cs" />
|
||||||
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomPaintingGrabEvent.cs" />
|
||||||
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomTimeEvent.cs" />
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomTimeEvent.cs" />
|
||||||
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookPullEvent.cs" />
|
<Compile Include="GamePatch\Components\TreasureRoom\TreasureRoomBookPullEvent.cs" />
|
||||||
<Compile Include="GamePatch\DoorLockPatch.cs" />
|
<Compile Include="GamePatch\DoorLockPatch.cs" />
|
||||||
<Compile Include="GamePatch\Enemies\KnightGhostVariant.cs" />
|
<Compile Include="GamePatch\Enemies\KnightGhostVariant.cs" />
|
||||||
|
<Compile Include="GamePatch\Enemies\KnightV2Variant.cs" />
|
||||||
<Compile Include="GamePatch\Enemies\KnightVariant.cs" />
|
<Compile Include="GamePatch\Enemies\KnightVariant.cs" />
|
||||||
<Compile Include="GamePatch\Enemies\MaidVariant.cs" />
|
<Compile Include="GamePatch\Enemies\MaidVariant.cs" />
|
||||||
<Compile Include="GamePatch\EnemyVentPatch.cs" />
|
<Compile Include="GamePatch\EnemyVentPatch.cs" />
|
||||||
|
|
|
@ -71,11 +71,11 @@ namespace ScarletMansion {
|
||||||
var pastCapacity = stream.Capacity > 1300;
|
var pastCapacity = stream.Capacity > 1300;
|
||||||
var flag = pastCapacity ? NetworkDelivery.ReliableFragmentedSequenced : NetworkDelivery.Reliable;
|
var flag = pastCapacity ? NetworkDelivery.ReliableFragmentedSequenced : NetworkDelivery.Reliable;
|
||||||
if (pastCapacity){
|
if (pastCapacity){
|
||||||
logger.LogInfo("Stream is past capacity. Sending fragmented message");
|
logger.LogDebug("Stream is past capacity. Sending fragmented message");
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.SendNamedMessage(title, clientId, stream, flag);
|
MessageManager.SendNamedMessage(title, clientId, stream, flag);
|
||||||
Plugin.logger.LogInfo($"Send message to client {clientId} with title {title} and flag {flag}");
|
Plugin.logger.LogDebug($"Send message to client {clientId} with title {title} and flag {flag}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace ScarletMansion {
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
Plugin.logger.LogError($"{debugFunction} could not inject {name}. Probably scary");
|
Plugin.logger.LogError($"{debugFunction} could not inject {name}. Probably scary");
|
||||||
} else if (!expectedCounter.HasValue) {
|
} else if (!expectedCounter.HasValue) {
|
||||||
Plugin.logger.LogInfo($"{debugFunction} inject {name} {counter} time(s)");
|
Plugin.logger.LogDebug($"{debugFunction} inject {name} {counter} time(s)");
|
||||||
} else if (expectedCounter.Value != counter){
|
} else if (expectedCounter.Value != counter){
|
||||||
Plugin.logger.LogWarning($"{debugFunction} inject {name} {counter} time(s) (Expected {expectedCounter.Value}). Probably not an error but be warned");
|
Plugin.logger.LogWarning($"{debugFunction} inject {name} {counter} time(s) (Expected {expectedCounter.Value}). Probably not an error but be warned");
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ namespace ScarletMansion {
|
||||||
foreach(var i in instructions){
|
foreach(var i in instructions){
|
||||||
var opString = i.opcode.ToString();
|
var opString = i.opcode.ToString();
|
||||||
var objString = i.operand != null ? i.operand.ToString() : "NULL";
|
var objString = i.operand != null ? i.operand.ToString() : "NULL";
|
||||||
Plugin.logger.LogInfo($"{opString}: {objString}");
|
Plugin.logger.LogDebug($"{opString}: {objString}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
protected override void UpdateValue(int direction) {
|
protected override void UpdateValue(int direction) {
|
||||||
current = Mathf.Clamp(current + direction * delta, min, max);
|
current = Mathf.Clamp(current + direction * delta, min, max);
|
||||||
Plugin.logger.LogInfo($"{name}: {current}");
|
Plugin.logger.LogDebug($"{name}: {current}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,12 +205,12 @@ namespace ScarletMansion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintToParent(Transform t) {
|
public static void PrintToParent(Transform t) {
|
||||||
Plugin.logger.LogInfo(t.name);
|
Plugin.logger.LogDebug(t.name);
|
||||||
var parent = t.parent;
|
var parent = t.parent;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
var header = new string(' ', ++i);
|
var header = new string(' ', ++i);
|
||||||
Plugin.logger.LogInfo($"{header}{parent.name}");
|
Plugin.logger.LogDebug($"{header}{parent.name}");
|
||||||
parent = parent.parent;
|
parent = parent.parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
for(var i = 0; i < items.Count; ++i){
|
for(var i = 0; i < items.Count; ++i){
|
||||||
Plugin.logger.LogInfo($"{i}: {items[i].spawnableItem.itemName}");
|
Plugin.logger.LogDebug($"{i}: {items[i].spawnableItem.itemName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ namespace ScarletMansion {
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
for(var i = 0; i < items.Count; ++i){
|
for(var i = 0; i < items.Count; ++i){
|
||||||
Plugin.logger.LogInfo($"{i}: {items[i].itemName}");
|
Plugin.logger.LogDebug($"{i}: {items[i].itemName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,13 +274,13 @@ namespace ScarletMansion {
|
||||||
if (result) strList.Add($"({i}){LayerMask.LayerToName(i)}");
|
if (result) strList.Add($"({i}){LayerMask.LayerToName(i)}");
|
||||||
}
|
}
|
||||||
var combine = string.Join(", ", strList);
|
var combine = string.Join(", ", strList);
|
||||||
Plugin.logger.LogInfo($"({layer}){LayerMask.LayerToName(layer)}: {combine}");
|
Plugin.logger.LogDebug($"({layer}){LayerMask.LayerToName(layer)}: {combine}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintCodeInstructions(IEnumerable<CodeInstruction> instructions){
|
public static void PrintCodeInstructions(IEnumerable<CodeInstruction> instructions){
|
||||||
foreach(var i in instructions){
|
foreach(var i in instructions){
|
||||||
var objString = i.operand != null ? $"[{i.operand.GetType().ToString()}] {i.operand.ToString()}" : "NULL";
|
var objString = i.operand != null ? $"[{i.operand.GetType().ToString()}] {i.operand.ToString()}" : "NULL";
|
||||||
Plugin.logger.LogInfo($"{i.opcode.ToString()}: {objString}");
|
Plugin.logger.LogDebug($"{i.opcode.ToString()}: {objString}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ namespace ScarletMansion {
|
||||||
var list = c as InteractEvent;
|
var list = c as InteractEvent;
|
||||||
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
||||||
var call = list.GetPersistentListenerState(i);
|
var call = list.GetPersistentListenerState(i);
|
||||||
Plugin.logger.LogInfo($"{spacing}CALL: {call}");
|
Plugin.logger.LogDebug($"{spacing}CALL: {call}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ namespace ScarletMansion {
|
||||||
var list = c as InteractEventFloat;
|
var list = c as InteractEventFloat;
|
||||||
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
||||||
var call = list.GetPersistentMethodName(i);
|
var call = list.GetPersistentMethodName(i);
|
||||||
Plugin.logger.LogInfo($"{spacing}CALL: {call}");
|
Plugin.logger.LogDebug($"{spacing}CALL: {call}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ namespace ScarletMansion {
|
||||||
var list = c as BooleanEvent;
|
var list = c as BooleanEvent;
|
||||||
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
for(var i = 0; i < list.GetPersistentEventCount(); i++){
|
||||||
var call = list.GetPersistentMethodName(i);
|
var call = list.GetPersistentMethodName(i);
|
||||||
Plugin.logger.LogInfo($"{spacing}CALL: {call}");
|
Plugin.logger.LogDebug($"{spacing}CALL: {call}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,10 +417,10 @@ namespace ScarletMansion {
|
||||||
try {
|
try {
|
||||||
var met = m.GetFloat("_Metallic");
|
var met = m.GetFloat("_Metallic");
|
||||||
var smo = m.GetFloat("_Smoothness");
|
var smo = m.GetFloat("_Smoothness");
|
||||||
Plugin.logger.LogInfo($"{spacing}METAL: {met}");
|
Plugin.logger.LogDebug($"{spacing}METAL: {met}");
|
||||||
Plugin.logger.LogInfo($"{spacing}SMOOTH: {smo}");
|
Plugin.logger.LogDebug($"{spacing}SMOOTH: {smo}");
|
||||||
} catch {
|
} catch {
|
||||||
Plugin.logger.LogInfo($"{spacing}FAILED READING");
|
Plugin.logger.LogDebug($"{spacing}FAILED READING");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue