Files
Aurora.3/code/game/objects/biomass.dm
mport2004@gmail.com 17ed3899c4 Fixed the map/code issues that the body bags caused.
/obj/effects is now /obj/effect.
/obj/station_objects is now /obj/structure.
Did a bit of minor blob work. 
The Bay 12 body bags were replaced with closets because having two sets of code that do almost the same thing is silly.
Changed back a few of the last jobproc edits as the remove from list before assign was a check to see if the mob was fucked up and if it was remove it so we did not check it again as it would still be fucked up.
The medbay/tox monkeys names are random once more.  More random name monkeys will help with changeling and clean up the observe/mob menus.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2324 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-03 10:28:57 +00:00

124 lines
3.5 KiB
Plaintext

/obj/effect/biomass
icon = 'biomass.dmi'
icon_state = "stage1"
opacity = 0
density = 0
anchored = 1
layer = 20 //DEBUG
var/health = 10
var/stage = 1
var/obj/effect/rift/originalRift = null //the originating rift of that biomass
var/maxDistance = 15 //the maximum length of a thread
var/newSpreadDistance = 10 //the length of a thread at which new ones are created
var/curDistance = 1 //the current length of a thread
var/continueChance = 3 //weighed chance of continuing in the same direction. turning left or right has 1 weight both
var/spreadDelay = 1 //will change to something bigger later, but right now I want it to spread as fast as possible for testing
/obj/effect/rift
icon = 'biomass.dmi'
icon_state = "rift"
var/list/obj/effect/biomass/linkedBiomass = list() //all the biomass patches that have spread from it
var/newicon = 1 //DEBUG
/obj/effect/rift/New()
set background = 1
..()
for(var/turf/T in orange(1,src))
if(!IsValidBiomassLoc(T))
continue
var/obj/effect/biomass/starting = new /obj/effect/biomass(T)
starting.dir = get_dir(src,starting)
starting.originalRift = src
linkedBiomass += starting
spawn(1) //DEBUG
starting.icon_state = "[newicon]"
/obj/effect/rift/Del()
for(var/obj/effect/biomass/biomass in linkedBiomass)
del(biomass)
..()
/obj/effect/biomass/New()
set background = 1
..()
if(!IsValidBiomassLoc(loc,src))
del(src)
return
spawn(1) //so that the dir and stuff can be set by the source first
if(curDistance >= maxDistance)
return
switch(dir)
if(NORTHWEST)
dir = NORTH
if(NORTHEAST)
dir = EAST
if(SOUTHWEST)
dir = WEST
if(SOUTHEAST)
dir = SOUTH
sleep(spreadDelay)
Spread()
/obj/effect/biomass/proc/Spread(var/direction = dir)
set background = 1
var/possibleDirsInt = 0
for(var/newDirection in cardinal)
if(newDirection == turn(direction,180)) //can't go backwards
continue
var/turf/T = get_step(loc,newDirection)
if(!IsValidBiomassLoc(T,src))
continue
possibleDirsInt |= newDirection
var/list/possibleDirs = list()
if(possibleDirsInt & direction)
for(var/i=0 , i<continueChance , i++)
possibleDirs += direction
if(possibleDirsInt & turn(direction,90))
possibleDirs += turn(direction,90)
if(possibleDirsInt & turn(direction,-90))
possibleDirs += turn(direction,-90)
if(!possibleDirs.len)
return
direction = pick(possibleDirs)
var/obj/effect/biomass/newBiomass = new /obj/effect/biomass(get_step(src,direction))
newBiomass.curDistance = curDistance + 1
newBiomass.maxDistance = maxDistance
newBiomass.dir = direction
newBiomass.originalRift = originalRift
newBiomass.icon_state = "[originalRift.newicon]" //DEBUG
originalRift.linkedBiomass += newBiomass
if(!(curDistance%newSpreadDistance))
var/obj/effect/rift/newrift = new /obj/effect/rift(loc)
if(originalRift.newicon <= 3)
newrift.newicon = originalRift.newicon + 1
// NewSpread()
/obj/effect/biomass/proc/NewSpread(maxDistance = 15)
set background = 1
for(var/turf/T in orange(1,src))
if(!IsValidBiomassLoc(T,src))
continue
var/obj/effect/biomass/starting = new /obj/effect/biomass(T)
starting.dir = get_dir(src,starting)
starting.maxDistance = maxDistance
/proc/IsValidBiomassLoc(turf/location,obj/effect/biomass/source = null)
set background = 1
for(var/obj/effect/biomass/biomass in location)
if(biomass != source)
return 0
if(istype(location,/turf/space))
return 0
if(location.density)
return 0
return 1