Dcrew Posted July 14, 2020 Share Posted July 14, 2020 Hi I am the owner of a DST mod called "Enhanced Biomes". I've had some bugs reported to me recently personally, I went through trying to reproduce it and I can't do it. My mod modifies the growth speed of pinecone saplings like so: local function ModifyGrowthTimer(ent, tile, multiplier) if ent.components.timer then local timetodeplete = ent.components.timer.timers["grow"].initial_time - ent.components.timer.timers["grow"].initial_time * multiplier local timeleft = ent.components.timer.timers["grow"].end_time - _G.GetTime() print("[Enhanced Biomes] "..ent.prefab.." planted on "..tile..", old time: "..timeleft.." (full: "..ent.components.timer.timers["grow"].initial_time.."), new time: "..timeleft - timetodeplete.." (full: "..ent.components.timer.timers["grow"].initial_time - timetodeplete..")") ent.components.timer:SetTimeLeft("grow", timeleft - timetodeplete) else ent:DoTaskInTime(2, function() ModifyGrowthTimer(ent, tile, multiplier) end) end end AddPrefabPostInit("pinecone_sapling", function(ent) ent:DoTaskInTime(0, function() if not ent.enhancedbiomes.ismodded then local tile = _G.TheWorld.Map:GetTileAtPoint(ent.Transform:GetWorldPosition()) if tile == GROUND.FOREST then ModifyGrowthTimer(ent, tile, enhancedbiomes.evergreentreegrowthmodifier) end ent.enhancedbiomes.ismodded = true end end) end) Now it works perfectly fine for me no matter how many new worlds I try it on. It doesn't work (doesn't print) when the user who reported it to me uses it, we're both planting saplings on forest tile, he has other server/client mods but disabled them all and re-tested with no change, we both have the mod config the exact same, the mod is working since he has other prints from my mod, it's only this part of it and I can't for the life of me figure out the problem here. Link to comment Share on other sites More sharing options...
Dcrew Posted July 15, 2020 Author Share Posted July 15, 2020 I figured out how to replicate it and it only happens when I add caves to my world. No idea why it's happening or how I can fix that. Any ideas? Link to comment Share on other sites More sharing options...
Dcrew Posted July 18, 2020 Author Share Posted July 18, 2020 Nobody got any ideas? I've looked around the game code (scripts) the last few days and tried a few different changes to my code but didn't get any answers. Link to comment Share on other sites More sharing options...
poolcool2 Posted July 18, 2020 Share Posted July 18, 2020 I ran into a similar problem where specifically when caves are enabled it causes an item of my mod to cause a crash in the "inventoryitem" component failing to do math on the owner variable for being "nil". Seems that caves cause some strange oddities in the code. If I figure out how to fix this and it would help you I will be sure to share the information with you. 1 Link to comment Share on other sites More sharing options...
Dcrew Posted July 18, 2020 Author Share Posted July 18, 2020 1 hour ago, poolcool2 said: I ran into a similar problem where specifically when caves are enabled it causes an item of my mod to cause a crash in the "inventoryitem" component failing to do math on the owner variable for being "nil". Seems that caves cause some strange oddities in the code. If I figure out how to fix this and it would help you I will be sure to share the information with you. Hope either of us figure out a fix, thanks Link to comment Share on other sites More sharing options...
-LukaS- Posted July 18, 2020 Share Posted July 18, 2020 Show me the client_log or server_log. Usually you can spot the error there. 1 Link to comment Share on other sites More sharing options...
Developer zarklord_klei Posted July 19, 2020 Developer Share Posted July 19, 2020 running the game with or without caves is practically running two seperate games, in general, 95% of players are going to be running the mod in the state you can simulate by adding caves to your world, the other 5% will be running it in the state you can simulate by not adding caves, you need to always test your mod in both environments to make sure it works properly in both. 1 Link to comment Share on other sites More sharing options...
Dcrew Posted July 19, 2020 Author Share Posted July 19, 2020 13 hours ago, Zarklord said: running the game with or without caves is practically running two seperate games, in general, 95% of players are going to be running the mod in the state you can simulate by adding caves to your world, the other 5% will be running it in the state you can simulate by not adding caves, you need to always test your mod in both environments to make sure it works properly in both. Okay but how can we/I make it run in the state where it'll work because if it breaks this part of my mod I'm sure it'll break most of my mod since a lot of it relies on ent components and values. 17 hours ago, IThatGuyI said: Show me the client_log or server_log. Usually you can spot the error there. https://www.dropbox.com/s/3qw303gogmca75s/log.7z?dl=1 Link to comment Share on other sites More sharing options...
-LukaS- Posted July 20, 2020 Share Posted July 20, 2020 (edited) So I just ran some tests of your mod and, I admit, it doesn't print the text from the ModifyGrowthTimer function but the the sapling does grow faster. With your mod enabled, when I planted the saplings on the forest tile the time to grow was ranging from 0:50 to 2:00 and on any other tile from 1:50 to 4:10. When I disabled your mod the timer, on any tile (even the forest tile), was ranging from 1:50 to 4:10 again. Edited July 20, 2020 by IThatGuyI 1 Link to comment Share on other sites More sharing options...
Dcrew Posted July 20, 2020 Author Share Posted July 20, 2020 (edited) 1 hour ago, IThatGuyI said: So I just ran some tests of your mod and, I admit, it doesn't print the text from the ModifyGrowthTimer function but the the sapling does grow faster. With your mod enabled, when I planted the saplings on the forest tile the time to grow was ranging from 0:50 to 2:00 and on any other tile from 1:50 to 4:10. When I disabled your mod the timer, on any tile (even the forest tile), was ranging from 1:50 to 4:10 again. That's freaking me out to be honest, did you enable caves? and there were no console prints even though it prints when any growth is modified? How does that work? I'm super confused! Edited July 20, 2020 by Dcrew Link to comment Share on other sites More sharing options...
-LukaS- Posted July 20, 2020 Share Posted July 20, 2020 I did enable caves, it did change the growing speed and it didn't print the message. I have no idea how is that possible but it just happens. 1 Link to comment Share on other sites More sharing options...
Dcrew Posted July 20, 2020 Author Share Posted July 20, 2020 27 minutes ago, IThatGuyI said: I did enable caves, it did change the growing speed and it didn't print the message. I have no idea how is that possible but it just happens. Maybe it applies the script to both forest & cave and only shows caves prints, there has to be a solution Link to comment Share on other sites More sharing options...
Dcrew Posted July 20, 2020 Author Share Posted July 20, 2020 Also @IThatGuyI this makes me want to remove the auto-retry recursion (DoInTime) because that means it's pointless and adds an extra retry script for the cave which wouldn't even need it 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