ShinyMoogle

  • Content count

    32
  • Joined

  • Last visited

Community Reputation

22 Excellent

About ShinyMoogle

  • Rank
    Junior Member

Recent Profile Visitors

176 profile views
  1. Thanks! I never knew those console commands were available, that's helpful. Print results were... as expected, I suppose? Component seems to have been added properly, necessary tags are there, the right fuel type is assigned... but the machine just doesn't want to take it. Is it possible that the container component is interfering somehow and getting prioritized as an action instead of adding fuel? Doesn't really make sense that it would only happen for Honey and not my custom fuel though, given that they can both be stored inside. [00:05:46]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select().components.fuel == nil)) @(370.42, -114.55) [00:05:46]: Selected 115851 - honey [00:05:46]: false [00:06:11]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select().components.fuel.fueltype)) @(370.62, -114.53) [00:06:11]: Selected 115851 - honey [00:06:11]: SWEETDREAM [00:06:34]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select().components.fuel.fueltype)) @(369.95, -112.87) [00:06:34]: Selected 116009 - dreamfuel [00:06:34]: SWEETDREAM [00:07:35]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select().components.fueled.fueltype)) @(368.89, -117.79) [00:07:35]: Selected 108929 - gummimaker [00:07:35]: SWEETDREAM [00:08:38]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select():HasTag("SWEETDREAM_fuel"))) @(372.26, -116.00) [00:08:38]: Selected 116305 - honey [00:08:38]: true [00:09:44]: [(KU_ZFa8MGsw) shinymoogle] ReceiveRemoteExecute(print(c_select():HasTag("SWEETDREAM_fueled"))) @(369.27, -117.78) [00:09:44]: Selected 108929 - gummimaker [00:09:44]: true
  2. I'm throwing in the towel on this one, but I'm sure it's something minor that I'm managing to overlook somehow... I've created a fueled machine which is supposed to accept a custom fuel type. Currently, this can be either a new custom item which provides a large amount of fuel, or plain Honey, which adds a small amount but is more readily accessible. The custom fuel is working perfectly as intended. However, the machine simply will not accept Honey as fuel, despite me adding the fueled component to Honey via AddPrefabPostInit and setting the fuel type accordingly. I've pulled out some of the relevant code snippets below: Fueled machine main prefab function local function fn(Sim) local inst = CreateEntity() local modnameFancy = "Pandora" local modnameActual = KnownModIndex:GetModActualName(modnameFancy) local craftrate if modnameActual == nil then print(string.format("Mod '%s' not found", modnameFancy)) craftrate = GUMMIMAKER_MAKE_RATE else craftrate = GetModConfigData("gummirate", modnameActual) end inst.entity:AddNetwork() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.AnimState:SetBank("gummimaker") inst.AnimState:SetBuild("gummimaker") MakeObstaclePhysics(inst, .4) inst:AddTag("structure") inst:AddTag("fridge") inst.entity:SetPristine() if not TheWorld.ismastersim then inst:DoTaskInTime(0.1, function(inst) inst.replica.container:WidgetSetup("treasurechest") end) return inst end inst:AddComponent("lootdropper") inst:AddComponent("machine") inst.components.machine.turnonfn = TurnOn inst.components.machine.turnofffn = TurnOff inst.components.machine.caninteractfn = CanInteract inst.components.machine.cooldowntime = 0.5 inst:AddComponent("container") inst.components.container:WidgetSetup("treasurechest") inst.components.container.onopenfn = onopen inst.components.container.onclosefn = onclose inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.SWEETDREAM inst.components.fueled.maxfuel = GUMMIMAKER_FUEL_MAX inst.components.fueled.accepting = true inst.components.fueled:SetSections(4) inst.components.fueled:SetDepletedFn(OnFuelEmpty) inst.components.fueled:SetTakeFuelFn(ontakefuelfn) inst.components.fueled:InitializeFuelLevel(GUMMIMAKER_FUEL_MAX/2) inst.components.fueled:StartConsuming() inst:AddComponent("inspectable") inst.components.inspectable.getstatus = getstatus inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(4) inst.components.workable:SetOnFinishCallback(onhammered) inst.components.workable:SetOnWorkCallback(onhit) -- Set the amount of time it takes to create a gummi inst.craftrate = TUNING.TOTAL_DAY_TIME / craftrate inst:ListenForEvent("onbuilt", onbuilt) return inst end Working Custom Fuel local assets = { Asset("ANIM", "anim/dreamfuel.zip"), Asset("ATLAS", "images/inventoryimages/dreamfuel.xml"), Asset("IMAGE", "images/inventoryimages/dreamfuel.tex"), } local prefabs = {} local function takenap(inst, time) if inst:HasTag("player") then inst:PushEvent("yawn", { grogginess = 4, knockoutduration = time + math.random() }) elseif inst.components.sleeper ~= nil then inst.components.sleeper:AddSleepiness(7, time + math.random()) elseif inst.components.grogginess ~= nil then inst.components.grogginess:AddGrogginess(4, time + math.random()) else ins:PushEvent("knockedout") end end local function oneat(inst, eater) eater:DoTaskInTime(0.5, function() takenap(eater, TUNING.MANDRAKE_SLEEP_TIME*2) end) end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("dreamfuel") inst.AnimState:SetBuild("dreamfuel") inst.AnimState:PlayAnimation("idle", true) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("edible") inst.components.edible.healthvalue = 0 inst.components.edible.hungervalue = 0 inst.components.edible.sanityvalue = TUNING.SANITY_SMALL inst.components.edible.foodtype = FOODTYPE.GENERIC inst.components.edible:SetOnEatenFn(oneat) inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("fuel") inst.components.fuel.fueltype = FUELTYPE.SWEETDREAM inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL * 2 print("Whipped Dream fuel type: "..FUELTYPE.SWEETDREAM) MakeHauntableLaunch(inst) inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/dreamfuel.xml" return inst end return Prefab("dreamfuel", fn, assets) AddPrefabPostInit in modmain.lua -- Allow honey to be used as fuel for the Confectionary Station -- Also define new fuel here GLOBAL.FUELTYPE.SWEETDREAM = "SWEETDREAM" AddPrefabPostInit("honey", function(inst) --inst:AddTag(GLOBAL.FUELTYPE.SWEETDREAM.."_fuel") if not GLOBAL.TheWorld.ismastersim then return end --print("Attempting to add fuel component to honey") inst:AddComponent("fuel") inst.components.fuel.fueltype = GLOBAL.FUELTYPE.SWEETDREAM inst.components.fuel.fuelvalue = GLOBAL.TUNING.MED_FUEL --print("Fuel type added: "..inst.components.fuel.fueltype) end) It seems like the component is being added to Honey and the right fuel type is being verified with that last print statement, but it's still not being accepted as valid fuel for the machine. I don't think I'm doing anything differently here from the custom fuel item, so I have no idea where the hangup is! My only other guess was that adding fuel isn't registering as a valid action in componentactions.lua, which seems to check for a matching tag, but adding that in manually didn't work out either. From componentactions.lua for k, v in pairs(FUELTYPE) do if inst:HasTag(v.."_fuel") then if target:HasTag(v.."_fueled") then table.insert(actions, inst:GetIsWet() and ACTIONS.ADDWETFUEL or ACTIONS.ADDFUEL) end return end end So... I'm stumped. Anyone have any insight? I've attached my modmain.lua and relevant prefab files if you need to see the big picture. modmain.lua dreamfuel.lua gummimaker.lua
  3. For server issues you will want to look at the server log, not the client log. You can find it in Documents/Klei/DoNotStarveTogether/[########]/[world slot]/Master/server_log.txt Please upload that and get back to us!