Replicate old Add() method signature structure

This commit is contained in:
Evil Factory
2026-03-28 14:14:11 -03:00
parent b358882016
commit 958335a01c
2 changed files with 4 additions and 4 deletions
@@ -8,9 +8,9 @@ public interface ILuaCsHook : ILuaPatcher, ILuaCsShim
{ {
// Event Services // Event Services
[Obsolete("ACsMod is deprecated. Use ILuaEventService.Add() instead.")] [Obsolete("ACsMod is deprecated. Use ILuaEventService.Add() instead.")]
void Add(string eventName, string identifier, LuaCsFunc callback); void Add(string eventName, string identifier, LuaCsFunc callback, object owner = null);
[Obsolete("ACsMod is deprecated. Use ILuaEventService.Add() instead.")] [Obsolete("ACsMod is deprecated. Use ILuaEventService.Add() instead.")]
void Add(string eventName, LuaCsFunc callback); void Add(string eventName, LuaCsFunc callback, object owner = null);
// Does anyone use this? TODO: Analyze old Lua mods for usage scenarios. // Does anyone use this? TODO: Analyze old Lua mods for usage scenarios.
//bool Exists(string eventName, string identifier); //bool Exists(string eventName, string identifier);
object Call(string eventName, params object[] args); object Call(string eventName, params object[] args);
@@ -103,7 +103,7 @@ public partial class EventService : IEventService
#region LuaEventSystem #region LuaEventSystem
public void Add(string eventName, string identifier, LuaCsFunc callback) public void Add(string eventName, string identifier, LuaCsFunc callback, object owner = null)
{ {
Guard.IsNotNullOrWhiteSpace(eventName, nameof(eventName)); Guard.IsNotNullOrWhiteSpace(eventName, nameof(eventName));
Guard.IsNotNullOrWhiteSpace(identifier, nameof(identifier)); Guard.IsNotNullOrWhiteSpace(identifier, nameof(identifier));
@@ -123,7 +123,7 @@ public partial class EventService : IEventService
} }
} }
public void Add(string eventName, LuaCsFunc callback) public void Add(string eventName, LuaCsFunc callback, object owner = null)
{ {
// random ident, we hope for no conflicts :barodev:. // random ident, we hope for no conflicts :barodev:.
Add(eventName, Random.Shared.NextInt64().ToString() ,callback); Add(eventName, Random.Shared.NextInt64().ToString() ,callback);