From b0926976dd61d9b28d4b14a5c6e2fb58ddecd974 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 20 Oct 2023 08:54:43 +0200 Subject: [PATCH] [MIRROR] fixes gibtonite bomb [MDB IGNORE] (#24457) * fixes gibtonite bomb (#79038) ## About The Pull Request https://github.com/tgstation/tgstation/assets/70376633/8d15d7c9-51c2-4aeb-b1c6-4386168947da i made it work slightly better too so also this was in the code since like 2015 but it probably got broken sometime also 10 second detonation timer is pretty harmless anyway so ## Why It's Good For The Game bug bad fyi this was added in 2015 https://github.com/tgstation/tgstation/pull/8587 ## Changelog :cl: fix: making assembly activated bombs works again /:cl: * fixes gibtonite bomb --------- Co-authored-by: jimmyl <70376633+mc-oofert@users.noreply.github.com> --- code/datums/wires/explosive.dm | 8 ---- code/modules/mining/ores_coins.dm | 74 +++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index 800b5b88444..c8d576cf4f3 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -144,11 +144,3 @@ /datum/wires/explosive/pizza/explode() var/obj/item/pizzabox/P = holder P.bomb.detonate() - - -/datum/wires/explosive/gibtonite - holder_type = /obj/item/gibtonite - -/datum/wires/explosive/gibtonite/explode() - var/obj/item/gibtonite/P = holder - P.GibtoniteReaction(null, "A wire signal has primed a") diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index b01b537ec80..bea2570fc4e 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -236,35 +236,77 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ inhand_icon_state = "Gibtonite ore" w_class = WEIGHT_CLASS_BULKY throw_range = 0 + /// if the gibtonite is currently primed for explosion var/primed = FALSE - var/det_time = 100 - var/quality = GIBTONITE_QUALITY_LOW //How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better - var/attacher = "UNKNOWN" + /// how long does it take for this to detonate + var/det_time = 10 SECONDS + /// the timer var/det_timer + /// How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better + var/quality = GIBTONITE_QUALITY_LOW + /// who attached the rig to us + var/attacher + /// the assembly rig + var/obj/item/assembly_holder/rig + /// the rig overlay + var/mutable_appearance/rig_overlay /obj/item/gibtonite/Initialize(mapload) . = ..() AddComponent(/datum/component/two_handed, require_twohands=TRUE) AddComponent(/datum/component/golem_food, consume_on_eat = FALSE, golem_food_key = /obj/item/gibtonite) +/obj/item/gibtonite/examine(mob/user) + . = ..() + if(rig) + . += span_warning("There is some kind of device rigged to it!") + else + . += span_notice("You could rig something to it.") + /obj/item/gibtonite/Destroy() - qdel(wires) - set_wires(null) + QDEL_NULL(rig) + rig_overlay = null return ..() +/obj/item/gibtonite/Exited(atom/movable/gone, direction) + . = ..() + if(gone == rig) + rig = null + attacher = null + cut_overlays(rig_overlay) + UnregisterSignal(src, COMSIG_IGNITER_ACTIVATE) + +/obj/item/gibtonite/IsSpecialAssembly() + return TRUE + /obj/item/gibtonite/attackby(obj/item/I, mob/user, params) - if(!wires && isigniter(I)) - user.visible_message(span_notice("[user] attaches [I] to [src]."), span_notice("You attach [I] to [src].")) - set_wires(new /datum/wires/explosive/gibtonite(src)) + if(istype(I, /obj/item/assembly_holder) && !rig) + var/obj/item/assembly_holder/holder = I + if(!(locate(/obj/item/assembly/igniter) in holder.assemblies)) + return ..() + if(!user.transferItemToLoc(holder, src)) + return + add_fingerprint(user) + rig = holder + holder.master = src + holder.on_attach() + rig_overlay = holder + rig_overlay.pixel_y -= 5 + add_overlay(rig_overlay) + RegisterSignal(src, COMSIG_IGNITER_ACTIVATE, PROC_REF(igniter_prime)) + log_bomber(user, "attached [holder] to ", src) attacher = key_name(user) - qdel(I) - add_overlay("Gibtonite_igniter") + user.balloon_alert_to_viewers("attached rig") return - - if(wires && !primed) - if(is_wire_tool(I)) - wires.interact(user) + + if(I.tool_behaviour == TOOL_WRENCH && rig) + rig.on_found() + if(QDELETED(src)) return + user.balloon_alert_to_viewers("detached rig") + user.log_message("detached [rig] from [src].", LOG_GAME) + user.put_in_hands(rig) + return if(I.tool_behaviour == TOOL_MINING || istype(I, /obj/item/resonator) || I.force >= 10) GibtoniteReaction(user, "A resonator has primed for detonation a") @@ -342,6 +384,10 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ hit_mob.Paralyze(1.5 SECONDS) hit_mob.Knockdown(8 SECONDS) +/obj/item/gibtonite/proc/igniter_prime() + SIGNAL_HANDLER + GibtoniteReaction(null, "An attached rig has primed a") + /obj/item/stack/ore/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1) . = ..() pixel_x = base_pixel_x + rand(0, 16) - 8