diff --git a/code/__DEFINES/wall_dents.dm b/code/__DEFINES/wall_dents.dm new file mode 100644 index 000000000000..1e4f813849ef --- /dev/null +++ b/code/__DEFINES/wall_dents.dm @@ -0,0 +1,2 @@ +#define WALL_DENT_HIT 1 +#define WALL_DENT_SHOT 2 diff --git a/code/game/objects/effects/temporary_visuals/miscellaneous.dm b/code/game/objects/effects/temporary_visuals/miscellaneous.dm index 31d23352bf0c..5203dd0a9053 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -312,14 +312,10 @@ icon_state = "impact_bullet" duration = 5 -/obj/effect/temp_visual/impact_effect/Initialize(mapload, atom/target, obj/item/projectile/P) - if(target == P.original) - pixel_x = target.pixel_x + P.p_x - 16 - pixel_y = target.pixel_y + P.p_y - 16 - else - pixel_x = target.pixel_x + rand(2, -2) - pixel_y = target.pixel_y + rand(2, -2) - . = ..() +/obj/effect/temp_visual/impact_effect/Initialize(mapload, x, y) + pixel_x = x + pixel_y = y + return ..() /obj/effect/temp_visual/impact_effect/red_laser icon_state = "impact_laser" diff --git a/code/game/objects/effects/temporary_visuals/temporary_visual.dm b/code/game/objects/effects/temporary_visuals/temporary_visual.dm index 6a1bbc443769..615f392a8617 100644 --- a/code/game/objects/effects/temporary_visuals/temporary_visual.dm +++ b/code/game/objects/effects/temporary_visuals/temporary_visual.dm @@ -35,3 +35,5 @@ if(set_dir) setDir(set_dir) . = ..() + + diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 210c91a58c0a..4cefe2fbcf2d 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -25,7 +25,18 @@ /turf/closed/wall/clockwork) smooth = SMOOTH_TRUE - var/list/damage_decals + var/list/dent_decals + + var/static/list/dent_decal_list = list( + WALL_DENT_HIT = list( + mutable_appearance('icons/effects/effects.dmi', "impact1", TURF_DECAL_LAYER), + mutable_appearance('icons/effects/effects.dmi', "impact2", TURF_DECAL_LAYER), + mutable_appearance('icons/effects/effects.dmi', "impact3", TURF_DECAL_LAYER) + ), + WALL_DENT_SHOT = list( + mutable_appearance('icons/effects/effects.dmi', "bullet_hole", TURF_DECAL_LAYER) + ) + ) /turf/closed/wall/examine(mob/user) ..() @@ -101,6 +112,8 @@ /turf/closed/wall/blob_act(obj/structure/blob/B) if(prob(50)) dismantle_wall() + else + add_dent(WALL_DENT_HIT) /turf/closed/wall/mech_melee_attack(obj/mecha/M) M.do_attack_animation(src) @@ -111,6 +124,8 @@ if(prob(hardness + M.force) && M.force > 20) dismantle_wall(1) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + else + add_dent(WALL_DENT_HIT) if(BURN) playsound(src, 'sound/items/welder.ogg', 100, 1) if(TOX) @@ -138,6 +153,7 @@ dismantle_wall(1) else playsound(src, 'sound/effects/bang.ogg', 50, 1) + add_dent(WALL_DENT_HIT) to_chat(user, text("You punch the wall.")) return TRUE @@ -170,17 +186,17 @@ return ..() /turf/closed/wall/proc/try_clean(obj/item/W, mob/user, turf/T) - if((user.a_intent != INTENT_HELP) || !LAZYLEN(damage_decals) || !istype(W, /obj/item/weldingtool)) + if((user.a_intent != INTENT_HELP) || !LAZYLEN(dent_decals) || !istype(W, /obj/item/weldingtool)) return FALSE var/obj/item/weldingtool/WT = W if(WT.remove_fuel(0, user)) to_chat(user, "You begin fixing dents on the wall...") playsound(src, W.usesound, 100, 1) - if(do_after(user, slicing_duration * W.toolspeed * 0.5, target = src)) - if(iswallturf(src) && user && !QDELETED(WT) && WT.isOn() && !QDELETED(T) && (user.loc == T) && (user.get_active_held_item() == WT) && damage_decals.len) + if(do_after(user, slicing_duration * W.toolspeed * 0.1, target = src)) + if(iswallturf(src) && user && !QDELETED(WT) && WT.isOn() && !QDELETED(T) && (user.loc == T) && (user.get_active_held_item() == WT) && LAZYLEN(dent_decals)) to_chat(user, "You fix some dents on the wall.") - cut_overlay(damage_decals) - LAZYCLEARLIST(damage_decals) + cut_overlay(dent_decals) + LAZYCLEARLIST(dent_decals) return TRUE return FALSE @@ -255,7 +271,7 @@ if(.) ChangeTurf(/turf/closed/wall/clockwork) -/turf/closed/wall/get_dumping_location(obj/item/storage/source,mob/user) +/turf/closed/wall/get_dumping_location(obj/item/storage/source, mob/user) return null /turf/closed/wall/acid_act(acidpwr, acid_volume) @@ -280,7 +296,11 @@ return TRUE return FALSE -/turf/closed/wall/proc/add_damage_decal(var/mutable_appearance/decal) - cut_overlay(damage_decals) - LAZYADD(damage_decals, decal) - add_overlay(damage_decals) +/turf/closed/wall/proc/add_dent(denttype, x=rand(-8, 8), y=rand(-8, 8)) + var/mutable_appearance/decal = pick(dent_decal_list[denttype]) + decal.pixel_x = x + decal.pixel_y = y + + cut_overlay(dent_decals) + LAZYADD(dent_decals, decal) + add_overlay(dent_decals) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 3f70f4f8ff5f..d89da3e37be8 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -101,21 +101,32 @@ /obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE) var/turf/target_loca = get_turf(target) + + var/hitx + var/hity + if(target == original) + hitx = target.pixel_x + p_x - 16 + hity = target.pixel_y + p_y - 16 + else + hitx = target.pixel_x + rand(-8, 8) + hity = target.pixel_y + rand(-8, 8) + if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && iswallturf(target_loca) && prob(75)) var/turf/closed/wall/W = target_loca - var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "bullet_hole", TURF_DECAL_LAYER) - if(target == original) - decal.pixel_x = target.pixel_x + p_x - 16 - decal.pixel_y = target.pixel_y + p_y - 16 - else - decal.pixel_x = target.pixel_x + rand(2, -2) - decal.pixel_y = target.pixel_y + rand(2, -2) - W.add_damage_decal(decal) + if(impact_effect_type) + new impact_effect_type(target_loca, hitx, hity) + + W.add_dent(WALL_DENT_SHOT, hitx, hity) + + return 0 + if(!isliving(target)) if(impact_effect_type) - new impact_effect_type(target_loca, target, src) + new impact_effect_type(target_loca, hitx, hity) return 0 + var/mob/living/L = target + if(blocked != 100) // not completely blocked if(damage && L.blood_volume && damage_type == BRUTE) var/splatter_dir = dir @@ -128,7 +139,7 @@ if(prob(33)) L.add_splatter_floor(target_loca) else if(impact_effect_type) - new impact_effect_type(target_loca, target, src) + new impact_effect_type(target_loca, hitx, hity) var/organ_hit_text = "" var/limb_hit = L.check_limb_hit(def_zone)//to get the correct message info. diff --git a/icons/effects/effects.dmi b/icons/effects/effects.dmi index fd53873c1836..cb4b8f659e0b 100644 Binary files a/icons/effects/effects.dmi and b/icons/effects/effects.dmi differ diff --git a/tgstation.dme b/tgstation.dme index ed103528b396..b1ceb991dec8 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -80,6 +80,7 @@ #include "code\__DEFINES\time.dm" #include "code\__DEFINES\typeids.dm" #include "code\__DEFINES\vv.dm" +#include "code\__DEFINES\wall_dents.dm" #include "code\__DEFINES\wires.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm"