Jump to content

How can i change the molehat's filter color?


Recommended Posts

i try to use the addcomponentpostinit but it does not work.

 

local function ChangeMoleShader (inst)
    print("it work")
    local OLD_CUBES = NIGHTVISION_COLOURCUBES
    local GHOSTVISION_COLOURCUBES =
    {
        day = "images/shader/purple_moon_cc.tex",
        dusk = "images/shader/purple_moon_cc.tex",
        night = "images/shader/purple_moon_cc.tex",
        full_moon = "images/shader/purple_moon_cc.tex",
    }
    print("work")
    return inst
end
AddComponentPostInit("playervision",ChangeMoleShader)
Link to comment
Share on other sites

The answers you seek lie within the hats.lua prefab, located in the scripts-prefabs folder, my child.

 

 

What I mean is, the colourcube override is in the onequip/onunequip functions in the hat.lua. What you'd wanna do is make a prefab postinit for the molehat itself. 

 

Adding a function something like this in said postinit:

 

        inst.components.equippable:SetOnEquip( function(inst)
DO THINGY
end)
 
And as for what thingy to do? You'll find your clues in the hat.lua.
An unequip would be uneeded, as it already just removes the colour cube and night vision. 
Link to comment
Share on other sites

the molehat has a tag nightvision which provides the vision effect,it can't be change during equip or unequip,it rely on the inst itself

 

inst:AddTag("nightvision")

 

like this, so i add the tag ,but can't change the color,i guess if i can find where nightvision is defined,i will be fine for modifying.

 

ill try what u've told.

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