0% found this document useful (0 votes)
27 views

Cosmetics Guide 1

The document provides instructions for setting up a development environment for modding the PlateUp game, including installing Visual Studio and necessary components, creating a class library project, adding references, and creating a basic mod template with a custom cosmetic game object.

Uploaded by

favioagg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Cosmetics Guide 1

The document provides instructions for setting up a development environment for modding the PlateUp game, including installing Visual Studio and necessary components, creating a class library project, adding references, and creating a basic mod template with a custom cosmetic game object.

Uploaded by

favioagg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Code

To get started, the first thing you want to do is to setup your development environment.

We recommend Visual Studio as the IDE of choice and this tutorial will continue with the
assumption that you are using Visual Studio. Some alternatives include Rider for linux
development and Visual Studio Code for lightweight systems.

Here's a link to the community edition download of Visual Studio


https://visualstudio.microsoft.com/downloads/

Once you've installed the community edition installer, you need to now install the
individual components needed to mod PlateUp.

In the Workloads tab, make sure the following workloads are installed:
● .NET desktop development
● Game development with Unity
In the Individual components tab make sure these following components are installed:
● .NET Framework 4.7.2 targeting pack
● .NET Framework project and item templates

Once all of that is installed you're ready to make your first project.

First click Create a new project


Make sure to select Class Library (.NET Framework)
This is what it should look like. Pick a name for your project and where you'd like to
save it and you'll be good to proceed.
But! We're not ready to code yet. Now we need to set up references for this project. Go
to Tools, NuGet Package Manager, and Manage NuGet Packages for Solution…

Now search yariazen and install my nuget package. As long as your PlateUp game is
installed in a normal location, you won't run into any issues here. If you do encounter
any issues please ping me on discord.
Now in the Solution Explorer, delete the default class Class1.cs
Now make a new item, and name it Mod.cs. This will be the main part of your mod.
The following is a template for Mod.cs.
Make sure to leave the namespace of your file as is instead of copying this
namespace.
Here's an explanation on semantic versioning notation: https://semver.org/

using KitchenLib;
using KitchenLib.Logging;
using KitchenLib.Logging.Exceptions;
using KitchenMods;
using System.Linq;
using System.Reflection;
using UnityEngine;

namespace ClassLibrary1
{
internal class Mod : BaseMod, IModSystem
{
// GUID must be unique and is recommended to be in reverse
domain name notation
public const string MOD_GUID = "com.example.mymod";
// Mod Name is displayed to the player and listed in the mods
menu
public const string MOD_NAME = "My Mod";
// Mod Version must follow semver notation e.g. "1.2.3"
public const string MOD_VERSION = "0.1.0";
public const string MOD_AUTHOR = "My Name";
// Game version this mod is designed for in semver
// e.g. ">=1.1.3" current and all future
// e.g. ">=1.1.3 <=1.2.3" for all from/until
public const string MOD_GAMEVERSION = ">=1.1.7";

public static AssetBundle Bundle;


public static KitchenLogger Logger;

public Mod() : base(MOD_GUID, MOD_NAME, MOD_AUTHOR,


MOD_VERSION, MOD_GAMEVERSION, Assembly.GetExecutingAssembly()) { }

protected override void OnPostActivate(KitchenMods.Mod mod)


{
Bundle = mod.GetPacks<AssetBundleModPack>().SelectMany(e
=> e.AssetBundles).FirstOrDefault() ?? throw new
MissingAssetBundleException(MOD_GUID);
Logger = InitLogger();

AddGameData();
}

protected override void OnInitialise()


{
Logger.LogInfo($"{MOD_GUID} v{MOD_VERSION} in use!");
}

private void AddGameData()


{
Logger.LogInfo("Attempting to register game data...");

// AddGameDataObject<MyCustomGDO>();

Logger.LogInfo("Done loading game data.");


}
}
}
With that out of the way, we can now make a custom cosmetic.
For this, make a new item again, and name it after the cosmetic you'd like to make.
Here's another template.
Once again, make sure to leave the namespace of your file as is instead of
copying this namespace.
Here's another resource explaining CustomPlayerCosmetic:
https://wiki.plateupgame.com/en/Modding/LibraryMods/KitchenLib/GameDataObjects/C
ustomPlayerCosmetic

using KitchenData;
using KitchenLib.Customs;
using UnityEngine;

namespace ClassLibrary1
{
internal class ExampleOutfit : CustomPlayerCosmetic
{
public override string UniqueNameID => "ExampleOutfit";

public override CosmeticType CosmeticType =>


CosmeticType.Outfit;

public override GameObject Visual =>


Mod.Bundle.LoadAsset<GameObject>("ExampleOutfit");

public override void OnRegister(GameDataObject


gameDataObject)
{
// Apply Materials
}
}
}
Now we want to add this new GDO(Game Data Object) to the game. To do so, go back
to our Mod.cs file and find the AddGameData function and add this gdo to it.
The result should look something like this
private void AddGameData()
{
Logger.LogInfo("Attempting to register game data...");

AddGameDataObject<ExampleOutfit>();

Logger.LogInfo("Done loading game data.");


}

A couple of notes to keep in mind now. You may notice your CustomOutfit didn't have
materials applied to it on its OnRegister function. That's because KitchenLibrary
automatically applies materials if they're on your unity GameObject. If you run into any
issues with this process however, do message us on the discord.
To test your mod, you can just click Build and launch the game.

I think I covered the basics for the code here, anything else you get confused about let
me know!

You might also like