Adds glass tables, glass table frames

This commit adds glass tables (credit to WalterJe of -tg-'s fourms for
the sprites) to the game. These can be constructed with two metal
sheets, and two glass sheets. Flipping the table causes it to shatter
and deconstruct itself. You can deconstruct the table at any stage
with a wrench.
This commit is contained in:
Tigercat2000
2015-04-13 06:29:05 -07:00
parent 24213e0596
commit acc3755a98
6 changed files with 141 additions and 0 deletions
@@ -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 << "<span class='notice'>You start to add the glass to \the [src].</span>"
if(do_after(user, 10))
G.use(2)
user << "<span class='notice'>You add the glass to \the [src].</span>"
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
new /obj/structure/table/glass(loc)
del(src)
else
user << "<span class='notice'>You don't have enough glass! You need at least 2 sheets.</span>"
return
if(iswrench(I))
user << "<span class='notice'>You start to deconstruct \the [src].</span>"
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
if(do_after(user, 10))
playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1)
user << "<span class='notice'>You dismantle \the [src].</span>"
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("<span class='warning'>\The [src] shatters, and the frame collapses!</span>")
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 << "<span class='notice'>[G.affecting] is buckled to [G.affecting.buckled]!</span>"
return
if(G.state < GRAB_AGGRESSIVE)
user << "<span class='notice'>You need a better grip to do that!</span>"
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