Alexius25.ChipLibrary
1.4.0
dotnet add package Alexius25.ChipLibrary --version 1.4.0
NuGet\Install-Package Alexius25.ChipLibrary -Version 1.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alexius25.ChipLibrary" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alexius25.ChipLibrary" Version="1.4.0" />
<PackageReference Include="Alexius25.ChipLibrary" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alexius25.ChipLibrary --version 1.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Alexius25.ChipLibrary, 1.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alexius25.ChipLibrary@1.4.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alexius25.ChipLibrary&version=1.4.0
#tool nuget:?package=Alexius25.ChipLibrary&version=1.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Chip Creation Guide
Reference Library
Chip Library is available either as a dll or through nuget. You need to reference it in your project to create custom chips.
dotnet add package Alexius25.ChipLibrary
Step 1
Make a class that inherits from ChipBase.cs:
public class TestChipMono : ChipBase
{
public override bool UsesUpdate => true; // Set to true if you want to use the EquippedUpdate method
public override void OnEquip()
{
// Call the base method
base.OnEquip();
// Code to execute when the chip is equipped
}
public override void OnUnequip()
{
// Call the base method
base.OnUnequip();
// Code to execute when the chip is unequipped
}
public override void EquippedUpdate()
{
// Code to execute every frame while the chip is equipped
}
}
Notes:
- The
ChipBaseclass itself inherits fromMonoBehaviour, so you can use all Unity lifecycle methods (e.g.,Start,Update) in your chip class. - Override the
OnEquipandOnUnequipmethods to define behavior when the chip is equipped or unequipped.
Step 2
Create your item prefab:
public static class TestChip
{
public static void Register()
{
var prefab = new CustomPrefab("TestChip", "Test Chip",
"A test chip for demonstration purposes.");
prefab.SetEquipment(EquipmentType.Chip);
prefab.SetGameObject(new CloneTemplate(prefab.Info, TechType.ComputerChip));
prefab.Register();
// Register the Class you created previously with the techtype of the item
ChipHandler.RegisterChip<TestChipMono>(prefab.Info.TechType);
}
}
Note:
- You can put these two snippets in the same file if you prefer.
Step 3
Register your chip during the mod initialization:
using BepInEx;
using BepInEx.Logging;
namespace TestChip;
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.alexius25.chiplibrary")]
public class Main : BaseUnityPlugin
{
private new static ManualLogSource Logger { get; private set; }
private void Awake()
{
// set project-scoped logger instance
Logger = base.Logger;
TestChip.Register();
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
}
}
Note:
- You need to add a dependency on ChipLibrary in your BepInEx plugin attributes. (
[BepInDependency("com.alexius25.chiplibrary")]) and users have to install ChipLibrary for your mod to work.
Final Notes
- An Example mod is available on GitHub for reference.
- Available Debug Commands can help you test your chip in-game.
- Events are also available for more advanced functionality; see the Events Documentation for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- BepInEx.Core (>= 5.4.21)
- BepInEx.PluginInfoProps (>= 1.1.0)
- PolySharp (>= 1.15.0)
- Subnautica.GameLibs (>= 82304.0.0-r.0)
- Unity.InputSystem (>= 1.4.1)
- UnityEngine.Modules (>= 2019.4.36)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.