Jump to content

Recommended Posts

Attempting to make a light emitting item using code similiar to heatrock.

	dbg.ptc("d--")
	local scs, msg = pcall(vinst.luminary.entity.SetParent,vinst.entity,vinst.entity)
	dbg.ptc(msg)

Here's the most relevant code.

The most astounding thing is that it crashes the entire game (not just the server) without a log when given the following parameters to SetParent EVEN inside pcall!

What's weirder is that similar code works for firelight!

if not vinst.firelight then
		--dbg.ptc("spawning firelight")
		vinst.firelight = SpawnPrefab(vfirelight)
	end
	
	vinst.firelight.entity:SetParent(vowner.entity)
	vinst.components.burnable:Ignite()

This works just fine and has never crashed yet.

 

Does anyone have any ideas??

Modding DST is pretty confounding on occasion.

------------

Solution:

setparent was attempting to set itself as parent which isn't good, presumably creating some infinite loop.  The previous setparent using the OWNER.entity didn't work for some reason I fixed earlier.

If the server crashes with no log, its probably because of infinite looping.

 

Now I just need to figure out how to get the light to actually display...

Edited by Monomono

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
×
  • Create New...