diff --git a/code/_helpers/visual_filters.dm b/code/_helpers/visual_filters.dm index ad1fc910420..0769a01fdd4 100644 --- a/code/_helpers/visual_filters.dm +++ b/code/_helpers/visual_filters.dm @@ -3,13 +3,16 @@ // All of this ported from TG. // And then ported to Nebula from Polaris. /atom/movable - var/list/filter_data // For handling persistent filters + VAR_PRIVATE/list/filter_data // For handling persistent filters // Defining this for future proofing and ease of searching for erroneous usage. /image/proc/add_filter(filter_name, priority, list/params) filters += filter(arglist(params)) return TRUE +/atom/movable/proc/has_filter(filter_name) + return (name in filter_data) + /atom/movable/proc/add_filter(filter_name, priority, list/params, force_update = FALSE) // Check if we already have a filter and hence don't need to rebuild filters. diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index ef312635529..d5bcac25da9 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -107,12 +107,16 @@ steam.start() -- spawns the effect /obj/effect/sparks/struck spark_sound = "light_bic" +/obj/effect/sparks/silent + spark_sound = null + /obj/effect/sparks/Initialize() . = ..() // this is 2 seconds so that it doesn't appear to freeze after its last move, which ends up making it look like timers are broken // if you change the number of or delay between moves in spread(), this may need to be changed QDEL_IN(src, 2 SECONDS) - playsound(loc, spark_sound, 100, 1) + if(spark_sound) + playsound(loc, spark_sound, 100, 1) set_light(lit_light_range, lit_light_power, lit_light_color) if(isturf(loc)) var/turf/T = loc @@ -140,6 +144,9 @@ steam.start() -- spawns the effect /datum/effect/effect/system/spark_spread var/spark_type = /obj/effect/sparks +/datum/effect/effect/system/spark_spread/silent + spark_type = /obj/effect/sparks/silent + /datum/effect/effect/system/spark_spread/non_electrical spark_type = /obj/effect/sparks/struck diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 85f9391c8a1..ef75c7e6dfd 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -405,7 +405,7 @@ return // Used by HE pipes and forging bars/billets. Defaults are for HE pipes. -/obj/proc/animate_heat_glow_filter(icon_temperature, scale_sub = 500, scale_div = 1500, scale_max = 2000) +/obj/proc/animate_heat_glow(icon_temperature, scale_sub = 500, scale_div = 1500, scale_max = 2000, skip_filter = FALSE) var/scale = max((icon_temperature - scale_sub) / scale_div, 0) var/h_r = heat2color_r(icon_temperature) @@ -422,5 +422,6 @@ for (var/thing in animate_targets) var/atom/movable/AM = thing animate(AM, color = scale_color, time = 2 SECONDS, easing = SINE_EASING) - animate_filter("glow", list(color = scale_color, time = 2 SECONDS, easing = LINEAR_EASING)) + if(!skip_filter) + animate_filter("glow", list(color = scale_color, time = 2 SECONDS, easing = LINEAR_EASING)) set_light(min(3, scale*2.5), min(3, scale*2.5), scale_color) diff --git a/code/modules/atmospherics/he_pipes.dm b/code/modules/atmospherics/he_pipes.dm index 7eb3dfefa69..54dd9a6c975 100644 --- a/code/modules/atmospherics/he_pipes.dm +++ b/code/modules/atmospherics/he_pipes.dm @@ -93,7 +93,7 @@ //fancy radiation glowing if(pipe_air.temperature && (icon_temperature > 500 || pipe_air.temperature > 500)) //start glowing at 500K if(abs(pipe_air.temperature - icon_temperature) > 10) - animate_heat_glow_filter(pipe_air.temperature) + animate_heat_glow(pipe_air.temperature) else set_light(0, 0) diff --git a/code/modules/crafting/forging/forge_bars.dm b/code/modules/crafting/forging/forge_bars.dm index bf95b1d24ae..a3ffa1590b1 100644 --- a/code/modules/crafting/forging/forge_bars.dm +++ b/code/modules/crafting/forging/forge_bars.dm @@ -1,10 +1,3 @@ -// Copied from billets/HE pipes. -/obj/item/stack/material/bar/set_material(new_material) - . = ..() - if(material?.forgable) - add_filter("glow",1, list(type = "drop_shadow", x = 0, y = 0, offset = 0, size = 4)) - -// Also copied from billets. /obj/item/stack/material/bar/get_thermal_mass_coefficient() return hot_enough_to_forge() ? 0.1 : ..() @@ -24,7 +17,12 @@ temperature_percentage = (material.melting_point - T20C) / (temperature - T20C) if(temperature_percentage < 0.25) set_light(0, 0) - animate_heat_glow_filter(temperature, scale_sub = round((material.melting_point - T20C) * 0.25) + T20C, scale_div = round(material.melting_point * 0.75), scale_max = material.melting_point) + else + animate_heat_glow(temperature, scale_sub = round((material.melting_point - T20C) * 0.25) + T20C, scale_div = round(material.melting_point * 0.75), scale_max = material.melting_point, skip_filter = TRUE) + else + set_light(0, 0) + if(istype(loc, /obj/item/tongs)) + loc.update_icon() // Copied from billets. /obj/item/stack/material/bar/proc/hot_enough_to_forge() diff --git a/code/modules/crafting/forging/forge_billet.dm b/code/modules/crafting/forging/forge_billet.dm index ce99afd9d91..d63b0f2d8ee 100644 --- a/code/modules/crafting/forging/forge_billet.dm +++ b/code/modules/crafting/forging/forge_billet.dm @@ -11,7 +11,6 @@ if(ispath(current_forging_step)) set_forging_step(current_forging_step, force = TRUE) . = ..() - add_filter("glow",1, list(type = "drop_shadow", x = 0, y = 0, offset = 0, size = 4)) /obj/item/billet/proc/set_forging_step(decl/forging_step/new_step, force) if(ispath(new_step)) @@ -37,7 +36,7 @@ var/obj/item/tongs/tongs = used_item if(tongs.holding_bar) return ..() - var/mob/holder = tongs.loc + var/mob/holder = loc if(istype(holder)) if(!holder.try_unequip(src, tongs)) return TRUE @@ -73,9 +72,20 @@ // Handle the actual forging process. var/last_step = current_forging_step var/decl/forging_action/next_action = show_radial_menu(user, src, current_forging_step.get_radial_choices(), radius = 42, use_labels = RADIAL_LABELS_CENTERED, require_near = TRUE, check_locs = list(src)) + if(!standard_forging_checks(user, used_item, last_step, next_action, anvil)) return TRUE - playsound(src, 'sound/effects/clang.ogg', 100, 1) // shake the billet? do attack animation? + + if(user.get_stamina() < 10) + to_chat(user, SPAN_WARNING("You are too exhausted to swing \the [used_item].")) + return TRUE + user.adjust_stamina(-10) + + playsound(src, 'sound/effects/clang.ogg', 100, 1) + user.do_attack_animation(anvil, used_item) + spark_at(get_turf(loc), amount = 1, spark_type = /datum/effect/effect/system/spark_spread/silent) + // TODO: shake the billet/anvil? + // Skill checks! var/decl/forging_step/next_step = current_forging_step.steps[next_action] @@ -88,8 +98,16 @@ // Since we have a sleep() above, we recheck our basic conditions. if(!standard_forging_checks(user, used_item, last_step, next_action, anvil)) return TRUE - playsound(src, 'sound/effects/clang.ogg', 100, 1) // shake the billet? do attack animation? - // TODO Use some stamina. + + if(user.get_stamina() < 10) + to_chat(user, SPAN_WARNING("You are too exhausted to keep swinging \the [used_item].")) + return TRUE + user.adjust_stamina(-10) + + playsound(src, 'sound/effects/clang.ogg', 100, 1) + user.do_attack_animation(anvil, used_item) + spark_at(get_turf(loc), amount = 1, spark_type = /datum/effect/effect/system/spark_spread/silent) + // TODO: shake the billet/anvil? // Update the billet (which may produce an item!) var/obj/item/forged_thing = set_forging_step(next_step) @@ -149,6 +167,9 @@ . = ..() // We have no real way to find temperature bounds without a material that has a melting point. if(!istype(material) || isnull(material.melting_point) || QDELETED(src)) + set_light(0, 0) + if(istype(loc, /obj/item/tongs)) + loc.update_icon() return var/temperature_percentage if(temperature >= material.melting_point) // We should have melted... @@ -159,7 +180,10 @@ temperature_percentage = (material.melting_point - T20C) / (temperature - T20C) if(temperature_percentage < 0.25) set_light(0, 0) - animate_heat_glow_filter(temperature, scale_sub = round((material.melting_point - T20C) * 0.25) + T20C, scale_div = round(material.melting_point * 0.75), scale_max = material.melting_point) + else + animate_heat_glow(temperature, scale_sub = round((material.melting_point - T20C) * 0.25) + T20C, scale_div = round(material.melting_point * 0.75), scale_max = material.melting_point, skip_filter = TRUE) + if(istype(loc, /obj/item/tongs)) + loc.update_icon() // Arbitrary value to give people enough time to forge the bloody thing. /obj/item/billet/get_thermal_mass_coefficient() diff --git a/code/modules/crafting/forging/forge_tools.dm b/code/modules/crafting/forging/forge_tools.dm index 427a63dacca..cefc43d1d24 100644 --- a/code/modules/crafting/forging/forge_tools.dm +++ b/code/modules/crafting/forging/forge_tools.dm @@ -16,7 +16,8 @@ /obj/item/tongs/on_update_icon() . = ..() if(holding_bar) - add_overlay(overlay_image(icon, "[icon_state]-bar", holding_bar.get_color(), RESET_COLOR)) + // Note, not get_color(); heat color is temporarily applied over the top of base color. + add_overlay(overlay_image(icon, "[icon_state]-bar", holding_bar.color, RESET_COLOR)) /obj/item/tongs/Exited(atom/movable/AM, atom/new_loc) . = ..()