From 09aec4da535724e58890e72673cf1c85e26366ef Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Mon, 26 Jun 2023 20:40:26 -0700 Subject: [PATCH] Lets mobs who can smash walls also smash some other relatively fragile structures (#21209) * Makes grilles and windows easier to smash * Some cleanups, windoors too * Adds tables, also holy shit these things are robust * Update code/game/objects/structures/window.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> * Make some reinforced windows stronger, too * Sean review, addresses a bug I noticed * Hanging return * re-adds take_damage --------- Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> --- code/game/machinery/doors/windowdoor.dm | 7 +++++++ code/game/objects/obj_defense.dm | 3 ++- code/game/objects/structures/grille.dm | 14 ++++++++++---- code/game/objects/structures/railings.dm | 7 +++++++ code/game/objects/structures/tables_racks.dm | 11 +++++++++++ code/game/objects/structures/window.dm | 17 +++++++++++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 130f7d1645c..c5d34376ead 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -251,6 +251,13 @@ /obj/machinery/door/window/attack_ai(mob/user) return attack_hand(user) +/obj/machinery/door/window/attack_animal(mob/living/simple_animal/M) + . = ..() + if(M.environment_smash >= ENVIRONMENT_SMASH_WALLS) + playsound(src, 'sound/effects/grillehit.ogg', 80, TRUE) + deconstruct(FALSE) + M.visible_message("[M] smashes through [src]!", "You smash through [src].") + /obj/machinery/door/window/attack_ghost(mob/user) if(user.can_advanced_admin_interact()) return attack_hand(user) diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 18fe9acee2a..e8e38470062 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -111,12 +111,13 @@ var/play_soundeffect = 1 if(M.environment_smash) play_soundeffect = 0 + var/obj_turf = get_turf(src) // play from the turf in case the object gets deleted mid attack if(M.obj_damage) . = attack_generic(M, M.obj_damage, M.melee_damage_type, MELEE, play_soundeffect, M.armour_penetration_flat, M.armour_penetration_percentage) else . = attack_generic(M, rand(M.melee_damage_lower,M.melee_damage_upper), M.melee_damage_type, MELEE, play_soundeffect, M.armour_penetration_flat, M.armour_penetration_percentage) if(. && !play_soundeffect) - playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE) + playsound(QDELETED(src) ? obj_turf : src, 'sound/effects/meteorimpact.ogg', 100, TRUE) /obj/force_pushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction) return TRUE diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 06c4fcbe76c..06096a47820 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -78,10 +78,16 @@ shock(user, 70) shockcooldown = world.time + my_shockcooldown -/obj/structure/grille/attack_animal(mob/user) - . = ..() - if(. && !QDELETED(src) && !shock(user, 70)) - take_damage(rand(5,10), BRUTE, MELEE, 1) +/obj/structure/grille/attack_animal(mob/living/simple_animal/user) + if(QDELETED(src) || shock(user, 70)) + return + if(user.environment_smash >= ENVIRONMENT_SMASH_STRUCTURES) + playsound(src, 'sound/effects/grillehit.ogg', 80, TRUE) + obj_break() + user.visible_message("[user] smashes through [src]!", "You smash through [src].") + else + take_damage(rand(5, 10), BRUTE, MELEE, 1) + return ..() /obj/structure/grille/hulk_damage() return 60 diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 2a5f31512a0..a63c83f8bdf 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -21,6 +21,13 @@ ..() add_fingerprint(user) +/obj/structure/railing/attack_animal(mob/living/simple_animal/M) + . = ..() + if(M.environment_smash >= ENVIRONMENT_SMASH_WALLS) + deconstruct(FALSE) + M.visible_message("[M] tears apart [src]!", "You tear apart [src]!") + + /obj/structure/railing/welder_act(mob/living/user, obj/item/I) if(user.intent != INTENT_HELP) return diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index b4bfc4076f6..5e96f473b7e 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -36,6 +36,8 @@ var/framestackamount = 2 var/deconstruction_ready = TRUE var/flipped = FALSE + /// The minimum level of environment_smash required for simple animals to be able to one-shot this. + var/minimum_env_smash = ENVIRONMENT_SMASH_WALLS /obj/structure/table/Initialize(mapload) . = ..() @@ -237,6 +239,12 @@ else return ..() +/obj/structure/table/attack_animal(mob/living/simple_animal/M) + . = ..() + if(M.environment_smash >= minimum_env_smash) + deconstruct(FALSE) + M.visible_message("[M] smashes [src]!", "You smash [src].") + /obj/structure/table/shove_impact(mob/living/target, mob/living/attacker) if(locate(/obj/structure/table) in get_turf(target)) return FALSE @@ -410,6 +418,7 @@ max_integrity = 70 resistance_flags = ACID_PROOF armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 80, ACID = 100) + minimum_env_smash = ENVIRONMENT_SMASH_STRUCTURES var/list/debris = list() var/shardtype = /obj/item/shard @@ -502,6 +511,7 @@ buildstack = /obj/item/stack/sheet/plasmaglass max_integrity = 140 shardtype = /obj/item/shard/plasma + minimum_env_smash = ENVIRONMENT_SMASH_RWALLS /obj/structure/table/glass/reinforced name = "reinforced glass table" @@ -515,6 +525,7 @@ deconstruction_ready = FALSE armor = list(MELEE = 10, BULLET = 30, LASER = 30, ENERGY = 100, BOMB = 20, RAD = 0, FIRE = 80, ACID = 70) smoothing_groups = list(SMOOTH_GROUP_REINFORCED_TABLES) + minimum_env_smash = ENVIRONMENT_SMASH_RWALLS canSmoothWith = list(SMOOTH_GROUP_REINFORCED_TABLES) /obj/structure/table/glass/reinforced/deconstruction_hints(mob/user) //look, it was either copy paste these 4 procs, or copy paste all of the glass stuff diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 8f4860e921c..dbe21cb4c29 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -33,6 +33,8 @@ var/edge_overlay_file /// Tracks the edging appearence sprite var/mutable_appearance/edge_overlay + /// Minimum environment smash level (found on simple animals) to break through this instantly + var/env_smash_level = ENVIRONMENT_SMASH_STRUCTURES /obj/structure/window/examine(mob/user) . = ..() @@ -171,6 +173,18 @@ return ..() +/obj/structure/window/attack_animal(mob/living/simple_animal/M) + if(!can_be_reached(M)) + return + . = ..() + if(M.environment_smash >= env_smash_level) + deconstruct(FALSE) + M.visible_message("[M] smashes through [src]!", "You smash through [src].", "You hear glass breaking.") + else + to_chat(M, "You smash against the window.") + take_damage(rand(25, 75)) + + /obj/structure/window/attackby(obj/item/I, mob/living/user, params) if(!can_be_reached(user)) return 1 //skip the afterattack @@ -702,6 +716,7 @@ armor = list(MELEE = 75, BULLET = 5, LASER = 0, ENERGY = 0, BOMB = 45, RAD = 100, FIRE = 99, ACID = 100) rad_insulation = RAD_NO_INSULATION edge_overlay_file = 'icons/obj/smooth_structures/windows/window_edges.dmi' + env_smash_level = ENVIRONMENT_SMASH_WALLS // these windows are a fair bit tougher /obj/structure/window/full/plasmareinforced name = "reinforced plasma window" @@ -719,6 +734,7 @@ armor = list(MELEE = 85, BULLET = 20, LASER = 0, ENERGY = 0, BOMB = 60, RAD = 100, FIRE = 99, ACID = 100) rad_insulation = RAD_NO_INSULATION edge_overlay_file = 'icons/obj/smooth_structures/windows/reinforced_window_edges.dmi' + env_smash_level = ENVIRONMENT_SMASH_RWALLS // these ones are insanely tough /obj/structure/window/full/plasmareinforced/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) return @@ -766,6 +782,7 @@ smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE, SMOOTH_GROUP_TITANIUM_WALLS) canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE, SMOOTH_GROUP_TITANIUM_WALLS) glass_type = /obj/item/stack/sheet/titaniumglass + env_smash_level = ENVIRONMENT_SMASH_RWALLS // shuttle windows should probably be a bit stronger, too /obj/structure/window/full/shuttle/narsie_act() color = "#3C3434"