Files
Paradise/code/game/objects/effects/glowshroom.dm
DGamerL bad8b31afa Changes all .len to length() where applicable (#25174)
* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
2024-04-19 17:32:09 +00:00

119 lines
3.4 KiB
Plaintext

//separate dm since hydro is getting bloated already
/obj/structure/glowshroom
name = "glowshroom"
desc = "Mycena Bregprox, a species of mushroom that glows in the dark."
anchored = TRUE
opacity = FALSE
density = FALSE
icon = 'icons/obj/lighting.dmi'
icon_state = "glowshroom" //replaced in New
layer = ABOVE_NORMAL_TURF_LAYER
max_integrity = 30
var/floor = 0
var/obj/item/seeds/myseed = /obj/item/seeds/glowshroom
/obj/structure/glowshroom/extinguish_light(force = FALSE)
visible_message("<span class='warning'>[src] withers away!</span>")
qdel(src)
/obj/structure/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"
myseed = /obj/item/seeds/glowshroom/glowcap
/obj/structure/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/structure/glowshroom/shadowshroom/extinguish_light(force = FALSE)
return
/obj/structure/glowshroom/Destroy()
QDEL_NULL(myseed)
return ..()
/obj/structure/glowshroom/New(loc, obj/item/seeds/newseed, mutate_stats)
..()
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))
obj_integrity = myseed.endurance
max_integrity = myseed.endurance
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
if(NORTH)
pixel_y = 32
if(SOUTH)
pixel_y = -32
if(EAST)
pixel_x = 32
if(WEST)
pixel_x = -32
icon_state = "[base_icon_state][rand(1,3)]"
else //if on the floor, glowshroom on-floor sprite
icon_state = "[base_icon_state]f"
/obj/structure/glowshroom/proc/CalcDir(turf/location = loc)
var/direction = 16
for(var/wallDir in GLOB.cardinal)
var/turf/newTurf = get_step(location,wallDir)
if(newTurf.density)
direction |= wallDir
for(var/obj/structure/glowshroom/shroom in location)
if(shroom == src)
continue
if(shroom.floor) //special
direction &= ~16
else
direction &= ~shroom.dir
var/list/dirList = list()
for(var/i=1,i<=16,i <<= 1)
if(direction & i)
dirList += i
if(length(dirList))
var/newDir = pick(dirList)
if(newDir == 16)
floor = 1
newDir = 1
return newDir
floor = 1
return 1
/obj/structure/glowshroom/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
if(damage_type == BURN && damage_amount)
playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/glowshroom/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..()
if(exposed_temperature > 300)
take_damage(5, BURN, 0, 0)
/obj/structure/glowshroom/acid_act(acidpwr, acid_volume)
. = 1
visible_message("<span class='danger'>[src] melts away!</span>")
var/obj/effect/decal/cleanable/molten_object/I = new (get_turf(src))
I.desc = "Looks like this was \an [src] some time ago."
qdel(src)