From e2ce1fa2dfdd24371339508cc452fb61bfe4bae4 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Tue, 30 Sep 2014 15:28:30 +0930 Subject: [PATCH] Collapsed Bump() down to carbon from alien and monkey. Stripped out extraneous stuff from carbon/alien HUD. Implemented some life stuff for aliens. --- code/_onclick/hud/alien_larva.dm | 47 +----- code/game/objects/items/weapons/shards.dm | 2 +- code/modules/mob/living/carbon/alien/alien.dm | 38 +---- .../mob/living/carbon/alien/diona/life.dm | 36 ++--- .../mob/living/carbon/alien/larva/life.dm | 14 ++ code/modules/mob/living/carbon/alien/life.dm | 137 ++++++++++++++++-- code/modules/mob/living/carbon/carbon.dm | 97 ++++--------- .../mob/living/carbon/carbon_powers.dm | 60 ++++++++ .../carbon/human/alien/alien_species.dm | 11 +- .../mob/living/carbon/human/species.dm | 2 +- .../mob/living/carbon/monkey/monkey.dm | 36 ----- code/modules/mob/mob.dm | 9 ++ 12 files changed, 276 insertions(+), 213 deletions(-) create mode 100644 code/modules/mob/living/carbon/alien/larva/life.dm diff --git a/code/_onclick/hud/alien_larva.dm b/code/_onclick/hud/alien_larva.dm index 4e29827e89..b2a85e2076 100644 --- a/code/_onclick/hud/alien_larva.dm +++ b/code/_onclick/hud/alien_larva.dm @@ -5,58 +5,22 @@ var/obj/screen/using - using = new /obj/screen() - using.name = "act_intent" - using.dir = SOUTHWEST - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = (mymob.a_intent == "hurt" ? "harm" : mymob.a_intent) - using.screen_loc = ui_acti - using.layer = 20 - src.adding += using - action_intent = using - using = new /obj/screen() using.name = "mov_intent" using.dir = SOUTHWEST using.icon = 'icons/mob/screen1_alien.dmi' using.icon_state = (mymob.m_intent == "run" ? "running" : "walking") - using.screen_loc = ui_movi + using.screen_loc = ui_acti using.layer = 20 src.adding += using move_intent = using - mymob.oxygen = new /obj/screen() - mymob.oxygen.icon = 'icons/mob/screen1_alien.dmi' - mymob.oxygen.icon_state = "oxy0" - mymob.oxygen.name = "oxygen" - mymob.oxygen.screen_loc = ui_alien_oxygen - - mymob.toxin = new /obj/screen() - mymob.toxin.icon = 'icons/mob/screen1_alien.dmi' - mymob.toxin.icon_state = "tox0" - mymob.toxin.name = "toxin" - mymob.toxin.screen_loc = ui_alien_toxin - - - mymob.fire = new /obj/screen() - mymob.fire.icon = 'icons/mob/screen1_alien.dmi' - mymob.fire.icon_state = "fire0" - mymob.fire.name = "fire" - mymob.fire.screen_loc = ui_alien_fire - - mymob.healths = new /obj/screen() mymob.healths.icon = 'icons/mob/screen1_alien.dmi' mymob.healths.icon_state = "health0" mymob.healths.name = "health" mymob.healths.screen_loc = ui_alien_health - mymob.pullin = new /obj/screen() - mymob.pullin.icon = 'icons/mob/screen1_alien.dmi' - mymob.pullin.icon_state = "pull0" - mymob.pullin.name = "pull" - mymob.pullin.screen_loc = ui_pull_resist - mymob.blind = new /obj/screen() mymob.blind.icon = 'icons/mob/screen1_full.dmi' mymob.blind.icon_state = "blackimageoverlay" @@ -71,11 +35,6 @@ mymob.flash.screen_loc = "1,1 to 15,15" mymob.flash.layer = 17 - mymob.zone_sel = new /obj/screen/zone_sel() - mymob.zone_sel.overlays.Cut() - mymob.zone_sel.overlays += image("icon" = 'icons/mob/zone_sel.dmi', "icon_state" = text("[]", mymob.zone_sel.selecting)) - mymob.client.screen = null - - mymob.client.screen += list( mymob.zone_sel, mymob.oxygen, mymob.toxin, mymob.fire, mymob.healths, mymob.pullin, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach ) - mymob.client.screen += src.adding + src.other + mymob.client.screen += list( mymob.healths, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach ) + mymob.client.screen += src.adding + src.other \ No newline at end of file diff --git a/code/game/objects/items/weapons/shards.dm b/code/game/objects/items/weapons/shards.dm index 1eeb6dff8d..0ecbe900d2 100644 --- a/code/game/objects/items/weapons/shards.dm +++ b/code/game/objects/items/weapons/shards.dm @@ -76,7 +76,7 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M - if(H.species.flags & IS_SYNTHETIC) + if(H.species.flags & IS_SYNTHETIC || H.species.insulated) return if( !H.shoes && ( !H.wear_suit || !(H.wear_suit.body_parts_covered & FEET) ) ) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 0cb28d1086..5d48ec1f3c 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -11,18 +11,20 @@ attack_sound = null friendly = "nuzzles" wall_smash = 0 + health = 100 + maxHealth = 100 var/adult_form var/dead_icon var/amount_grown = 0 var/max_grown = 10 var/time_of_birth - var/co2overloadtime = null - var/temperature_resistance = T0C+75 var/language /mob/living/carbon/alien/New() + time_of_birth = world.time + verbs += /mob/living/proc/ventcrawl verbs += /mob/living/proc/hide @@ -44,38 +46,6 @@ /mob/living/carbon/alien/u_equip(obj/item/W as obj) return -//This is fine, works the same as a human -/mob/living/carbon/alien/Bump(atom/movable/AM as mob|obj, yes) - - spawn( 0 ) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(istype(tmob, /mob/living/carbon/human) && (FAT in tmob.mutations)) - if(prob(70)) - src << "\red You fail to push [tmob]'s fat ass out of the way." - now_pushing = 0 - return - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - tmob.LAssailant = src - - now_pushing = 0 - ..() - if (!( istype(AM, /atom/movable) )) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - step(AM, t) - now_pushing = null - return - return - /mob/living/carbon/alien/Stat() ..() stat(null, "Progress: [amount_grown]/[max_grown]") diff --git a/code/modules/mob/living/carbon/alien/diona/life.dm b/code/modules/mob/living/carbon/alien/diona/life.dm index 26d236bcaa..5a82e3f373 100644 --- a/code/modules/mob/living/carbon/alien/diona/life.dm +++ b/code/modules/mob/living/carbon/alien/diona/life.dm @@ -1,20 +1,20 @@ -/* TODO - if(alien) //Diona nymphs are the only alien monkey currently. - var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing - if(isturf(loc)) //else, there's considered to be no light - var/turf/T = loc - var/area/A = T.loc - if(A) - if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights - else light_amount = 5 +//Dionaea regenerate health and nutrition in light. +/mob/living/carbon/alien/diona/handle_environment(datum/gas_mixture/environment) - nutrition += light_amount - traumatic_shock -= light_amount + var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing + if(isturf(loc)) //else, there's considered to be no light + var/turf/T = loc + var/area/A = T.loc + if(A) + if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights + else light_amount = 5 - if(nutrition > 500) - nutrition = 500 - if(light_amount > 2) //if there's enough light, heal - adjustBruteLoss(-1) - adjustToxLoss(-1) - adjustOxyLoss(-1) -*/ \ No newline at end of file + nutrition += light_amount + + if(nutrition > 500) + nutrition = 500 + if(light_amount > 2) //if there's enough light, heal + adjustBruteLoss(-1) + adjustFireLoss(-1) + adjustToxLoss(-1) + adjustOxyLoss(-1) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm new file mode 100644 index 0000000000..c5dddfd7ac --- /dev/null +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -0,0 +1,14 @@ +//Larvae regenerate health and nutrition from plasma and alien weeds. +/mob/living/carbon/alien/larva/handle_environment() + + var/turf/T = loc + if(!T) return + var/datum/gas_mixture/environment = T.return_air() + if(!environment) return + + if(environment.gas["phoron"] > 0 || locate(/obj/effect/alien/weeds) in T.contents) + update_progression() + adjustBruteLoss(-1) + adjustFireLoss(-1) + adjustToxLoss(-1) + adjustOxyLoss(-1) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 5c0ea8ed1f..9ddce0c549 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -4,8 +4,8 @@ set invisibility = 0 set background = 1 - if (monkeyizing) - return + if (monkeyizing) return + if(!loc) return ..() @@ -50,14 +50,131 @@ adjustToxLoss(-(rads)) return -/mob/living/carbon/alien/proc/handle_environment(enviroment) - //TODO: Work out if larvae breathe/suffer from pressure/suffer from heat. - if(!enviroment) - return - /mob/living/carbon/alien/proc/handle_regular_status_updates() - // TODO: sleep, blind, stunned, paralyzed? - return + + if(status_flags & GODMODE) return 0 + + if(stat == DEAD) + blinded = 1 + silent = 0 + else + updatehealth() + + if(health <= 0) + death() + blinded = 1 + silent = 0 + return 1 + + if(paralysis) + AdjustParalysis(-1) + blinded = 1 + stat = UNCONSCIOUS + if(halloss > 0) + adjustHalLoss(-3) + else if(sleeping) + + adjustHalLoss(-3) + if (mind) + if((mind.active && client != null) || immune_to_ssd) + sleeping = max(sleeping-1, 0) + blinded = 1 + stat = UNCONSCIOUS + + else if(resting) + if(halloss > 0) + adjustHalLoss(-3) + + //CONSCIOUS + else + stat = CONSCIOUS + if(halloss > 0) + adjustHalLoss(-1) + + // Eyes and blindness. + if(!has_eyes()) + eye_blind = 1 + blinded = 1 + eye_blurry = 1 + else if(eye_blind) + eye_blind = max(eye_blind-1,0) + blinded = 1 + else if(eye_blurry) + eye_blurry = max(eye_blurry-1, 0) + + //Ears + if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own + ear_deaf = max(ear_deaf, 1) + else if(ear_deaf) //deafness, heals slowly over time + ear_deaf = max(ear_deaf-1, 0) + ear_damage = max(ear_damage-0.05, 0) + + return 1 /mob/living/carbon/alien/proc/handle_regular_hud_updates() - return //TODO: Not sure what to do with this yet. \ No newline at end of file + + if (stat == 2 || (XRAY in src.mutations)) + sight |= SEE_TURFS + sight |= SEE_MOBS + sight |= SEE_OBJS + see_in_dark = 8 + see_invisible = SEE_INVISIBLE_LEVEL_TWO + else if (stat != 2) + sight &= ~SEE_TURFS + sight &= ~SEE_MOBS + sight &= ~SEE_OBJS + see_in_dark = 2 + see_invisible = SEE_INVISIBLE_LIVING + + if (healths) + if (stat != 2) + switch(health) + if(100 to INFINITY) + healths.icon_state = "health0" + if(80 to 100) + healths.icon_state = "health1" + if(60 to 80) + healths.icon_state = "health2" + if(40 to 60) + healths.icon_state = "health3" + if(20 to 40) + healths.icon_state = "health4" + if(0 to 20) + healths.icon_state = "health5" + else + healths.icon_state = "health6" + else + healths.icon_state = "health7" + + if(pullin) + pullin.icon_state = "pull[pulling ? 1 : 0]" + + if (client) + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) + + if ((blind && stat != 2)) + if ((blinded)) + blind.layer = 18 + else + blind.layer = 0 + if (disabilities & NEARSIGHTED) + client.screen += global_hud.vimpaired + if (eye_blurry) + client.screen += global_hud.blurry + if (druggy) + client.screen += global_hud.druggy + + if (stat != 2) + if (machine) + if (!( machine.check_eye(src) )) + reset_view(null) + else + if(client && !client.adminobs) + reset_view(null) + + return 1 + +/mob/living/carbon/alien/proc/handle_environment(datum/gas_mixture/environment) + // At the moment, neither of the alien species breathe or suffer from pressure. + // TODO: Implement heat and phoron exposure checks. + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 1687016f85..468f2861fa 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -428,71 +428,38 @@ if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes") usr.sleeping = 20 //Short nap -//Brain slug proc for voluntary removal of control. -/mob/living/carbon/proc/release_control() +/mob/living/carbon/Bump(atom/movable/AM as mob|obj, yes) - set category = "Abilities" - set name = "Release Control" - set desc = "Release control of your host's body." + spawn( 0 ) + if ((!( yes ) || now_pushing)) + return + now_pushing = 1 + if(ismob(AM)) + var/mob/tmob = AM + if(istype(tmob, /mob/living/carbon/human) && (HULK in tmob.mutations)) + if(prob(70)) + usr << "\red You fail to push [tmob]'s fat ass out of the way." + now_pushing = 0 + return + if(!(tmob.status_flags & CANPUSH)) + now_pushing = 0 + return - var/mob/living/simple_animal/borer/B = has_brain_worms() - - if(B && B.host_brain) - src << "\red You withdraw your probosci, releasing control of [B.host_brain]" - - B.detatch() - - verbs -= /mob/living/carbon/proc/release_control - verbs -= /mob/living/carbon/proc/punish_host - verbs -= /mob/living/carbon/proc/spawn_larvae - - else - src << "\red ERROR NO BORER OR BRAINMOB DETECTED IN THIS MOB, THIS IS A BUG !" - -//Brain slug proc for tormenting the host. -/mob/living/carbon/proc/punish_host() - set category = "Abilities" - set name = "Torment host" - set desc = "Punish your host with agony." - - var/mob/living/simple_animal/borer/B = has_brain_worms() - - if(!B) + tmob.LAssailant = src + now_pushing = 0 + ..() + if (!( istype(AM, /atom/movable) )) + return + if (!( now_pushing )) + now_pushing = 1 + if (!( AM.anchored )) + var/t = get_dir(src, AM) + if (istype(AM, /obj/structure/window)) + if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) + for(var/obj/structure/window/win in get_step(AM,t)) + now_pushing = 0 + return + step(AM, t) + now_pushing = null return - - if(B.host_brain.ckey) - src << "\red You send a punishing spike of psychic agony lancing into your host's brain." - B.host_brain << "\red Horrific, burning agony lances through you, ripping a soundless scream from your trapped mind!" - -//Check for brain worms in head. -/mob/proc/has_brain_worms() - - for(var/I in contents) - if(istype(I,/mob/living/simple_animal/borer)) - return I - - return 0 - -/mob/living/carbon/proc/spawn_larvae() - set category = "Abilities" - set name = "Reproduce" - set desc = "Spawn several young." - - var/mob/living/simple_animal/borer/B = has_brain_worms() - - if(!B) - return - - if(B.chemicals >= 100) - src << "\red Your host twitches and quivers as you rapidly excrete a larva from your sluglike body." - visible_message("\red [src] heaves violently, expelling a rush of vomit and a wriggling, sluglike creature!") - B.chemicals -= 100 - B.has_reproduced = 1 - - new /obj/effect/decal/cleanable/vomit(get_turf(src)) - playsound(loc, 'sound/effects/splat.ogg', 50, 1) - new /mob/living/simple_animal/borer(get_turf(src)) - - else - src << "You do not have enough chemicals stored to reproduce." - return \ No newline at end of file + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon_powers.dm b/code/modules/mob/living/carbon/carbon_powers.dm index c477d26031..f4bc6e4d68 100644 --- a/code/modules/mob/living/carbon/carbon_powers.dm +++ b/code/modules/mob/living/carbon/carbon_powers.dm @@ -37,3 +37,63 @@ src.reagents.add_reagent("nutriment", target.weedlevel) target.weedlevel = 0 src.visible_message("\red [src] begins rooting through [target], ripping out weeds and eating them noisily.","\red You begin rooting through [target], ripping out weeds and eating them noisily.") + +//Brain slug proc for voluntary removal of control. +/mob/living/carbon/proc/release_control() + + set category = "Abilities" + set name = "Release Control" + set desc = "Release control of your host's body." + + var/mob/living/simple_animal/borer/B = has_brain_worms() + + if(B && B.host_brain) + src << "\red You withdraw your probosci, releasing control of [B.host_brain]" + + B.detatch() + + verbs -= /mob/living/carbon/proc/release_control + verbs -= /mob/living/carbon/proc/punish_host + verbs -= /mob/living/carbon/proc/spawn_larvae + + else + src << "\red ERROR NO BORER OR BRAINMOB DETECTED IN THIS MOB, THIS IS A BUG !" + +//Brain slug proc for tormenting the host. +/mob/living/carbon/proc/punish_host() + set category = "Abilities" + set name = "Torment host" + set desc = "Punish your host with agony." + + var/mob/living/simple_animal/borer/B = has_brain_worms() + + if(!B) + return + + if(B.host_brain.ckey) + src << "\red You send a punishing spike of psychic agony lancing into your host's brain." + B.host_brain << "\red Horrific, burning agony lances through you, ripping a soundless scream from your trapped mind!" + +/mob/living/carbon/proc/spawn_larvae() + set category = "Abilities" + set name = "Reproduce" + set desc = "Spawn several young." + + var/mob/living/simple_animal/borer/B = has_brain_worms() + + if(!B) + return + + if(B.chemicals >= 100) + src << "\red Your host twitches and quivers as you rapidly excrete a larva from your sluglike body." + visible_message("\red [src] heaves violently, expelling a rush of vomit and a wriggling, sluglike creature!") + B.chemicals -= 100 + B.has_reproduced = 1 + + new /obj/effect/decal/cleanable/vomit(get_turf(src)) + playsound(loc, 'sound/effects/splat.ogg', 50, 1) + new /mob/living/simple_animal/borer(get_turf(src)) + + else + src << "You do not have enough chemicals stored to reproduce." + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/alien/alien_species.dm b/code/modules/mob/living/carbon/human/alien/alien_species.dm index 09302235c3..c1c820a17f 100644 --- a/code/modules/mob/living/carbon/human/alien/alien_species.dm +++ b/code/modules/mob/living/carbon/human/alien/alien_species.dm @@ -69,10 +69,12 @@ /datum/species/xenos/handle_environment_special(var/mob/living/carbon/human/H) - if(!H.loc) - return + var/turf/T = H.loc + if(!T) return + var/datum/gas_mixture/environment = T.return_air() + if(!environment) return - if(locate(/obj/effect/alien/weeds) in H.loc) + if(environment.gas["phoron"] > 0 || locate(/obj/effect/alien/weeds) in T) if(H.health >= H.maxHealth - H.getCloneLoss()) var/datum/organ/internal/xenos/plasmavessel/P = H.internal_organs_by_name["plasma vessel"] P.stored_plasma += weeds_plasma_rate @@ -82,7 +84,8 @@ H.adjustFireLoss(-weeds_heal_rate) H.adjustOxyLoss(-weeds_heal_rate) H.adjustToxLoss(-weeds_heal_rate) - ..() + ..() + /datum/species/xenos/handle_login_special(var/mob/living/carbon/human/H) H.AddInfectionImages() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 36ab00b656..6b4e3b4586 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -28,7 +28,7 @@ var/mutantrace // Safeguard due to old code. var/list/speech_sounds // A list of sounds to potentially play when speaking. var/has_fine_manipulation = 1 // Can use small items. - var/insulated // Immune to electrocution. + var/insulated // Immune to electrocution and glass shards to the feet. // Some species-specific gibbing data. var/gibbed_anim = "gibbed-h" diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 2d9abfa246..a38ba9c695 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -111,42 +111,6 @@ tally += (283.222 - bodytemperature) / 10 * 1.75 return tally+config.monkey_delay -/mob/living/carbon/monkey/Bump(atom/movable/AM as mob|obj, yes) - - spawn( 0 ) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(istype(tmob, /mob/living/carbon/human) && (HULK in tmob.mutations)) - if(prob(70)) - usr << "\red You fail to push [tmob]'s fat ass out of the way." - now_pushing = 0 - return - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!( istype(AM, /atom/movable) )) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - return - return - /mob/living/carbon/monkey/Topic(href, href_list) ..() if (href_list["mach_close"]) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index feee1b00f4..c2430de0da 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1036,3 +1036,12 @@ mob/proc/yank_out_object() if(paralysis) AdjustParalysis(-1) return paralysis + +//Check for brain worms in head. +/mob/proc/has_brain_worms() + + for(var/I in contents) + if(istype(I,/mob/living/simple_animal/borer)) + return I + + return 0 \ No newline at end of file