Prerequisites:


Setting up the template mod:

  1. Decide on a place to keep your mods (e.g. Documents/Roguelands Modding).
  2. Go to https://github.com/SuperKael/Gadget-Core, click the Download Code button, then click Download ZIP. Then extract the GadgetCore.xml file inside the Release folder and copy it to the Roguelands_Data/Managed folder in your Roguelands install (which is usually somewhere like C:/Program Files (x86)/Steam/steamapps/common/Roguelands) so it's alongside GadgetCore.dll.
  3. From the same zip, extract the folder named TemplateGadgetMod and copy it into your modding folder (so for example your path would be Documents/Roguelands Modding/TemplateGadgetMod.
  4. Rename the TemplateGadgetMod folder and the TemplateGadgetMod.cs and TemplateGadgetMod.csproj within, and edit the contents of Manifest.ini to something more appropriate for your mod (e.g. BugFixMod, BugFixMod.cs, BugFixMod.csproj, BugFixMod, BugFixMod.dll).
  5. Follow the instruction in the README.txt file inside your mod's folder to set up GamePaths.xml. The ManagedFolder field should be Roguelands_Data/Managed/
  6. Open Visual Studio and choose Create a new project and select Blank Solution. The Location will be one folder above where you store your mods (e.g. Documents). The Solution Name will be the name for where you store your mods (e.g. Roguelands Modding). This should have the same spelling and capitalization so your solution file appears inside your modding folder. Click Create.
  7. There should be a panel named Solution Explorer on the right side of the window (if not, go to View -> Solution Explorer). Right click on the solution you just made in the Solution Explorer and go to Add -> Existing Project... and direct it to the .csproj file in your mod's folder (e.g. Documents/Roguelands Modding/BugFixMod/BugFixMod.csproj).
  8. Hit Ctrl+F to open the Find and Replace dialogue, change the tab to Replace in Files, set the Find text to TemplateGadgetMod and the Replace text to your mod's name without spaces (e.g. BugFixMod), then click Replace All. Then change the Find text to Template Gadget Mod and the Replace text to your mod's name (with or without spaces, e.g. BugFixMod or Bug Fix Mod).
  9. In the Solution Explorer, expand the Properties folder and double-click AssemblyInfo.cs to edit it. Change all the template stuff.

Creating your first mod

Now that you have your template mod set up you can modify it to do whatever you want.

You can include textures in your mod by creating a folder named Assets in your mod's folder (e.g. BugFixMod/Assets) and dropping .png files in there, then selecting them in the Solution Explorer in Visual Studio and setting Copy To Output Directory to Copy always or Copy if newer. You can then load these textures with GadgetCoreAPI.LoadTexture2D("FileName");

Most "normal" content can be added to the game via GadgetCore without needing to patch, by using GadgetCore's specific methods in your mod's Initialize method. See the examples below.

Items:
You can change the ItemType to create emblems, usables, armor, etc. swordUseTex here is the item texture that shows in your hand when equipped. The image itself is 64x64px but you mostly want to use the top right of the image; the image is centered on the player's hand. swordInventoryTex is the item texture in your inventory. The image itself is 32x32px but you should generally only use the middle 14x14 to fit in an inventory slot.
protected override void Initialize()
{
    Texture2D swordUseTex = GadgetCoreAPI.LoadTexture2D("SwordUse.png"); // equipped
    Texture2D swordInventoryTex = GadgetCoreAPI.LoadTexture2D("SwordInventory.png");
    var sword = new ItemInfo(ItemType.WEAPON, "Sword", "Scales with STR + FTH/2", swordInventoryTex, 20, new EquipStats(3, 2, 0, 0, 0, 2), HeldTex: swordUseTex);
    sword.SetWeaponInfo(new float[6] { 0, 1, 0, 0, 0, 0.5f }, (AudioClip)Resources.Load("au/i/i300")); // scaling and sound
    sword.Register("Sword");
    sword.OnAttack += sword.SwingSword; // you can replace this with your own attack coroutine
}
Combat Chips:
This code goes in the initialize method like in the previous example.
ChipInfo myChip = new ChipInfo(ChipType.ACTIVE, "Example Chip", "Description here", 8, exampleTexture);
myChip.Register("Example Chip");
myChip.OnUse += MyChip_OnUse;
Ship Tiles:
Enemies:
Planets: