Jump to content

Gaining sanity during daytime?

Recommended Posts

I'm designing a character whose stats change and improve as they get colder, and vise versa when it gets hot.  The only factor I've programmed related to sanity and temperature is the following code, but should only affect their nighttime sanity.  When I began testing, I noticed their sanity was increasing during the day when they got hot.  Is that a default feature?

inst.components.sanity.night_drain_mult = -22/(0.03*inst.components.temperature.current^2+5)+1.3  --Sanity at night increases as temperature decreases

Link to comment
Share on other sites

I just tested it with Wilson, and his sanity is unaffected by temperature during the day.  It's very strange, but daytime sanity seems to have been affected inversely affected by my code..  No idea how to address this yet.  It's a mechanic I'm not familiar with and I've found no threads on this subject.

Wow wow wow wow, wow.  Turns out daytime sanity is Literally based on nighttime sanity.  Who knew.  On, so now I have to code that in too.

    if not self.light_drain_immune then
        if TheWorld.state.isday and not TheWorld:HasTag("cave") then
            light_delta = light_sanity_drain.DAY
            local lightval = CanEntitySeeInDark(self.inst) and .9 or self.inst.LightWatcher:GetLightValue()
            light_delta =
                (   (lightval > TUNING.SANITY_HIGH_LIGHT and light_sanity_drain.NIGHT_LIGHT) or
                    (lightval < TUNING.SANITY_LOW_LIGHT and light_sanity_drain.NIGHT_DARK) or
                ) * self.night_drain_mult

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

  • Create New...