From fc7692cdce73e5d42b3d1365440f88de1405b0e8 Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Sat, 19 May 2018 03:26:10 -0400 Subject: [PATCH] alien object damage system --- code/game/objects/structures/aliens.dm | 189 +++++------------- .../hostile/terror_spiders/terror_spiders.dm | 5 - .../reagents/chemistry/reagents/toxins.dm | 3 +- 3 files changed, 46 insertions(+), 151 deletions(-) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 429ff2f89ab..1738344ae60 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -13,6 +13,27 @@ /obj/structure/alien icon = 'icons/mob/alien.dmi' + max_integrity = 100 + +/obj/structure/alien/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) + if(damage_flag == "melee") + switch(damage_type) + if(BRUTE) + damage_amount *= 0.25 + if(BURN) + damage_amount *= 2 + . = ..() + +/obj/structure/alien/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) + switch(damage_type) + if(BRUTE) + if(damage_amount) + playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) + else + playsound(src, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(damage_amount) + playsound(loc, 'sound/items/welder.ogg', 100, 1) /* * Resin @@ -22,13 +43,13 @@ desc = "Looks like some kind of thick resin." icon = 'icons/obj/smooth_structures/alien/resin_wall.dmi' icon_state = "resin" - density = 1 - opacity = 1 - anchored = 1 + density = TRUE + opacity = TRUE + anchored = TRUE canSmoothWith = list(/obj/structure/alien/resin) - var/health = 200 - var/resintype = null + max_integrity = 200 smooth = SMOOTH_TRUE + var/resintype = null /obj/structure/alien/resin/Initialize() air_update_turf(1) @@ -60,7 +81,7 @@ /obj/structure/alien/resin/wall/shadowling //For chrysalis name = "chrysalis wall" desc = "Some sort of purple substance in an egglike shape. It pulses and throbs from within and seems impenetrable." - health = INFINITY + max_integrity = INFINITY /obj/structure/alien/resin/membrane name = "resin membrane" @@ -68,72 +89,11 @@ icon = 'icons/obj/smooth_structures/alien/resin_membrane.dmi' icon_state = "membrane0" opacity = 0 - health = 120 + max_integrity = 160 resintype = "membrane" canSmoothWith = list(/obj/structure/alien/resin/wall, /obj/structure/alien/resin/membrane) -/obj/structure/alien/resin/proc/healthcheck() - if(health <=0) - qdel(src) - - -/obj/structure/alien/resin/bullet_act(obj/item/projectile/Proj) - if(Proj.damage_type == BRUTE || Proj.damage_type == BURN) - health -= Proj.damage - ..() - healthcheck() - - -/obj/structure/alien/resin/ex_act(severity) - switch(severity) - if(1) - health -= 150 - if(2) - health -= 100 - if(3) - health -= 50 - healthcheck() - - -/obj/structure/alien/resin/blob_act() - health -= 50 - healthcheck() - - -/obj/structure/alien/resin/hitby(atom/movable/AM) - ..() - var/tforce = 0 - if(ismob(AM)) - tforce = 10 - else if(isobj(AM)) - var/obj/O = AM - tforce = O.throwforce - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - health -= tforce - healthcheck() - -/obj/structure/alien/resin/attack_alien(mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - if(islarva(user)) - return - user.visible_message("[user] claws at the resin!") - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - health -= 50 - if(health <= 0) - user.visible_message("[user] slices the [name] apart!") - healthcheck() - - -/obj/structure/alien/resin/attackby(obj/item/I, mob/living/user, params) - user.changeNext_move(CLICK_CD_MELEE) - health -= I.force - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - healthcheck() - ..() - - -/obj/structure/alien/resin/CanPass(atom/movable/mover, turf/target, height=0) +/obj/structure/alien/resin/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) return !opacity return !density @@ -149,11 +109,11 @@ gender = PLURAL name = "resin floor" desc = "A thick resin surface covers the floor." + anchored = TRUE + density = FALSE + layer = TURF_LAYER icon_state = "weeds" - anchored = 1 - density = 0 - layer = 2 - var/health = 15 + max_integrity = 15 var/obj/structure/alien/weeds/node/linked_node = null var/static/list/weedImageCache @@ -196,39 +156,9 @@ new /obj/structure/alien/weeds(T, linked_node) - -/obj/structure/alien/weeds/ex_act(severity) - qdel(src) - - -/obj/structure/alien/weeds/attackby(obj/item/I, mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) - if(I.attack_verb.len) - visible_message("[user] has [pick(I.attack_verb)] [src] with [I]!") - else - visible_message("[user] has attacked [src] with [I]!") - - var/damage = I.force / 4 - if(istype(I, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = I - if(WT.remove_fuel(0, user)) - damage = 15 - playsound(loc, WT.usesound, 100, 1) - - health -= damage - healthcheck() - - -/obj/structure/alien/weeds/proc/healthcheck() - if(health <= 0) - qdel(src) - - /obj/structure/alien/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) - health -= 5 - healthcheck() - + take_damage(5, BURN, 0, 0) /obj/structure/alien/weeds/proc/updateWeedOverlays() @@ -295,9 +225,10 @@ name = "egg" desc = "A large mottled egg." icon_state = "egg_growing" - density = 0 - anchored = 1 - var/health = 100 + density = FALSE + anchored = TRUE + max_integrity = 100 + integrity_failure = 5 var/status = GROWING //can be GROWING, GROWN or BURST; all mutually exclusive layer = MOB_LAYER @@ -307,6 +238,8 @@ ..() spawn(rand(MIN_GROWTH_TIME, MAX_GROWTH_TIME)) Grow() + if(status == BURST) + obj_integrity = integrity_failure /obj/structure/alien/egg/attack_alien(mob/living/carbon/alien/user) return attack_hand(user) @@ -338,7 +271,7 @@ icon_state = "egg" status = GROWN -/obj/structure/alien/egg/proc/Burst(kill = 1) //drops and kills the hugger if any is remaining +/obj/structure/alien/egg/proc/Burst(kill = TRUE) //drops and kills the hugger if any is remaining if(status == GROWN || status == GROWING) icon_state = "egg_hatched" flick("egg_opening", src) @@ -356,45 +289,13 @@ child.Attach(M) break -/obj/structure/alien/egg/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - health -= Proj.damage - ..() - healthcheck() - - -/obj/structure/alien/egg/attackby(obj/item/I, mob/user, params) - if(I.attack_verb.len) - visible_message("[user] has [pick(I.attack_verb)] [src] with [I]!") - else - visible_message("[user] has attacked [src] with [I]!") - - var/damage = I.force / 4 - if(istype(I, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = I - - if(WT.remove_fuel(0, user)) - damage = 15 - playsound(loc, WT.usesound, 100, 1) - - health -= damage - user.changeNext_move(CLICK_CD_MELEE) - healthcheck() - - -/obj/structure/alien/egg/proc/healthcheck() - if(health <= 0) - if(status != BURST && status != BURSTING) - Burst() - else if(status == BURST && prob(50)) - qdel(src) //Remove the egg after it has been hit after bursting. - +/obj/structure/alien/egg/obj_break(damage_flag) + if(status != BURST) + Burst(kill = TRUE) /obj/structure/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 500) - health -= 5 - healthcheck() - + take_damage(5, BURN, 0, 0) /obj/structure/alien/egg/HasProximity(atom/movable/AM) if(status == GROWN) diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm index ef456ddcb0e..235a161c595 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm @@ -201,11 +201,6 @@ var/global/list/ts_spiderling_list = list() spider_specialattack(G,can_poison) else G.attack_animal(src) - else if(istype(target, /obj/structure/alien/resin)) - var/obj/structure/alien/resin/E = target - do_attack_animation(E) - E.health -= rand(melee_damage_lower, melee_damage_upper) - E.healthcheck() else target.attack_animal(src) diff --git a/code/modules/reagents/chemistry/reagents/toxins.dm b/code/modules/reagents/chemistry/reagents/toxins.dm index 8cad5400c02..e0777e9ccef 100644 --- a/code/modules/reagents/chemistry/reagents/toxins.dm +++ b/code/modules/reagents/chemistry/reagents/toxins.dm @@ -947,8 +947,7 @@ /datum/reagent/glyphosate/reaction_obj(obj/O, volume) if(istype(O,/obj/structure/alien/weeds)) var/obj/structure/alien/weeds/alien_weeds = O - alien_weeds.health -= rand(15,35) // Kills alien weeds pretty fast - alien_weeds.healthcheck() + alien_weeds.take_damage(rand(15, 35), BRUTE, 0) // Kills alien weeds pretty fast else if(istype(O, /obj/structure/glowshroom)) //even a small amount is enough to kill it qdel(O) else if(istype(O, /obj/structure/spacevine))