mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
Adds view and viewers checks for ranged construction devices such as ARCD and RLD.
This commit is contained in:
@@ -130,19 +130,12 @@ RLD
|
|||||||
return .
|
return .
|
||||||
|
|
||||||
/obj/item/construction/proc/range_check(atom/A, mob/user)
|
/obj/item/construction/proc/range_check(atom/A, mob/user)
|
||||||
if(!(A in range(custom_range, get_turf(user))))
|
if(!(A in range(custom_range, get_turf(user))) || !((A in view(user.client.view, user)) || (user in viewers(user.client.view, A))))
|
||||||
to_chat(user, "<span class='warning'>The \'Out of Range\' light on [src] blinks red.</span>")
|
to_chat(user, "<span class='warning'>The \'Out of Range\' light on [src] blinks red.</span>")
|
||||||
return FALSE
|
return FALSE
|
||||||
else
|
else
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/obj/item/construction/proc/prox_check(proximity)
|
|
||||||
if(proximity)
|
|
||||||
return TRUE
|
|
||||||
else
|
|
||||||
return FALSE
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/construction/rcd
|
/obj/item/construction/rcd
|
||||||
name = "rapid-construction-device (RCD)"
|
name = "rapid-construction-device (RCD)"
|
||||||
icon = 'icons/obj/tools.dmi'
|
icon = 'icons/obj/tools.dmi'
|
||||||
@@ -523,7 +516,12 @@ RLD
|
|||||||
|
|
||||||
/obj/item/construction/rcd/afterattack(atom/A, mob/user, proximity)
|
/obj/item/construction/rcd/afterattack(atom/A, mob/user, proximity)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!prox_check(proximity))
|
if(!proximity)
|
||||||
|
if(!ranged || !range_check(A,user)) //early return not-in-range sanity.
|
||||||
|
return
|
||||||
|
if(target_check(A,user))
|
||||||
|
user.Beam(A,icon_state="rped_upgrade",time=30)
|
||||||
|
rcd_create(A,user)
|
||||||
return
|
return
|
||||||
rcd_create(A, user)
|
rcd_create(A, user)
|
||||||
|
|
||||||
@@ -635,6 +633,7 @@ RLD
|
|||||||
max_matter = INFINITY
|
max_matter = INFINITY
|
||||||
matter = INFINITY
|
matter = INFINITY
|
||||||
upgrade = TRUE
|
upgrade = TRUE
|
||||||
|
ranged = TRUE
|
||||||
|
|
||||||
// Ranged RCD
|
// Ranged RCD
|
||||||
|
|
||||||
@@ -650,20 +649,10 @@ RLD
|
|||||||
item_state = "oldrcd"
|
item_state = "oldrcd"
|
||||||
has_ammobar = FALSE
|
has_ammobar = FALSE
|
||||||
|
|
||||||
/obj/item/construction/rcd/arcd/afterattack(atom/A, mob/user)
|
|
||||||
. = ..()
|
|
||||||
if(!range_check(A,user))
|
|
||||||
return
|
|
||||||
if(target_check(A,user))
|
|
||||||
user.Beam(A,icon_state="rped_upgrade",time=30)
|
|
||||||
rcd_create(A,user)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// RAPID LIGHTING DEVICE
|
// RAPID LIGHTING DEVICE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/construction/rld
|
/obj/item/construction/rld
|
||||||
name = "rapid-light-device (RLD)"
|
name = "rapid-light-device (RLD)"
|
||||||
desc = "A device used to rapidly provide lighting sources to an area. Reload with metal, plasteel, glass or compressed matter cartridges."
|
desc = "A device used to rapidly provide lighting sources to an area. Reload with metal, plasteel, glass or compressed matter cartridges."
|
||||||
|
|||||||
Reference in New Issue
Block a user