diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index a624c5c9431..7cfed545f93 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -688,31 +688,29 @@ Congratulations! You are now trained for invasive xenobiology research!"} framestack = /obj/item/stack/sheet/mineral/abductor framestackamount = 1 density = TRUE + anchored = TRUE + resistance_flags = FIRE_PROOF | ACID_PROOF -/obj/structure/table_frame/abductor/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stack/sheet/mineral/abductor)) - var/obj/item/stack/sheet/P = I - if(P.get_amount() < 1) - to_chat(user, "You need one alien alloy sheet to do this!") - return - to_chat(user, "You start adding [P] to [src]...") - if(do_after(user, 50, target = src)) - P.use(1) - new /obj/structure/table/abductor(loc) - qdel(src) - return - if(istype(I, /obj/item/stack/sheet/mineral/silver)) - var/obj/item/stack/sheet/P = I - if(P.get_amount() < 1) - to_chat(user, "You need one sheet of silver to do this!") - return - to_chat(user, "You start adding [P] to [src]...") - if(do_after(user, 50, target = src)) - P.use(1) - new /obj/machinery/optable/abductor(loc) - qdel(src) - return - return ..() +/obj/structure/table_frame/abductor/try_make_table(obj/item/stack/stack, mob/user) + if(!istype(stack, /obj/item/stack/sheet/mineral/abductor) && !istype(stack, /obj/item/stack/sheet/mineral/silver)) + return FALSE + + if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier + to_chat(user, "You need at least one sheet of [stack] to do this!") + return TRUE + + to_chat(user, "You start adding [stack] to [src]...") + + if(!(do_after(user, 50, target = src) && stack.use(1))) + return TRUE + + if(istype(stack, /obj/item/stack/sheet/mineral/abductor)) //if it's not this then it's silver, so no need for an else afterwards + make_new_table(stack.table_type) + return TRUE + + new /obj/machinery/optable/abductor(loc) + qdel(src) + return TRUE /obj/structure/table/abductor name = "alien table" diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 06ce0bbc1a1..63a18fbd094 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -37,6 +37,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( full_window = /obj/structure/window/full/basic merge_type = /obj/item/stack/sheet/glass point_value = 1 + table_type = /obj/structure/table/glass /obj/item/stack/sheet/glass/detailed_examine() return "Use in your hand to build a window. Can be upgraded to reinforced glass by adding metal rods, which are made from metal sheets." @@ -110,6 +111,7 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( full_window = /obj/structure/window/full/reinforced merge_type = /obj/item/stack/sheet/rglass point_value = 4 + table_type = /obj/structure/table/glass/reinforced /obj/item/stack/sheet/rglass/New(loc, amount) recipes = GLOB.reinforced_glass_recipes @@ -145,6 +147,7 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( created_window = /obj/structure/window/plasmabasic full_window = /obj/structure/window/full/plasmabasic point_value = 19 + table_type = /obj/structure/table/glass/plasma /obj/item/stack/sheet/plasmaglass/New(loc, amount) recipes = GLOB.pglass_recipes @@ -188,6 +191,7 @@ GLOBAL_LIST_INIT(prglass_recipes, list ( created_window = /obj/structure/window/plasmareinforced full_window = /obj/structure/window/full/plasmareinforced point_value = 23 + table_type = /obj/structure/table/glass/reinforced/plasma /obj/item/stack/sheet/plasmarglass/New(loc, amount) recipes = GLOB.prglass_recipes @@ -208,6 +212,7 @@ GLOBAL_LIST_INIT(titaniumglass_recipes, list( resistance_flags = ACID_PROOF merge_type = /obj/item/stack/sheet/titaniumglass full_window = /obj/structure/window/full/shuttle + table_type = /obj/structure/table/glass/reinforced/titanium /obj/item/stack/sheet/titaniumglass/New(loc, amount) recipes = GLOB.titaniumglass_recipes @@ -228,6 +233,7 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list( resistance_flags = ACID_PROOF merge_type = /obj/item/stack/sheet/plastitaniumglass full_window = /obj/structure/window/full/plastitanium + table_type = /obj/structure/table/glass/reinforced/plastitanium /obj/item/stack/sheet/plastitaniumglass/New(loc, amount) recipes = GLOB.plastitaniumglass_recipes diff --git a/code/game/objects/items/stacks/sheets/mineral.dm b/code/game/objects/items/stacks/sheets/mineral.dm index aa6fb7337f2..6157c71ab75 100644 --- a/code/game/objects/items/stacks/sheets/mineral.dm +++ b/code/game/objects/items/stacks/sheets/mineral.dm @@ -418,6 +418,7 @@ GLOBAL_LIST_INIT(plastitanium_recipes, list( throw_speed = 1 origin_tech = "materials=6;abductor=1" sheettype = "abductor" + table_type = /obj/structure/table/abductor /obj/item/stack/sheet/mineral/abductor/fifty amount = 50 diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 9478a3c41bd..630e474c861 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -126,6 +126,7 @@ GLOBAL_LIST_INIT(metal_recipes, list( origin_tech = "materials=1" merge_type = /obj/item/stack/sheet/metal point_value = 2 + table_type = /obj/structure/table /obj/item/stack/sheet/metal/cyborg energy_type = /datum/robot_energy_storage/metal @@ -177,6 +178,7 @@ GLOBAL_LIST_INIT(plasteel_recipes, list( origin_tech = "materials=2" merge_type = /obj/item/stack/sheet/plasteel point_value = 23 + table_type = /obj/structure/table/reinforced /obj/item/stack/sheet/plasteel/New(loc, amount=null) recipes = GLOB.plasteel_recipes @@ -243,6 +245,7 @@ GLOBAL_LIST_INIT(wood_recipes, list( armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 0) merge_type = /obj/item/stack/sheet/wood sheettype = "wood" + table_type = /obj/structure/table/wood /obj/item/stack/sheet/wood/New(loc, amount=null) recipes = GLOB.wood_recipes @@ -497,6 +500,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( throw_speed = 1 throw_range = 3 turf_type = /turf/simulated/floor/clockwork + table_type = /obj/structure/table/reinforced/brass /obj/item/stack/tile/brass/narsie_act() new /obj/item/stack/sheet/runed_metal(loc, amount) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 478215f39b1..6b8918813ac 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -27,6 +27,8 @@ var/merge_type = null // This path and its children should merge with this stack, defaults to src.type var/recipe_width = 400 //Width of the recipe popup var/recipe_height = 400 //Height of the recipe popup + /// What sort of table is made when applying this stack to a frame? + var/table_type /obj/item/stack/New(loc, new_amount, merge = TRUE) ..() diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index 4ccd5e90e4a..663610c8225 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -76,7 +76,7 @@ icon_state = "tile-carpet" turf_type = /turf/simulated/floor/carpet resistance_flags = FLAMMABLE - var/fancy_table_type = /obj/structure/table/wood/fancy //Decides what table will be built with what carpet tile + table_type = /obj/structure/table/wood/fancy //Decides what table will be built with what carpet tile /obj/item/stack/tile/carpet/twenty amount = 20 @@ -85,7 +85,7 @@ name = "black carpet" icon_state = "tile-carpet-black" turf_type = /turf/simulated/floor/carpet/black - fancy_table_type = /obj/structure/table/wood/fancy/black + table_type = /obj/structure/table/wood/fancy/black /obj/item/stack/tile/carpet/black/twenty amount = 20 @@ -94,7 +94,7 @@ name = "blue carpet" icon_state = "tile-carpet-blue" turf_type = /turf/simulated/floor/carpet/blue - fancy_table_type = /obj/structure/table/wood/fancy/blue + table_type = /obj/structure/table/wood/fancy/blue /obj/item/stack/tile/carpet/blue/twenty amount = 20 @@ -103,7 +103,7 @@ name = "cyan carpet" icon_state = "tile-carpet-cyan" turf_type = /turf/simulated/floor/carpet/cyan - fancy_table_type = /obj/structure/table/wood/fancy/cyan + table_type = /obj/structure/table/wood/fancy/cyan /obj/item/stack/tile/carpet/cyan/twenty amount = 20 @@ -112,7 +112,7 @@ name = "green carpet" icon_state = "tile-carpet-green" turf_type = /turf/simulated/floor/carpet/green - fancy_table_type = /obj/structure/table/wood/fancy/green + table_type = /obj/structure/table/wood/fancy/green /obj/item/stack/tile/carpet/green/twenty amount = 20 @@ -121,7 +121,7 @@ name = "orange carpet" icon_state = "tile-carpet-orange" turf_type = /turf/simulated/floor/carpet/orange - fancy_table_type = /obj/structure/table/wood/fancy/orange + table_type = /obj/structure/table/wood/fancy/orange /obj/item/stack/tile/carpet/orange/twenty amount = 20 @@ -130,7 +130,7 @@ name = "purple carpet" icon_state = "tile-carpet-purple" turf_type = /turf/simulated/floor/carpet/purple - fancy_table_type = /obj/structure/table/wood/fancy/purple + table_type = /obj/structure/table/wood/fancy/purple /obj/item/stack/tile/carpet/purple/twenty amount = 20 @@ -139,7 +139,7 @@ name = "red carpet" icon_state = "tile-carpet-red" turf_type = /turf/simulated/floor/carpet/red - fancy_table_type = /obj/structure/table/wood/fancy/red + table_type = /obj/structure/table/wood/fancy/red /obj/item/stack/tile/carpet/red/twenty amount = 20 @@ -148,7 +148,7 @@ name = "royal black carpet" icon_state = "tile-carpet-royalblack" turf_type = /turf/simulated/floor/carpet/royalblack - fancy_table_type = /obj/structure/table/wood/fancy/royalblack + table_type = /obj/structure/table/wood/fancy/royalblack /obj/item/stack/tile/carpet/royalblack/ten amount = 10 @@ -159,7 +159,7 @@ name = "royal blue carpet" icon_state = "tile-carpet-royalblue" turf_type = /turf/simulated/floor/carpet/royalblue - fancy_table_type = /obj/structure/table/wood/fancy/royalblue + table_type = /obj/structure/table/wood/fancy/royalblue /obj/item/stack/tile/carpet/royalblue/ten amount = 10 diff --git a/code/game/objects/structures/table_frames.dm b/code/game/objects/structures/table_frames.dm index f7fd74d4b7a..cbba55e24ba 100644 --- a/code/game/objects/structures/table_frames.dm +++ b/code/game/objects/structures/table_frames.dm @@ -22,45 +22,27 @@ var/framestackamount = 2 /obj/structure/table_frame/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stack/sheet/plasteel)) - var/obj/item/stack/sheet/plasteel/P = I - if(P.get_amount() < 1) - to_chat(user, "You need one plasteel sheet to do this!") - return - to_chat(user, "You start adding [P] to [src]...") - if(do_after(user, 50, target = src) && P.use(1)) - make_new_table(/obj/structure/table/reinforced) - - else if(istype(I, /obj/item/stack/sheet/metal)) - var/obj/item/stack/sheet/metal/M = I - if(M.get_amount() < 1) - to_chat(user, "You need one metal sheet to do this!") - return - to_chat(user, "You start adding [M] to [src]...") - if(do_after(user, 20, target = src) && M.use(1)) - make_new_table(/obj/structure/table) - - else if(istype(I, /obj/item/stack/sheet/glass)) - var/obj/item/stack/sheet/glass/G = I - if(G.get_amount() < 1) - to_chat(user, "You need one glass sheet to do this!") - return - to_chat(user, "You start adding [G] to [src]...") - if(do_after(user, 20, target = src) && G.use(1)) - make_new_table(/obj/structure/table/glass) - - else if(istype(I, /obj/item/stack/tile/carpet)) - var/obj/item/stack/tile/carpet/C = I - if(C.get_amount() < 1) - to_chat(user, "You need one [C.name] sheet to do this!") - return - to_chat(user, "You start adding [C] to [src]...") - if(do_after(user, 20, target = src) && C.use(1)) - make_new_table(C.fancy_table_type) - - else + if(!try_make_table(I, user)) return ..() +///Try to make a table with the item used to attack. FALSE if you can't make a table and should attack. TRUE does not necessarily mean a table was made. +/obj/structure/table_frame/proc/try_make_table(obj/item/stack/stack, mob/user) + if(!stack?.table_type) + return FALSE + + if(stack.get_amount() < 1) + to_chat(user, "You need at least one sheet of [stack] to do this!") + return TRUE + + to_chat(user, "You start adding [stack] to [src]...") + + if(!(do_after(user, 50, target = src) && stack.use(1))) + return TRUE + + if(stack.table_type) + make_new_table(stack.table_type) + return TRUE + /obj/structure/table_frame/wrench_act(mob/user, obj/item/I) . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) @@ -99,46 +81,50 @@ framestackamount = 2 resistance_flags = FLAMMABLE -/obj/structure/table_frame/wood/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stack/sheet/wood)) - var/obj/item/stack/sheet/wood/W = I - if(W.get_amount() < 1) - to_chat(user, "You need one wood sheet to do this!") - return - to_chat(user, "You start adding [W] to [src]...") - if(do_after(user, 20, target = src) && W.use(1)) - make_new_table(/obj/structure/table/wood) - return - else if(istype(I, /obj/item/stack/tile/carpet)) - var/obj/item/stack/tile/carpet/C = I - if(C.get_amount() < 1) - to_chat(user, "You need one carpet sheet to do this!") - return - to_chat(user, "You start adding [C] to [src]...") - if(do_after(user, 20, target = src) && C.use(1)) - make_new_table(/obj/structure/table/wood/poker) - else - return ..() +/obj/structure/table_frame/wood/try_make_table(obj/item/stack/stack, mob/user) + if(!istype(stack, /obj/item/stack/tile/carpet) && !istype(stack, /obj/item/stack/sheet/wood)) + return FALSE + + if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier + to_chat(user, "You need at least one sheet of [stack] to do this!") + return TRUE + + to_chat(user, "You start adding [stack] to [src]...") + + if(!(do_after(user, 50, target = src) && stack.use(1))) + return TRUE + + if(istype(stack, /obj/item/stack/tile/carpet)) + make_new_table(/obj/structure/table/wood/poker) + return TRUE + + make_new_table(stack.table_type) + return TRUE /obj/structure/table_frame/brass name = "brass table frame" desc = "Four pieces of brass arranged in a square. It's slightly warm to the touch." icon_state = "brass_frame" resistance_flags = FIRE_PROOF | ACID_PROOF + density = TRUE + anchored = TRUE framestack = /obj/item/stack/tile/brass framestackamount = 1 -/obj/structure/table_frame/brass/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stack/tile/brass)) - var/obj/item/stack/tile/brass/W = I - if(W.get_amount() < 1) - to_chat(user, "You need one brass sheet to do this!") - return - to_chat(user, "You start adding [W] to [src]...") - if(do_after(user, 20, target = src) && W.use(1)) - make_new_table(/obj/structure/table/reinforced/brass) - else - return ..() +/obj/structure/table_frame/brass/try_make_table(obj/item/stack/stack, mob/user) + if(!istype(stack, /obj/item/stack/tile/brass)) + return FALSE + + if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier + to_chat(user, "You need at least one sheet of [stack] to do this!") + return TRUE + + to_chat(user, "You start adding [stack] to [src]...") + + if(do_after(user, 20, target = src) && stack.use(1)) + make_new_table(stack.table_type) + + return TRUE /obj/structure/table_frame/brass/narsie_act() ..()