-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shroom spreading code was slightly optimized
We did a number of things here, first we collect the potential turfs for the view call in a single pass, not once per yield run. Second we dont' run a second view(1) on every single potential turf, instead we try to randomly pick a turf 3 times during yield phase and check the view then. If we fail to find a potential location then we bail out of that yield phase. This is a tradeoff between processing time spent finding locations and the chance that the glowshroom fails to spread Finally, we have maximum limit on how many times a glowshroom fails to spread, if it fails to spread at least 5 times over any iteration, it stops processing completely. As a bonus, the timers have been made unique, so we don't accidentally generate multiple timers for a single shroom, other than the two it already needs. This code would benefit from being a seperate subsystem and grouping, generations of the plants together as a single ticking entity and just spreading from selected edge plants. However I don't particularly feel like plumbing that together, so this will suit for now.
- Loading branch information
1 parent
824be91
commit faabdc0
Showing
1 changed file
with
50 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters