Moved dungen code to DunGenPlus
Added critical damage as a mechanic Maid knife feed deals critical damage, then kills on second time Added concept of treasure room with kitchen Frames now only start at the player when not being looked New attempt at snowglobe animations, it broke though Added concept of indoor weathers LethalConfig compability now changes the color of configs that my presets touch Added jukebox Changed modGUID Removed AC compability Falling into void deals critical damage and teleports, then kills on second time Maid spawns revenant ghost on death
This commit is contained in:
parent
faa391c309
commit
056cac8df1
63 changed files with 976 additions and 2061 deletions
|
|
@ -23,7 +23,10 @@ namespace ScarletMansion.GamePatch.Managers {
|
|||
|
||||
//public Dictionary<EnemyAI, int> angeredEnemies;
|
||||
public int level;
|
||||
|
||||
public List<Transform> roomsOfInterest;
|
||||
public List<ScarletBedroom> bedrooms;
|
||||
|
||||
public List<ScarletDoor> doors;
|
||||
public List<ScarletLight> lights;
|
||||
|
||||
|
|
@ -32,6 +35,8 @@ namespace ScarletMansion.GamePatch.Managers {
|
|||
|
||||
void Awake(){
|
||||
Instance = this;
|
||||
|
||||
roomsOfInterest = new List<Transform>();
|
||||
bedrooms = new List<ScarletBedroom>();
|
||||
doors = new List<ScarletDoor>();
|
||||
lights = new List<ScarletLight>();
|
||||
|
|
@ -91,10 +96,14 @@ namespace ScarletMansion.GamePatch.Managers {
|
|||
bedrooms.Add(b);
|
||||
}
|
||||
|
||||
public void AddRoomOfInterest(Transform t) {
|
||||
roomsOfInterest.Add(t);
|
||||
}
|
||||
|
||||
public void AddDoor(ScarletDoor d){
|
||||
// I want to get only doors that are revelant
|
||||
foreach(var b in bedrooms){
|
||||
var dist = Vector3.SqrMagnitude(d.transform.position - b.transform.position);
|
||||
foreach(var t in roomsOfInterest){
|
||||
var dist = Vector3.SqrMagnitude(d.transform.position - t.position);
|
||||
if (dist < 16f * 16f){
|
||||
doors.Add(d);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,85 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using DunGen;
|
||||
using ScarletMansion.DunGenPatch.Doorways;
|
||||
using Unity.AI.Navigation;
|
||||
using UnityEngine.AI;
|
||||
using DunGen.Adapters;
|
||||
|
||||
namespace ScarletMansion.GamePatch.Managers {
|
||||
public class DoorwayManager : MonoBehaviour {
|
||||
|
||||
public static DoorwayManager Instance { get; private set; }
|
||||
public static ActionList onMainEntranceTeleportSpawnedEvent = new ActionList("onMainEntranceTeleportSpawned");
|
||||
|
||||
public List<DoorwayCleanup> doorwayCleanup;
|
||||
|
||||
public void Awake(){
|
||||
Instance = this;
|
||||
doorwayCleanup = new List<DoorwayCleanup>();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
private NavMeshSurface surface;
|
||||
private GameObject meshGameObject;
|
||||
private MeshFilter meshFilter;
|
||||
|
||||
void Update(){
|
||||
if (surface == null){
|
||||
surface = FindObjectOfType<NavMeshSurface>();
|
||||
}
|
||||
|
||||
if (surface != null){
|
||||
if (meshFilter == null){
|
||||
meshGameObject = new GameObject("Nav Mesh V");
|
||||
meshFilter = meshGameObject.AddComponent<MeshFilter>();
|
||||
|
||||
var renderer = meshGameObject.AddComponent<MeshRenderer>();
|
||||
renderer.materials = new Material[1];
|
||||
renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
}
|
||||
|
||||
var mesh = new Mesh();
|
||||
var triangulation = NavMesh.CalculateTriangulation();
|
||||
mesh.SetVertices(triangulation.vertices);
|
||||
mesh.SetIndices(triangulation.indices, MeshTopology.Triangles, 0);
|
||||
|
||||
meshGameObject.transform.position = new Vector3(0f, 0.05f, 0f);
|
||||
meshFilter.mesh = mesh;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public void AddDoorwayCleanup(DoorwayCleanup dw){
|
||||
doorwayCleanup.Add(dw);
|
||||
}
|
||||
|
||||
public static void onMainEntranceTeleportSpawnedFunction(){
|
||||
if (Instance && DunGenPatch.Patch.active) {
|
||||
var doorwayCleanups = Instance.doorwayCleanup;
|
||||
foreach(var d in doorwayCleanups){
|
||||
d.SetBlockers(false);
|
||||
d.Cleanup();
|
||||
}
|
||||
|
||||
try{
|
||||
var dungeonGen = RoundManager.Instance.dungeonGenerator;
|
||||
var navmesh = dungeonGen.transform.parent.GetComponentInChildren<UnityNavMeshAdapter>();
|
||||
navmesh.Run(dungeonGen.Generator);
|
||||
Plugin.logger.LogInfo("Rebuild nav mesh");
|
||||
} catch (Exception e){
|
||||
Plugin.logger.LogError("Failed to rebuild nav mesh");
|
||||
Plugin.logger.LogError(e.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,6 @@ namespace ScarletMansion {
|
|||
}
|
||||
|
||||
public void OnDungeonComplete(Dungeon dungeon) {
|
||||
// IDK KNOW IF I CAN TRUST THIS TO BE THE SAME FOR ALL CLIENTS
|
||||
// but probably
|
||||
var points = dungeon.GetComponentsInChildren<KnightSpawnPoint>();
|
||||
spawnPoints = points.ToList();
|
||||
for(var i = 0; i < spawnPoints.Count; ++i){
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using GameNetcodeStuff;
|
|||
using ScarletMansion.GamePatch.Items;
|
||||
using ScarletMansion.GamePatch;
|
||||
using ScarletMansion.GamePatch.Components;
|
||||
using static LethalLevelLoader.ExtendedEvent;
|
||||
|
||||
namespace ScarletMansion {
|
||||
|
||||
|
|
@ -301,16 +302,77 @@ namespace ScarletMansion {
|
|||
|
||||
}
|
||||
|
||||
public void CreateSpawnAudioPrefab(Vector3 positon, ulong playerId) {
|
||||
CreateSpawnAudioPrefabServerRpc(positon, playerId);
|
||||
CreateSpawnAudioPrefab(positon);
|
||||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
public void CreateSpawnAudioPrefabServerRpc(Vector3 position, ulong playerId){
|
||||
CreateSpawnAudioPrefabClientRpc(position, playerId);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
public void CreateSpawnAudioPrefabClientRpc(Vector3 position, ulong playerId){
|
||||
if (StartOfRound.Instance.localPlayerController.actualClientId == playerId) return;
|
||||
CreateSpawnAudioPrefab(position);
|
||||
}
|
||||
|
||||
private void CreateSpawnAudioPrefab(Vector3 position) {
|
||||
var copy = Instantiate(Assets.networkObjectList.yukariSpawnPrefab, position, Quaternion.identity);
|
||||
var audioSource = copy.GetComponentInChildren<AudioSource>();
|
||||
audioSource.time = 0.5f;
|
||||
Destroy(copy, 5f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ScarletNetworkManagerUtility {
|
||||
|
||||
public static int GetCriticalDamageToPlayer(PlayerControllerB player, bool forceKill) {
|
||||
if (player.health > 20 && !forceKill) {
|
||||
return player.health - 15;
|
||||
}
|
||||
return player.health;
|
||||
}
|
||||
|
||||
|
||||
public static int GetFlashlightId(FlashlightItem flashlightItem){
|
||||
var flashlight = Assets.GetFlashlight(flashlightItem.itemProperties);
|
||||
if (flashlight != null) return flashlight.itemId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static NetworkObjectReference CreateEnemyWithRef(EnemyReferenceSpawnLogic enemy, Vector3 position, float yRotation) {
|
||||
var roundManager = RoundManager.Instance;
|
||||
if (roundManager == null || !roundManager.IsHost) return default;
|
||||
|
||||
return roundManager.SpawnEnemyGameObject(position, yRotation, enemy.index);
|
||||
}
|
||||
|
||||
public static T CreateEnemyWithRef<T>(EnemyReferenceSpawnLogic enemy, Vector3 position, float yRotation) where T: EnemyAI {
|
||||
var spawnedEnemy = CreateEnemyWithRef(enemy, position, yRotation);
|
||||
if (spawnedEnemy.TryGet(out var obj)) {
|
||||
return obj.GetComponentInChildren<T>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static NetworkObjectReference CreateEnemyWithType(EnemyType enemy, Vector3 position, float yRotation) {
|
||||
var roundManager = RoundManager.Instance;
|
||||
if (roundManager == null || !roundManager.IsHost) return default;
|
||||
|
||||
return roundManager.SpawnEnemyGameObject(position, yRotation, -1, enemy);
|
||||
}
|
||||
|
||||
public static T CreateEnemyWithType<T>(EnemyType enemy, Vector3 position, float yRotation) where T: EnemyAI {
|
||||
var spawnedEnemy = CreateEnemyWithType(enemy, position, yRotation);
|
||||
if (spawnedEnemy.TryGet(out var obj)) {
|
||||
return obj.GetComponentInChildren<T>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool CreateFlashlight(PlayerControllerB player, FlashlightItem flashLight, FlandreCrystal crystal){
|
||||
var color = crystal.colorIndex;
|
||||
var position = crystal.transform.position + Vector3.up * 0.25f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue