adds shadowshrooms from tgstation, nerf glowshroom glow a bit and add new vars for glow, add new shadow and red light genes

This commit is contained in:
uraniummeltdown
2017-03-11 13:36:04 +04:00
parent 98526aa020
commit 658e0f6a82
8 changed files with 112 additions and 34 deletions
+46 -18
View File
@@ -10,30 +10,54 @@
icon_state = "glowshroom" //replaced in New
layer = 2.1
var/endurance = 30
var/potency = 30
var/delay = 1200
var/floor = 0
var/yield = 3
var/generation = 1
var/spreadIntoAdjacentChance = 60
light_color = "#006622"
var/obj/item/seeds/myseed = /obj/item/seeds/glowshroom
obj/effect/glowshroom/glowcap
/obj/effect/glowshroom/glowcap
name = "glowcap"
desc = "Mycena Ruthenia, a species of mushroom that, while it does glow in the dark, is not actually bioluminescent."
icon_state = "glowcap"
light_color = "#8E0300"
myseed = /obj/item/seeds/glowshroom/glowcap
/obj/effect/glowshroom/single
yield = 0
/obj/effect/glowshroom/shadowshroom
name = "shadowshroom"
desc = "Mycena Umbra, a species of mushroom that emits shadow instead of light."
icon_state = "shadowshroom"
myseed = /obj/item/seeds/glowshroom/shadowshroom
/obj/effect/glowshroom/single/Spread()
return
/obj/effect/glowshroom/examine(mob/user)
. = ..()
to_chat(user, "This is a [generation]\th generation [name]!")
/obj/effect/glowshroom/New()
/obj/effect/glowshroom/Destroy()
if(myseed)
qdel(myseed)
myseed = null
return ..()
/obj/effect/glowshroom/New(loc, obj/item/seeds/newseed, mutate_stats)
..()
set_light(round(potency/10))
dir = CalcDir()
if(newseed)
myseed = newseed.Copy()
myseed.forceMove(src)
else
myseed = new myseed(src)
if(mutate_stats) //baby mushrooms have different stats :3
myseed.adjust_potency(rand(-3,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
if(myseed.get_gene(/datum/plant_gene/trait/glow))
var/datum/plant_gene/trait/glow/G = myseed.get_gene(/datum/plant_gene/trait/glow)
set_light(G.glow_range(myseed), G.glow_power(myseed), G.glow_color)
setDir(CalcDir())
var/base_icon_state = initial(icon_state)
if(!floor)
switch(dir) //offset to make it be on the wall rather than on the floor
@@ -49,10 +73,12 @@ obj/effect/glowshroom/glowcap
else //if on the floor, glowshroom on-floor sprite
icon_state = "[base_icon_state]f"
addtimer(src, "Spread", delay)
addtimer(src, "Spread", delay, FALSE)
/obj/effect/glowshroom/proc/Spread()
for(var/i = 1 to yield)
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
@@ -61,6 +87,8 @@ obj/effect/glowshroom/glowcap
spreadsIntoAdjacent = TRUE
for(var/turf/simulated/floor/earth in view(3,src))
if(!ownturf.CanAtmosPass(earth))
continue
if(spreadsIntoAdjacent || !locate(/obj/effect/glowshroom) in view(1,earth))
possibleLocs += earth
CHECK_TICK
@@ -81,14 +109,14 @@ obj/effect/glowshroom/glowcap
if(shroomCount >= placeCount)
continue
var/obj/effect/glowshroom/child = new type(newLoc)//The baby mushrooms have different stats :3
child.potency = max(potency + rand(-3,6), 0)
child.yield = max(yield + rand(-1,2), 0)
child.delay = max(delay + rand(-30,60), 0)
child.endurance = max(endurance + rand(-3,6), 1)
var/obj/effect/glowshroom/child = new type(newLoc, myseed, TRUE)
child.generation = generation + 1
shrooms_planted++
CHECK_TICK
if(shrooms_planted < myseed.yield) //if we didn't get all possible shrooms planted, try again later
myseed.yield -= shrooms_planted
addtimer(src, "Spread", delay, FALSE)
/obj/effect/glowshroom/proc/CalcDir(turf/location = loc)
var/direction = 16
@@ -146,4 +174,4 @@ obj/effect/glowshroom/glowcap
/obj/effect/glowshroom/proc/CheckEndurance()
if(endurance <= 0)
qdel(src)
qdel(src)