This commit is contained in:
nicbn
2017-11-04 02:40:21 -02:00
committed by Emmett Gaines
parent d908619c7b
commit a38605414e
7 changed files with 61 additions and 29 deletions

View File

@@ -0,0 +1,2 @@
#define WALL_DENT_HIT 1
#define WALL_DENT_SHOT 2

View File

@@ -312,14 +312,10 @@
icon_state = "impact_bullet" icon_state = "impact_bullet"
duration = 5 duration = 5
/obj/effect/temp_visual/impact_effect/Initialize(mapload, atom/target, obj/item/projectile/P) /obj/effect/temp_visual/impact_effect/Initialize(mapload, x, y)
if(target == P.original) pixel_x = x
pixel_x = target.pixel_x + P.p_x - 16 pixel_y = y
pixel_y = target.pixel_y + P.p_y - 16 return ..()
else
pixel_x = target.pixel_x + rand(2, -2)
pixel_y = target.pixel_y + rand(2, -2)
. = ..()
/obj/effect/temp_visual/impact_effect/red_laser /obj/effect/temp_visual/impact_effect/red_laser
icon_state = "impact_laser" icon_state = "impact_laser"

View File

@@ -35,3 +35,5 @@
if(set_dir) if(set_dir)
setDir(set_dir) setDir(set_dir)
. = ..() . = ..()

View File

@@ -25,7 +25,18 @@
/turf/closed/wall/clockwork) /turf/closed/wall/clockwork)
smooth = SMOOTH_TRUE 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) /turf/closed/wall/examine(mob/user)
..() ..()
@@ -101,6 +112,8 @@
/turf/closed/wall/blob_act(obj/structure/blob/B) /turf/closed/wall/blob_act(obj/structure/blob/B)
if(prob(50)) if(prob(50))
dismantle_wall() dismantle_wall()
else
add_dent(WALL_DENT_HIT)
/turf/closed/wall/mech_melee_attack(obj/mecha/M) /turf/closed/wall/mech_melee_attack(obj/mecha/M)
M.do_attack_animation(src) M.do_attack_animation(src)
@@ -111,6 +124,8 @@
if(prob(hardness + M.force) && M.force > 20) if(prob(hardness + M.force) && M.force > 20)
dismantle_wall(1) dismantle_wall(1)
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
else
add_dent(WALL_DENT_HIT)
if(BURN) if(BURN)
playsound(src, 'sound/items/welder.ogg', 100, 1) playsound(src, 'sound/items/welder.ogg', 100, 1)
if(TOX) if(TOX)
@@ -138,6 +153,7 @@
dismantle_wall(1) dismantle_wall(1)
else else
playsound(src, 'sound/effects/bang.ogg', 50, 1) playsound(src, 'sound/effects/bang.ogg', 50, 1)
add_dent(WALL_DENT_HIT)
to_chat(user, text("<span class='notice'>You punch the wall.</span>")) to_chat(user, text("<span class='notice'>You punch the wall.</span>"))
return TRUE return TRUE
@@ -170,17 +186,17 @@
return ..() return ..()
/turf/closed/wall/proc/try_clean(obj/item/W, mob/user, turf/T) /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 return FALSE
var/obj/item/weldingtool/WT = W var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0, user)) if(WT.remove_fuel(0, user))
to_chat(user, "<span class='notice'>You begin fixing dents on the wall...</span>") to_chat(user, "<span class='notice'>You begin fixing dents on the wall...</span>")
playsound(src, W.usesound, 100, 1) playsound(src, W.usesound, 100, 1)
if(do_after(user, slicing_duration * W.toolspeed * 0.5, target = src)) 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) && damage_decals.len) 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, "<span class='notice'>You fix some dents on the wall.</span>") to_chat(user, "<span class='notice'>You fix some dents on the wall.</span>")
cut_overlay(damage_decals) cut_overlay(dent_decals)
LAZYCLEARLIST(damage_decals) LAZYCLEARLIST(dent_decals)
return TRUE return TRUE
return FALSE return FALSE
@@ -255,7 +271,7 @@
if(.) if(.)
ChangeTurf(/turf/closed/wall/clockwork) 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 return null
/turf/closed/wall/acid_act(acidpwr, acid_volume) /turf/closed/wall/acid_act(acidpwr, acid_volume)
@@ -280,7 +296,11 @@
return TRUE return TRUE
return FALSE return FALSE
/turf/closed/wall/proc/add_damage_decal(var/mutable_appearance/decal) /turf/closed/wall/proc/add_dent(denttype, x=rand(-8, 8), y=rand(-8, 8))
cut_overlay(damage_decals) var/mutable_appearance/decal = pick(dent_decal_list[denttype])
LAZYADD(damage_decals, decal) decal.pixel_x = x
add_overlay(damage_decals) decal.pixel_y = y
cut_overlay(dent_decals)
LAZYADD(dent_decals, decal)
add_overlay(dent_decals)

View File

@@ -101,21 +101,32 @@
/obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE) /obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE)
var/turf/target_loca = get_turf(target) 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)) if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && iswallturf(target_loca) && prob(75))
var/turf/closed/wall/W = target_loca var/turf/closed/wall/W = target_loca
var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "bullet_hole", TURF_DECAL_LAYER) if(impact_effect_type)
if(target == original) new impact_effect_type(target_loca, hitx, hity)
decal.pixel_x = target.pixel_x + p_x - 16
decal.pixel_y = target.pixel_y + p_y - 16 W.add_dent(WALL_DENT_SHOT, hitx, hity)
else
decal.pixel_x = target.pixel_x + rand(2, -2) return 0
decal.pixel_y = target.pixel_y + rand(2, -2)
W.add_damage_decal(decal)
if(!isliving(target)) if(!isliving(target))
if(impact_effect_type) if(impact_effect_type)
new impact_effect_type(target_loca, target, src) new impact_effect_type(target_loca, hitx, hity)
return 0 return 0
var/mob/living/L = target var/mob/living/L = target
if(blocked != 100) // not completely blocked if(blocked != 100) // not completely blocked
if(damage && L.blood_volume && damage_type == BRUTE) if(damage && L.blood_volume && damage_type == BRUTE)
var/splatter_dir = dir var/splatter_dir = dir
@@ -128,7 +139,7 @@
if(prob(33)) if(prob(33))
L.add_splatter_floor(target_loca) L.add_splatter_floor(target_loca)
else if(impact_effect_type) 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/organ_hit_text = ""
var/limb_hit = L.check_limb_hit(def_zone)//to get the correct message info. var/limb_hit = L.check_limb_hit(def_zone)//to get the correct message info.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View File

@@ -80,6 +80,7 @@
#include "code\__DEFINES\time.dm" #include "code\__DEFINES\time.dm"
#include "code\__DEFINES\typeids.dm" #include "code\__DEFINES\typeids.dm"
#include "code\__DEFINES\vv.dm" #include "code\__DEFINES\vv.dm"
#include "code\__DEFINES\wall_dents.dm"
#include "code\__DEFINES\wires.dm" #include "code\__DEFINES\wires.dm"
#include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_lists.dm"
#include "code\__HELPERS\_logging.dm" #include "code\__HELPERS\_logging.dm"