Jump to content

Assertion Failure at "TransformComponent.cpp"


Recommended Posts

I'm doing a custom item for a custom game mode and I made a prefab like this:

local function fn()
	local inst = SpawnPrefab"waterballoon"
	inst.prefab = "sfwaterballoon"
    inst:SetPrefabNameOverride"waterballoon"
    if not TheWorld.ismastersim then return inst end
  -- etc, where I remove stackable and weapon components and do a fix for the complexprojectile component

and when I tested it on my client it worked out fine, but when I uploaded it onto the server, I've been getting this: when I spawn it with c_give, the server would be fine, and the rest of the people on the server would be fine, but my own client would crash, and in my log I find this:

[00:00:43]: Assert failure '!mTransformationHistory' at /jenkins-buildmaster/workspace/DST_BuildGame_OSX/source/game/components/TransformComponent.cpp(446)
[00:00:43]: Assert failure 'BREAKPT:' at /jenkins-buildmaster/workspace/DST_BuildGame_OSX/source/game/components/TransformComponent.cpp(446)

Does anyone have ideas about what this assertion failure might be about? I'm doubly confused that it came from a file called transform component, since I did nothing with its Transform...

Edited by Bad Willow
Link to comment
Share on other sites

@Bad Willow

Are you creating a new prefab that creates another prefab like this:

local fn = function()
    local inst = SpawnPrefab("waterballoon")
    return inst
end
return Prefab("magicballoon", fn, assets, prefabs)

Or are you doing something like:

local GenerateCustomBalloon = function(arg1, arg2, arg3)
    local inst = SpawnPrefab("waterballoon")
    if not TheWorld.ismastersim
    then
        return
    end
    inst.Transform:SetPosition(arg1, arg2, arg3)
end

If you're trying to make prefabs inside of other prefab's init functions, then that'd start getting into questionable territory with entity initialization procedures.  I'd recommend changing the code around to reflect similar to GenerateCustomBalloon's functionality so it's not a prefab-in-prefab nest.

  • Like 2
Link to comment
Share on other sites

I remembered that the different world prefabs such as "forest" or "shipwrecked" or "porkland", they all started by spawning  a "world" prefab, so I thought that would work. Is this questionable territory specific to DST...? and has to do with juggling an instance between the client and the server? so that the world prefabs, being server exclusive, can actually be created like this and that other prefabs would cause a crash.

Edited by Bad Willow
Link to comment
Share on other sites

3 hours ago, Bad Willow said:

I remembered that the different world prefabs such as "forest" or "shipwrecked" or "porkland", they all started by spawning  a "world" prefab, so I thought that would work. Is this questionable territory specific to DST...? and has to do with juggling an instance between the client and the server? so that the world prefabs, being server exclusive, can actually be created like this and that other prefabs would cause a crash.

Not sure how it's handled in singleplayer, but in DST the different worlds use "MakeWorld" rather than "Prefab" for their variants, which then call "Prefab" once per world type during creation.  (See: scripts/prefabs/world.lua for MakeWorld function)

I suspect by having it try to make a prefab in a prefab that there's some entity initialization happening twice when it shouldn't be.

Edited by CarlZalph
  • Like 2
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...