[MIRROR] Adds layer switching with mouse wheel to the RPD. (#1491)

* Adds layer switching with mouse wheel to the RPD. (#54458)

Adds a signal that gets sent to items in currently active hand on mouse scroll
and makes RPD listen to this and change the piping layer accordingly.

* Adds layer switching with mouse wheel to the RPD.

Co-authored-by: TheChosenEvilOne <34602646+TheChosenEvilOne@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-10-27 09:09:25 +00:00
committed by GitHub
co-authored by TheChosenEvilOne
parent 1da5c3d721
commit cb880bb359
3 changed files with 28 additions and 1 deletions
+25
View File
@@ -237,6 +237,18 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
spark_system = null
return ..()
/obj/item/pipe_dispenser/examine(mob/user)
. = ..()
. += "You can scroll your mouse wheel to change the piping layer."
/obj/item/pipe_dispenser/equipped(mob/user, slot, initial)
. = ..()
RegisterSignal(user, COMSIG_MOUSE_SCROLL_ON, .proc/mouse_wheeled)
/obj/item/pipe_dispenser/dropped(mob/user, silent)
UnregisterSignal(user, COMSIG_MOUSE_SCROLL_ON)
return ..()
/obj/item/pipe_dispenser/attack_self(mob/user)
ui_interact(user)
@@ -507,6 +519,19 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
/obj/item/pipe_dispenser/proc/activate()
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
/obj/item/pipe_dispenser/proc/mouse_wheeled(mob/source, atom/A, delta_x, delta_y, params)
SIGNAL_HANDLER
if(source.incapacitated(ignore_restraints = TRUE, ignore_stasis = TRUE))
return
if(delta_y > 0)
piping_layer = min(PIPING_LAYER_MAX, piping_layer + 1)
else if(delta_y < 0)
piping_layer = max(PIPING_LAYER_MIN, piping_layer - 1)
else
return
to_chat(source, "<span class='notice'>You set the layer to [piping_layer].</span>")
#undef ATMOS_CATEGORY
#undef DISPOSALS_CATEGORY
#undef TRANSIT_CATEGORY