looterz / atmos

garrysmod weather modification
GNU General Public License v3.0
5 stars 5 forks source link

Sky broken by latest skypaint matproxy change #12

Closed ghost closed 4 months ago

ghost commented 5 months ago

Commit that caused this issue: https://github.com/Facepunch/garrysmod/pull/2068

A possible workaround could be defining our own GetNetworkVars method in https://github.com/looterz/atmos/blob/master/lua/entities/atmos_sky.lua.

ghost commented 5 months ago

tested, seems to work fine. i'm working on other fixes right now

-- HACK: https://github.com/looterz/atmos/issues/12
function ENT:GetNetworkVars()
    local tbl = {
        TopColor = self.TopColor,
        BottomColor = self.BottomColor,
        DuskColor = self.DuskColor,
        DuskIntensity = self.DuskIntensity,
        DuskScale = self.DuskScale,
        FadeBias = self.FadeBias,
        HDRScale = self.HDRScale,
        SunNormal = self.SunNormal,
        SunColor = self.SunColor,
        SunSize = self.SunSize
    }

    -- (might) reduce __index calls a bit
    if self.DrawStars then
        tbl.DrawStars = self.DrawStars
        tbl.StarLayers = self.StarLayers
        tbl.StarScale = self.StarScale
        tbl.StarFade = self.StarFade
        tbl.StarSpeed = self.StarSpeed
        tbl.StarTexture = self.StarTexture
    end

    return tbl
end
ghost commented 5 months ago

my eternal apologies but my dumb ass forgot to use self.Values so here's the real fix

-- HACK: https://github.com/looterz/atmos/issues/12
function ENT:GetNetworkVars()
    local tbl = {
        TopColor = self.Values.TopColor,
        BottomColor = self.Values.BottomColor,
        DuskColor = self.Values.DuskColor,
        DuskIntensity = self.Values.DuskIntensity,
        DuskScale = self.Values.DuskScale,
        FadeBias = self.Values.FadeBias,
        HDRScale = self.Values.HDRScale,
        SunNormal = self.Values.SunNormal,
        SunColor = self.Values.SunColor,
        SunSize = self.Values.SunSize
    }

    -- (might) reduce __index calls a bit
    if self.Values.DrawStars then
        tbl.DrawStars = self.Values.DrawStars
        tbl.StarLayers = self.Values.StarLayers
        tbl.StarScale = self.Values.StarScale
        tbl.StarFade = self.Values.StarFade
        tbl.StarSpeed = self.Values.StarSpeed
        tbl.StarTexture = self.Values.StarTexture
    end

    return tbl
end
looterz commented 4 months ago

Thanks! Updated the sky ent with your changes.