r2mods/ilspy_dump/ror2_csproj/RoR2.Achievements/RescueTreebotAchievement.cs

43 lines
946 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using EntityStates.Treebot.UnlockInteractable;
namespace RoR2.Achievements;
[RegisterAchievement("RescueTreebot", "Characters.Treebot", null, 3u, typeof(RescueTreebotServerAchievement))]
public class RescueTreebotAchievement : BaseAchievement
{
public class RescueTreebotServerAchievement : BaseServerAchievement
{
public override void OnInstall()
{
base.OnInstall();
Unlock.onActivated += OnActivated;
}
public override void OnUninstall()
{
Unlock.onActivated -= OnActivated;
base.OnInstall();
}
private void OnActivated(Interactor interactor)
{
CharacterBody currentBody = serverAchievementTracker.networkUser.GetCurrentBody();
if ((bool)currentBody && currentBody.GetComponent<Interactor>() == interactor)
{
Grant();
}
}
}
public override void OnInstall()
{
base.OnInstall();
SetServerTracked(shouldTrack: true);
}
public override void OnUninstall()
{
base.OnUninstall();
}
}