diff --git a/code/modules/smithing/machinery/lava_furnace.dm b/code/modules/smithing/machinery/lava_furnace.dm index 8ae84454e25..1cc5d776e08 100644 --- a/code/modules/smithing/machinery/lava_furnace.dm +++ b/code/modules/smithing/machinery/lava_furnace.dm @@ -4,6 +4,8 @@ icon = 'icons/obj/machines/large_smithing_machines.dmi' icon_state = "furnace_off" operation_sound = 'sound/surgery/cautery1.ogg' + /// How much the device heats the component + var/heat_amount = 5 /obj/machinery/smithing/lava_furnace/Initialize(mapload) . = ..() @@ -19,10 +21,13 @@ /obj/machinery/smithing/lava_furnace/RefreshParts() var/operation_mult = 0 + var/heat_mult = 0 for(var/obj/item/stock_parts/component in component_parts) operation_mult += OPERATION_SPEED_MULT_PER_RATING * component.rating + heat_mult += 0.25 * component.rating // Update our values operation_time = max(ROUND_UP(initial(operation_time) * (1.3 - operation_mult)), 2) + heat_amount = round(5 * heat_mult) /obj/machinery/smithing/lava_furnace/update_overlays() . = ..() @@ -42,14 +47,14 @@ update_icon(UPDATE_OVERLAYS) /obj/machinery/smithing/lava_furnace/operate(loops, mob/living/user) - if(working_component.hot) + if(working_component.heat > 10) to_chat(user, "[working_component] is already well heated.") return if(working_component.hammer_time <= 0) to_chat(user, "[working_component] is already fully shaped.") return ..() - working_component.heat_up() + working_component.heat_up(heat_amount) /obj/machinery/smithing/lava_furnace/attack_hand(mob/user) . = ..() diff --git a/code/modules/smithing/machinery/power_hammer.dm b/code/modules/smithing/machinery/power_hammer.dm index e5e70e1d7a7..1fc5ba5c847 100644 --- a/code/modules/smithing/machinery/power_hammer.dm +++ b/code/modules/smithing/machinery/power_hammer.dm @@ -47,7 +47,7 @@ operation_time = max(ROUND_UP(initial(operation_time) * (1.3 - operation_mult)), 2) /obj/machinery/smithing/power_hammer/operate(loops, mob/living/user) - if(!working_component.hot) + if(!working_component.heat) to_chat(user, "[working_component] is too cold to properly shape.") return if(working_component.hammer_time <= 0) @@ -57,7 +57,7 @@ working_component.powerhammer() do_sparks(5, TRUE, src) // If the hammer is set to repeat mode, let it repeat operations automatically. - if(repeating && working_component.hot && working_component.hammer_time) + if(repeating && working_component.heat && working_component.hammer_time) operate(loops, user) // When an item is done, beep. if(!working_component.hammer_time) diff --git a/code/modules/smithing/smith_component.dm b/code/modules/smithing/smith_component.dm index ed2639b90be..1d105546c84 100644 --- a/code/modules/smithing/smith_component.dm +++ b/code/modules/smithing/smith_component.dm @@ -7,39 +7,54 @@ var/part_type /// What is this a part of var/finished_product - /// Is this component currently hot - var/hot = TRUE + /// Heat stacks on the component + var/heat = 5 + /// How often does a component lose heat stacks + var/cool_time = 10 SECONDS /// How many times the component needs to be shaped to be considered ready var/hammer_time = 3 +/obj/item/smithed_item/component/Initialize(mapload) + . = ..() + addtimer(CALLBACK(src, PROC_REF(cool_off)), cool_time) + /obj/item/smithed_item/component/update_icon_state() . = ..() - if(hot) + if(heat) icon_state = "[initial(icon_state)]_hot" else icon_state = "[initial(icon_state)]" /obj/item/smithed_item/component/proc/powerhammer() hammer_time-- - if(prob(50) || hammer_time <= 0) - hot = FALSE - update_icon(UPDATE_ICON_STATE) - -/obj/item/smithed_item/component/proc/heat_up() - hot = TRUE + if(!hammer_time) + heat = 0 update_icon(UPDATE_ICON_STATE) +/obj/item/smithed_item/component/proc/heat_up(heat_to_add) + heat += heat_to_add + if(heat) + addtimer(CALLBACK(src, PROC_REF(cool_off)), cool_time) + update_icon(UPDATE_ICON_STATE) + +/obj/item/smithed_item/component/proc/cool_off() + heat-- + if(heat) + addtimer(CALLBACK(src, PROC_REF(cool_off)), cool_time) + else + update_icon(UPDATE_ICON_STATE) + /obj/item/smithed_item/component/examine(mob/user) . = ..() if(hammer_time) . += "It is incomplete. It looks like it needs [hammer_time] more cycles in the power hammer." else . += "It is complete." - if(hot) + if(heat) . +="It is glowing hot!" /obj/item/smithed_item/component/attack_hand(mob/user) - if(!hot) + if(!heat) return ..() if(burn_check(user)) burn_user(user) @@ -52,7 +67,7 @@ hammer_time = ROUND_UP(initial(hammer_time) * quality.work_mult) /obj/item/smithed_item/component/proc/burn_check(mob/user) - if(!hot) + if(!heat) return FALSE var/burn_me = TRUE var/mob/living/carbon/human/H = user