Merge pull request #10050 from Ghommie/Ghommie-cit427
Adds view and viewers checks for ranged construction devices such as ARCD and RLD.
This commit is contained in:
@@ -133,15 +133,14 @@ RLD
|
||||
if(!(A in range(custom_range, get_turf(user))))
|
||||
to_chat(user, "<span class='warning'>The \'Out of Range\' light on [src] blinks red.</span>")
|
||||
return FALSE
|
||||
else
|
||||
return TRUE
|
||||
|
||||
/obj/item/construction/proc/prox_check(proximity)
|
||||
if(proximity)
|
||||
return TRUE
|
||||
else
|
||||
var/view_range = user.client ? user.client.view : world.view
|
||||
//if user can't be seen from A (only checks surroundings' opaqueness) and can't see A.
|
||||
//jarring, but it should stop people from targetting atoms they can't see...
|
||||
//excluding darkness, to allow RLD to be used to light pitch black dark areas.
|
||||
if(!((user in view(view_range, A)) || (user in viewers(view_range, A))))
|
||||
to_chat(user, "<span class='warning'>You focus, pointing \the [src] at whatever outside your field of vision in the given direction... to no avail.</span>")
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/construction/rcd
|
||||
name = "rapid-construction-device (RCD)"
|
||||
@@ -523,7 +522,12 @@ RLD
|
||||
|
||||
/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
|
||||
rcd_create(A, user)
|
||||
|
||||
@@ -635,6 +639,7 @@ RLD
|
||||
max_matter = INFINITY
|
||||
matter = INFINITY
|
||||
upgrade = TRUE
|
||||
ranged = TRUE
|
||||
|
||||
// Ranged RCD
|
||||
|
||||
@@ -650,20 +655,10 @@ RLD
|
||||
item_state = "oldrcd"
|
||||
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
|
||||
|
||||
|
||||
|
||||
/obj/item/construction/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."
|
||||
|
||||
Reference in New Issue
Block a user