Add Logger property for resource script

This commit is contained in:
Sardelka
2022-07-14 16:44:35 +08:00
parent 2a29011015
commit e10a0f5415
3 changed files with 15 additions and 0 deletions

View File

@ -27,5 +27,10 @@ namespace RageCoop.Client.Scripting
/// </summary>
public ClientResource CurrentResource { get; internal set; }
/// <summary>
/// Eqivalent of <see cref="ClientResource.Logger"/> in <see cref="CurrentResource"/>
/// </summary>
public Core.Logger Logger { get { return CurrentResource.Logger; } }
}
}

View File

@ -30,6 +30,11 @@ namespace RageCoop.Client.Scripting
/// Get the <see cref="ResourceFile"/> where this script is loaded from.
/// </summary>
public Dictionary<string, ResourceFile> Files { get; internal set; } = new Dictionary<string, ResourceFile>();
/// <summary>
/// A <see cref="Core.Logger"/> instance that can be used to debug your resource.
/// </summary>
public Logger Logger { get; internal set; }
}
internal class Resources
{

View File

@ -31,6 +31,11 @@ namespace RageCoop.Server.Scripting
/// Get the <see cref="ResourceFile"/> that the script belongs to.
/// </summary>
public ResourceFile CurrentFile { get; internal set; }
/// <summary>
/// Eqivalent of <see cref="ServerResource.Logger"/> in <see cref="CurrentResource"/>
/// </summary>
public Core.Logger Logger { get { return CurrentResource.Logger; } }
}
/// <summary>
/// Decorate your method with this attribute and use <see cref="API.RegisterCommands{T}"/> or <see cref="API.RegisterCommands(object)"/> to register commands.