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

View File

@@ -8,9 +8,9 @@ public interface ILuaCsHook : ILuaPatcher, ILuaCsShim
{
// Event Services
[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.")]
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.
//bool Exists(string eventName, string identifier);
object Call(string eventName, params object[] args);

View File

@@ -103,7 +103,7 @@ public partial class EventService : IEventService
#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(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:.
Add(eventName, Random.Shared.NextInt64().ToString() ,callback);