r2mods/ilspy_dump/ror2_csproj/RoR2.Artifacts/FriendlyFireArtifactManager.cs

32 lines
925 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using System;
namespace RoR2.Artifacts;
public static class FriendlyFireArtifactManager
{
private static ArtifactDef myArtifact => RoR2Content.Artifacts.friendlyFireArtifactDef;
[SystemInitializer(new Type[] { typeof(ArtifactCatalog) })]
private static void Init()
{
RunArtifactManager.onArtifactEnabledGlobal += OnArtifactEnabledGlobal;
RunArtifactManager.onArtifactDisabledGlobal += OnArtifactDisabledGlobal;
}
private static void OnArtifactEnabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
{
if (!(artifactDef != myArtifact))
{
FriendlyFireManager.friendlyFireMode = FriendlyFireManager.FriendlyFireMode.FriendlyFire;
}
}
private static void OnArtifactDisabledGlobal(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
{
if (!(artifactDef != myArtifact))
{
FriendlyFireManager.friendlyFireMode = FriendlyFireManager.FriendlyFireMode.Off;
}
}
}