NAVY Posted August 17, 2018 Share Posted August 17, 2018 (edited) Hey! After a long time and trying to figure out, I couldn't find a solution to my problem, so my last hope is this forum. I tried to edit a recipe and add an option to it, in this example I want to change the recipe of the beefalo hat so you need 2 horns to craft it! My code: modmain.lua STRINGS = GLOBAL.STRINGS RECIPETABS = GLOBAL.RECIPETABS Recipe = GLOBAL.Recipe Ingredient = GLOBAL.Ingredient TECH = GLOBAL.TECH local updateRecipe = GetModConfigData("BEEFALOHATRECIPE") AddRecipe("beefalohat", {Ingredient("beefalowool", 8),Ingredient("horn", updateRecipe)}, RECIPETABS.DRESS, TECH.SCIENCE_ONE) modinfo.lua name = "Beefalo Hat Testing" description = "..." author = "NAVY" version = "1.0" api_version = 10 dst_compatible = true restart_required = false icon = "modiconbeefalo.tex" icon_atlas = "modiconbeefalo.xml" priority = -1 configuration_options = { { name = "BEEFALOHATRECIPE", label = "Beefalo Hat Recipe", hover = "Change how many horns you need to craft a beefalo hat.", options = { {description = "1 Horn", data = 1, hover = "You need 1 horn to craft a beefalo hat. (Default)"}, {description = "2 Horns", data = 2, hover = "You need 2 horns to craft a beefalo hat."}, }, default = 1, }, } Then in the modinfo you have option to change "BEEFALOHATRECIPE" to 1 or 2. It works all fine in a normal world! However in a world with caves enabled it doesn't work at all. I tried to change the recipe or twist around, but it simpy doesn't want to impelent the optional feature. It works only if I set the number by myself to 2 in the Addrecipe(), but since I want to make this optional, I want to handle this feature through the settings. Any ideas what I am missing? Really confused why this works on a normal world, but has no effect on a world with caves enabled. :/ Edited August 17, 2018 by NAVY Link to comment Share on other sites More sharing options...
Lumina Posted August 17, 2018 Share Posted August 17, 2018 Can you copy the modinfo just in case ? Link to comment Share on other sites More sharing options...
NAVY Posted August 17, 2018 Author Share Posted August 17, 2018 (edited) 13 minutes ago, Lumina said: Can you copy the modinfo just in case ? Sure, I edited the post! It really makes me confused why this works in a normal world all fine, even adding more options like 10 horns or whatever, but as soon as I try this mod with a world with caves, then it wont let me use the options, it sticks to the default. (No crash tho.) Edited August 17, 2018 by NAVY Link to comment Share on other sites More sharing options...
Lumina Posted August 17, 2018 Share Posted August 17, 2018 5 hours ago, NAVY said: Sure, I edited the post! It really makes me confused why this works in a normal world all fine, even adding more options like 10 horns or whatever, but as soon as I try this mod with a world with caves, then it wont let me use the options, it sticks to the default. (No crash tho.) The only guess i could have is that maybe all client require mod, so try adding this line maybe : all_clients_require_mod = true Because, usually, when something works on world without cave and doesn't on world with caves, it's because of a host vs client problem. In a server without cave that you are hosting, you are the host. In a server with caves, a dedicated server, or someone else's server, you are client. So maybe the mod is lacking some information as a client ? It's the only guess i have, it doesn't explain why when you change the recipe directly it works and not with the config option. If this changes nothing then i hope someone else will be able to help you. Link to comment Share on other sites More sharing options...
NAVY Posted August 17, 2018 Author Share Posted August 17, 2018 Thanks for the info about how the server is dealt with and without caves. It would make sense that it lacka some info/code when caves are enabled, since I am not the host, but the client. Still odd how it does not register the option. For example setting the recipe manually to say 10 horns would work, but making it an option doesnt work. Option only works when caves are disabled. I will play around with code and try to figure it out. My guess so far is: Either a bug or there must be another way of implementing the code. Link to comment Share on other sites More sharing options...
NAVY Posted August 18, 2018 Author Share Posted August 18, 2018 (edited) @Lumina Interesting, I played around and figured out: Adding "all_clients_require_mod = true" does solve the issue, thanks! It basicly doesn't matter how I define the recipe, multiple ways made it work on a default world. However I think you are right about caves and the client issue. At least now I know this mod will be required by all clients! Still interesting to know how the game handels code input. For example I was able to edit insulation, persish value, even add waterproofness etc., and all worked as a server sided mod. However adding an option to the recipe makes it required by all clients. BUT without an option and instead manually change the number to 2 (How many horns are required to craft the beefa hat..) this will work server sided only hehe. Odd isn't it? I guess after all this is how the game handles modinfo.lua Basicly: Either add options and make the mod requied by all clients, or predefine edited/new recipes. Funny. What do you think is the best for a mod? (The beefalo hat part is only a minor part of it) Either having options, but every player has to download the mod to play on the server, or having predefined/edited recipes without options, however player do not have to download the mod? (I know most players tend to click-and-join and do not like to download exta stuff) Edited August 18, 2018 by NAVY Link to comment Share on other sites More sharing options...
Lumina Posted August 19, 2018 Share Posted August 19, 2018 Depending of what you want to do it's totally possible that you'll have to make the mod required for all client at the end anyway. If it's not the case, most people like option, especially when you do some changes making the game harder (requiring 2 horns for the hat will enter in this category for some people). 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