Jump to content

Recommended Posts

You will likely want to override lootdropper component, more precisely, LootDropper:DropLoot()

It's actually the burnt callback that controls this.

@standardcomponents.lua:

function DefaultBurntFn(inst)    local ash = SpawnPrefab("ash")    ash.Transform:SetPosition(inst.Transform:GetWorldPosition())        if inst.components.stackable then        ash.components.stackable.stacksize = inst.components.stackable.stacksize    end    inst:Remove()end

So, OP, what you'd want to do is implement custom versions of a function like the above, and then do

inst.components.burnable:SetOnBurntFn(my_very_own_burnt_fn)

Thanks for the quick replies.

I also wasted alot of time with lootdropper.lua but it seems the answer is in "standardcomponents.lua". I've been able to change "ash" with "charcoal", but if I copy the file to "mods\modname\scripts\standardcomponents.lua" it doesn't do anything.

I also tried to implement the function in modmain.lua but I get a crash the following crash:

 

    modmain.lua:79: attempt to call global 'SpawnPrefab' (a nil value)

 

local function BoardsBurntFn(inst)    local cc = SpawnPrefab("charcoal")    cc.Transform:SetPosition(inst.Transform:GetWorldPosition())        if inst.components.stackable then        cc.components.stackable.stacksize = inst.components.stackable.stacksize    end    inst:Remove()endlocal function MakeBoardsBurnable(inst)        inst.components.burnable:SetOnBurntFn(BoardsBurntFn)endAddPrefabPostInit("boards", MakeBoardsBurnable)

Don't know what else to try. Any ideas? An easy workaround would be to just make crafting recipe but I wanted to figure this out...

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...