From 987cce76ed124fa54527e80d7160f0164b125f32 Mon Sep 17 00:00:00 2001 From: Jalleo Date: Mon, 30 Apr 2018 11:01:43 +0100 Subject: [PATCH 1/2] [s] Small tweaks and fixes a edgecase with machine construction (#37494) * Puts back required time for the emitter and field_generator and also removes a certain issue that certain people were causing * Couple of things I missed * I noticed the error with regards to atom and changed to obj like I was trying to originally. Also its fine to build on tables that wasnt the issue with this specific aspect. * Edge windows. We need those. * optimised the checks to be behind a if check for when you are actually needing to make something for the floor... * Corrects a input proc by request * Working is not my strong suit. --- code/game/objects/items/stacks/stack.dm | 28 +++++++++++++------ code/modules/power/singularity/collector.dm | 4 +-- code/modules/power/singularity/emitter.dm | 2 +- .../power/singularity/field_generator.dm | 2 +- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index b1afc7bd18..e67efb0c8a 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -227,26 +227,36 @@ else to_chat(usr, "You haven't got enough [src] to build \the [R.title]!") 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, "The [R.title] won't fit here!") 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, "There is another [R.title] here!") return FALSE - if(R.on_floor && !isfloorturf(usr.loc)) - to_chat(usr, "\The [R.title] must be constructed on the floor!") - return FALSE + if(R.on_floor) + if(!isfloorturf(T)) + to_chat(usr, "\The [R.title] must be constructed on the floor!") + 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, "Theres a [AM.name] here. You cant make a [R.title] here!") + 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, "\The [R.title] must not be built directly adjacent to another!") 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, "\The [R.title] must be constructed at least one tile away from others of its type!") 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 diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index f68b2c612c..15ae1748f0 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -113,7 +113,7 @@ if(loaded_tank) to_chat(user, "There's already a plasma tank loaded!") return TRUE - if(panel_open) + if(panel_open) to_chat(user, "Close the maintenance panel first!") return TRUE if(!user.transferItemToLoc(W, src)) @@ -134,7 +134,7 @@ return ..() /obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I) - default_unfasten_wrench(user, I, 0) + default_unfasten_wrench(user, I) return TRUE /obj/machinery/power/rad_collector/screwdriver_act(mob/living/user, obj/item/I) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index da2fc9dc94..3ca4c70199 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -229,7 +229,7 @@ state = EM_UNSECURED /obj/machinery/power/emitter/wrench_act(mob/living/user, obj/item/I) - default_unfasten_wrench(user, I, 0) + default_unfasten_wrench(user, I) return TRUE /obj/machinery/power/emitter/welder_act(mob/living/user, obj/item/I) diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 5c93d3a7e8..3ea81568a7 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -106,7 +106,7 @@ field_generator power level display state = FG_UNSECURED /obj/machinery/field/generator/wrench_act(mob/living/user, obj/item/I) - default_unfasten_wrench(user, I, 0) + default_unfasten_wrench(user, I) return TRUE /obj/machinery/field/generator/welder_act(mob/living/user, obj/item/I)