From b77b4830f586e78f3f0103d2ba3a1401c04ba2f8 Mon Sep 17 00:00:00 2001 From: Bokkiewokkie Date: Sat, 8 Jun 2024 23:08:01 +0200 Subject: [PATCH 1/2] Why would you put it on a turf anyway? --- nsv13/code/modules/overmap/shieldgen.dm | 13 +++++++------ nsv13/code/modules/overmap/weapons/damage.dm | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nsv13/code/modules/overmap/shieldgen.dm b/nsv13/code/modules/overmap/shieldgen.dm index d0cd127dd03..dbc675c6cd4 100644 --- a/nsv13/code/modules/overmap/shieldgen.dm +++ b/nsv13/code/modules/overmap/shieldgen.dm @@ -338,7 +338,7 @@ /obj/effect/temp_visual/overmap_shield_hit name = "Shield hit" - icon = 'nsv13/icons/overmap/shieldhit.dmi'; + icon = 'nsv13/icons/overmap/shieldhit.dmi' icon_state = "shieldhit" duration = 0.75 SECONDS layer = ABOVE_MOB_LAYER+0.1 @@ -349,17 +349,18 @@ /obj/effect/temp_visual/overmap_shield_hit/Initialize(mapload, obj/structure/overmap/OM) . = ..() //Scale up the shield hit icon to roughly fit the overmap ship that owns us. - if(!OM) + if(!OM || !istype(OM)) + log_runtime("Shield hit effect was made with no ship!") return INITIALIZE_HINT_QDEL - overmap = OM var/matrix/desired = new() - var/icon/I = icon(overmap.icon) + var/icon/I = icon(OM.icon) var/resize_x = I.Width()/96 var/resize_y = I.Height()/96 desired.Scale(resize_x,resize_y) - desired.Turn(overmap.angle) + desired.Turn(OM.angle) transform = desired - overmap.vis_contents += src + OM.vis_contents |= src + overmap = OM /obj/effect/temp_visual/overmap_shield_hit/Destroy() overmap?.vis_contents -= src diff --git a/nsv13/code/modules/overmap/weapons/damage.dm b/nsv13/code/modules/overmap/weapons/damage.dm index 1bcd3fa46b1..4d36c653326 100644 --- a/nsv13/code/modules/overmap/weapons/damage.dm +++ b/nsv13/code/modules/overmap/weapons/damage.dm @@ -23,7 +23,7 @@ Bullet reactions if(shield_result) var/damage_sound = pick('nsv13/sound/effects/ship/damage/shield_hit.ogg', 'nsv13/sound/effects/ship/damage/shield_hit2.ogg') if(!impact_sound_cooldown) - new /obj/effect/temp_visual/overmap_shield_hit(get_turf(src), src) + new /obj/effect/temp_visual/overmap_shield_hit(src, src) relay(damage_sound) if(P.damage >= 15) //Flak begone shake_everyone(5) From e238169bac917f35cfd0b476a703903fc40964ae Mon Sep 17 00:00:00 2001 From: Bokkiewokkie Date: Thu, 20 Jun 2024 17:15:07 +0200 Subject: [PATCH 2/2] Debugging --- nsv13/code/modules/overmap/shieldgen.dm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nsv13/code/modules/overmap/shieldgen.dm b/nsv13/code/modules/overmap/shieldgen.dm index dbc675c6cd4..55376675734 100644 --- a/nsv13/code/modules/overmap/shieldgen.dm +++ b/nsv13/code/modules/overmap/shieldgen.dm @@ -343,7 +343,7 @@ duration = 0.75 SECONDS layer = ABOVE_MOB_LAYER+0.1 animate_movement = NO_STEPS // Override the inbuilt movement engine to avoid bouncing - appearance_flags = TILE_BOUND | PIXEL_SCALE + vis_flags = VIS_INHERIT_ID var/obj/structure/overmap/overmap /obj/effect/temp_visual/overmap_shield_hit/Initialize(mapload, obj/structure/overmap/OM) @@ -357,13 +357,19 @@ var/resize_x = I.Width()/96 var/resize_y = I.Height()/96 desired.Scale(resize_x,resize_y) - desired.Turn(OM.angle) transform = desired - OM.vis_contents |= src + //Don't even ask, this makes it fit on the ship sprite properly most of the time + if(I.Width() <= 48) + pixel_x = -24 + pixel_y = -24 + else + pixel_x += round(I.Width()/16, 1) + pixel_y += pixel_x*round(I.Height()/32, 1) + OM.overlays.Add(src) //Otherwise it won't animate with the ship nicely overmap = OM /obj/effect/temp_visual/overmap_shield_hit/Destroy() - overmap?.vis_contents -= src + overmap?.overlays.Remove(src) overmap = null return ..()