Yred: Signaller Alt-click behavior (#36773)

* Add mode to signallers to auto-send signal on use.

Instead of needing to open the signaller menu, then clicking "Send Signal".

* whoops

---------

Co-authored-by: Allspice <sagebasilmint@gmail.com>
This commit is contained in:
SonixApache
2024-07-18 14:27:50 +02:00
committed by GitHub
parent ce5de7d89e
commit ea6baf4c07
2 changed files with 31 additions and 6 deletions

View File

@@ -5,7 +5,7 @@
name = "remote signaling device"
short_name = "signaler"
desc = "Used to remotely activate devices."
desc = "Used to remotely activate devices. Alt-click to toggle between the configuration menu and sending a signal on use."
icon_state = "signaller"
item_state = "signaler"
starting_materials = list(MAT_IRON = 1000, MAT_GLASS = 200)
@@ -20,6 +20,7 @@
var/delay = 0
var/datum/radio_frequency/radio_connection
var/deadman = 0
var/autosignal = 0
accessible_values = list(\
VALUE_CODE = "code;"+VT_NUMBER+";1;100",\
@@ -60,6 +61,13 @@
else
to_chat(user, "<span class='warning'>Re-secure the signaler first!</span>")
/obj/item/device/assembly/signaler/proc/attempt_activate()
if(!cooldown)
activate()
else
to_chat(usr, "<span class='warning'>You must wait a little before sending out a signal again!</span>")
/obj/item/device/assembly/signaler/activate()
if(cooldown > 0)
return 0
@@ -75,7 +83,7 @@
holder.update_icon()
return
/obj/item/device/assembly/signaler/interact(mob/user as mob, flag1)
/obj/item/device/assembly/signaler/proc/show_menu(var/user as mob)
var/t1 = "-------"
// if ((src.b_stat && !( flag1 )))
// t1 = text("-------<BR>\nGreen Wire: []<BR>\nRed Wire: []<BR>\nBlue Wire: []<BR>\n", (src.wires & 4 ? text("<A href='?src=\ref[];wires=4'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=4'>Mend Wire</A>", src)), (src.wires & 2 ? text("<A href='?src=\ref[];wires=2'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=2'>Mend Wire</A>", src)), (src.wires & 1 ? text("<A href='?src=\ref[];wires=1'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=1'>Mend Wire</A>", src)))
@@ -105,6 +113,13 @@
onclose(user, "radio")
return
/obj/item/device/assembly/signaler/interact(mob/user as mob, flag1)
if(autosignal)
spawn(0)
attempt_activate()
else
show_menu(user)
/obj/item/device/assembly/signaler/Topic(href, href_list)
..()
@@ -129,10 +144,7 @@
if(href_list["send"])
spawn(0)
if(!cooldown)
activate()
else
to_chat(usr, "<span class='warning'>You must wait a little before sending out a signal again!</span>")
attempt_activate()
if(usr)
attack_self(usr)
@@ -291,3 +303,16 @@
set_frequency(sanitize_frequency(new_value))
else
return ..()
/obj/item/device/assembly/signaler/AltClick(var/mob/user)
if(user.incapacitated() || !Adjacent(user))
..()
return
if(autosignal)
autosignal = 0
to_chat(user, "<span class='notice'>The signaller will now show the configuration menu on use.</span>")
icon_state = "signaller"
else
autosignal = 1
to_chat(user, "<span class='notice'>The signaller will now activate the signal on use without showing the menu.</span>")
icon_state = "signaller_autosignal"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB