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"
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"

View File

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

View File

@@ -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("<span class='notice'>You punch the wall.</span>"))
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, "<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)
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, "<span class='notice'>You fix some dents on the wall.</span>")
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)

View File

@@ -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.

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\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"