Jump to content

What is going on!?


Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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 :D

Link to comment
Share on other sites

  • Developer

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.

  • Like 1
Link to comment
Share on other sites

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

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 by IThatGuyI
  • Like 1
Link to comment
Share on other sites

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 by Dcrew
Link to comment
Share on other sites

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

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...