Jump to content

Need Help with actions priority for my mod

Recommended Posts

So I've been working on a mod, it basically adds component functionality to the miner helmet, and allows you to store bulbs inside,

by making it a container however, it has lost the ability to take in fireflies as fuel, the tooltip action for fireflies is only to store it inside,

i tried accessing the actions.lua to give adding fuel a higher priority, but my game just crashes, if anyone knows how to correctly change the priority of actions, if that is even allowed that would be pretty useful.

if there is a totally different solution please let me know,

Thanks in advance



here is my modmain:

GLOBAL.setmetatable(env, {
    __index = function(t, k)
        return GLOBAL.rawget(GLOBAL, k)

Assets = {Asset("ANIM", "anim/ui_cookpot_1x1.zip")}

local containers = require("containers")
local params = containers.params

ACTIONS.ACTIONS.ADDFUEL.data.priority = 10

params.miner = 
    widget =
        slotpos =
            Vector3(0,   -18,  0),--0,   32 + 4,  0
        slotbg =
            {  image = "slingshot_ammo_slot.tex" }, --image = "slingshot_ammo_slot.tex"
        animbank = "ui_cookpot_1x1",
        animbuild = "ui_cookpot_1x1",
        --[[animbank = "ui_cookpot_1x2",
        animbuild = "ui_cookpot_1x2",]]
        pos = Vector3(115, 45, 0), --Vector3(0, 15, 0),
    usespecificslotsforitems = true,
    type = "hand_inv",

function params.miner.itemtestfn(container, item, slot)
    return item:HasTag("lightbattery") --or item:HasTag("firefly")

--[[local function minerupdate(inst)

AddPrefabPostInit("minerhat", function(inst)
    if not TheWorld.ismastersim then
        return inst
    inst.components.preserver:SetPerishRateMultiplier(GetModConfigData("Spoilage Rate"))--GetModConfigData("Preserver")



Link to comment
Share on other sites

What exactly is the crash at the moment?

I would suggest that you make turn off the canbeopened in the container component, and make it automatically open when you equip it, and then automatically close when you unequip it, this would be a simpler fix than rearranging the action priorities.

My guess is that you are crashing because the container widgets are not replicated correctly. Containers are tricky in DST and you could search up older forum posts concerning how replicate it correctly.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...