-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMod.cs
More file actions
89 lines (74 loc) · 2.97 KB
/
Copy pathMod.cs
File metadata and controls
89 lines (74 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using p5rpc.flowscriptframework.Configuration;
using p5rpc.flowscriptframework.FixScriptPrintFuncs;
using p5rpc.flowscriptframework.interfaces;
using p5rpc.flowscriptframework.Template;
using Reloaded.Hooks.ReloadedII.Interfaces;
using Reloaded.Mod.Interfaces;
namespace p5rpc.flowscriptframework;
/// <summary>
/// Your mod logic goes here.
/// </summary>
public class Mod : ModBase, IExports // <= Do not Remove.
{
/// <summary>
/// Provides access to the mod loader API.
/// </summary>
private readonly IModLoader _modLoader;
/// <summary>
/// Provides access to the Reloaded.Hooks API.
/// </summary>
/// <remarks>This is null if you remove dependency on Reloaded.SharedLib.Hooks in your mod.</remarks>
private readonly IReloadedHooks? _hooks;
/// <summary>
/// Provides access to the Reloaded logger.
/// </summary>
private readonly ILogger _logger;
/// <summary>
/// Entry point into the mod, instance that created this class.
/// </summary>
private readonly IMod _owner;
/// <summary>
/// Provides access to this mod's configuration.
/// </summary>
private Config _configuration;
/// <summary>
/// The configuration of the currently executing mod.
/// </summary>
private readonly IModConfig _modConfig;
private readonly FlowscriptFramework _flowscriptFramework;
private readonly FixPUTFuncs _fixScriptPrintFuncs;
public Mod(ModContext context)
{
_modLoader = context.ModLoader;
_hooks = context.Hooks;
_logger = context.Logger;
_owner = context.Owner;
_configuration = context.Configuration;
_modConfig = context.ModConfig;
// For more information about this template, please see
// https://reloaded-project.github.io/Reloaded-II/ModTemplate/
// If you want to implement e.g. unload support in your mod,
// and some other neat features, override the methods in ModBase.
// TODO: Implement some mod logic
Utils.Utils.Initialize(context);
_flowscriptFramework = new FlowscriptFramework(_hooks);
_modLoader.AddOrReplaceController<IFlowFramework>(_owner, new FlowscriptFrameworkApi(_flowscriptFramework, FlowApi.Initialize(_hooks)));
if (_configuration.FixScriptPrintFuncs)
_fixScriptPrintFuncs = new(_modLoader, _logger);
}
#region Standard Overrides
public override void ConfigurationUpdated(Config configuration)
{
// Apply settings from configuration.
// ... your code here.
_configuration = configuration;
_logger.WriteLine($"[{_modConfig.ModId}] Config Updated: Applying");
}
public Type[] GetTypes() => new[] { typeof(IFlowFramework) };
#endregion
#region For Exports, Serialization etc.
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public Mod() { }
#pragma warning restore CS8618
#endregion
}