Example mods
Working example mods to learn from.
Complete example mods that come with the game's docs. Each one is a working mod: copy it, change it, learn from it.
- Ban Hammer: The host can ban players (kept out when they try to join). Console: ban, unban, bans.
- Berry Jam: Adds berry jam (crafted from blueberries and a clay pot) and lets rope stack to 50.
- Hello Mod: Code mod tour: lifecycle logs, console commands hello / hello.ping / hello.beacon / hello.stats, host-player messages, a network prefab, game events and world data.
- Town Life: NPCs carry lanterns about in the evening, tell you about animals nearby, and pigs follow anyone holding a carrot.
- Trader Compass: Wandering traders near you show on the compass. Range on Settings ▸ Mods. Console: traders.
- Volcano Island: A new world type (New World > World): an island with a volcano, a crater lake, ash fields and lava-tube caves. Viggo sells sulfur.
- Waypoint Map: M opens a map; click for waypoints (Shift+click: shared with everyone). Waypoints show on the compass.
Mod.props
The code examples' project files import this shared file. Put it one folder above the example's folder.
<Project>
<!--
Shared build settings for the example code mods (each .csproj imports this).
Builds bin/<ModFolder>/ = the mod's DLL + mod.json: copy that folder into the game's Mods folder.
GameManaged = the game's managed DLLs:
- a game build: "<game folder>/Seeds & Circuits_Data/Managed" (has everything)
- the editor: the project's Library/ScriptAssemblies (the default), plus
UnityManaged = "<Unity>/Editor/Data/Managed/UnityEngine" for Unity's own modules.
dotnet build -c Release -p:GameManaged="C:/Games/Seeds & Circuits/Seeds & Circuits_Data/Managed"
-->
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>9</LangVersion>
<Nullable>disable</Nullable>
<OutputPath>bin/$(ModFolder)/</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateDependencyFile>false</GenerateDependencyFile>
<DebugType>portable</DebugType>
<GameManaged Condition="'$(GameManaged)' == ''">$(MSBuildThisFileDirectory)../../../Library/ScriptAssemblies</GameManaged>
<UnityManaged Condition="'$(UnityManaged)' == '' and Exists('C:/Program Files/Unity/Hub/Editor/6000.6.3f1/Editor/Data/Managed/UnityEngine')">C:/Program Files/Unity/Hub/Editor/6000.6.3f1/Editor/Data/Managed/UnityEngine</UnityManaged>
<!-- No Unity installed: a game build's Managed folder has Unity's modules too. -->
<UnityManaged Condition="'$(UnityManaged)' == ''">$(GameManaged)</UnityManaged>
</PropertyGroup>
<ItemGroup>
<!-- Private=false: the game already has these, so the mod folder only gets the mod's own DLL. -->
<Reference Include="$(GameManaged)/SeedsAndCircuits.*.dll" Private="false" />
<Reference Include="$(GameManaged)/Unity.*.dll" Private="false" />
<Reference Include="$(GameManaged)/UnityEngine.UI.dll" Private="false" />
<!-- Unity's modules (UnityEngine.*.dll; not the UnityEngine.dll facade, which duplicates them). -->
<Reference Include="$(UnityManaged)/UnityEngine.*.dll" Exclude="$(UnityManaged)/UnityEngine.UI.dll" Private="false" />
</ItemGroup>
<ItemGroup>
<None Include="mod.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>