Fixes RCD giving no user feedback when out of ammo

RCD will now give a low ammo error for what you are trying to build / destroy. Additionally gives errors when trying to build airlocks or windows over space tiles otherwise it would give a low ammo error when trying to do so.
This commit is contained in:
AzuleUtama
2018-11-06 19:38:34 +00:00
parent e8538d1eab
commit 429df67dd2
+52 -21
View File
@@ -255,7 +255,10 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
var/turf/AT = get_turf(A)
AT.ChangeTurf(/turf/simulated/floor/plating)
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to construct this floor!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
if(isfloorturf(A))
if(checkResource(3, user))
@@ -268,28 +271,39 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/wall)
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to construct this wall!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
return FALSE
/obj/item/rcd/proc/mode_airlock(atom/A, mob/user)
if(isfloorturf(A) && checkResource(10, user))
to_chat(user, "Building Airlock...")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 50 * toolspeed, target = A))
if(locate(/obj/machinery/door/airlock) in A.contents)
if(isfloorturf(A))
if(checkResource(10, user))
to_chat(user, "Building Airlock...")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 50 * toolspeed, target = A))
if(locate(/obj/machinery/door/airlock) in A.contents)
return FALSE
if(!useResource(10, user))
return FALSE
playsound(loc, usesound, 50, 1)
var/obj/machinery/door/airlock/T = new door_type(A)
T.name = door_name
T.autoclose = TRUE
if(one_access)
T.req_one_access = door_accesses.Copy()
else
T.req_access = door_accesses.Copy()
return FALSE
if(!useResource(10, user))
return FALSE
playsound(loc, usesound, 50, 1)
var/obj/machinery/door/airlock/T = new door_type(A)
T.name = door_name
T.autoclose = TRUE
if(one_access)
T.req_one_access = door_accesses.Copy()
else
T.req_access = door_accesses.Copy()
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to construct this airlock!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! No stable floor detected for airlock construction!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
/obj/item/rcd/proc/mode_decon(atom/A, mob/user)
if(iswallturf(A))
@@ -305,7 +319,10 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/floor/plating)
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to deconstruct this wall!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
if(isfloorturf(A))
if(checkResource(5, user))
@@ -318,7 +335,10 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
var/turf/AT = A
AT.ChangeTurf(/turf/space)
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to deconstruct this floor!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
if(istype(A, /obj/machinery/door/airlock))
if(checkResource(20, user))
@@ -330,12 +350,17 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
playsound(loc, usesound, 50, 1)
qdel(A)
return TRUE
return FALSE
else
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to deconstruct this airlock!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return FALSE
if(istype(A, /obj/structure/window)) // You mean the grille of course, do you?
A = locate(/obj/structure/grille) in A.loc
if(istype(A, /obj/structure/grille))
if(!checkResource(2, user))
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to deconstruct this window!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return 0
to_chat(user, "Deconstructing window...")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
@@ -367,6 +392,8 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
if(locate(/obj/structure/grille) in A)
return 0 // We already have window
if(!checkResource(2, user))
to_chat(user, "<span class='warning'>ERROR! Not enough matter in unit to construct this window!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return 0
to_chat(user, "Constructing window...")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
@@ -392,6 +419,10 @@ GLOBAL_LIST_INIT(rcd_door_types, list(
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/floor/plating) // Platings go under windows.
return 1
else
to_chat(user, "<span class='warning'>ERROR! No stable floor detected for window construction!</span>")
playsound(loc, 'sound/machines/click.ogg', 50, 1)
return 0
/obj/item/rcd/afterattack(atom/A, mob/user, proximity)
if(!proximity)