You are viewing a potentially older version of this package. View all versions.
jinxOAO-BuildBarTool-1.0.0 icon

BuildBarTool

Add a second row in build menu, allowing mod developers to bind their new items to the new row in build menu. 在建造菜单新增额外的一行,允许mod开发者将他们的新物品绑定在新的这行建造栏上。

Date uploaded 4 months ago
Version 1.0.0
Download link jinxOAO-BuildBarTool-1.0.0.zip
Downloads 923
Dependency string jinxOAO-BuildBarTool-1.0.0

This mod requires the following mods to function

xiaoye97-BepInEx-5.4.17 icon
xiaoye97-BepInEx

BepInEx5.4.17 mod plugin framework, Mod框架

Preferred version: 5.4.17
CommonAPI-DSPModSave-1.1.4 icon
CommonAPI-DSPModSave

Library that allows to store mod save data separately from vanilla saves

Preferred version: 1.1.4
xiaoye97-LDBTool-2.0.6 icon
xiaoye97-LDBTool

Library that allows mods to add and edit Proto data. Also allows you to see Proto data, config ID's of mod Protos and change localized strings

Preferred version: 2.0.6
CommonAPI-CommonAPI-1.6.3 icon
CommonAPI-CommonAPI

A modding library for Dyson Sphere Program. Currently is under development.

Preferred version: 1.6.3

README

BuildBarTool / 建造栏工具

This mod add a new row to the build menu. MOD developers can bind their new items to the buttons in this new row.

这个mod添加了一行新的建造栏供mod开发者和玩家使用。

image.png

Examples -- For MOD Developers / 使用示例 -- 给MOD开发者

using BuildBarTool;

[BepInPlugin(GUID, NAME, VERSION)] // your mod info 你的mod信息
[BepInDependency(BuildBarToolPlugin.GUID)] // add this mod as hard dependency 将此mod作为你mod的依赖
public class YourPlugin : BaseUnityPlugin
{   
    void Start()
    {
        // ********* Anything you do to register new items. 
		
        BuildBarTool.SetBuildBar(3, 4, 9554, true); 
        // for example, item 9554 will be bound to the button in the red circle (index 4 of top row) in category 3. 
        // "true" means the item will be bound to the top row (red square).
        // 把物品9554绑定到红圈所示的按钮上。 true 代表着绑定在第二行上(红框所示)
    }
	
    public static void MethodThatYouRegisterYourItems()
    {
        // ItemProto yourItem;
        // ******** Anything you do to register your items by CommonAPI or LDBTool.
		
        yourItem.SetBuildBar(3, 4, true); 
        // This is another way you can bind your item to the build bar. 你也可以使用这另一种方法。
        // DONNOT USE LDB.items.Select(id) to select an ItemProto to bind build bar. 绝不要使用LDB.items.Select(id)来获取ItemProto进行绑定。
    }
}

You can simply set your itemProto's buildIndex = category × 100 + index + 20, without adding this mod to your mod's hard dependency or using BuildBarTool;. In this case, only the players who has installed BuildBarTool will automatically bind that item to the buttons in the top row. Those who doesn't install the BuildBarTool can still play your mod.

你也可以直接把itemProto的buildIndex设置成category × 100 + index + 20,而不需要using BuildBarTool;,也不需要把此mod作为前置mod。若如此做,任何安装了此mod的玩家可以自动将该物品绑定到对应的第二行建造菜单上,未安装此mod的玩家也可以正常使用你的mod。

yourItem.buildIndex = 324; 
// This is another way you can bind your item to the button in the red circle (index 4 of top row) in category 3.

Compatibility -- AND FOR PLAYERS / 兼容性 -- 以及致玩家

This mod is compatible with RebindBuildBar, and with that mod, players can customize their own build bar, even for the buttons in the top row.
此mod与RebindBuildBar 兼容,同时安装这两个mod允许玩家自定义建造菜单(包括第二行)。