From 3b3468747fb75cacb36f9ca5f7fca4d4b8739e58 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:16:17 +0200 Subject: [PATCH] [MIRROR] Overclock safety setting for Gygax [MDB IGNORE] (#24495) * Overclock safety setting for Gygax (#79101) ![SVYgXCYIFN](https://github.com/tgstation/tgstation/assets/3625094/fffe3763-fae5-4449-a47e-7fc564e96853) ## About The Pull Request Since people started using OC on all mechs by attaching a signaller to the wire, I figured that Gygax should have at least something special, except the 2x overclock modifier for dark gygax and the UI button for overclock. Now Gygax type mechs have an option to automatically disable overclock when the mech is overheated. As Gygax was designed to use overclock, other mechs lack this component and there is no wire for this. ## Why It's Good For The Game Special overclock behavior for Gygax. ## Changelog :cl: add: Gygax type mechs now have an option to disable overclock when overheated. fix: Fixed overclocking having no effect on Ripley. /:cl: * Overclock safety setting for Gygax --------- Co-authored-by: Andrew --- code/modules/vehicles/mecha/_mecha.dm | 18 ++++++- code/modules/vehicles/mecha/combat/gygax.dm | 2 + code/modules/vehicles/mecha/mecha_actions.dm | 1 - code/modules/vehicles/mecha/mecha_ui.dm | 7 +-- code/modules/vehicles/mecha/working/ripley.dm | 4 +- .../tgui/interfaces/Mecha/AlertPane.tsx | 52 +++++++++++++------ tgui/packages/tgui/interfaces/Mecha/data.ts | 28 +++++----- 7 files changed, 78 insertions(+), 34 deletions(-) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 0652c554b8a..573e09f347d 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -173,6 +173,10 @@ var/overclock_temp = 0 ///Temperature threshold at which actuators may start causing internal damage var/overclock_temp_danger = 15 + ///Whether the mech has an option to enable safe overclocking + var/overclock_safety_available = FALSE + ///Whether the overclocking turns off automatically when overheated + var/overclock_safety = FALSE //Bool for zoom on/off var/zoom_mode = FALSE @@ -520,6 +524,9 @@ overclock_temp = min(overclock_temp + seconds_per_tick, overclock_temp_danger * 2) if(overclock_temp < overclock_temp_danger) return + if(overclock_temp >= overclock_temp_danger && overclock_safety) + toggle_overclock(FALSE) + return var/damage_chance = 100 * ((overclock_temp - overclock_temp_danger) / (overclock_temp_danger * 2)) if(SPT_PROB(damage_chance, seconds_per_tick)) do_sparks(5, TRUE, src) @@ -811,6 +818,15 @@ else overclock_mode = !overclock_mode log_message("Toggled overclocking.", LOG_MECHA) + + for(var/mob/occupant as anything in occupants) + var/datum/action/act = locate(/datum/action/vehicle/sealed/mecha/mech_overclock) in occupant.actions + if(!act) + continue + act.button_icon_state = "mech_overload_[overclock_mode ? "on" : "off"]" + balloon_alert(occupant, "overclock [overclock_mode ? "on":"off"]") + act.build_all_button_icons() + if(overclock_mode) movedelay = movedelay / overclock_coeff visible_message(span_notice("[src] starts heating up, making humming sounds.")) @@ -857,5 +873,5 @@ act.button_icon_state = "mech_lights_on" else act.button_icon_state = "mech_lights_off" - balloon_alert(occupant, "toggled lights [mecha_flags & LIGHTS_ON ? "on":"off"]") + balloon_alert(occupant, "lights [mecha_flags & LIGHTS_ON ? "on":"off"]") act.build_all_button_icons() diff --git a/code/modules/vehicles/mecha/combat/gygax.dm b/code/modules/vehicles/mecha/combat/gygax.dm index 204739cd7fc..223ab66ca31 100644 --- a/code/modules/vehicles/mecha/combat/gygax.dm +++ b/code/modules/vehicles/mecha/combat/gygax.dm @@ -22,6 +22,8 @@ ) step_energy_drain = 4 can_use_overclock = TRUE + overclock_safety_available = TRUE + overclock_safety = TRUE /datum/armor/mecha_gygax melee = 25 diff --git a/code/modules/vehicles/mecha/mecha_actions.dm b/code/modules/vehicles/mecha/mecha_actions.dm index f42e89aa1d5..43301c19605 100644 --- a/code/modules/vehicles/mecha/mecha_actions.dm +++ b/code/modules/vehicles/mecha/mecha_actions.dm @@ -152,6 +152,5 @@ if(!owner || !chassis || !(owner in chassis.occupants)) return chassis.toggle_overclock(forced_state) - chassis.balloon_alert(owner, chassis.overclock_mode ? "started overclocking" : "stopped overclocking") button_icon_state = "mech_overload_[chassis.overclock_mode ? "on" : "off"]" build_all_button_icons() diff --git a/code/modules/vehicles/mecha/mecha_ui.dm b/code/modules/vehicles/mecha/mecha_ui.dm index 815770875ea..76d8b4613fa 100644 --- a/code/modules/vehicles/mecha/mecha_ui.dm +++ b/code/modules/vehicles/mecha/mecha_ui.dm @@ -82,6 +82,8 @@ data["internal_damage"] = internal_damage data["can_use_overclock"] = can_use_overclock + data["overclock_safety_available"] = overclock_safety_available + data["overclock_safety"] = overclock_safety data["overclock_mode"] = overclock_mode data["overclock_temp_percentage"] = overclock_temp / overclock_temp_danger @@ -210,9 +212,8 @@ toggle_lights(user = usr) if("toggle_overclock") toggle_overclock() - var/datum/action/act = locate(/datum/action/vehicle/sealed/mecha/mech_overclock) in usr.actions - act.button_icon_state = "mech_overload_[overclock_mode ? "on" : "off"]" - act.build_all_button_icons() + if("toggle_overclock_safety") + overclock_safety = !overclock_safety if("repair_int_damage") try_repair_int_damage(usr, params["flag"]) return FALSE diff --git a/code/modules/vehicles/mecha/working/ripley.dm b/code/modules/vehicles/mecha/working/ripley.dm index 9db12624125..d2b13d48d26 100644 --- a/code/modules/vehicles/mecha/working/ripley.dm +++ b/code/modules/vehicles/mecha/working/ripley.dm @@ -266,11 +266,11 @@ GLOBAL_DATUM(cargo_ripley, /obj/vehicle/sealed/mecha/ripley/cargo) var/turf/T = get_turf(loc) if(lavaland_equipment_pressure_check(T)) - movedelay = fast_pressure_step_in + movedelay = !overclock_mode ? fast_pressure_step_in : fast_pressure_step_in / overclock_coeff for(var/obj/item/mecha_parts/mecha_equipment/drill/drill in flat_equipment) drill.equip_cooldown = initial(drill.equip_cooldown) * 0.5 else - movedelay = slow_pressure_step_in + movedelay = !overclock_mode ? slow_pressure_step_in : slow_pressure_step_in / overclock_coeff for(var/obj/item/mecha_parts/mecha_equipment/drill/drill in flat_equipment) drill.equip_cooldown = initial(drill.equip_cooldown) diff --git a/tgui/packages/tgui/interfaces/Mecha/AlertPane.tsx b/tgui/packages/tgui/interfaces/Mecha/AlertPane.tsx index c29c60b8bc3..953e1a6b5f8 100644 --- a/tgui/packages/tgui/interfaces/Mecha/AlertPane.tsx +++ b/tgui/packages/tgui/interfaces/Mecha/AlertPane.tsx @@ -27,6 +27,8 @@ export const AlertPane = (props, context) => { scanmod_rating, capacitor_rating, can_use_overclock, + overclock_safety_available, + overclock_safety, overclock_mode, overclock_temp_percentage, } = data; @@ -35,21 +37,41 @@ export const AlertPane = (props, context) => { title="Status" buttons={ (!!overclock_mode || !!can_use_overclock) && ( - + <> + + {!!overclock_safety_available && ( +