Glowshrooms no longer spread when planted (#19299)

* goodbye, lag machine

* Remove unneeded variable

* single glowshrooms are just regular glowshrooms
This commit is contained in:
BiancaWilkson
2022-10-12 10:30:44 -05:00
committed by GitHub
parent 7d9ef94330
commit c86d0a293d
4 changed files with 7 additions and 65 deletions
-58
View File
@@ -10,10 +10,7 @@
icon_state = "glowshroom" //replaced in New
layer = ABOVE_NORMAL_TURF_LAYER
max_integrity = 30
var/delay = 1200
var/floor = 0
var/generation = 1
var/spreadIntoAdjacentChance = 60
var/obj/item/seeds/myseed = /obj/item/seeds/glowshroom
/obj/structure/glowshroom/extinguish_light()
@@ -35,13 +32,6 @@
/obj/structure/glowshroom/shadowshroom/extinguish_light()
return
/obj/structure/glowshroom/single/Spread()
return
/obj/structure/glowshroom/examine(mob/user)
. = ..()
. += "This is a [generation]\th generation [name]!"
/obj/structure/glowshroom/Destroy()
QDEL_NULL(myseed)
return ..()
@@ -58,7 +48,6 @@
myseed.adjust_yield(rand(-1,2))
myseed.adjust_production(rand(-3,6))
myseed.adjust_endurance(rand(-3,6))
delay = delay - myseed.production * 100 //So the delay goes DOWN with better stats instead of up. :I
obj_integrity = myseed.endurance
max_integrity = myseed.endurance
if(myseed.get_gene(/datum/plant_gene/trait/glow))
@@ -80,53 +69,6 @@
else //if on the floor, glowshroom on-floor sprite
icon_state = "[base_icon_state]f"
addtimer(CALLBACK(src, .proc/Spread), delay)
/obj/structure/glowshroom/proc/Spread()
var/turf/ownturf = get_turf(src)
var/shrooms_planted = 0
for(var/i in 1 to myseed.yield)
if(prob(1/(generation * generation) * 100))//This formula gives you diminishing returns based on generation. 100% with 1st gen, decreasing to 25%, 11%, 6, 4, 2...
var/list/possibleLocs = list()
var/spreadsIntoAdjacent = FALSE
if(prob(spreadIntoAdjacentChance))
spreadsIntoAdjacent = TRUE
for(var/turf/simulated/floor/earth in view(3,src))
if(!ownturf.CanAtmosPass(earth))
continue
if(spreadsIntoAdjacent || !locate(/obj/structure/glowshroom) in view(1,earth))
possibleLocs += earth
CHECK_TICK
if(!possibleLocs.len)
break
var/turf/newLoc = pick(possibleLocs)
var/shroomCount = 0 //hacky
var/placeCount = 1
for(var/obj/structure/glowshroom/shroom in newLoc)
shroomCount++
for(var/wallDir in GLOB.cardinal)
var/turf/isWall = get_step(newLoc,wallDir)
if(isWall.density)
placeCount++
if(shroomCount >= placeCount)
continue
var/obj/structure/glowshroom/child = new type(newLoc, myseed, TRUE)
child.generation = generation + 1
shrooms_planted++
CHECK_TICK
else
shrooms_planted++ //if we failed due to generation, don't try to plant one later
if(shrooms_planted < myseed.yield) //if we didn't get all possible shrooms planted, try again later
myseed.yield -= shrooms_planted
addtimer(CALLBACK(src, .proc/Spread), delay)
/obj/structure/glowshroom/proc/CalcDir(turf/location = loc)
var/direction = 16