mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +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)
|
||||
|
||||
Reference in New Issue
Block a user