SDM_LethalCompany_Mod/CoronerPatch/ScarletMansionCoronerPatch/Patch.cs

38 lines
1.5 KiB
C#
Raw Permalink Normal View History

using Coroner;
using GameNetcodeStuff;
using ScarletMansion.ModPatch;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScarletMansionCoronerPatch {
public class Patch {
public static Dictionary<CoronerDeathEnum, object> causesOfDeath;
public static void Activate() {
causesOfDeath = new Dictionary<CoronerDeathEnum, object>();
causesOfDeath.Add(CoronerDeathEnum.Knight, AdvancedCauseOfDeath.Build("DeathEnemyKnight"));
causesOfDeath.Add(CoronerDeathEnum.Maid, AdvancedCauseOfDeath.Build("DeathEnemyMaid"));
causesOfDeath.Add(CoronerDeathEnum.Void, AdvancedCauseOfDeath.Build("DeathPitVoid"));
causesOfDeath.Add(CoronerDeathEnum.GhostKnight, AdvancedCauseOfDeath.Build("DeathEnemyGhostKnight"));
causesOfDeath.Add(CoronerDeathEnum.Knife, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnife"));
causesOfDeath.Add(CoronerDeathEnum.KnifeFeed, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFeed"));
causesOfDeath.Add(CoronerDeathEnum.KnifeFriendlyFire, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFriendlyFire"));
ScarletMansion.Assets.onPlayerDeath.AddEvent("CoronerPatch", ProcessCauseOfDeath);
}
public static void ProcessCauseOfDeath(CoronerParameters parameters) {
if (causesOfDeath.TryGetValue(parameters.death, out var value)) {
Coroner.API.SetCauseOfDeath(parameters.player, (AdvancedCauseOfDeath)value);
Plugin.logger.LogInfo(parameters.death);
}
}
}
}