Merge pull request #3366 from Citadel-Station-13/upstream-merge-31420

[MIRROR] Bullet decals tweak
This commit is contained in:
LetterJay
2017-10-14 10:17:18 -04:00
committed by GitHub
4 changed files with 57 additions and 42 deletions
@@ -313,12 +313,12 @@
duration = 5
/obj/effect/temp_visual/impact_effect/Initialize(mapload, atom/target, obj/item/projectile/P)
if(target == P.original) //the projectile hit the target originally clicked
pixel_x = P.p_x + target.pixel_x - 16 + rand(-4,4)
pixel_y = P.p_y + target.pixel_y - 16 + rand(-4,4)
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(-4,4)
pixel_y = target.pixel_y + rand(-4,4)
pixel_x = target.pixel_x + rand(2, -2)
pixel_y = target.pixel_y + rand(2, -2)
. = ..()
/obj/effect/temp_visual/impact_effect/red_laser
-13
View File
@@ -157,16 +157,3 @@
desc = "A wall made out of a strange metal. The squares on it pulse in a predictable pattern."
icon = 'icons/turf/walls/hierophant_wall.dmi'
icon_state = "wall"
/turf/closed/bullet_act(obj/item/projectile/Proj)
. = ..()
if((. != -1) && !Proj.nodamage && (Proj.damage_type == BRUTE || Proj.damage_type == BURN))
var/mutable_appearance/bullet_hole = mutable_appearance('icons/effects/effects.dmi', "bullet_hole", BULLET_HOLE_LAYER)
var/random_x = rand(-13, 13)
bullet_hole.pixel_x += random_x
var/random_y = rand(-13, 13)
bullet_hole.pixel_y += random_y
add_overlay(bullet_hole, TRUE)
+42 -24
View File
@@ -25,6 +25,8 @@
/turf/closed/wall/clockwork)
smooth = SMOOTH_TRUE
var/list/damage_decals
/turf/closed/wall/examine(mob/user)
..()
deconstruction_hints(user)
@@ -113,7 +115,7 @@
playsound(src, 'sound/items/welder.ogg', 100, 1)
if(TOX)
playsound(src, 'sound/effects/spray2.ogg', 100, 1)
return 0
return FALSE
/turf/closed/wall/attack_paw(mob/living/user)
user.changeNext_move(CLICK_CD_MELEE)
@@ -137,7 +139,7 @@
else
playsound(src, 'sound/effects/bang.ogg', 50, 1)
to_chat(user, text("<span class='notice'>You punch the wall.</span>"))
return 1
return TRUE
/turf/closed/wall/attack_hand(mob/user)
user.changeNext_move(CLICK_CD_MELEE)
@@ -168,9 +170,23 @@
var/turf/T = user.loc //get user's location for delay checks
//the istype cascade has been spread among various procs for easy overriding
if(try_wallmount(W,user,T) || try_decon(W,user,T) || try_destroy(W,user,T))
if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || try_destroy(W, user, T))
return
/turf/closed/wall/proc/try_clean(obj/item/W, mob/user, turf/T)
if((user.a_intent != INTENT_HELP) || !damage_decals.len || !istype(W, /obj/item/weldingtool))
return FALSE
var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0, user))
to_chat(user, "<span class='notice'>You begin fixing dents on the wall...</span>")
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)
to_chat(user, "<span class='notice'>You fix some dents on the wall.</span>")
cut_overlay(damage_decals)
LAZYCLEARLIST(damage_decals)
return TRUE
return FALSE
/turf/closed/wall/proc/try_wallmount(obj/item/W, mob/user, turf/T)
//check for wall mounted frames
@@ -178,53 +194,50 @@
var/obj/item/wallframe/F = W
if(F.try_build(src, user))
F.attach(src, user)
return 1
return TRUE
//Poster stuff
else if(istype(W, /obj/item/poster))
place_poster(W,user)
return 1
return 0
return TRUE
return FALSE
/turf/closed/wall/proc/try_decon(obj/item/W, mob/user, turf/T)
if( istype(W, /obj/item/weldingtool) )
if(istype(W, /obj/item/weldingtool))
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 slicing through the outer plating...</span>")
playsound(src, W.usesound, 100, 1)
if(do_after(user, slicing_duration*W.toolspeed, target = src))
if(!iswallturf(src) || !user || !WT || !WT.isOn() || !T)
return 1
if( user.loc == T && user.get_active_held_item() == WT )
if(do_after(user, slicing_duration * W.toolspeed, target = src))
if(iswallturf(src) && user && !QDELETED(WT) && WT.isOn() && !QDELETED(T) && (user.loc == T) && (user.get_active_held_item() == WT))
to_chat(user, "<span class='notice'>You remove the outer plating.</span>")
dismantle_wall()
return 1
else if( istype(W, /obj/item/gun/energy/plasmacutter) )
return TRUE
else if(istype(W, /obj/item/gun/energy/plasmacutter))
to_chat(user, "<span class='notice'>You begin slicing through the outer plating...</span>")
playsound(src, 'sound/items/welder.ogg', 100, 1)
if(do_after(user, slicing_duration*W.toolspeed, target = src))
if(!iswallturf(src) || !user || !W || !T)
return 1
if( user.loc == T && user.get_active_held_item() == W )
if(do_after(user, slicing_duration * W.toolspeed, target = src))
if(!iswallturf(src) || !user || QDELETED(W) || QDELETED(T))
return TRUE
if((user.loc == T) && (user.get_active_held_item() == W))
to_chat(user, "<span class='notice'>You remove the outer plating.</span>")
dismantle_wall()
visible_message("The wall was sliced apart by [user]!", "<span class='italics'>You hear metal being sliced apart.</span>")
return 1
return 0
return TRUE
return FALSE
/turf/closed/wall/proc/try_destroy(obj/item/W, mob/user, turf/T)
if(istype(W, /obj/item/pickaxe/drill/jackhammer))
var/obj/item/pickaxe/drill/jackhammer/D = W
if(!iswallturf(src) || !user || !W || !T)
return 1
return TRUE
if( user.loc == T && user.get_active_held_item() == W )
D.playDigSound()
dismantle_wall()
visible_message("<span class='warning'>[user] smashes through the [name] with the [W.name]!</span>", "<span class='italics'>You hear the grinding of metal.</span>")
return 1
return 0
return TRUE
return FALSE
/turf/closed/wall/proc/thermitemelt(mob/user)
@@ -295,3 +308,8 @@
ChangeTurf(/turf/open/floor/plating)
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)
+10
View File
@@ -85,6 +85,16 @@
/obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE)
var/turf/target_loca = get_turf(target)
if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && istype(target_loca, /turf/closed/wall) && 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(!isliving(target))
if(impact_effect_type)
new impact_effect_type(target_loca, target, src)