Sanity check for facehuggers.

Sanity checks galore for simple_animals (if(list) behaviour seems to have changed lately).
Humans once again get their bodies burned into husks in fire. This only changes their appearance and name now, however, leaving their DNA intact.
WIP space worms.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3140 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
uporotiy
2012-02-17 19:26:14 +00:00
parent 9641dc8c91
commit 7c865548c5
15 changed files with 244 additions and 448 deletions
+1 -1
View File
@@ -905,7 +905,7 @@
if(!T.dna)
usr << "You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum)"
return
if(T.mutations & HUSK) //target done been et, no more blood in him
if(T.mutations & NOCLONE) //target done been et, no more blood in him
user << "\red You are unable to locate any blood."
return
B.holder = src
@@ -55,4 +55,9 @@
mutations |= HUSK
real_name = "Unknown"
update_body()
return
/mob/living/carbon/human/proc/Drain()
ChangeToHusk()
mutations |= NOCLONE
return
@@ -2222,8 +2222,8 @@ It can still be worn/put on as normal.
src.stat = 0
return
src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss()
//if(getFireLoss() > 100 && stat == DEAD)
// ChangeToHusk() // Commented out due to lasers and fire also husking you and making you unclonable.
if(getFireLoss() > (100 - config.health_threshold_dead) && stat == DEAD) //100 only being used as the magic human max health number, feel free to change it if you add a var for it -- Urist
ChangeToHusk()
return
+1 -1
View File
@@ -22,7 +22,7 @@
max_co2 = 0
max_tox = 0
speed = 3
destroyer = 1
wall_smash = 1
nopush = 1
a_intent = "harm"
stop_automated_movement = 1
+33 -28
View File
@@ -47,7 +47,7 @@
var/attacktext = "attacks"
var/attack_sound = null
var/friendly = "nuzzles" //If the mob does no damage with it's attack
var/destroyer = 0 //if they can smash walls
var/wall_smash = 0 //if they can smash walls
var/speed = 0 //LETS SEE IF I CAN SET SPEEDS FOR SIMPLE MOBS WITHOUT DESTROYING EVERYTHING. Higher speed is slower, negative speed is faster
/mob/living/simple_animal/New()
@@ -66,16 +66,12 @@
if(health > 0)
icon_state = icon_living
alive = 1
stat = 0 //Alive - conscious
stat = CONSCIOUS
density = 1
return
if(health < 1)
alive = 0
icon_state = icon_dead
stat = 2 //Dead
density = 0
return
Die()
if(health > maxHealth)
health = maxHealth
@@ -91,35 +87,37 @@
//Speaking
if(speak_chance)
if(prob(speak_chance))
if(speak && (emote_hear || emote_see) )
var/length = speak.len
if(emote_hear)
length += emote_hear.len
if(emote_see)
length += emote_see.len
var/pick = rand(1,length)
if(pick <= speak.len)
say(pick(speak))
else
pick -= speak.len
if(emote_see && pick <= emote_see.len)
emote(pick(emote_see),1)
if(speak && speak.len)
if((emote_hear && emote_hear.len) || (emote_see && emote_see.len))
var/length = speak.len
if(emote_hear && emote_hear.len)
length += emote_hear.len
if(emote_see && emote_see.len)
length += emote_see.len
var/randomValue = rand(1,length)
if(randomValue <= speak.len)
say(pick(speak))
else
emote(pick(emote_hear),2)
if(!speak)
if(!emote_hear && emote_see)
randomValue -= speak.len
if(emote_see && randomValue <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
else
say(pick(speak))
else
if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len))
emote(pick(emote_see),1)
if(emote_hear && !emote_see)
if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len))
emote(pick(emote_hear),2)
if(emote_hear && emote_see)
if((emote_hear && emote_hear.len) && (emote_see && emote_see.len))
var/length = emote_hear.len + emote_see.len
var/pick = rand(1,length)
if(pick <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
if(speak && !(emote_see || emote_hear))
say(pick(speak))
//Atmos
var/atmos_suitable = 1
@@ -193,7 +191,7 @@
..()
/mob/living/simple_animal/say_quote(var/text)
if(speak_emote)
if(speak_emote && speak_emote.len)
var/emote = pick(speak_emote)
if(emote)
return "[emote], \"[text]\""
@@ -300,3 +298,10 @@
tally = speed
return tally
/mob/living/simple_animal/proc/Die()
alive = 0
icon_state = icon_dead
stat = DEAD
density = 0
return
+183
View File
@@ -0,0 +1,183 @@
/mob/living/simple_animal/space_worm
name = "space worm segment"
desc = "A part of a space worm."
icon = 'critter.dmi'
icon_state = "spaceworm"
icon_living = "spaceworm"
icon_dead = "spacewormdead"
speak_emote = list("transmits") //not supposed to be used under AI control
emote_hear = list("transmits") //I'm just adding it so it doesn't runtime if controlled by player who speaks
response_help = "touches"
response_disarm = "flails at"
response_harm = "punches the"
harm_intent_damage = 2
maxHealth = 30
health = 30
stop_automated_movement = 1
animate_movement = SYNC_STEPS
minbodytemp = 0
maxbodytemp = 350
min_oxy = 0
max_co2 = 0
max_tox = 0
a_intent = "harm" //so they don't get pushed around
nopush = 1
wall_smash = 1
speed = -1
var/mob/living/simple_animal/space_worm/previous //next/previous segments, correspondingly
var/mob/living/simple_animal/space_worm/next //head is the nextest segment
var/stomach_process_probability = 50
var/digestion_probability = 20
var/flat_plasma_value = 5 //flat plasma amount given for non-items
head
name = "space worm head"
icon_state = "spacewormhead"
icon_living = "spacewormhead"
icon_dead = "spacewormdead"
maxHealth = 20
health = 20
melee_damage_lower = 10
melee_damage_upper = 15
attacktext = "bites"
animate_movement = SLIDE_STEPS
New(var/location, var/segments = 6)
..()
var/mob/living/simple_animal/space_worm/current = src
for(var/i = 1 to segments)
var/mob/living/simple_animal/space_worm/newSegment = new /mob/living/simple_animal/space_worm(loc)
current.Attach(newSegment)
current = newSegment
update_icon()
if(stat == CONSCIOUS || stat == UNCONSCIOUS)
icon_state = "spacewormhead[previous?1:0]"
if(previous)
dir = get_dir(previous,src)
else
icon_state = "spacewormheaddead"
Life()
..()
if(next && !(next in view(src,1)))
Detach()
if(stat == DEAD) //dead chunks fall off and die immediately
if(previous)
previous.Detach()
if(next)
Detach(1)
if(prob(stomach_process_probability))
ProcessStomach()
update_icon()
return
Del() //if a chunk a destroyed, make a new worm out of the split halves
if(previous)
previous.Detach()
..()
Move()
var/attachementNextPosition = loc
if(..())
if(previous)
previous.Move(attachementNextPosition)
update_icon()
Bump(atom/obstacle)
AttemptToEat(obstacle)
return
proc/update_icon() //only for the sake of consistency with the other update icon procs
if(stat == CONSCIOUS || stat == UNCONSCIOUS)
if(previous) //midsection
icon_state = "spaceworm[get_dir(src,previous) | get_dir(src,next)]" //see 3 lines below
else //tail
icon_state = "spacewormtail"
dir = get_dir(src,next) //next will always be present since it's not a head and if it's dead, it goes in the other if branch
else
icon_state = "spacewormdead"
return
proc/AttemptToEat(var/atom/target) //will take time later, prototype right now
if(istype(target,/turf/simulated/wall))
var/turf/simulated/wall/wall = target
wall.ReplaceWithFloor()
new /obj/item/stack/sheet/metal(src, 5) //will depend on wall type later, of course
else if(istype(target,/atom/movable))
var/atom/movable/objectOrMob = target
contents += objectOrMob
return
proc/Attach(var/mob/living/simple_animal/space_worm/attachement)
if(!attachement)
return
previous = attachement
attachement.next = src
return
proc/Detach(die = 0)
var/mob/living/simple_animal/space_worm/newHead = new /mob/living/simple_animal/space_worm/head(loc,0)
var/mob/living/simple_animal/space_worm/newHeadPrevious = previous
previous = null //so that no extra heads are spawned
newHead.Attach(newHeadPrevious)
if(die)
newHead.Die()
del(src)
proc/ProcessStomach()
for(var/atom/movable/stomachContent in contents)
if(prob(digestion_probability))
if(istype(stomachContent,/obj/item/stack)) //converts to plasma, keeping the stack value
if(!istype(stomachContent,/obj/item/stack/sheet/plasma))
var/obj/item/stack/oldStack = stomachContent
new /obj/item/stack/sheet/plasma(src, oldStack.amount)
del(oldStack)
continue
else if(istype(stomachContent,/obj/item)) //converts to plasma, keeping the w_class
var/obj/item/oldItem = stomachContent
new /obj/item/stack/sheet/plasma(src, oldItem.w_class)
del(oldItem)
continue
else
new /obj/item/stack/sheet/plasma(src, flat_plasma_value) //just flat amount
del(stomachContent)
continue
if(previous)
for(var/atom/movable/stomachContent in contents) //transfer it along the digestive tract
previous.contents += stomachContent
else
for(var/atom/movable/stomachContent in contents) //or poop it out
loc.contents += stomachContent
return