Browse Source

NPort rename

tags/v0.0.1
NGnius (Graham) 3 years ago
parent
commit
7e250642b6
5 changed files with 54 additions and 77 deletions
  1. +0
    -52
      HelloModdingWorld/MyPlugin.cs
  2. +1
    -1
      NPort.sln
  3. +1
    -1
      NPort/NPort.csproj
  4. +43
    -0
      NPort/NPortPlugin.cs
  5. +9
    -23
      README.md

+ 0
- 52
HelloModdingWorld/MyPlugin.cs View File

@@ -1,52 +0,0 @@
using System.Reflection;

using IllusionPlugin;
//using GamecraftModdingAPI;

namespace HelloModdingWorld
{
public class MyPlugin : IEnhancedPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
{
public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // HelloModdingWorld by default
// To change the name, change the project's name

public override 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

// called when Gamecraft shuts down
public override void OnApplicationQuit()
{
// Shutdown this mod
GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");

// Shutdown the Gamecraft modding API last
GamecraftModdingAPI.Main.Shutdown();
}

// called when Gamecraft starts up
public override void OnApplicationStart()
{
// Initialize the Gamecraft modding API first
GamecraftModdingAPI.Main.Init();
// check out the modding API docs here: https://mod.exmods.org/

// Initialize this mod
// 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)
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.MetaLog($"{Name} has started up");
}

// unused methods

public override void OnFixedUpdate() { } // called once per physics update

public override void OnUpdate() { } // called once per rendered frame (frame update)
}
}

HelloModdingWorld.sln → NPort.sln View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloModdingWorld", "HelloModdingWorld\HelloModdingWorld.csproj", "{E0EEA15D-AB3C-4C73-A000-C49B5AE9EA66}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPort", "NPort\NPort.csproj", "{E0EEA15D-AB3C-4C73-A000-C49B5AE9EA66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

HelloModdingWorld/HelloModdingWorld.csproj → NPort/NPort.csproj View File

@@ -6,7 +6,7 @@
<Version>0.0.1</Version>
<Authors>Me</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://git.exmods.org/modtainers/HelloModdingWorld</PackageProjectUrl>
<PackageProjectUrl>https://git.exmods.org/NGnius/NPort</PackageProjectUrl>
<NeutralLanguage>en-CA</NeutralLanguage>
</PropertyGroup>


+ 43
- 0
NPort/NPortPlugin.cs View File

@@ -0,0 +1,43 @@
using System.Reflection;

using IllusionPlugin;
//using GamecraftModdingAPI;

namespace NPort
{
public class NPortPlugin : IEnhancedPlugin
{
public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name;
// To change the name, change the project's name

public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();

// called when Gamecraft shuts down
public override void OnApplicationQuit()
{
// Shutdown this mod
GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");

// Shutdown the Gamecraft modding API last
GamecraftModdingAPI.Main.Shutdown();
}

// called when Gamecraft starts up
public override void OnApplicationStart()
{
// Initialize the Gamecraft modding API first
GamecraftModdingAPI.Main.Init();
// check out the modding API docs here: https://mod.exmods.org/

// Initialize this mod

GamecraftModdingAPI.Utility.Logging.MetaLog($"{Name} has started up");
}

// unused methods

public override void OnFixedUpdate() { } // called once per physics update

public override void OnUpdate() { } // called once per rendered frame (frame update)
}
}

+ 9
- 23
README.md View File

@@ -1,35 +1,21 @@
# HelloModdingWorld
# NPort

Shell project for Techblox mods.
Use this as a quick-start project structure for your own mods, or to learn how modding works.
Stuff for importing things into Techblox.

## Setup

This project requires most of Techblox's `.dll` files to function correctly.
Most, but not all, of these files are stored in Techblox's `Techblox_Data/Managed` folder.
The project is pre-configured to look in a folder called ref in the solution's main directory or one level up from that.
Refer to [HelloModdingWorld's instructions](https://git.exmods.org/modtainers/HelloModdingWorld).

You can make sure HelloModdingWorld can find all of `.dll` files it needs by copying your Techblox folder here and renaming it to `ref`, but you'll have to re-copy it after every Techblox update.
You can also create a symbolic link (look it up) to your Techblox install folder named `ref` in this folder to avoid having to re-copy files.

For any mod to work, you will have to patch your game with [GCIPA](https://git.exmods.org/modtainers/GCIPA).
[Direct link to install guide](https://git.exmods.org/modtainers/GCIPA/src/branch/master/README.md#how-to-install).

This project also requires the [GamecraftModdingAPI](https://git.exmods.org/modtainers/GamecraftModdingAPI) library to be installed (in `ref/Plugins/GamecraftModdingAPI.dll`).
[Direct link to install guide](https://www.exmods.org/guides/install.html).

If you don't want to use the standard modding API,
you can remove the dependency by removing `<Reference Include="GamecraftModdingAPI"> ... </Reference>` in `HelloModdingWorld.csproj` and removing all mentions in `MyPlugin.cs`.
Some external libraries are also used, which should be installed seperately.

## Building

After you've completed the setup, open the solution file `HelloModdingWorld.sln` in your prefered C# .NET/Mono development environment.
I'd recommend Visual Studio Community Edition or JetBrains Rider for Windows and Monodevelop for Linux.
Refer to [HelloModdingWorld's instructions](https://git.exmods.org/modtainers/HelloModdingWorld).

If you've successfully completed setup, you should be able to build the HelloModdingWorld project without errors.
The build configuration should be automatically imported from the project's files.
If it doesn't work and you can't figure out why, ask for help on [our Discord server](https://discord.gg/xjnFxQV).
Some external libraries written in Rust are also used, which can be built by the standard Rust toolchain (`cargo build`).

## Installation

To install the HelloModdingWorld mod, copy the build's `HelloModdingWorld.dll` into the `Plugins` folder in Techblox's main folder.
Patch Techblox with the latest version of [GCIPA](https://git.exmods.org/modtainers/GCIPA) and install [GamecraftModdingAPI](https://git.exmods.org/modtainers/GamecraftModdingAPI) first.
Then, to install the NPort, download the latest release and put `NPort.dll` into Techblox's `Plugins` folder.
The next time Techblox is launched, NPort may automatically download any other required files.

Loading…
Cancel
Save