bulletholes (#16411)

adds atom/proc/ to create/clear bulletholes
makes walls use this proc
This commit is contained in:
Llywelwyn
2023-06-02 16:33:13 +00:00
committed by GitHub
parent 54d37e9530
commit ef9d56f70d
6 changed files with 79 additions and 0 deletions
+26
View File
@@ -675,3 +675,29 @@
/atom/proc/handle_pointed_at(var/mob/pointer)
return
/atom/proc/create_bullethole(obj/item/projectile/Proj)
var/p_x = Proj.p_x + rand(-6, 6)
var/p_y = Proj.p_y + rand(-6, 6)
var/obj/effect/overlay/bmark/bullet_mark = new(src)
bullet_mark.pixel_x = p_x
bullet_mark.pixel_y = p_y
//Offset correction
bullet_mark.pixel_x--
bullet_mark.pixel_y--
if(Proj.damage_flags & DAMAGE_FLAG_BULLET)
bullet_mark.icon_state = "dent"
else if(Proj.damage_flags & DAMAGE_FLAG_LASER)
bullet_mark.name = "scorch mark"
if(Proj.damage >= 20)
bullet_mark.icon_state = "scorch"
bullet_mark.set_dir(pick(NORTH,SOUTH,EAST,WEST)) // Pick random scorch design
else
bullet_mark.icon_state = "light_scorch"
/atom/proc/clear_bulletholes()
for(var/obj/effect/overlay/bmark/bullet_mark in src)
qdel(bullet_mark)
@@ -0,0 +1,6 @@
/obj/effect/overlay/bmark
name = "bullet hole"
desc = "Somebody's been shooting."
icon = 'icons/effects/effects.dmi'
layer = ABOVE_OBJ_LAYER
icon_state = "dent"
@@ -179,6 +179,7 @@
if(WT.use_tool(src, user, max(5, damage / 5), volume = 50) && WT && WT.isOn())
to_chat(user, SPAN_NOTICE("You finish repairing the damage to [src]."))
take_damage(-damage)
clear_bulletholes()
else
to_chat(user, SPAN_NOTICE("You need more welding fuel to complete this task."))
return
+3
View File
@@ -86,6 +86,7 @@
burn(500)
bullet_ping(Proj)
create_bullethole(Proj)
var/proj_damage = Proj.get_structure_damage()
var/damage = proj_damage
@@ -123,6 +124,7 @@
/turf/simulated/wall/ChangeTurf(var/newtype)
clear_plants()
clear_bulletholes()
..(newtype)
//Appearance
@@ -205,6 +207,7 @@
O.forceMove(src)
clear_plants()
clear_bulletholes()
material = SSmaterials.get_material_by_name("placeholder")
reinf_material = null