Added new treasure room spawn (servant's quarters)
Fixed treasure room event for bedroom Fixed painting's interaction with MattyFixes Fixed critical damage bug introduced by v62 Increased lights spawn for all presets by a lot Added Coroner compatibility Added Scarlet Devil Mansion (moon) to the interior's spawn list Lights now have a chance of flickering and dying
This commit is contained in:
parent
93e249d838
commit
4413d12ea3
42 changed files with 986 additions and 333 deletions
|
@ -1,4 +1,5 @@
|
|||
using GameNetcodeStuff;
|
||||
using LethalLib.Modules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -22,49 +23,69 @@ namespace ScarletMansion.GamePatch.Components
|
|||
if (!otherGameObject.CompareTag("Player")) {
|
||||
return;
|
||||
}
|
||||
var comp = otherGameObject.GetComponent<PlayerControllerB>();
|
||||
if (comp != GameNetworkManager.Instance.localPlayerController) return;
|
||||
var playerControllerB = otherGameObject.GetComponent<PlayerControllerB>();
|
||||
if (playerControllerB != GameNetworkManager.Instance.localPlayerController) return;
|
||||
|
||||
// sanity check
|
||||
if (audioClipIndex == -1) comp.statusEffectAudioIndex = 0;
|
||||
comp.statusEffectAudioIndex = audioClipIndex;
|
||||
if (audioClipIndex == -1) playerControllerB.statusEffectAudioIndex = 0;
|
||||
playerControllerB.statusEffectAudioIndex = audioClipIndex;
|
||||
|
||||
if (comp.isSinking) {
|
||||
// teleporting them out for a second time in life
|
||||
// won't be easy though kek
|
||||
var scarletPlayer = ScarletPlayerControllerB.GetScarletPlayerScript(comp);
|
||||
if (scarletPlayer != null && !scarletPlayer.fellInPit && comp.sinkingValue >= 0.9f && comp.health > 20) {
|
||||
var selfPos = scarletPlayer.transform.position;
|
||||
var farthestAINode = RoundManager.Instance.insideAINodes
|
||||
.Select(n => n.transform.position)
|
||||
.OrderByDescending(n => (selfPos - n).magnitude).FirstOrDefault();
|
||||
if (playerControllerB.isSinking) {
|
||||
|
||||
comp.TeleportPlayer(farthestAINode);
|
||||
var damage = ScarletNetworkManagerUtility.GetCriticalDamageToPlayer(comp, false);
|
||||
comp.DamagePlayer(damage, false, true, CauseOfDeath.Suffocation);
|
||||
// to override the normal sinking kill behaviour
|
||||
if (playerControllerB.sinkingValue >= 0.9f){
|
||||
// teleporting them out for a second time in life
|
||||
// won't be easy though kek
|
||||
var scarletPlayer = ScarletPlayerControllerB.GetScarletPlayerScript(playerControllerB);
|
||||
if (scarletPlayer != null && !scarletPlayer.fellInPit && !playerControllerB.criticallyInjured) {
|
||||
var selfPos = scarletPlayer.transform.position;
|
||||
var farthestAINode = RoundManager.Instance.insideAINodes
|
||||
.Select(n => n.transform.position)
|
||||
.OrderByDescending(n => (selfPos - n).magnitude).FirstOrDefault();
|
||||
|
||||
ScarletNetworkManager.Instance.CreateSpawnAudioPrefab(farthestAINode, comp.actualClientId);
|
||||
StopSinkingLocalPlayer(comp);
|
||||
playerControllerB.TeleportPlayer(farthestAINode);
|
||||
var damage = ScarletNetworkManagerUtility.GetCriticalDamageToPlayer(playerControllerB, false);
|
||||
playerControllerB.DamagePlayer(damage, false, true, CauseOfDeath.Suffocation);
|
||||
|
||||
scarletPlayer.fellInPit = true;
|
||||
if (playerControllerB.isPlayerDead) {
|
||||
Assets.onPlayerDeath.Call(new ModPatch.CoronerParameters(playerControllerB, ModPatch.CoronerDeathEnum.Void));
|
||||
}
|
||||
|
||||
StopSinkingLocalPlayer(playerControllerB);
|
||||
ScarletNetworkManager.Instance.CreateSpawnAudioPrefab(farthestAINode, playerControllerB.actualClientId);
|
||||
|
||||
scarletPlayer.fellInPit = true;
|
||||
}
|
||||
// just straight up murder
|
||||
else {
|
||||
// this is to prevent Coroner from thinking it's quicksand
|
||||
playerControllerB.isSinking = false;
|
||||
playerControllerB.KillPlayer(Vector3.zero, false, CauseOfDeath.Suffocation);
|
||||
if (playerControllerB.isPlayerDead) {
|
||||
Assets.onPlayerDeath.Call(new ModPatch.CoronerParameters(playerControllerB, ModPatch.CoronerDeathEnum.Void));
|
||||
} else {
|
||||
// a just in case
|
||||
playerControllerB.isSinking = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (sinkingLocalPlayer){
|
||||
if (!comp.CheckConditionsForSinkingInQuicksand()) {
|
||||
if (!playerControllerB.CheckConditionsForSinkingInQuicksand()) {
|
||||
|
||||
StopSinkingLocalPlayer(comp);
|
||||
StopSinkingLocalPlayer(playerControllerB);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (comp.CheckConditionsForSinkingInQuicksand()){
|
||||
if (playerControllerB.CheckConditionsForSinkingInQuicksand()){
|
||||
sinkingLocalPlayer = true;
|
||||
comp.sourcesCausingSinking++;
|
||||
comp.isMovementHindered++;
|
||||
comp.hinderedMultiplier *= movementHinderence;
|
||||
comp.sinkingSpeedMultiplier = sinkingSpeedMultiplier;
|
||||
playerControllerB.sourcesCausingSinking++;
|
||||
playerControllerB.isMovementHindered++;
|
||||
playerControllerB.hinderedMultiplier *= movementHinderence;
|
||||
playerControllerB.sinkingSpeedMultiplier = sinkingSpeedMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue