Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions managed/src/SwiftlyS2.Core/Modules/EntitySystem/EntitySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,18 @@ public CHandle<T> GetRefEHandle<T>( T entity ) where T : class, ISchemaClass<T>
public CCSGameRules? GetGameRules()
{
ThrowIfEntitySystemInvalid();
if (cachedGameRules != null)
if (cachedGameRules != null && cachedGameRulesProxy != null && cachedGameRulesProxy.IsValidEntity)
{
if (cachedGameRulesProxy != null && cachedGameRulesProxy.IsValidEntity)
{
return cachedGameRules;
} else
{
cachedGameRules = null;
cachedGameRulesProxy = null;
return null;
}
} else
return cachedGameRules;
}
cachedGameRules = null;
cachedGameRulesProxy = null;

if (GetAllEntitiesByClass<CCSGameRulesProxy>().FirstOrDefault() is CCSGameRulesProxy proxy)
{
if (GetAllEntitiesByClass<CCSGameRulesProxy>().FirstOrDefault() is CCSGameRulesProxy proxy)
{
cachedGameRulesProxy = proxy;
cachedGameRules = cachedGameRulesProxy.GameRules;
return cachedGameRules;
}
cachedGameRulesProxy = proxy;
cachedGameRules = cachedGameRulesProxy.GameRules;
return cachedGameRules;
}
return null;
}
Expand Down
Loading