Skip to content

Commit

Permalink
dented
Browse files Browse the repository at this point in the history
  • Loading branch information
Gristlebee committed Sep 1, 2024
1 parent 08015f6 commit 51f220b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 30 additions & 1 deletion code/game/turfs/closed/_closed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
. = ..()
Expand Down Expand Up @@ -119,6 +146,7 @@
if(P.suppressed != SUPPRESSED_VERY)
visible_message("<span class='danger'>[src] is hit by \a [P]!</span>", 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)
Expand Down Expand Up @@ -177,7 +205,7 @@
if(.)
return
user.changeNext_move(CLICK_CD_MELEE)
to_chat(user, "<span class='notice'>You push the wall but nothing happens!</span>")
to_chat(user, "<span class='notice'>You push \the [src] but nothing happens!</span>")
playsound(src, 'sound/weapons/genhit.ogg', 25, TRUE)
add_fingerprint(user)

Expand Down Expand Up @@ -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

Expand Down
32 changes: 0 additions & 32 deletions code/game/turfs/closed/walls.dm
Original file line number Diff line number Diff line change
@@ -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."
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 51f220b

Please sign in to comment.