Jump to content

Is this a glitch or did I mess up?


Recommended Posts

First of all, I'm sorry if this topic is kinda stupid. But I'm genuinely confused. I have been always told that as long as I plat the flowers under the sunlight range inside the caves they will last forever. I had this bee farm set up since the day 300 and it has been working great (the area where I'm standing on the screenshot). Last summer I decided to expand it by adding a second enclosure around the stairs and now all my flowers are withered. I'm not sure why did this happen. As you can see all flowers get sunlight, I checked before planting them. Did I mess up somehow or is this a glitch? Has anyone had this happen to them before? I really don't want to replant all the flowers just for them wither again. :crushed: 

Flowers.png

Link to comment
Share on other sites

Its not stupid, as far as I know that shouldn't happen, although I'm no expert I had bees in a cave base working for a while using the same logic you used.

Did they stay as flowers for a while, and only now did they change, or was it immediately after you created it, left the caves and came back to find it like that? Im thinking that maybe cave entrance light is not considered real light for a reason unlike the other light patches in the caves, but Im not really sure.

Awesome bee farm design btw, sorry about the flowers :/

Link to comment
Share on other sites

6 hours ago, Naechan said:

I really don't want to replant all the flowers just for them wither again

I don't know exactly why this happened, but looking at the lua, I can kinda guess. But before that, your best solution to keep flowers in the caves without ever having to worry about withering flowers is to convert all the flowers into evil flowers by haunting them as a ghost. Evil flowers can never wither since they do not have the DieInDarkness function in their lua (flower_evil.lua). Although tedious and will be a drain on your sanity, this is a guaranteed, year-round flower that bees will use instead of regular flowers.

Now for the code itself.

The function OnIsCaveDay in flower.lua, which to my understanding is simply a time limit before the flower dies in Darkness if it does not find light specifically in the caves (or at least I think specifically in the caves. Would have to see in a lights out world.) I don't know what unit (sec, minutes, or whatever) the 5 in DoTaskInTime represents, so if someone has a better understanding of this or the code/lua in general, please share.

My best guess is that you got an unlucky number with the timer and/or that the night was just long enough for the timer to take action.

Spoiler

local function OnIsCaveDay(inst, isday)
    if isday then
        inst:DoTaskInTime(5.0 + math.random()*5.0, DieInDarkness)
    end
end

 

This is the function DieInDarkness, which to my understanding changes regular flowers into withered flowers if it does not detect sunlight in the caves (explained before).

Spoiler

local function DieInDarkness(inst)
    local x,y,z = inst.Transform:GetWorldPosition()
    local ents = TheSim:FindEntities(x,0,z, DAYLIGHT_SEARCH_RANGE, { "daylight", "lightsource" })
    for i,v in ipairs(ents) do
        local lightrad = v.Light:GetCalculatedRadius() * .7
        if v:GetDistanceSqToPoint(x,y,z) < lightrad * lightrad then
            --found light
            return
        end
    end
    --in darkness
    inst:Remove()
    SpawnPrefab("flower_withered").Transform:SetPosition(x,y,z)
end

 

So yea, bad luck is the best guess I can interpret from this. Again, if someone has a better understanding of this or the code/lua in general, please share.

Link to comment
Share on other sites

I'm glad to know this is not a normal thing to happen. 

I'm going to try replanting the flowers and see what happens. If they die again I will make them dark flowers, that is a good idea. I forgot that those don't wither.  

If it's a mod that is causing this I'm not sure which one it would be. Most mods I use don't interfere with the gameplay, they are just UI mods.

In any case, thanks for the help guys. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...