
NodeAPI
Version 2.0.0: massive update. NodeAPI is a BepInEx plugin that allows for easy creation of custom nodes. (Update to make it actually work for the normal version of the game)NodeAPI
NodeAPI is a BepInEx plugin that allows for easy creation of custom nodes. To use NodeAPI in your mod, just add it as a reference in your project. Custom node creation examples:
new NewNode("Nodes_Name_For_Code_Purposes", NewNode.MapNodeType.Other /*Can be NewNode.MapNodeType.Other or NewNode.MapNodeType.SpecialCardChoice*/, new List<Texture2D> { framesForMapAnimation }, typeof(NodeSequenceHandler), new List<NodeData.SelectionCondition> { nodeAppearancePrerequisites /*can be empty*/ }, new List<NodeData.SelectionCondition> { forceGenerationConditions /*conditions at which the node always generates instead of other nodes, can be empty*/ /*you can use something like new CustomPreviousNodesContent("Nodes_Name_For_Code_Purposes", false) (this type is built into nodeapi) for it to always generate once for debug*/ });
new NewNode<NodeSequenceHandler>("Nodes_Name_For_Code_Purposes", NewNode.MapNodeType.Other /*Can be NewNode.MapNodeType.Other or NewNode.MapNodeType.SpecialCardChoice*/, new List<Texture2D> { framesForMapAnimation }, new List<NodeData.SelectionCondition> { nodeAppearancePrerequisites /*can be empty*/ }, new List<NodeData.SelectionCondition> { forceGenerationConditions /*conditions at which the node always generates instead of other nodes, can be empty*/ /*you can use something like new CustomPreviousNodesContent("Nodes_Name_For_Code_Purposes", false) (this type is built into nodeapi) for it to always generate once for debug*/ });
new NewNode("Nodes_Name_For_Code_Purposes", NewNode.MapNodeType.Other /*Can be NewNode.MapNodeType.Other or NewNode.MapNodeType.SpecialCardChoice*/, new List<Texture2D> { framesForMapAnimation }, nodeSequencerPrefab, new List<NodeData.SelectionCondition> { nodeAppearancePrerequisites /*can be empty*/ }, new List<NodeData.SelectionCondition> { forceGenerationConditions /*conditions at which the node always generates instead of other nodes, can be empty*/ /*you can use something like new CustomPreviousNodesContent("Nodes_Name_For_Code_Purposes", false) (this type is built into nodeapi) for it to always generate once for debug*/ });
NodeSequenceHandler here would be a class that implements the INodeSequencer interface. There are already two built-in abstract classes that implement it: CustomSpecialNodeSequencer (for regular events) and CustomCardChoiceNodeSequencer (for card-based events). If you're using one of the built-in abstract types, just override the DoCustomSequence abstract method. You can also override the Inherit virtual method if you want to change your event sequencer object before the event actually starts. If you want to make a new class that implements INodeSequencer (for whatever reason), you need to implement the DoCustomSequence and Inherit methods (Inherit can be an empty method). Also, you don't have to manually return the player to the map after the event ends, NodeAPI does it for you.
nodeSequencerPrefab in the second example would be a prefab object with a INodeSequencer component added to it.
Installation
To use NodeAPI, put NodeAPI.dll inside of your BepInEx plugins folder. It also probably works for Thunderstore Mod Manager or r2modman but I don't know for sure (I don't use them)
Patch Notes
- 2.0.0 - Massive update: Instead of needing to inherit
CustomSpecialNodeSequencer, all custom node sequencers need to implement the newly-addedINodeSequencerinterface. Don't worryCustomSpecialNodeSequencerwasn't removed and stays mostly the same. Added a new built-in abstract sequencer type:CustomCardChoiceNodeSequencer. It inherits fromCardChoicesSequencer, allowing you to use all the handy methods likeSpawnCardsand more. Use it for custom events that spawn cards. Added the staticEasyAccesstype for quicker access to all base-game act 1 event sequencers. Added the new generic version ofNewNodethat allows you to give it the sequencer type as a generic argument instead of aType. Added the ability to giveNewNodeaGameObjectprefab with a sequencer component instead of a sequencerType. - 1.0.1 - Fixed a bug where NodeAPI would error if you tried to create a node in the non-kaycee's-mod version of the game.
- 1.0.0 - Released
NOTE: This mod was developed for Kaycee's Mod beta but it works for the normal game (this time for sure).