Page 1 of 1

Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 18:44
by MTDad
I can't find in a search where this was discussed, only the hud topic touches on a similar problem, so I'm asking here if anyone has found a solution. My head hurts from trying.

-food requires diet and or hud to run first. diet requires hud first. no problem there.
-hud/diet require mt foods to run first, or mtfoods won't register with those mods.
-mtfoods requires food to run first so it can utilize the food groups.
-Minetest doesn't seem to be able to resolve the loop, and the mods don't load.

Leave out mtfoods, everythings fine, leave out hud and diet and everything's fine, leave out food and everything is fine (mt foods just won't be able to utilize the range of food sources that food covers).

For now I'm planning on removing the food mod support from mtfoods and editing in the appropriate ingredients for my games so mtfoods can load first.

Anyone come up with a better solution?

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 20:31
by Krock
It's impossible to get a proper soulation. You'll have to disable one of them.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 20:48
by rubenwardy
Remove food from the depends of mtfood. It shouldn't be there.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 21:01
by Wuzzy
Oh, Krock, don’t say the word “impossible”.

Maybe you should inform the modders of this problem.

But I can’t see the cyclic dependency here. According to the depends.txt files or the respective threads:

food has an optional dependency on diet and on mtfoods.
diet has no dependencies at all.
hud depends on default.
mtfoods depends on many mods, but none of the above.

Where exactly is the cycle?

@rubenwardy: If your solution works, this change should directly go upstream to mtfoods.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 21:04
by rubenwardy
Diet optionally depends on HUD.

An Optional dependency just means that an error is not thrown when the mod it is depending on in is not present. If the mod is present then it must be loaded before the depending mod.

I am the creator of the Food and Diet mods.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 21:14
by Wuzzy
Sorry, I still don’t get it.

Where and why exactly is there a dependency circle? Someone please explain it to me. :-(

And yes, I already know what an optional dependency is.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 21:24
by rubenwardy
Food on HUD
HUD on mtfoods
Mtfoods on food.


Or

Food on diet
Diet on mtfoods
Mtfoods on food.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 22:04
by MTDad
yup, like Ruben puts it and I tried to explain. Its a circle.

problem with removing mtfoods dependency, is then the game errors, as mtfoods attempts to "index global 'food' (a nil value)". Would have to actually remove/change part of mtfoods code to make that work, which I guess I will have to in my local copy.

Thanks for the input.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Sat Sep 27, 2014 22:07
by rubenwardy
I will fix this tomorrow.

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Mon Sep 29, 2014 17:58
by rubenwardy
This has been fixed in Food, and a pull request has been made to mtfoods.

Get the latest version of Food.

Get the fixed version of mtfoods from here: https://github.com/rubenwardy/mtfoods/

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Mon Sep 29, 2014 19:27
by Wuzzy
Great!

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Mon Sep 29, 2014 21:50
by MTDad
Excellent!
Ruben, thank you!

Re: Food>Diet/Hud>MTfoods>Food Depends Loop

PostPosted: Mon Sep 29, 2014 23:48
by philipbenr
@Ruben: Pull request merged. Mtfoods should be fixed now.