Merge pull request #6590 from Citadel-Station-13/upstream-merge-37494

[MIRROR] [s] Small tweaks and fixes a edgecase with machine construction
This commit is contained in:
LetterJay
2018-04-30 11:03:33 -05:00
committed by GitHub
4 changed files with 24 additions and 12 deletions
+20 -8
View File
@@ -227,26 +227,36 @@
else
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.title]!</span>")
return FALSE
if(R.window_checks && !valid_window_location(usr.loc, usr.dir))
var/turf/T = get_turf(usr)
if(R.window_checks && !valid_window_location(T, usr.dir))
to_chat(usr, "<span class='warning'>The [R.title] won't fit here!</span>")
return FALSE
if(R.one_per_turf && (locate(R.result_type) in usr.loc))
if(R.one_per_turf && (locate(R.result_type) in T))
to_chat(usr, "<span class='warning'>There is another [R.title] here!</span>")
return FALSE
if(R.on_floor && !isfloorturf(usr.loc))
to_chat(usr, "<span class='warning'>\The [R.title] must be constructed on the floor!</span>")
return FALSE
if(R.on_floor)
if(!isfloorturf(T))
to_chat(usr, "<span class='warning'>\The [R.title] must be constructed on the floor!</span>")
return FALSE
for(var/obj/AM in T)
if(istype(AM,/obj/structure/grille))
continue
if(istype(AM,/obj/structure/table))
continue
if(AM.density)
to_chat(usr, "<span class='warning'>Theres a [AM.name] here. You cant make a [R.title] here!</span>")
return FALSE
if(R.placement_checks)
switch(R.placement_checks)
if(STACK_CHECK_CARDINALS)
var/turf/step
for(var/direction in GLOB.cardinals)
step = get_step(usr, direction)
step = get_step(T, direction)
if(locate(R.result_type) in step)
to_chat(usr, "<span class='warning'>\The [R.title] must not be built directly adjacent to another!</span>")
return FALSE
if(STACK_CHECK_ADJACENT)
if(locate(R.result_type) in range(1, usr))
if(locate(R.result_type) in range(1, T))
to_chat(usr, "<span class='warning'>\The [R.title] must be constructed at least one tile away from others of its type!</span>")
return FALSE
return TRUE
@@ -395,7 +405,9 @@
var/window_checks = FALSE
var/placement_checks = FALSE
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = FALSE, on_floor = FALSE, window_checks = FALSE, placement_checks = FALSE)
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1,time = 0, one_per_turf = FALSE, on_floor = FALSE, window_checks = FALSE, placement_checks = FALSE )
src.title = title
src.result_type = result_type
src.req_amount = req_amount