Jump to content

Lureplant / eyeplant (minionspawner) multiple code issues


Bumber64
  • Pending

There are multiple issues in minionspawner.lua that mess with the spawning of eyeplants.

GetSpawnLocation function only checks tile compatibility, not entities. (As MakeSpawnLocations does.) Eyeplants can spawn inside other entities as a result.

maxminions:

  • Starts at 27 and can increase up to 32 in MakeSpawnLocations (if less than 33 usablepositions) on the first call. Hypothetical maxminions of 100 by increasing valid spawn locations up to 1.2 each time before the function is called.
  • Having less than 5 usablepositions in will permanently limit maxminions below 5, even if clearing blocked spaces and restarting server, due to #useablepositions >= maxpositions check in MakeSpawnLocations loop and maxminions being saved in data. Must kill and replant to fix.
  • 5 maxminions can increase to 6 if exactly 6 out of 100 iterations are usable, avoiding early return from function but not decreasing maxminions. You can work back to 27 and beyond from there.
  • Having maxminions of 0 can't even get past StartNextSpawn, due to MaxedMinions() check.

freepositions:

  • Resets to list of length 32 (27 * 1.2) after restarting, due to not being saved as data. (Occurs in class definition before maxminions is restored from data, so result is consistent.)
  • These num values won't correspond to entries in minionpositions (which are saved) and result in pos of nil when randomly selected in SpawnNewMinion, resulting in a MakeSpawnLocations call.
  • If that call returns before 100 iterations (more likely with lower maxminions,) then the issue of invalid entries will remain and SpawnNewMinion must keep guessing. In any case, minionpositions is rebuilt, tossing out existing positions of living eyeplants (which could possibly mess with lureplant control over them.)

Steps to Reproduce

Issues occur when:

Placing an entity on an eyeplant spawn point after it's been generated,

Having certain numbers of spawn locations blocked, or

Loading a saved game with lureplants.

  • Like 2



User Feedback


There are no comments to display.



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