r2mods/ilspy_dump/ror2_csproj/RoR2/ArtifactEnabler.cs

30 lines
681 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
using UnityEngine.Networking;
namespace RoR2;
public class ArtifactEnabler : MonoBehaviour
{
[SerializeField]
private ArtifactDef artifactDef;
private bool artifactWasEnabled;
private void OnEnable()
{
if (NetworkServer.active && (bool)artifactDef)
{
artifactWasEnabled = RunArtifactManager.instance.IsArtifactEnabled(artifactDef);
RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, newEnabled: true);
}
}
private void OnDisable()
{
if (NetworkServer.active && (bool)artifactDef && (bool)RunArtifactManager.instance)
{
RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, artifactWasEnabled);
}
}
}