mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
BRPD Auto-wrenching (#26855)
* Modified the RPD auto-wrenching behaviour * Removed tool requirement for auto-wrenching * Allowed the BRPD to auto-wrench remotely * Added a TGUI toggle for auto-wrenching * Added a Line of Sight check for the BRPD * Readded missing UI buttons * Tweaked disposals construction * Disposals objects can't be anchored if there's floor tiles * Bins, chutes and outlets now need a constructed trunk to be anchored. * Changed LoS check, added sounds, stopped station auto-wrench. * Final touches for the RPD * Added sounds when wrenching occurs * tgui bundle * Consolidated all RPD related sounds to the RPD code * removed some redundant things I forgot about * tguibundle * span classes and tgui bundle * Applying lewcc's suggestion Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Toastical <vnndvp@gmail.com> * applying lewcc's 2nd suggestion Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Toastical <vnndvp@gmail.com> * Applying contrabang's suggestions + added marks in pipe.dm * typos n stuff * tgui bundle * Update code/modules/recycling/disposal-construction.dm Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Signed-off-by: Toastical <vnndvp@gmail.com> Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
var/ranged = FALSE
|
||||
var/primary_sound = 'sound/machines/click.ogg'
|
||||
var/alt_sound = null
|
||||
var/auto_wrench_toggle = TRUE
|
||||
|
||||
//Lists of things
|
||||
var/list/mainmenu = list(
|
||||
@@ -114,8 +115,7 @@
|
||||
else if(!iconrotation) //If user selected a rotation
|
||||
P.dir = user.dir
|
||||
to_chat(user, "<span class='notice'>[src] rapidly dispenses [P]!</span>")
|
||||
if(istype(user.get_inactive_hand(), /obj/item/wrench) && (user.can_reach(P, user.get_inactive_hand())))
|
||||
P.wrench_act(user, user.get_inactive_hand())
|
||||
automatic_wrench_down(user, P)
|
||||
activate_rpd(TRUE)
|
||||
|
||||
/obj/item/rpd/proc/create_disposals_pipe(mob/user, turf/T) //Make a disposals pipe / construct
|
||||
@@ -127,8 +127,7 @@
|
||||
if(!iconrotation && whatdpipe != PIPE_DISPOSALS_JUNCTION_RIGHT) //Disposals pipes are in the opposite direction to atmos pipes, so we need to flip them. Junctions don't have this quirk though
|
||||
P.flip()
|
||||
to_chat(user, "<span class='notice'>[src] rapidly dispenses [P]!</span>")
|
||||
if(istype(user.get_inactive_hand(), /obj/item/wrench) && (user.can_reach(P, user.get_inactive_hand())))
|
||||
P.attackby(user.get_inactive_hand(), user)
|
||||
automatic_wrench_down(user, P)
|
||||
activate_rpd(TRUE)
|
||||
|
||||
/obj/item/rpd/proc/create_transit_tube(mob/user, turf/dest)
|
||||
@@ -144,8 +143,7 @@
|
||||
S.dir = iconrotation ? iconrotation : user.dir
|
||||
|
||||
to_chat(user, "<span class='notice'>[src] rapidly dispenses [S]!</span>")
|
||||
if(istype(user.get_inactive_hand(), /obj/item/wrench) && (user.can_reach(S, user.get_inactive_hand())))
|
||||
S.wrench_act(user, user.get_inactive_hand())
|
||||
automatic_wrench_down(user, S)
|
||||
activate_rpd(TRUE)
|
||||
|
||||
/obj/item/rpd/proc/rotate_all_pipes(mob/user, turf/T) //Rotate all pipes on a turf
|
||||
@@ -195,6 +193,22 @@
|
||||
QDEL_NULL(P)
|
||||
activate_rpd()
|
||||
|
||||
/**
|
||||
* Automatically wrenches down an atmos device/pipe if the auto_wrench_toggle is TRUE.
|
||||
* Arguments:
|
||||
* * user - the user of the RPD.
|
||||
* * target - the pipe/device/tube being placed by the RPD.
|
||||
*/
|
||||
/obj/item/rpd/proc/automatic_wrench_down(mob/living/user, obj/item/target)
|
||||
if(!auto_wrench_toggle)
|
||||
return
|
||||
if(mode == RPD_TRANSIT_MODE)
|
||||
if(target.screwdriver_act(user, src) & RPD_TOOL_SUCCESS)
|
||||
playsound(src, 'sound/items/impactwrench.ogg', 50, TRUE)
|
||||
return
|
||||
if(target.wrench_act(user, src) & RPD_TOOL_SUCCESS)
|
||||
playsound(src, 'sound/items/impactwrench.ogg', 50, TRUE)
|
||||
return
|
||||
// TGUI stuff
|
||||
|
||||
/obj/item/rpd/attack_self(mob/user)
|
||||
@@ -228,6 +242,7 @@
|
||||
data["whatdpipe"] = whatdpipe
|
||||
data["whatpipe"] = whatpipe
|
||||
data["whatttube"] = whatttube
|
||||
data["auto_wrench_toggle"] = auto_wrench_toggle
|
||||
return data
|
||||
|
||||
/obj/item/rpd/ui_act(action, list/params)
|
||||
@@ -249,6 +264,8 @@
|
||||
pipe_category = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("mode")
|
||||
mode = isnum(params[action]) ? params[action] : text2num(params[action])
|
||||
if("auto_wrench_toggle")
|
||||
auto_wrench_toggle = !auto_wrench_toggle
|
||||
|
||||
//RPD radial menu
|
||||
/obj/item/rpd/proc/check_menu(mob/living/user)
|
||||
@@ -325,14 +342,17 @@
|
||||
|
||||
// If we get here, then we're effectively acting on the turf, probably placing a pipe.
|
||||
if(ranged) //woosh beam if bluespaced at a distance
|
||||
if(get_dist(src, T) <= (user.client.maxview() + 2))\
|
||||
user.Beam(T, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 5)
|
||||
else
|
||||
if(get_dist(src, T) >= (user.client.maxview() + 2))
|
||||
message_admins("\[EXPLOIT] [key_name_admin(user)] attempted to place pipes with a BRPD via a camera console. (Attempted range exploit)")
|
||||
playsound(src, 'sound/machines/synth_no.ogg', 15, TRUE)
|
||||
to_chat(user, "<span class='notice'>ERROR: \The [T] is out of [src]'s range!</span>")
|
||||
return
|
||||
|
||||
if(!(user in viewers(12, T))) // Checks if the user can see the target turf
|
||||
to_chat(user, "<span class='warning'>[src] needs full visibility to determine the dispensing location.</span>")
|
||||
playsound(src, 'sound/machines/synth_no.ogg', 50, TRUE)
|
||||
return
|
||||
user.Beam(T, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 0.5 SECONDS)
|
||||
T.rpd_act(user, src)
|
||||
|
||||
/obj/item/rpd/attack_obj(obj/O, mob/living/user)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
var/installed_type = null
|
||||
var/installed_type_flipped = null
|
||||
var/flipped = FALSE
|
||||
var/is_station = FALSE
|
||||
|
||||
/obj/structure/transit_tube_construction/proc/rotate()
|
||||
setDir(turn(dir, -90))
|
||||
@@ -43,20 +44,25 @@
|
||||
. = TRUE
|
||||
var/turf/T = get_turf(src)
|
||||
if(!isfloorturf(T) && !isspaceturf(T))
|
||||
to_chat(user, "<span class='notice'>You cannot install [src] here.</span>")
|
||||
to_chat(user, "<span class='warning'>You cannot install [src] here.</span>")
|
||||
return
|
||||
for(var/obj/turf_contents in T)
|
||||
// It's okay for tube parts to be installed over existing pods.
|
||||
if(!istype(turf_contents, /obj/structure/transit_tube_pod) && turf_contents.density)
|
||||
to_chat(user, "<span class='notice'>There is not enough space to install [src] here.</span>")
|
||||
to_chat(user, "<span class='warning'>There is not enough space to install [src] here.</span>")
|
||||
return
|
||||
if(is_station && !user.can_reach(src))
|
||||
to_chat(user, "<span class='warning'>[src] must be installed manually.</span>")
|
||||
return
|
||||
|
||||
var/install_type = flipped ? installed_type_flipped : installed_type
|
||||
var/atom/installed = new install_type(T)
|
||||
installed.dir = dir
|
||||
user.visible_message("<span class='notice'>[user] installs [src].</span>")
|
||||
|
||||
I.play_tool_sound(src, I.tool_volume)
|
||||
qdel(src)
|
||||
. |= RPD_TOOL_SUCCESS
|
||||
|
||||
/obj/structure/transit_tube_construction/wrench_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
@@ -93,7 +99,7 @@
|
||||
|
||||
qdel(src)
|
||||
|
||||
to_chat(user, "<span class='notice'>[src] can only be installed in a transit tube!</span>")
|
||||
to_chat(user, "<span class='warning'>[src] can only be installed in a transit tube!</span>")
|
||||
|
||||
/obj/structure/transit_tube_construction/straight
|
||||
installed_type = /obj/structure/transit_tube
|
||||
@@ -121,14 +127,17 @@
|
||||
installed_type = /obj/structure/transit_tube/station
|
||||
base_icon_state = "transit_station"
|
||||
icon_state = "transit_station"
|
||||
is_station = TRUE
|
||||
|
||||
/obj/structure/transit_tube_construction/terminus/dispenser
|
||||
installed_type = /obj/structure/transit_tube/station/dispenser/reverse
|
||||
installed_type_flipped = /obj/structure/transit_tube/station/dispenser/reverse/flipped
|
||||
base_icon_state = "transit_dispenser_terminus"
|
||||
icon_state = "transit_dispenser_terminus"
|
||||
is_station = TRUE
|
||||
|
||||
/obj/structure/transit_tube_construction/station/dispenser
|
||||
installed_type = /obj/structure/transit_tube/station/dispenser
|
||||
base_icon_state = "transit_dispenser_station"
|
||||
icon_state = "transit_dispenser_station"
|
||||
is_station = TRUE
|
||||
|
||||
Reference in New Issue
Block a user