This is the Survivalcraft 2 SuAPI (Sumod) development framework, used for creating your own third-party Mods.
The SDK for the development framework is based on .net8. If you wish to develop using this foundation, it is recommended to enable the .net8 workload in Visual Studio.
If you plan to use AI for development, please download the relevant skills and configuration information yourself.
Mod Installation Path
Android: /storage/emulated/0/download/Survivalcraft/Mods/
Windows: ./Mods/
Method for Disabling/Removing Mods:
Change the suffix from .scmod to .scmod.unint
To load a Mod into memory, the Modinfo.xml must be filled out correctly. Modinfo.xml must be placed in the root directory of the .scmod file.
[SuAPI] Night of Cold Rain (Tested for V0116).scmod
âââ Lib/
â âââ X64/
â â âââ RainWithoutDawn.dll
â âââ Arm64/
â âââ RainWithoutDawn.dll
âââ Content/
â âââ Textures/
âââ ModInfo.xml
ï»ż<?xml version="1.0" encoding="UTF-8"?>
<Mod>
<!-- Basic information about the Mod -->
<ModInfo>
<Identifier>RainWithoutDawn</Identifier>
<LocalizedName>
<Text lang="en_US">RainWithoutDawn</Text>
<Text lang="zh_CN">ć·éšć€</Text>
</LocalizedName>
<ModVersion>
<Version>1.0.0</Version>
<APIVersion>2.1.0</APIVersion>
</ModVersion>
<Asset>
<ContentRoot>Content</ContentRoot>
</Asset>
</ModInfo>
<!-- List of other dependent Mods -->
<Dependencies>
<!-- Example dependency (commented) -->
<!--
<Dependency>
<ModInfo>
<Identifier>RequiredMod1</Identifier>
<LocalizedName>
<Text lang="en_US">Required Mod 1</Text>
</LocalizedName>
<ModVersion>
<Version>2.3.0</Version>
<APIVersion>1.5.0</APIVersion>
</ModVersion>
</ModInfo>
</Dependency>
-->
</Dependencies>
</Mod>
The entry point for a Mod is the IMod interface. Providing this information in your Mod code will automatically load it into the program.
using SuMod;
using SuMod.Tools;
public class RainWithoutDawn: IMod
{
public string Name = "ć·éšć€";
public string Version = "1.0.1";
public IEnumerable<string> Dependencies = Array.Empty<string>();
public bool IsEnabled { get; set; } = true;
public void OnLoad(IModEventBus eventBus, IModInjector modInjector)
{
//modInjector.Register("Game.SubsystemTimeOfDay", );
eventBus.SubscribeEvent("GameDatabase.GameDatabase", args =>
{
; return HandleGameDatabase((Database)args[0]);
}, EventPriority.HIGHEST);
}
public void OnUnload()
{
Log.Information($"OnUnload");
}
public object[] HandleGameDatabase(Database database)
{
var subsystemTimeOfDay = database.FindDatabaseObject(new Guid("1e884b27-fc1d-486a-bd0e-518e554b9734"), database.FindDatabaseObjectType("Parameter", true), true);
subsystemTimeOfDay.Value = "RainWithoutDawn.RWDSubsystemTimeOfDay";
/* DatabaseObject ComponentTemplatemap = new DatabaseObject(database.FindDatabaseObjectType("ComponentTemplate", true), new Guid("387007A5-9269-1362-A0E7-DFEA4AC68E02"), "Map", null);
ComponentTemplatemap.Description = "";
ComponentTemplatemap.ExplicitInheritanceParent = database.FindDatabaseObject(new Guid("b05700ed-7e4e-4679-98f5-b597f421496b"), database.FindDatabaseObjectType("ComponentTemplate", true), true);
ComponentTemplatemap.NestingParent = database.FindDatabaseObject("Gameplay", database.FindDatabaseObjectType("Folder", true), true);
DatabaseObject Parameterclass = new DatabaseObject(database.FindDatabaseObjectType("Parameter", true), new Guid("B13D2D65-46A7-D038-8111-DE8FCBA58FBC"), "Class", "SurvivalcraftMiniMap.SuComponentMap");
Parameterclass.NestingParent = ComponentTemplatemap;
DatabaseObject databaseObject1 = new DatabaseObject(database.FindDatabaseObjectType("MemberComponentTemplate", true), new Guid("736FC2A9-9B0A-2E00-F7C8-95A4A6811FEE"), "Map", null);
databaseObject1.Description = "";
databaseObject1.ExplicitInheritanceParent = database.FindDatabaseObject(new Guid("387007A5-9269-1362-A0E7-DFEA4AC68E02"), database.FindDatabaseObjectType("ComponentTemplate", true), true);
databaseObject1.NestingParent = database.FindDatabaseObject("Player", database.FindDatabaseObjectType("EntityTemplate", true), true);*///Attach
Log.Information($"HandleDatabase");
return new object[] { true, database };
}
}
SuAPI Core
SurvivalcraftSuAPI: Survivalcraft 2 SuMod Development Framework, used for creating third-party Mods.
Mod Demo