Jump to content

Recommended Posts

I'm currently working on a "better hambat" mod. It's a simple mod, that allows you to get the most out of your spoiling hambat.

 

This is the entirety of my mod:

 

function BetterBat(inst)
 
    inst:AddComponent("cookable")
    inst.components.cookable.product = "kabobs"
    inst:AddComponent("dryable")
    inst.components.dryable:SetProduct("meat_dried")
    inst.components.dryable:SetDryTime(TUNING.DRY_MED)
    inst:AddComponent("tradable")
    inst.components.tradable.goldvalue = TUNING.GOLD_VALUES.MEAT*2
    end
    
AddPrefabPostInit("hambat",BetterBat)
 
Everything works exactly how I want, but the hambat doesn't have any animations on the drying rack. I'm fine using the existing meat animations, I'm just not sure how to link it all up.

Well, I seemed to have "solved" it. I really just copy pasted some coding from the "Better Drying Rack" mod made by Mouse.

I'm not savvy enough to do my own coding :razz:

 

Heres the finished mod:

TUNING=GLOBAL.TUNING
 
function onstartdrying(inst, dryable)
if not inst:HasTag("burnt") then
   inst.AnimState:PlayAnimation("drying_pre")
inst.AnimState:PushAnimation("drying_loop", true)
if dryable=="hambat" then
   dryable="meat"
end
 
   inst.AnimState:OverrideSymbol("swap_dried", "meat_rack_food", dryable)
end
end
AddPrefabPostInit("meatrack", function(inst)
inst.components.dryer:SetStartDryingFn(onstartdrying)
inst.components.dryer:SetContinueDryingFn(onstartdrying)
end)
 
AddPrefabPostInit("hambat", function(inst)
inst:AddComponent("dryable")
inst.components.dryable:SetProduct("meat_dried")
inst.components.dryable:SetDryTime(TUNING.DRY_MED)
end)
 
function BetterBat(inst)
 
    inst:AddComponent("cookable")
    inst.components.cookable.product = "kabobs"
    inst:AddComponent("tradable")
    inst.components.tradable.goldvalue = TUNING.GOLD_VALUES.MEAT*2
    end
    
AddPrefabPostInit("hambat",BetterBat)

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