Coding custom entities - FujiAPI/Fuji GitHub Wiki

This article explains how to code custom entities into the game.

[!CAUTION] Since Fuji is still in active development, support for custom entities is still rough around the edges. Please only follow this guide if you're comfortable with things not working as expected.

Writing the code

  • Make a new C# .net 8.0 class library
  • Add a reference to the Celeste64.dll file from Fuji.
  • Make a new C# class and have it extend from the GameMod class from the Celeste64.dll library. You probably need to add using Celeste64; to the top as well.
  • In the gamemod class, override the OnModLoaded function, and add a call to the AddActorFactory function to register your custom collectible as an actor in the game.
{
    AddActorFactory("SuperStrawberry", new Map.ActorFactory((Map map, SledgeEntity entity) =>
        {
            return new SuperStrawberry();
        }
    ));
}
  • Make your new Collectible as a separate class. Make sure it extends the proper Actor class and interrfaces too.
  • When that's all ready, build your solution. Go to the bin folder where it generated it the dll, and copy it to a new DLLs folder in your mod.

Adding Trenchbroom definitions

  • Make a copy of the Celeste64.fgd file under the Content folder in fuji
  • Add a new point class that defines your collectible. You can use one of the existing ones as an example.
  • In trenchbroom, set it up to point to your new custom fgd file. and reload it
  • From there you should be able to right click in the map and click Create Point Entity, and add your custom entity.
  • Note the model probably won't load properly in trenchbroom, but that's fine.

Testing your entity

  • Save your map to your mod's Maps folder
  • Make a new Levels.json file pointing to your map (you can copy the basegame one and edit it)
  • Load the game, and hopefully it will work 🤞