Jump to content

Nightvision Colorcube not working in worlds with caves


Recommended Posts

Title is self explanitory. I know I have been using the forums too much. I'm sorry. I do not know how to fix these issues I have. Basically, in worlds with caves, the colorcubes in that world will have completely black colorcubes.

local NIGHTVISION_COLOURCUBES =
{
    day = "images/colour_cubes/day05_cc.tex",
    dusk = "images/colour_cubes/dusk03_cc.tex",
    night = "images/colour_cubes/purple_moon_cc.tex",
    full_moon = "images/colour_cubes/purple_moon_cc.tex",
	caveday = "images/colour_cubes/purple_moon_cc.tex", --Not sure if these 3 are correct
	cavedusk = "images/colour_cubes/purple_moon_cc.tex",
	cavenight = "images/colour_cubes/purple_moon_cc.tex",
}

Oh and also here is my nightvision code. I know that this is different from the light code being thrown around, but the one I had before was visible to other players who weren't my character.

 

	inst.components.playervision:ForceNightVision(true)
	inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES)

 

Edited by Earthyburt
Clarification
Link to comment
Share on other sites

6 hours ago, Earthyburt said:

Title is self explanitory. I know I have been using the forums too much. I'm sorry. I do not know how to fix these issues I have. Basically, in worlds with caves, the colorcubes in that world will have completely black colorcubes.


local NIGHTVISION_COLOURCUBES =
{
    day = "images/colour_cubes/day05_cc.tex",
    dusk = "images/colour_cubes/dusk03_cc.tex",
    night = "images/colour_cubes/purple_moon_cc.tex",
    full_moon = "images/colour_cubes/purple_moon_cc.tex",
	caveday = "images/colour_cubes/purple_moon_cc.tex", --Not sure if these 3 are correct
	cavedusk = "images/colour_cubes/purple_moon_cc.tex",
	cavenight = "images/colour_cubes/purple_moon_cc.tex",
}

Oh and also here is my nightvision code. I know that this is different from the light code being thrown around, but the one I had before was visible to other players who weren't my character.

 


	inst.components.playervision:ForceNightVision(true)
	inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES)

 

I have my own character ability that changes to my own custom colour cube, it works in caves correctly and everything. Only thing I see different is the fact you actually specified the cave stuff in the NIGHTVISION_COLOURCUBES table, try removing it, like so, and using it like that.

local NIGHTVISION_COLOURCUBES =
{
    day = "images/colour_cubes/day05_cc.tex",
    dusk = "images/colour_cubes/dusk03_cc.tex",
    night = "images/colour_cubes/purple_moon_cc.tex",
    full_moon = "images/colour_cubes/purple_moon_cc.tex",
}

 

Edit: I actually misread the content of your post. The reason your getting this is because only the server knows the colour cubes have been updated, you need to pass the colour cube change to the client as well. You can do this with a client RPC. I need to sleep now, but if someone else hasn't helped you by the time I'm home from work tomorrow, I'll get you all set up.

Link to comment
Share on other sites

1 minute ago, Earthyburt said:

Thank You! It seems to work in common_postinit

 

Could you post how you achieved it? You took a different approach at it than I did, and I think it might be more efficient than how I did it in my mod.

Link to comment
Share on other sites

2 minutes ago, TheSkylarr said:

Could you post how you achieved it? You took a different approach at it than I did, and I think it might be more efficient than how I did it in my mod.

local common_postinit = function(inst) 
    -- Minimap icon
    inst.MiniMapEntity:SetIcon( "wayne.tex" )
    inst:AddTag("charactertag")
    inst:AddTag("wayne")
    
    local NIGHTVISION_COLOURCUBES =
    {
        day = "images/colour_cubes/day05_cc.tex",
        dusk = "images/colour_cubes/dusk03_cc.tex",
        night = "images/colour_cubes/night03_cc.tex",
        full_moon = "images/colour_cubes/purple_moon_cc.tex",
    }

    inst.components.playervision:ForceNightVision(true)
    inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES)
end

 

Edited by Earthyburt
Code
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...