Skip to content

Commit

Permalink
[MIRROR] fixes gibtonite bomb [MDB IGNORE] (#176)
Browse files Browse the repository at this point in the history
* fixes gibtonite bomb (#79038)
---------

Co-authored-by: jimmyl <[email protected]>
  • Loading branch information
Steals-The-PRs and mc-oofert authored Oct 20, 2023
1 parent 6e35810 commit a75d80d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 22 deletions.
8 changes: 0 additions & 8 deletions code/datums/wires/explosive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
74 changes: 60 additions & 14 deletions code/modules/mining/ores_coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>rigged</b> to it!")
else
. += span_notice("You could <b>rig</b> 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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a75d80d

Please sign in to comment.