Jump to content

mod acts completely different on separate servers, errors not in log


Recommended Posts

so I've been working to fix the last few bugs out of my chester mod. However, glow chester is STILL having issues, though the issues are completely different between dedicated and non dedicated servers. On my non-dedicated server, the game crashes as soon as chester is finished morphing into glow chester. I checked every single log file multiple times and found absolutely nothing.

On my dedicated server, the game doesn't crash, but glow chester looks and acts the same as regular chester. Again, nothing in any of the logs, but at least the game didn't crash I guess.

basically, in one game glow chester works perfectly but his existence makes the game crash, and in another he just doesn't exist.

chesterfix.zip 

I checked all the files I thought might have an issue and couldn't find anything. (ignore the mod configuration options, they aren't the problem I promise)

I'm pretty sure this has something to do with how I'm implementing the light entity, but I've coded light the exact same way before without any problems.

Link to comment
Share on other sites

(All testing done on hosted single-level world.)

After adding a bunch of debug prints, I determined that the hard crash occurs right after the chesterlight (spawned in stategraphs/SGchester|transition|onenter is removed (scheduled in prefabs/chesterlight|TurnOff()) if this happens later than the light is added to freshly morphed glow chester.
I have no idea why this happens. I thought it had to do with two light sources at the same coordinates, but moving the chesterlight away did not help. Adding custom light later did seem to help:

local function MorphGlowChester(inst)
    inst.AnimState:SetBuild("chester_light_build")
    --inst:AddTag("")
    inst.MiniMapEntity:SetIcon("chestersnow.png")
    inst:DoTaskInTime(5, function()
        inst.entity:AddLight()  
        --inst.Light:EnableClientModulation(true)
        inst.Light:Enable(true)
        inst.Light:SetIntensity(.6)
        inst.Light:SetRadius(1)
        inst.Light:SetFalloff(.6)
        inst.Light:SetColour(180 / 255, 195 / 255, 225 / 255)
    end)
    
    inst.entity:SetPristine()
    
    local leader = inst.components.follower.leader
    if leader ~= nil then
        inst.components.follower.leader:MorphSnowEyebone()
    end

    inst.ChesterState = "GLOW"
    inst._isshadowchester:set(false)
end

 

Regarding the difference between hosted vs. dedicated server, the inst.entity:SetPristine() within MorphGlowChester() seems suspicious to me. I thought it is usually used in constructor functions.

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