feat: Entity.OnEvent now support resubscribing

This commit is contained in:
2023-05-25 11:28:18 +03:00
parent 907bd2611e
commit 6c441d9dee
+4 -2
View File
@@ -179,8 +179,10 @@ namespace Ragon.Client
if (_events.ContainsKey(eventCode)) if (_events.ContainsKey(eventCode))
{ {
RagonLog.Warn($"Event already {eventCode} subscribed"); _events.Remove(eventCode);
return; _localEvents.Remove(eventCode);
RagonLog.Warn($"Event already {eventCode} subscribed, removed old one!");
} }
_localEvents.Add(eventCode, (player, eventData) => { callback.Invoke(player, (TEvent) eventData); }); _localEvents.Add(eventCode, (player, eventData) => { callback.Invoke(player, (TEvent) eventData); });