Skip to content

Commit

Permalink
fixes some omni tool intractions (#5432)
Browse files Browse the repository at this point in the history
* fixes some omni tool intractions

* fixes hydrogen generator

* Update hydrogen_generator.dm
  • Loading branch information
Trilbyspaceclone authored Jun 18, 2024
1 parent 11350e0 commit 51a7c58
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 33 deletions.
29 changes: 24 additions & 5 deletions code/modules/aberrants/organs/machinery/organ_fabricator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,33 @@

/obj/machinery/autolathe/organ_fabricator/attackby(obj/item/I, mob/user)
// Warn about deconstruction

var/list/usable_qualities = list(QUALITY_SCREW_DRIVING)
if(panel_open)
var/tool_type = I.get_tool_type(user, list(QUALITY_PRYING), src)
if(tool_type == QUALITY_PRYING)
var/starting_loc = user.loc // Save location so user can't magically deconstruct it from a distance
var/choice = alert("If you deconstruct this machine, the biomatter inside will be destroyed. Are you sure you want to continue?", "Deconstruction Warning", "Deconstruct", "Leave it alone")
if(choice != "Deconstruct" || starting_loc != user.loc)
usable_qualities.Add(QUALITY_PRYING)

if(usable_qualities)
var/tool_type = I.get_tool_type(user, usable_qualities, src)
switch(tool_type)
if(QUALITY_PRYING)
var/starting_loc = user.loc // Save location so user can't magically deconstruct it from a distance
var/choice = alert("If you deconstruct this machine, the biomatter inside will be destroyed. Are you sure you want to continue?", "Deconstruction Warning", "Deconstruct", "Leave it alone")
if(choice != "Deconstruct" || starting_loc != user.loc)
return TRUE
..()
return

if(QUALITY_SCREW_DRIVING)
var/used_sound = panel_open ? 'sound/machines/Custom_screwdriveropen.ogg' : 'sound/machines/Custom_screwdriverclose.ogg'
if(I.use_tool(user, src, WORKTIME_NEAR_INSTANT, tool_type, FAILCHANCE_VERY_EASY, required_stat = STAT_MEC, instant_finish_tier = 30, forced_sound = used_sound))
panel_open = !panel_open
to_chat(user, SPAN_NOTICE("You [panel_open ? "open" : "close"] the maintenance hatch of \the [src] with [I]."))
return TRUE

if(ABORT_CHECK)
return


..()

/obj/machinery/autolathe/organ_fabricator/on_deconstruction(obj/item/I, mob/user)
Expand Down
48 changes: 27 additions & 21 deletions code/modules/power/hydrogen_generator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@

// Proc when attacking the generator with something, used for upgrades, inserting fuel cells & wrenching it to the ground
/obj/machinery/power/hydrogen_gen/attackby(obj/item/W, mob/user)

if(default_deconstruction(W, user))
if(active)
to_chat(user, SPAN_NOTICE("You can't work with [src] while its running!"))
return

if(default_part_replacement(W, user))
Expand All @@ -108,26 +108,32 @@
updateDialog()
return

if(active)
to_chat(user, SPAN_NOTICE("You can't work with [src] while its running!"))
else
var/list/usable_qualities = list(QUALITY_BOLT_TURNING)
var/tool_type = W.get_tool_type(user, usable_qualities, src)
switch(tool_type)
if(QUALITY_BOLT_TURNING)
if(istype(get_turf(src), /turf/space) && !anchored)
to_chat(user, SPAN_NOTICE("You can't anchor something to empty space. Idiot."))
return
if(W.use_tool(user, src, WORKTIME_NORMAL, tool_type, FAILCHANCE_EASY, required_stat = STAT_MEC))
to_chat(user, SPAN_NOTICE("You [anchored ? "un" : ""]anchor the brace with [W]."))
anchored = !anchored
if(anchored)
connect_to_network()
else
disconnect_from_network()

if(ABORT_CHECK)
var/list/usable_qualities = list(QUALITY_SCREW_DRIVING, QUALITY_BOLT_TURNING, QUALITY_PRYING)
var/tool_type = W.get_tool_type(user, usable_qualities, src)
switch(tool_type)
if(QUALITY_BOLT_TURNING)
if(istype(get_turf(src), /turf/space) && !anchored)
to_chat(user, SPAN_NOTICE("You can't anchor something to empty space. Idiot."))
return
if(W.use_tool(user, src, WORKTIME_NORMAL, tool_type, FAILCHANCE_EASY, required_stat = STAT_MEC))
to_chat(user, SPAN_NOTICE("You [anchored ? "un" : ""]anchor the brace with [W]."))
anchored = !anchored
if(anchored)
connect_to_network()
else
disconnect_from_network()

if(QUALITY_SCREW_DRIVING)
default_deconstruction(W, user)
return

if(QUALITY_PRYING)
default_deconstruction(W, user)
return

if(ABORT_CHECK)
return


..()

Expand Down
7 changes: 6 additions & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ For the sake of consistency, I suggest always rounding up on even values when ap
to_chat(user, "<span class='info'>Projectile Serial Calibration: ERROR.</span>")


var/list/usable_qualities = list()
var/list/usable_qualities = list(QUALITY_SCREW_DRIVING)
if(saw_off)
usable_qualities.Add(QUALITY_SAWING)

Expand Down Expand Up @@ -484,6 +484,11 @@ For the sake of consistency, I suggest always rounding up on even values when ap
plusing_intraction(I, user)
return

//This is litterly just a stop gap so you dont accidently decon your weapon.
if(QUALITY_SCREW_DRIVING)
..()
return

if(ABORT_CHECK)
return

Expand Down
30 changes: 24 additions & 6 deletions code/modules/reagents/machinery/chem_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,30 @@
. = ..()

/obj/machinery/chemical_dispenser/attackby(obj/item/I, mob/living/user)
if(default_deconstruction(I, user))
return
var/list/usable_qualities = list(QUALITY_SCREW_DRIVING, QUALITY_PRYING)

if(length(hacked_reagents))
usable_qualities.Add(QUALITY_PULSING)

if(usable_qualities)
var/tool_type = I.get_tool_type(user, usable_qualities, src)
switch(tool_type)

if(QUALITY_PULSING)
to_chat(usr, SPAN_WARNING("You pulse a few wires, changing the dispensing restrictions."))
hacked()
return

if(QUALITY_SCREW_DRIVING)
default_deconstruction(I, user)
return

if(QUALITY_PRYING)
default_deconstruction(I, user)
return

if(ABORT_CHECK)
return

if(default_part_replacement(I, user))
return
Expand All @@ -237,10 +259,6 @@
to_chat(usr, SPAN_WARNING("Your biological understanding isn't enough to use this."))
return

if(istype(I, /obj/item/tool/multitool) && length(hacked_reagents))
to_chat(usr, SPAN_WARNING("You pulse a few wires, unlocking the dispensing restrictions."))
hacked()

var/obj/item/reagent_containers/B = I
if(beaker)
to_chat(user, "Something is already loaded into the machine.")
Expand Down

0 comments on commit 51a7c58

Please sign in to comment.