- Added setting to disable lua scripts caching in the storage service for scenarios that use extern editors.
This commit is contained in:
@@ -9,5 +9,10 @@ namespace Barotrauma.LuaCs;
|
||||
public interface ILuaScriptLoader : IService, IScriptLoader, ISafeStorageValidation
|
||||
{
|
||||
void ClearCaches();
|
||||
/// <summary>
|
||||
/// Whether caching is enabled/disabled.
|
||||
/// </summary>
|
||||
/// <param name="useCaching"></param>
|
||||
void SetCachingPolicy(bool useCaching);
|
||||
Task<Result<ImmutableArray<(ContentPath Path, Result<string>)>>> CacheResourcesAsync(ImmutableArray<ILuaScriptResourceInfo> resourceInfos);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,20 @@ namespace Barotrauma.LuaCs
|
||||
_storageService?.PurgeCache();
|
||||
}
|
||||
|
||||
public void SetCachingPolicy(bool useCaching)
|
||||
{
|
||||
if (_storageService is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!useCaching)
|
||||
{
|
||||
_storageService.PurgeCache();
|
||||
}
|
||||
_storageService.UseCaching = useCaching;
|
||||
}
|
||||
|
||||
public async Task<Result<ImmutableArray<(ContentPath Path, Result<string>)>>> CacheResourcesAsync(ImmutableArray<ILuaScriptResourceInfo> resourceInfos)
|
||||
{
|
||||
IService.CheckDisposed(this);
|
||||
|
||||
Reference in New Issue
Block a user