From 0cca5543c79ba358be9acae1b7837f48f445c638 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Fri, 22 May 2020 15:02:23 -0400 Subject: [PATCH] Update to GamecraftModdingAPI v1.0 --- HelloModdingWorld/HelloModdingWorld.csproj | 19 +++++++++++++++++-- HelloModdingWorld/MyPlugin.cs | 21 +++++++-------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/HelloModdingWorld/HelloModdingWorld.csproj b/HelloModdingWorld/HelloModdingWorld.csproj index e3b07b4..4488e3f 100644 --- a/HelloModdingWorld/HelloModdingWorld.csproj +++ b/HelloModdingWorld/HelloModdingWorld.csproj @@ -11,7 +11,11 @@ - + + + + + @@ -364,6 +368,14 @@ ..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll + + ..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll + ..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll @@ -392,6 +404,10 @@ ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll + + ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll + ..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll @@ -780,7 +796,6 @@ ..\ref\Gamecraft_Data\Managed\VisualProfiler.dll ..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll - diff --git a/HelloModdingWorld/MyPlugin.cs b/HelloModdingWorld/MyPlugin.cs index 57bc909..d8749b6 100644 --- a/HelloModdingWorld/MyPlugin.cs +++ b/HelloModdingWorld/MyPlugin.cs @@ -1,8 +1,7 @@ using System.Reflection; using IllusionPlugin; -// using GamecraftModdingAPI; -using GamecraftModdingAPI.Commands; +//using GamecraftModdingAPI; namespace HelloModdingWorld { @@ -14,8 +13,6 @@ namespace HelloModdingWorld public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default // To change the version, change 0.0.1 in HelloModdingWorld.csproj - private static readonly string helloWorldCommandName = "HelloWorld"; // command name - // called when Gamecraft shuts down public void OnApplicationQuit() { @@ -34,18 +31,14 @@ namespace HelloModdingWorld // check out the modding API docs here: https://mod.exmods.org/ // Initialize this mod - // create SimpleCustomCommandEngine + // create HelloWorld command // this writes "Hello modding world!" when you execute it in Gamecraft's console // (use the forward-slash key '/' to open the console in Gamecraft when in a game) - SimpleCustomCommandEngine helloWorldCommand = new SimpleCustomCommandEngine( - () => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); }, // command action - // also try using CommandLogWarning or CommandLogError instead of CommandLog - helloWorldCommandName, // command name (used to invoke it in the console) - "Says Hello modding world!" // command description (displayed when help command is executed) - ); // this command can also be executed using the Command Computer - - // register the command so the modding API knows about it - CommandManager.AddCommand(helloWorldCommand); + GamecraftModdingAPI.Commands.CommandBuilder.Builder() + .Name("HelloWorld") // command name (used to invoke it in the console) + .Description("Says Hello modding world!") // command description (displayed in help and hint toolbar) + .Action(() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); }) + .Build(); // construct and automatically register the command so the modding API knows about it GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up"); }