Skip to content

Quick Start Guide

Tobey Blaber edited this page Sep 14, 2020 · 14 revisions

SMLHelper V2 Quick Start Guide


Here you will find a quick listing of all the classes and namespaces provided by SMLHelper V2 for your mods to use.


Class Access Namespace Summary
Handlers
TechTypeHandler static SMLHelper.V2.Handlers Registers New Techtypes and check for Modded TechTypes
SpriteHandler static SMLHelper.V2.Handlers Manages in-game sprites from both new and existing assets
PrefabHandler static SMLHelper.V2.Handlers Registers your ModPrefab for your new GameObject to the game world
OptionsPanelHandler static SMLHelper.V2.Handlers Registers your ModOptions for handling mod configs in game's pause menu
LanguageHandler static SMLHelper.V2.Handlers Registers new keyed text entries
KnownTechHandler static SMLHelper.V2.Handlers Configures how and when craftable GameObjects are unlocked
PDAHandler static SMLHelper.V2.Handlers Manages add/editing Scanner entries
CraftTreeHandler static SMLHelper.V2.Handlers Edit crafting trees or create new ones
CraftDataHandler static SMLHelper.V2.Handlers Sets recipes and other properties that involved with new GameObject instances
BioReactorHandler static SMLHelper.V2.Handlers Sets energy outputs of GameObjects in the Bioreactor
FishHandler static SMLHelper.V2.Handlers Manages registering of fish GameObjects into the game
ItemActionHandler static SMLHelper.V2.Handlers Manages registering your custom middle click actions for items
LootDistributionHandler static SMLHelper.V2.Handlers Manages adding and altering the Loot Distribution of the game
WorldEntityDatabaseHandler static SMLHelper.V2.Handlers Manages adding custom gameobject data into the World Entity Database for use in the LootDistributionHandler
PDAEncyclopediaHandler static SMLHelper.V2.Handlers Manages adding custom Encyclopedia entries
PingHandler static SMLHelper.V2.Handlers Manages adding custom beacon icons
IngameMenuHandler static SMLHelper.V2.Handlers Register Custom events that happen when a player saves or quits
ConsoleCommandsHandler static SMLHelper.V2.Handlers Register methods that respond to custom console commands entered by users
Crafting
TechData new SMLHelper.V2.Crafting Represents an in-game crafting recipe
RecipeData new SMLHelper.V2.Crafting Equals TechData but for BelowZero instead.
ModCraftTreeNode instance SMLHelper.V2.Crafting Starts a new custom craft tree when created from CraftTreeHandler
Assets
ModPrefab inherit SMLHelper.V2.Assets Inherit this and pass it to the PrefabHandler to add your own Unity Prefabs
Spawnable inherit SMLHelper.V2.Assets Inherits from ModPrefab
PdaItem inherit SMLHelper.V2.Assets Inherits from Spawnable
Buildable inherit SMLHelper.V2.Assets Inherits from PdaItem
CustomFabricator inherit SMLHelper.V2.Assets Inherits from Buildable
Craftable inherit SMLHelper.V2.Assets Inherits from PdaItem
Equipable inherit SMLHelper.V2.Assets Inherits from Craftable
Options and Utilities
ConfigFile inherit SMLHelper.V2.Json Inherit this and add fields/properties and call Load()/Save() to create a config.json file
ModOptions inherit SMLHelper.V2.Options Inherit this and pass it to the OptionsPanelHandler to add your in-game options
ReflectionHelper static SMLHelper.V2.Utility Provides extension methods for simple Reflection calls
ImageUtils static SMLHelper.V2.Utility Loads external images into Unity formats
SaveUtils static SMLHelper.V2.Utility Provides save game directory paths
JsonUtils static SMLHelper.V2.Utility Provides helper methods for working with JSON files
AudioUtils static SMLHelper.V2.Utility Create and Play Custom Sounds from .wav files
PlayerPrefsExtra static SMLHelper.V2.Utility Utility methods that simplify calls into PlayerPrefs for quick custom save data
SaveUtils static SMLHelper.V2.Utility Provides save game directory paths
Attributes
ConsoleCommandAttribute attribute SMLHelper.V2.Commands Decorate a public static method with this attribute and pass its enclosing type to ConsoleCommandsHandler to register it as a console command
MenuAttribute attribute SMLHelper.V2.Options.Attributes Decorate a ConfigFile class with this attribute and pass its type to the OptionsPanelHandler to generate an in-game options menu from its members
ConfigFileAttribute attribute SMLHelper.V2.Json Can be used in conjunction with MenuAttribute to change the filename/path of the generated config file
ButtonAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member method of a ConfigFile with this attribute to specify it represents a ModButtonOption
ChoiceAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member field/property of a ConfigFile with this attribute to specify it represents a ModChoiceOption
KeybindAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member field/property of a ConfigFile with this attribute to specify it represents a ModKeybindOption
SliderAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member field/property of a ConfigFile with this attribute to specify it represents a ModSliderOption
ToggleAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member field/property of a ConfigFile with this attribute to specify it represents a ModToggleOption
OnChangeAttribute attribute SMLHelper.V2.Options.Attributes Decorate a member field/property of a ConfigFile with this attribute to specify the name of a method to call whenever the member's value changes