diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index c8e76fa8ac9..2462c13c2a7 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -485,6 +485,12 @@ icon_state = "wood_tableparts" flags = null +/obj/item/weapon/table_parts/glass + name = "glass table parts" + desc = "fragile!" + icon_state = "glass_tableparts" + flags = null + /obj/item/weapon/wire desc = "This is just a simple piece of regular insulated wire." name = "wire" diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 69ab0899003..72aa63abf2e 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -28,6 +28,7 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \ ), 2), \ null, \ new/datum/stack_recipe("table parts", /obj/item/weapon/table_parts, 2), \ + new/datum/stack_recipe("glass table frame parts", /obj/item/weapon/table_parts/glass, 2), \ new/datum/stack_recipe("rack parts", /obj/item/weapon/rack_parts), \ new/datum/stack_recipe("closet", /obj/structure/closet, 2, time = 15, one_per_turf = 1, on_floor = 1), \ null, \ diff --git a/code/game/objects/items/weapons/table_rack_parts.dm b/code/game/objects/items/weapons/table_rack_parts.dm index 2c2b44ae387..03a07d4a2d1 100644 --- a/code/game/objects/items/weapons/table_rack_parts.dm +++ b/code/game/objects/items/weapons/table_rack_parts.dm @@ -62,6 +62,21 @@ del(src) return +/* + * Glass Table Parts + */ +/obj/item/weapon/table_parts/glass/attackby(obj/item/weapon/W as obj, mob/user as mob, params) + if (istype(W, /obj/item/weapon/wrench)) + new /obj/item/stack/sheet/metal( user.loc ) + new /obj/item/stack/sheet/metal( user.loc ) + del(src) + +/obj/item/weapon/table_parts/glass/attack_self(mob/user as mob) + new /obj/structure/glasstable_frame( user.loc ) + user.drop_item() + del(src) + return + /* * Rack Parts */ diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 46558088bc8..0e9e4c5df39 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -237,6 +237,22 @@ icon_state = "wood_tabledir2" if(6) icon_state = "wood_tabledir3" + else if(istype(src,/obj/structure/table/glass)) + switch(table_type) + if(0) + icon_state = "glass_table" + if(1) + icon_state = "glass_table_1tileendtable" + if(2) + icon_state = "glass_table_1tilethick" + if(3) + icon_state = "glass_table_dir" + if(4) + icon_state = "glass_table_middle" + if(5) + icon_state = "glass_tabledir2" + if(6) + icon_state = "glass_tabledir3" else switch(table_type) if(0) @@ -668,6 +684,109 @@ return 1 +/obj/structure/glasstable_frame + name = "glass table frame" + desc = "A metal frame for a glass table." + icon = 'icons/obj/structures.dmi' + icon_state = "glass_table_frame" + density = 1 + +/obj/structure/glasstable_frame/attackby(obj/item/I as obj, mob/user as mob, params) + if(istype(I, /obj/item/stack/sheet/glass)) + var/obj/item/stack/sheet/glass/G = I + if(G.amount >= 2) + user << "You start to add the glass to \the [src]." + if(do_after(user, 10)) + G.use(2) + user << "You add the glass to \the [src]." + playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1) + new /obj/structure/table/glass(loc) + del(src) + else + user << "You don't have enough glass! You need at least 2 sheets." + return + + if(iswrench(I)) + user << "You start to deconstruct \the [src]." + playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) + if(do_after(user, 10)) + playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1) + user << "You dismantle \the [src]." + new /obj/item/stack/sheet/metal(loc) + new /obj/item/stack/sheet/metal(loc) + del(src) + +/obj/structure/table/glass + name = "glass table" + desc = "Looks fragile. You should totally flip it. It's begging you too." + icon_state = "glass_table" + parts = /obj/item/weapon/table_parts/glass + health = 10 + +/obj/structure/table/glass/flip(var/direction) + src.visible_message("\The [src] shatters, and the frame collapses!") + new /obj/item/weapon/table_parts/glass(loc) + getFromPool(/obj/item/weapon/shard, loc) + if(prob(50)) //50% chance to spawn two shards + getFromPool(/obj/item/weapon/shard, loc) + qdel(src) + +/obj/structure/table/glass/attackby(obj/item/I as obj, mob/user as mob, params) + + if (istype(I, /obj/item/weapon/grab)) + var/obj/item/weapon/grab/G = I + if(G.affecting.buckled) + user << "[G.affecting] is buckled to [G.affecting.buckled]!" + return + if(G.state < GRAB_AGGRESSIVE) + user << "You need a better grip to do that!" + return + if(!G.confirm()) + return + G.affecting.loc = src.loc + G.affecting.Weaken(5) + visible_message("\red [G.assailant] puts [G.affecting] on the table.") + del(I) + return + + if (istype(I, /obj/item/weapon/wrench)) + user << "\blue Now disassembling the glass table" + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + sleep(50) + new /obj/item/weapon/table_parts/glass( src.loc ) + new /obj/item/stack/sheet/glass( src.loc ) + playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) + del(src) + return + + if(isrobot(user)) + return + if(istype(I, /obj/item/weapon/melee/energy/blade)) + var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread() + spark_system.set_up(5, 0, src.loc) + spark_system.start() + playsound(src.loc, 'sound/weapons/blade1.ogg', 50, 1) + playsound(src.loc, "sparks", 50, 1) + for(var/mob/O in viewers(user, 4)) + O.show_message("\blue The wooden table was sliced apart by [user]!", 1, "\red You hear glass being sliced apart.", 2) + new /obj/item/weapon/table_parts/glass( src.loc ) + new /obj/item/stack/sheet/glass( src.loc ) + del(src) + return + + if(!(I.flags & ABSTRACT)) + if(user.drop_item()) + I.Move(loc) + var/list/click_params = params2list(params) + //Center the icon where the user clicked. + if(!click_params || !click_params["icon-x"] || !click_params["icon-y"]) + return + //Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf) + I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2) + I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2) + + return 1 + /* * Reinforced tables diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 18b76b54558..6025a1d5cdb 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ diff --git a/icons/obj/structures.dmi b/icons/obj/structures.dmi index b78df26501f..1efc3af47a8 100644 Binary files a/icons/obj/structures.dmi and b/icons/obj/structures.dmi differ