Jump to content

Lureplants volume adjusting can set the value to Inf or NaN


hoxi
  • Fixed

In the following:

inst.components.minionspawner.numminions / inst.components.minionspawner.maxminions

Both numminions and maxminions can be 0, which results in NaN (or Inf if some minion exists, and the nearby tiles are terraformed to not allow any spawns, without killing the existing ones).

numminions being 0 isn't inherently an issue, that results in setting the volume to 0 when maxminions is a value above 0. The problem is that maxminions being 0 needs to be sanitized. It should be checking for that and sending 0 instead of doing the division, which results in Inf or NaN.

It might be harmless as it's probably accounted for on the engine side (otherwise we'd see reports of it given how easy this is to reproduce), but it's still pretty bad to have something like this.

 

There's also this bit here that doesn't account for these values being 0:

        elseif inst.components.minionspawner.numminions * 2 >= inst.components.minionspawner.maxminions then
            local meat = SpawnPrefab("plantmeat")
            inst.components.inventory:GiveItem(meat)
            return meat
        end

However, keep in mind that this is what allows Lureplants on boats or surrounded by tiles where Eyeplants can't grow, to still produce Leafy Meat. So if you were to address it, keep that in mind if you want to keep that behavior in some way or another, given how commonly it's used by players.

 

 

Also, on an unrelated note.. is there a reason as to why the following tiles are missing in the lureplantspawner component?

-- vanilla
local VALID_TILES = table.invert(
{
    WORLD_TILES.DIRT,
    WORLD_TILES.SAVANNA,
    WORLD_TILES.GRASS,
    WORLD_TILES.FOREST,
    WORLD_TILES.MARSH,
    WORLD_TILES.CAVE,
    WORLD_TILES.FUNGUS,
    WORLD_TILES.SINKHOLE,
    WORLD_TILES.MUD,
})

-- missing ones
WORLD_TILES.DECIDUOUS
WORLD_TILES.FUNGUSRED
WORLD_TILES.FUNGUSGREEN

FUNGUSRED and FUNGUSGREEN being missing is weird because FUNGUS (blue) is included..

 

And DECIDUOUS used to be there in Don't Starve, and is weirdly missing here, which is very limiting given how big those biomes are (plus, if MARSH is there, it makes extra weird if they can show up in the swamp biome but not in one specific forest biome?).

Was this maybe missed when initially porting Reign of Giants content into DST? Given how different the code is between both games, and how in DS the table used for this was set with magic numbers rather than using proper tile references..

You could check for other tiles that could potentially be added there, if we consider this list outdated, not just these three I mentioned.

 

Note that changing either of these has nothing to do with where players can replant Lureplants, it's specifically just how the world spawns them automatically during Spring.


Steps to Reproduce

Not much to explain here.

  • Big Ups 1



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


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