This commit is contained in:
2026-04-25 23:33:11 +02:00
commit 324a5b0aae
84 changed files with 23020 additions and 0 deletions
@@ -0,0 +1,40 @@
using IntoTheAbyss.Events;
using IntoTheAbyss.Runtime.Scripts;
using RPGCore.Core.Objects;
using RPGCore.ObjectModules.EventObjectModule;
using RPGCore.StatusEffect.ObjectModules.StatusObjectModule;
using RPGCoreCommon.Settings;
namespace IntoTheAbyss.ObjectExtensions
{
public static class BaseObjectExtensions
{
/// <summary>Try to kill this object.</summary>
public static void Death(this BaseObject obj)
{
var deathStatusDefinitionSO = SettingsManager.Get<IntoTheAbyssSettings>().deathStatusDefinitionSO;
if (obj.GetComponent<StatusModule>().Check(deathStatusDefinitionSO)) return;
var deathEvent = new DeathEvent { target = obj };
obj.events.InvokeBefore(deathEvent);
if (deathEvent.isPrevented) return;
obj.GetComponent<StatusModule>().Apply(deathStatusDefinitionSO);
obj.events.InvokeAfter(deathEvent);
}
/// <summary>Try to revive this object.</summary>
public static void Revive(this BaseObject obj)
{
var deathStatusDefinitionSO = SettingsManager.Get<IntoTheAbyssSettings>().deathStatusDefinitionSO;
if (obj.GetComponent<StatusModule>().Check(deathStatusDefinitionSO) == false) return;
var reviveEvent = new ReviveEvent { target = obj };
obj.events.InvokeBefore(reviveEvent);
if (reviveEvent.isPrevented) return;
obj.GetComponent<StatusModule>().Remove(deathStatusDefinitionSO);
obj.events.InvokeAfter(reviveEvent);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 35f9d19d383e43269ac36578ef76eb05
timeCreated: 1767397492