Hydroponics

Fixed bug with mutated plants not being harvestable.
Added glowshrooms. They (maybe) glown in the dark. To get their seeds, you need to hack the seed machine. They're pretty straightforward. To plant a glowshroom on the floor, you need to click it while it's in your hand.
 Badmin
Added a "Honk" button.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1515 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
uporotiy
2011-05-01 20:19:18 +00:00
parent 42a7c44325
commit f05a9843af
12 changed files with 238 additions and 3 deletions
+154
View File
@@ -0,0 +1,154 @@
//separate dm since hydro is getting bloated already
/obj/glowshroom
opacity = 0
density = 0
icon = 'lighting.dmi'
icon_state = "glowshroomf"
layer = 2.1
var/endurance = 30
var/potency = 30
var/delay = 300
var/floor = 0
var/yield = 3
var/spreadChance = 80
var/spreadIntoAdjacentChance = 10
var/evolveChance = 2
/obj/glowshroom/New()
..()
dir = CalcDir()
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 = "glowshroom[rand(1,3)]"
else //if on the floor, glowshroom on-floor sprite
icon_state = "glowshroomf"
spawn(2) //allows the luminosity and spread rate to be affected by potency at the moment of creation
sd_SetLuminosity(potency/10)
spawn(delay)
if(src)
Spread()
/obj/glowshroom/proc/Spread()
set background = 1
for(var/i=1,i<=yield,i++)
if(prob(spreadChance))
var/list/possibleLocs = list()
for(var/turf/turf in view(3,src))
if(!turf.density)
possibleLocs += turf
var/turf/newLoc = pick(possibleLocs)
if(istype(newLoc,/turf/space))
continue
var/ifContinue = 0 //hacky
if(!prob(spreadIntoAdjacentChance))
for(var/obj/glowshroom in view(1,newLoc))
ifContinue = 1
break
if(ifContinue)
continue
var/shroomCount = 0 //hacky
var/placeCount = 1
for(var/obj/glowshroom/shroom in newLoc)
shroomCount++
for(var/wallDir in cardinal)
var/turf/isWall = get_step(newLoc,wallDir)
if(isWall.density)
placeCount++
if(shroomCount >= placeCount)
continue
var/obj/glowshroom/child = new /obj/glowshroom(newLoc)
child.potency = potency
child.yield = yield
child.delay = delay
child.endurance = endurance
if(prob(evolveChance)) //very low chance to evolve on its own
potency += rand(4,6)
sleep(delay)
if(src)
.()
/obj/glowshroom/proc/CalcDir(turf/location = loc)
var/direction = 16
for(var/wallDir in cardinal)
var/turf/newTurf = get_step(location,wallDir)
if(newTurf.density)
direction |= wallDir
for(var/obj/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=0,i<=4,i++)
if(direction & 2 ** i)
dirList += 2 ** i
if(dirList.len)
var/newDir = pick(dirList)
if(newDir == 16)
floor = 1
newDir = 1
return newDir
floor = 1
return 1
/obj/glowshroom/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
endurance -= W.force
CheckEndurance()
/obj/glowshroom/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(50))
del(src)
return
if(3.0)
if (prob(5))
del(src)
return
else
return
/obj/glowshroom/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > 300)
endurance -= 5
CheckEndurance()
/obj/glowshroom/proc/CheckEndurance()
if(endurance <= 0)
del(src)