Update to GamecraftModdingAPI v1.0

This commit is contained in:
NGnius (Graham) 2020-05-22 15:02:23 -04:00
parent ff64700784
commit 0cca5543c7
2 changed files with 24 additions and 16 deletions

View file

@ -11,7 +11,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="1.2.0.1" />
<PackageReference Include="Lib.Harmony" Version="2.0.0.10" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<!--Start Dependencies-->
@ -364,6 +368,14 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.CharacterVulnerability">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.CharacterVulnerabilityGui">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Effects">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
@ -392,6 +404,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.GUI.WorldSpaceGuis">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Tweaks">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
@ -780,7 +796,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<!--End Dependencies-->

View file

@ -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 <Version>0.0.1</Version> 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");
}