Skip to content

Commit 1bd3f13

Browse files
committed
- Changed event aliases to be case insensitive.
1 parent e3b2b34 commit 1bd3f13

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/EventService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public partial class EventService : IEventService
2424
public TypeStringKey(Type type)
2525
{
2626
Type = type ?? throw new ArgumentNullException(nameof(type));
27-
TypeName = type.Name;
27+
TypeName = type.Name.ToLowerInvariant();
2828
HashCode = TypeName.GetHashCode();
2929
}
3030

3131
public TypeStringKey(string typeName)
3232
{
3333
Type = null;
34-
TypeName = typeName ?? throw new ArgumentNullException(nameof(typeName));
34+
TypeName = typeName?.ToLowerInvariant() ?? throw new ArgumentNullException(nameof(typeName));
3535
HashCode = TypeName.GetHashCode();
3636
}
3737

@@ -56,7 +56,7 @@ public int GetHashCode(TypeStringKey obj)
5656
private readonly AsyncReaderWriterLock _operationsLock = new();
5757
private readonly ConcurrentDictionary<TypeStringKey, ConcurrentDictionary<OneOf<IEvent, string>, IEvent>> _subscribers = new();
5858
private readonly ConcurrentDictionary<TypeStringKey, (TypeStringKey Event, Func<LuaCsFunc, IEvent> RunnerFactory)> _luaAliasEventFactory = new();
59-
private readonly ConcurrentDictionary<string, ConcurrentDictionary<string, LuaCsFunc>> _luaLegacyEventsSubscribers = new();
59+
private readonly ConcurrentDictionary<TypeStringKey, ConcurrentDictionary<TypeStringKey, LuaCsFunc>> _luaLegacyEventsSubscribers = new();
6060
private readonly ConcurrentDictionary<IEventService, IEventService> _subscribedEventDispatchers = new();
6161

6262
#region LifeCycle
@@ -118,7 +118,7 @@ public void Add(string eventName, string identifier, LuaCsFunc callback, object
118118
}
119119
else
120120
{
121-
var eventSubs = _luaLegacyEventsSubscribers.GetOrAdd(eventName, key => new ConcurrentDictionary<string, LuaCsFunc>());
121+
var eventSubs = _luaLegacyEventsSubscribers.GetOrAdd(eventName, key => new ConcurrentDictionary<TypeStringKey, LuaCsFunc>());
122122
eventSubs[identifier] = callback;
123123
}
124124
}

0 commit comments

Comments
 (0)