Jump to content

Weird bug with extremely simple mod


Recommended Posts

Hi all! I'm new to modding, but am an experienced computer science student. I just created and uploaded my first mod *yay!* to just try it. 

The mod is supposed to add 1 recipe to the game under the refine tab, to trade in 4 boneshards for a rocks. Shouldn't be hard you'd say? Welp, when i install and run the mod on my own server hosted through DST, it works just fine. When i move it to my dedicated server however, i get a strange bug. I run a lot of other mods (yes, i am aware that this can cause issues) which all work fine together with each other. I moved the mod like i do with any other mod, so that should be fine too. 

The bug: Ladies and gentlemen, the easiest code you can imagine (shown below) resulted in the following bug. Everyone appeared to have 100 hp on their screen, even though you healed, got hit, it didnt change (on your screen). When hp *should have* reached 0 however, you died like normal. But there was no ghost animation until you pressed space, as there WAS a haunting-object animation, which played until done and you dissapeared again. This with the fact that it continuously seemed as you were bleeding, presents couldn't be opened everything from the ancient pseudoscience station tab could be crafted at any time. 

The magical code:


local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local TECH = GLOBAL.TECH
local STRINGS = GLOBAL.STRINGS

local rocksRecipe = Recipe("rocks",
    {
        Ingredient("boneshard", 4),
    },
    RECIPETABS.REFINE,
    TECH.NONE)
	-- Custom recipe to clean up bodies at portal

STRINGS.RECIPE_DESC.ROCKS = "Thanks for cleaning corpses!"

Yes, i have just copied you my entire content of modmain.lua. 

I hope anyone has the slightest clue what might be going on right here!

Sincerely yours, Merlijn

Link to comment
Share on other sites

16 hours ago, merlade said:

Everyone appeared to have 100 hp on their screen, even though you healed, got hit, it didnt change (on your screen). When hp *should have* reached 0 however, you died like normal. But there was no ghost animation until you pressed space, as there WAS a haunting-object animation, which played until done and you dissapeared again. This with the fact that it continuously seemed as you were bleeding, presents couldn't be opened everything from the ancient pseudoscience station tab could be crafted at any time. 

This happens when the network message stream gets a difference between the server and client.

 

This can be because of your mod or others, you'd have to check and verify either by loading each mod individually with yours to see which one causes the conflict (from improper code handling of the other mod) or look through each mod for bad code handling.

The only thing I'd change in your code is to use 'AddRecipe' directly so it won't spam server console logs about you using the deprecated 'Recipe' function; they're identical in functionality but 'Recipe' spews a one line in the console about not using it anymore.

Link to comment
Share on other sites

Thank you sincerely for the reply! To get something straight: i tried and have disabled ALL mods (except for this one), which results in the exact same bug. Conclusion: it has nothing to do with my other mods! :) / :(

To get back to my code: i slightly changed it:

AddRecipe("rocks",
    {
        Ingredient("boneshard", 4),
    },
    RECIPETABS.REFINE,
    TECH.NONE)
	-- Custom recipe to clean up bodies at portal

STRINGS.NAMES.ROCKS = "Rocks"
STRINGS.RECIPE_DESC.ROCKS = "Thanks for cleaning corpses!"

Still though, what the flying F causes these few lines of code to crash half the game? 

Currently there are no other mods, no caves, nothing special...

 

So you said:

This happens when the network message stream gets a difference between the server and client.

I totally assume that that's the case then, maybe the recipe only gets added for the server, or only for the clients?

Edited by merlade
Link to comment
Share on other sites

8 hours ago, merlade said:

Still though, what the flying F causes these few lines of code to crash half the game? 

Currently there are no other mods, no caves, nothing special...

Magic, I suspect.  I couldn't reproduce the error you're experiencing when I did it:

GLOBAL.STRINGS.RECIPE_DESC.ROCKS = "Thanks for cleaning corpses!"
PrefabFiles = {
    "rocks",
}
AddRecipe(
    "rocks",
    {
        Ingredient("boneshard", 4),
    },
    GLOBAL.RECIPETABS.REFINE,
    GLOBAL.TECH.NONE
)

Ensure that "all_clients_require_mod = true" is in your modinfo.lua file.

Link to comment
Share on other sites

I want to mention i just right now spent about 10 minutes cursing myself, while i kept worshipping you CarlZalph. 

19 hours ago, CarlZalph said:

Ensure that "all_clients_require_mod = true" is in your modinfo.lua file.

Yes, that was it. That totally was it. I did not know that all clients needed the mod. Thank you sincerely for the help and research, everything works like a charm now!!!

Thank you once more, 

Sincerely yours, Merlijn

Edit: Am i supposed to close this thread now? Or do mods do that?

Edited by merlade
Link to comment
Share on other sites

1 hour ago, merlade said:

Am i supposed to close this thread now? Or do mods do that?

Given time the thread will self-archive itself.  May as well let it stand for future people to come by from a search to see a solution, it may apply to them.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...