deadlyreg Posted December 16, 2016 Share Posted December 16, 2016 I've made a mod for Willow so her lighter doesn't run out of fuel whilst she is using it, but that means the Willow player is left with a big 100% stuck over the top of it all the time. Does anyone know where the script is that calls up that display so I can disable it? I've looked in the components files at "fueled" and "finiteuses" and can't seem to see it. Link to comment Share on other sites More sharing options...
Serpens Posted December 17, 2016 Share Posted December 17, 2016 (edited) I really hate this forum... it happens that often, that a post is totally screwed up when adding a link... this time my whole post was deleted instead of sent >.< so again: The easiest way would be to simply remove the fueled component. Then it would last forever and you don't have the percentages. The only problem is, that the devs made no "is nil" check in their code in the oncook function. I made a report here, maybe they will adjust it.http://forums.kleientertainment.com/klei-bug-tracker/dont-starve-together/willow-lighter-fueled-check-r2368/ In the meantime the mod needs to adjust the oncook function to prevent crash when cooking with lighter. So the modmain code will be: local function newoncook(inst, product, chef) if not chef:HasTag("expertchef") then --burn if chef.components.health ~= nil then chef.components.health:DoFireDamage(5, inst, true) chef:PushEvent("burnt") end if inst.components.fueled~=nil then inst.components.fueled:DoDelta(-.05 * inst.components.fueled.maxfuel) end else if inst.components.fueled~=nil then inst.components.fueled:DoDelta(-.01 * inst.components.fueled.maxfuel) end end end AddPrefabPostInit("lighter",function(inst) if not GLOBAL.TheNet:GetIsServer() then return end inst:RemoveComponent("fueled") inst.components.cooker.oncookfn = newoncook end) Edited December 17, 2016 by Serpens Link to comment Share on other sites More sharing options...
deadlyreg Posted December 17, 2016 Author Share Posted December 17, 2016 The issue is I want to make it so that Willow's lighter still runs down for other players she makes them for. Is it possible to have a conditional removal of the "fueled" component? I used the StopConsuming function triggered by the Willow prefab and that seems to work okay. I found a function in the inventory files called ItemTile:SetPercent that I think would disable it but I'm bad at working out code. This is the function I frankensteined together: local function willowlighter(item) return item.prefab == "lighter" end local function hideusesleft(inst, owner) local equip = owner.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) if (equip ~= nil and equipitem.prefab =="lighter") or (owner.components.inventory:FindItem(willowlighter) == true) and owner.HasTag("pyromaniac") then local display = ItemTile:SetPercent(percent) item.prefab("willowlighter").display:Hide() end end Did I make a pig's ear of it? I feel like it should work. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now