From dc6f794368ff4c130c2e05d931c691db788ec0e5 Mon Sep 17 00:00:00 2001 From: VelardAmakar Date: Sat, 5 Apr 2014 09:19:11 -0400 Subject: [PATCH] Adds the ability to construct, destroy, and take apart bookcases. Bookcases can be built using 5 wood planks. Bookcases can be destroyed using weapons(50HP). Bookcases can be taken apart using a wrench. --- .../items/stacks/sheets/sheet_types.dm | 3 ++- code/modules/library/lib_items.dm | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index de511f9fc89..d508a759a18 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -129,6 +129,7 @@ var/global/list/datum/stack_recipe/wood_recipes = list ( \ new/datum/stack_recipe("table parts", /obj/item/weapon/table_parts/wood, 2), \ new/datum/stack_recipe("wooden chair", /obj/structure/stool/bed/chair/wood/normal, 3, time = 10, one_per_turf = 1, on_floor = 1), \ new/datum/stack_recipe("wooden barricade", /obj/structure/barricade/wooden, 5, time = 50, one_per_turf = 1, on_floor = 1), \ + new/datum/stack_recipe("bookcase", /obj/structure/bookcase, 5, time = 50, one_per_turf = 1, on_floor = 1), \ new/datum/stack_recipe("wooden door", /obj/structure/mineral_door/wood, 10, time = 20, one_per_turf = 1, on_floor = 1), \ new/datum/stack_recipe("coffin", /obj/structure/closet/coffin, 5, time = 15, one_per_turf = 1, on_floor = 1), \ new/datum/stack_recipe("apiary", /obj/item/apiary, 10, time = 25, one_per_turf = 0, on_floor = 0), \ @@ -181,4 +182,4 @@ var/global/list/datum/stack_recipe/cardboard_recipes = list ( \ /obj/item/stack/sheet/cardboard/New(var/loc, var/amount=null) recipes = cardboard_recipes - return ..() \ No newline at end of file + return ..() diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index bb21795a55c..b9c95fc6486 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -18,6 +18,7 @@ anchored = 1 density = 1 opacity = 1 + var/health = 50 /obj/structure/bookcase/initialize() for(var/obj/item/I in loc) @@ -30,6 +31,18 @@ user.drop_item() O.loc = src update_icon() + else if(istype(O, /obj/item/weapon/wrench)) + user << "\blue Now disassembling bookcase" + playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1) + if(do_after(user,50)) + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + density = 0 + qdel(src) + return else if(istype(O, /obj/item/weapon/pen)) var/newname = stripped_input(usr, "What would you like to title this bookshelf?") if(!newname) @@ -37,6 +50,18 @@ else name = ("bookcase ([sanitize(newname)])") else + switch(O.damtype) + if("fire") + src.health -= O.force * 1 + if("brute") + src.health -= O.force * 0.75 + else + if (src.health <= 0) + visible_message("The bookcase is smashed apart!") + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + new /obj/item/stack/sheet/wood(get_turf(src)) + qdel(src) ..() /obj/structure/bookcase/attack_hand(var/mob/user as mob)