From 51f220bbd77b96ae92e9391485b507a87b132eae Mon Sep 17 00:00:00 2001 From: Gristlebee <56049844+Gristlebee@users.noreply.github.com> Date: Sun, 1 Sep 2024 16:21:03 -0700 Subject: [PATCH] dented --- code/__DEFINES/turfs.dm | 4 ++++ code/game/turfs/closed/_closed.dm | 31 +++++++++++++++++++++++++++++- code/game/turfs/closed/walls.dm | 32 ------------------------------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/code/__DEFINES/turfs.dm b/code/__DEFINES/turfs.dm index ed816cdaa8d5..30db6fc98f33 100644 --- a/code/__DEFINES/turfs.dm +++ b/code/__DEFINES/turfs.dm @@ -13,4 +13,8 @@ #define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS) +// Integrity of mineral walls. #define MINERAL_WALL_INTEGRITY 100 + +// how many bullet holes a wall can have at a given time +#define MAX_DENT_DECALS 15 diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm index af6056bf3220..dc410d027504 100644 --- a/code/game/turfs/closed/_closed.dm +++ b/code/game/turfs/closed/_closed.dm @@ -33,11 +33,20 @@ var/damage_visual = 'icons/effects/wall_damage.dmi' var/overlay_layer = BULLET_HOLE_LAYER + var/list/dent_decals + /turf/closed/Initialize(mapload, inherited_virtual_z) . = ..() if(integrity == null) integrity = max_integrity +/turf/closed/copyTurf(turf/T, copy_air, flags) + . = ..() + var/turf/closed/wall_copy = T + if(LAZYLEN(dent_decals)) + wall_copy.dent_decals = dent_decals.Copy() + wall_copy.update_appearance() + /turf/closed/update_overlays() . = ..() damage_overlay = null @@ -48,6 +57,24 @@ damage_overlay = mutable_appearance(damage_visual, "cracks", overlay_layer) damage_overlay.alpha = adj_dam_pct*255 . += damage_overlay + for(var/decal in dent_decals) + . += decal + +/turf/closed/proc/add_dent(denttype, x=rand(-8, 8), y=rand(-8, 8)) + if(LAZYLEN(dent_decals) >= MAX_DENT_DECALS) + return + + var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "", BULLET_HOLE_LAYER) + switch(denttype) + if(WALL_DENT_SHOT) + decal.icon_state = "bullet_hole" + if(WALL_DENT_HIT) + decal.icon_state = "impact[rand(1, 3)]" + + decal.pixel_x = x + decal.pixel_y = y + LAZYADD(dent_decals, decal) + update_appearance() /turf/closed/examine(mob/user) . = ..() @@ -119,6 +146,7 @@ if(P.suppressed != SUPPRESSED_VERY) visible_message("[src] is hit by \a [P]!", null, null, COMBAT_MESSAGE_RANGE) if(!QDELETED(src)) + add_dent(WALL_DENT_SHOT) alter_integrity(-dam, shooter) /turf/closed/proc/get_item_damage(obj/item/I, t_min = min_dam) @@ -177,7 +205,7 @@ if(.) return user.changeNext_move(CLICK_CD_MELEE) - to_chat(user, "You push the wall but nothing happens!") + to_chat(user, "You push \the [src] but nothing happens!") playsound(src, 'sound/weapons/genhit.ogg', 25, TRUE) add_fingerprint(user) @@ -219,6 +247,7 @@ playsound(src,attack_hitsound, 100, TRUE) if(BURN) playsound(src, 'sound/items/welder.ogg', 100, TRUE) + add_dent(WALL_DENT_HIT) alter_integrity(-dam, user) return TRUE diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index bcc9af026890..bed648ff592b 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -1,5 +1,3 @@ -#define MAX_DENT_DECALS 15 -// KILL MINING CODE /turf/closed/wall name = "wall" desc = "A huge chunk of metal used to separate rooms." @@ -24,8 +22,6 @@ var/sheet_amount = 2 var/obj/girder_type = /obj/structure/girder - var/list/dent_decals - min_dam = 8 max_integrity = 400 brute_mod = 1 @@ -54,19 +50,6 @@ fixed_underlay = string_assoc_list(fixed_underlay) underlays += underlay_appearance -// to be changed - move up -/turf/closed/wall/copyTurf(turf/T, copy_air, flags) - . = ..() - var/turf/closed/wall/wall_copy = T - if(LAZYLEN(dent_decals)) - wall_copy.dent_decals = dent_decals.Copy() - wall_copy.update_appearance() - -/turf/closed/wall/update_overlays() - . = ..() - for(var/decal in dent_decals) - . += decal - /turf/closed/wall/examine(mob/user) . += ..() . += deconstruction_hints(user) @@ -195,20 +178,5 @@ return TRUE return FALSE -/turf/closed/wall/proc/add_dent(denttype, x=rand(-8, 8), y=rand(-8, 8)) - if(LAZYLEN(dent_decals) >= MAX_DENT_DECALS) - return - - var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "", BULLET_HOLE_LAYER) - switch(denttype) - if(WALL_DENT_SHOT) - decal.icon_state = "bullet_hole" - if(WALL_DENT_HIT) - decal.icon_state = "impact[rand(1, 3)]" - decal.pixel_x = x - decal.pixel_y = y - LAZYADD(dent_decals, decal) - update_appearance() -#undef MAX_DENT_DECALS