removes table parts, adds table frames

table/woodentable -> table/wood
tables are built by applying stacks to table frames
altered table construction
cleaned the code and increased obj_integrity of some tables and racks
lowercased 'carpet'
This commit is contained in:
uraniummeltdown
2018-01-12 23:22:55 +05:00
parent c2c7d50c7e
commit 7f4c9263ce
60 changed files with 972 additions and 918 deletions
@@ -0,0 +1,120 @@
/* Table Frames
* Contains:
* Frames
* Wooden Frames
*/
/*
* Normal Frames
*/
/obj/structure/table_frame
name = "table frame"
desc = "Four metal legs with four framing rods for a table. You could easily pass through this."
icon = 'icons/obj/structures.dmi'
icon_state = "table_frame"
density = FALSE
anchored = FALSE
layer = PROJECTILE_HIT_THRESHHOLD_LAYER
max_integrity = 100
var/framestack = /obj/item/stack/rods
var/framestackamount = 2
/obj/structure/table_frame/attackby(obj/item/I, mob/user, params)
if(iswrench(I))
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
playsound(loc, I.usesound, 50, 1)
if(do_after(user, 30*I.toolspeed, target = src))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
deconstruct(TRUE)
else if(istype(I, /obj/item/stack/sheet/plasteel))
var/obj/item/stack/sheet/plasteel/P = I
if(P.get_amount() < 1)
to_chat(user, "<span class='warning'>You need one plasteel sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [P] to [src]...</span>")
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, "<span class='warning'>You need one metal sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [M] to [src]...</span>")
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, "<span class='warning'>You need one glass sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [G] to [src]...</span>")
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/black))
var/obj/item/stack/tile/carpet/black/C = I
if(C.get_amount() < 1)
to_chat(user, "<span class='warning'>You need one black carpet sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [C] to [src]...</span>")
if(do_after(user, 20, target = src) && C.use(1))
make_new_table(/obj/structure/table/wood/fancy/black)
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, "<span class='warning'>You need one carpet sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [C] to [src]...</span>")
if(do_after(user, 20, target = src) && C.use(1))
make_new_table(/obj/structure/table/wood/fancy)
else
return ..()
/obj/structure/table_frame/proc/make_new_table(table_type) //makes sure the new table made retains what we had as a frame
var/obj/structure/table/T = new table_type(loc)
T.frame = type
T.framestack = framestack
T.framestackamount = framestackamount
qdel(src)
/obj/structure/table_frame/deconstruct(disassembled = TRUE)
new framestack(get_turf(src), framestackamount)
qdel(src)
/obj/structure/table_frame/narsie_act()
new /obj/structure/table_frame/wood(loc)
qdel(src)
/*
* Wooden Frames
*/
/obj/structure/table_frame/wood
name = "wooden table frame"
desc = "Four wooden legs with four framing wooden rods for a wooden table. You could easily pass through this."
icon_state = "wood_frame"
framestack = /obj/item/stack/sheet/wood
framestackamount = 2
burn_state = 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, "<span class='warning'>You need one wood sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [W] to [src]...</span>")
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, "<span class='warning'>You need one carpet sheet to do this!</span>")
return
to_chat(user, "<span class='notice'>You start adding [C] to [src]...</span>")
if(do_after(user, 20, target = src) && C.use(1))
make_new_table(/obj/structure/table/wood/poker)
else
return ..()
+294 -224
View File
@@ -1,49 +1,51 @@
/* Tables and Racks
* Contains:
* Tables
* Wooden tables
* Reinforced tables
* Glass Tables
* Wooden Tables
* Reinforced Tables
* Racks
* Rack Parts
*/
/*
* Tables
*/
/obj/structure/table
name = "table"
desc = "A square piece of metal standing on four metal legs. It can not move."
icon = 'icons/obj/smooth_structures/table.dmi'
icon_state = "table"
density = 1
anchored = 1.0
layer = 2.8
density = TRUE
anchored = TRUE
layer = TABLE_LAYER
pass_flags = LETPASSTHROW
climbable = 1
var/parts = /obj/item/weapon/table_parts
var/flipped = 0
var/health = 100
var/busy = 0
climbable = TRUE
max_integrity = 100
integrity_failure = 30
smooth = SMOOTH_TRUE
canSmoothWith = list(/obj/structure/table, /obj/structure/table/reinforced)
var/frame = /obj/structure/table_frame
var/framestack = /obj/item/stack/rods
var/buildstack = /obj/item/stack/sheet/metal
var/busy = FALSE
var/buildstackamount = 1
var/framestackamount = 2
var/deconstruction_ready = TRUE
var/flipped = 0
/obj/structure/table/New()
..()
for(var/obj/structure/table/T in src.loc)
if(T != src)
qdel(T)
if(flipped)
update_icon()
/obj/structure/table/proc/destroy()
new parts(loc)
density = 0
qdel(src)
/obj/structure/table/examine(mob/user)
..()
deconstruction_hints(user)
/obj/structure/table/narsie_act()
if(prob(20))
new /obj/structure/table/woodentable(loc)
/obj/structure/table/proc/deconstruction_hints(mob/user)
to_chat(user, "<span class='notice'>The top is <b>screwed</b> on, but the main <b>bolts</b> are also visible.</span>")
/obj/structure/table/update_icon()
if(smooth && !flipped)
@@ -63,7 +65,7 @@
if(type == 1)
subtype = direction == turn(dir,90) ? "-" : "+"
var/base = "table"
if(istype(src, /obj/structure/table/woodentable))
if(istype(src, /obj/structure/table/wood))
base = "wood"
if(istype(src, /obj/structure/table/reinforced))
base = "rtable"
@@ -72,51 +74,53 @@
return 1
/obj/structure/table/narsie_act()
new /obj/structure/table/wood(loc)
qdel(src)
/obj/structure/table/ex_act(severity)
switch(severity)
if(1.0)
if(1)
qdel(src)
return
if(2.0)
if(2)
if(prob(50))
qdel(src)
return
if(3.0)
if(3)
if(prob(25))
destroy()
deconstruct(FALSE)
else
return
/obj/structure/table/blob_act()
if(prob(75))
destroy()
qdel(src)
/obj/structure/table/attack_alien(mob/living/user)
user.do_attack_animation(src)
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1)
visible_message("<span class='danger'>[user] slices [src] apart!</span>")
destroy()
deconstruct(FALSE)
/obj/structure/table/mech_melee_attack(obj/mecha/M)
visible_message("<span class='danger'>[M] smashes [src] apart!</span>")
destroy()
deconstruct(FALSE)
/obj/structure/table/attack_animal(mob/living/simple_animal/user)
if(user.environment_smash)
user.do_attack_animation(src)
playsound(loc, 'sound/weapons/Genhit.ogg', 50, 1)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
destroy()
deconstruct(FALSE)
/obj/structure/table/attack_hand(mob/living/user)
if(HULK in user.mutations)
user.do_attack_animation(src)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
playsound(loc, 'sound/effects/bang.ogg', 50, 1)
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
destroy()
deconstruct(FALSE)
else
..()
if(climber)
@@ -171,17 +175,17 @@
else
return 1 //But only from one side
if(prob(chance))
health -= P.damage/2
if(health > 0)
obj_integrity -= P.damage/2
if(obj_integrity > 0)
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
return 0
else
visible_message("<span class='warning'>[src] breaks down!</span>")
destroy()
deconstruct(FALSE)
return 1
return 1
/obj/structure/table/CheckExit(atom/movable/O as mob|obj, target as turf)
/obj/structure/table/CheckExit(atom/movable/O, turf/target)
if(istype(O) && O.checkpass(PASSTABLE))
return 1
if(flipped)
@@ -191,7 +195,7 @@
return 1
return 1
/obj/structure/table/MouseDrop_T(obj/O as obj, mob/user as mob)
/obj/structure/table/MouseDrop_T(obj/O, mob/user)
..()
if((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
return
@@ -223,58 +227,74 @@
return 1
qdel(I)
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/grab))
tablepush(W, user)
/obj/structure/table/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/grab))
tablepush(I, user)
return
if(can_deconstruct)
if(isscrewdriver(I) && deconstruction_ready)
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
playsound(loc, I.usesound, 50, 1)
if(do_after(user, 20*I.toolspeed, target = src))
deconstruct(TRUE)
return
if(istype(W, /obj/item/weapon/wrench))
user.visible_message("<span class='notice'>[user] is disassembling \a [src].</span>", "<span class='notice'>You start disassembling \the [src].</span>")
playsound(loc, W.usesound, 50, 1)
if(do_after(user, 50 * W.toolspeed, target = src))
playsound(loc, W.usesound, 50, 1)
destroy()
return
if(iswrench(I) && deconstruction_ready)
to_chat(user, "<span class='notice'>You start deconstructing [src]...</span>")
playsound(loc, I.usesound, 50, 1)
if(do_after(user, 40*I.toolspeed, target = src))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
deconstruct(TRUE, 1)
return
if(isrobot(user))
return
if(istype(W, /obj/item/weapon/melee/energy/blade))
if(istype(I, /obj/item/weapon/melee/energy/blade))
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src.loc)
spark_system.set_up(5, 0, loc)
spark_system.start()
playsound(src.loc, W.usesound, 50, 1)
playsound(src.loc, "sparks", 50, 1)
playsound(loc, I.usesound, 50, 1)
playsound(loc, "sparks", 50, 1)
for(var/mob/O in viewers(user, 4))
O.show_message("<span class='notice'>The [src] was sliced apart by [user]!</span>", 1, "<span class='warning'>You hear [src] coming apart.</span>", 2)
destroy()
deconstruct(FALSE)
return
if(!(W.flags & ABSTRACT))
if(!(I.flags & ABSTRACT))
if(user.drop_item())
W.Move(loc)
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)
W.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
W.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
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
/obj/structure/table/proc/straight_table_check(var/direction)
/obj/structure/table/deconstruct(disassembled = TRUE, wrench_disassembly = 0)
if(can_deconstruct)
var/turf/T = get_turf(src)
new buildstack(T, buildstackamount)
if(!wrench_disassembly)
new frame(T)
else
new framestack(T, framestackamount)
qdel(src)
/obj/structure/table/proc/straight_table_check(direction)
var/obj/structure/table/T
for(var/angle in list(-90,90))
T = locate() in get_step(src.loc,turn(direction,angle))
T = locate() in get_step(loc,turn(direction,angle))
if(T && !T.flipped)
return 0
T = locate() in get_step(src.loc,direction)
T = locate() in get_step(loc,direction)
if(!T || T.flipped)
return 1
if(istype(T,/obj/structure/table/reinforced/))
var/obj/structure/table/reinforced/R = T
if(R.status == 2)
if(!T.deconstruction_ready)
return 0
return T.straight_table_check(direction)
@@ -309,7 +329,7 @@
return
/obj/structure/table/proc/flip(var/direction)
/obj/structure/table/proc/flip(direction)
if(flipped)
return 0
@@ -344,7 +364,7 @@
return 0
var/can_flip = 1
for(var/mob/A in oview(src,0))//src.loc)
for(var/mob/A in oview(src,0))//loc)
if(istype(A))
can_flip = 0
if(!can_flip)
@@ -365,52 +385,111 @@
return 1
/*
* Glass Tables
*/
/obj/structure/table/glass
name = "glass table"
desc = "Looks fragile. You should totally flip it. It is begging for it."
icon = 'icons/obj/smooth_structures/glass_table.dmi'
icon_state = "glass_table"
buildstack = /obj/item/stack/sheet/glass
max_integrity = 70
canSmoothWith = null
var/list/debris = list()
/obj/structure/table/glass/New()
. = ..()
debris += new frame
debris += new /obj/item/weapon/shard
/obj/structure/table/glass/Destroy()
for(var/i in debris)
qdel(i)
. = ..()
/obj/structure/table/glass/Crossed(atom/movable/AM)
. = ..()
if(!can_deconstruct)
return
if(!isliving(AM))
return
// Don't break if they're just flying past
if(AM.throwing)
addtimer(src, "throw_check", 5, FALSE, AM)
else
check_break(AM)
/obj/structure/table/glass/proc/throw_check(mob/living/M)
if(M.loc == get_turf(src))
check_break(M)
/obj/structure/table/glass/proc/check_break(mob/living/M)
if(has_gravity(M) && M.mob_size > MOB_SIZE_SMALL)
table_shatter(M)
/obj/structure/table/glass/flip(direction)
deconstruct(FALSE)
/obj/structure/table/glass/proc/table_shatter(mob/living/L)
visible_message("<span class='warning'>[src] breaks!</span>",
"<span class='danger'>You hear breaking glass.</span>")
var/turf/T = get_turf(src)
playsound(T, "shatter", 50, 1)
for(var/I in debris)
var/atom/movable/AM = I
AM.forceMove(T)
debris -= AM
if(istype(AM, /obj/item/weapon/shard))
AM.throw_impact(L)
L.Weaken(5)
qdel(src)
/obj/structure/table/glass/deconstruct(disassembled = TRUE, wrench_disassembly = 0)
if(can_deconstruct)
if(disassembled)
..()
return
else
var/turf/T = get_turf(src)
playsound(T, "shatter", 50, 1)
for(var/X in debris)
var/atom/movable/AM = X
AM.forceMove(T)
debris -= AM
qdel(src)
/*
* Wooden tables
*/
/obj/structure/table/woodentable
/obj/structure/table/wood
name = "wooden table"
desc = "Do not apply fire to this. Rumour says it burns easily."
icon = 'icons/obj/smooth_structures/wood_table.dmi'
icon_state = "wood_table"
parts = /obj/item/weapon/table_parts/wood
health = 50
canSmoothWith = list(/obj/structure/table/woodentable, /obj/structure/table/woodentable/poker)
frame = /obj/structure/table_frame/wood
framestack = /obj/item/stack/sheet/wood
buildstack = /obj/item/stack/sheet/wood
max_integrity = 70
canSmoothWith = list(/obj/structure/table/wood, /obj/structure/table/wood/poker)
burn_state = FLAMMABLE
burntime = 20
var/canPokerize = 1
/obj/structure/table/woodentable/attackby(obj/item/I as obj, mob/user as mob, params)
if(canPokerize && istype(I, /obj/item/stack/tile/grass))
var/obj/item/stack/tile/grass/gr = I
gr.use(1)
new /obj/structure/table/woodentable/poker( src.loc )
qdel(src)
visible_message("<span class='notice'>[user] adds the grass to the wooden table</span>")
return 1
else
return ..()
return 1
/obj/structure/table/woodentable/narsie_act()
/obj/structure/table/wood/narsie_act()
return
/obj/structure/table/woodentable/poker //No specialties, Just a mapping object.
/obj/structure/table/wood/poker //No specialties, Just a mapping object.
name = "gambling table"
desc = "A seedy table for seedy dealings in seedy places."
icon = 'icons/obj/smooth_structures/poker_table.dmi'
icon_state = "pokertable"
canSmoothWith = list(/obj/structure/table/woodentable/poker, /obj/structure/table/woodentable)
canPokerize = 0
icon_state = "poker_table"
buildstack = /obj/item/stack/tile/carpet
/obj/structure/table/woodentable/poker/destroy()
new /obj/item/stack/tile/grass(loc)
..()
/obj/structure/table/woodentable/poker/narsie_act()
return
/obj/structure/table/wood/poker/narsie_act()
new /obj/structure/table/wood(loc)
qdel(src)
/*
* Fancy Tables
@@ -421,7 +500,9 @@
desc = "A standard metal table frame covered with an amazingly fancy, patterned cloth."
icon = 'icons/obj/structures.dmi'
icon_state = "fancy_table"
parts = /obj/item/weapon/table_parts/fancy
frame = /obj/structure/table_frame
framestack = /obj/item/stack/rods
buildstack = /obj/item/stack/tile/carpet
canSmoothWith = list(/obj/structure/table/wood/fancy, /obj/structure/table/wood/fancy/black)
/obj/structure/table/wood/fancy/New()
@@ -430,123 +511,59 @@
/obj/structure/table/wood/fancy/black
icon_state = "fancy_table_black"
parts = /obj/item/weapon/table_parts/fancy/black
buildstack = /obj/item/stack/tile/carpet/black
/obj/structure/table/wood/fancy/black/New()
..()
icon = 'icons/obj/smooth_structures/fancy_table_black.dmi' //so that the tables place correctly in the map editor
/*
* Glass Tables
*/
/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)
to_chat(user, "<span class='notice'>You start to add the glass to \the [src].</span>")
if(do_after(user, 10 * G.toolspeed, target = src))
G.use(2)
to_chat(user, "<span class='notice'>You add the glass to \the [src].</span>")
playsound(get_turf(src), G.usesound, 50, 1)
new /obj/structure/table/glass(loc)
qdel(src)
else
to_chat(user, "<span class='notice'>You don't have enough glass! You need at least 2 sheets.</span>")
return
if(iswrench(I))
to_chat(user, "<span class='notice'>You start to deconstruct \the [src].</span>")
playsound(src.loc, I.usesound, 75, 1)
if(do_after(user, 10 * I.toolspeed, target = src))
playsound(src.loc, I.usesound, 75, 1)
to_chat(user, "<span class='notice'>You dismantle \the [src].</span>")
new /obj/item/stack/sheet/metal(loc)
new /obj/item/stack/sheet/metal(loc)
qdel(src)
/obj/structure/table/glass
name = "glass table"
desc = "Looks fragile. You should totally flip it. It is begging for it."
icon = 'icons/obj/smooth_structures/glass_table.dmi'
icon_state = "glass_table"
parts = /obj/item/weapon/table_parts/glass
health = 10
canSmoothWith = null
/obj/structure/table/glass/flip(var/direction)
collapse()
/obj/structure/table/glass/proc/collapse() //glass table collapse is called twice in this code, more efficent to just have a proc
src.visible_message("<span class='warning'>\The [src] shatters, and the frame collapses!</span>", "<span class='warning'>You hear metal collapsing and glass shattering.</span>")
playsound(src.loc, "shatter", 50, 1)
destroy(1)
/obj/structure/table/glass/destroy(dirty)
if(dirty)
new /obj/item/weapon/shard(loc)
new /obj/item/weapon/shard(loc)
else
new /obj/item/stack/sheet/glass(loc, 2)
..()
/obj/structure/table/glass/tablepush(obj/item/I, mob/user)
if(..())
collapse()
/*
* Reinforced tables
*/
/obj/structure/table/reinforced
name = "reinforced table"
desc = "A version of the four legged table. It is stronger."
desc = "A reinforced version of the four legged table."
icon = 'icons/obj/smooth_structures/reinforced_table.dmi'
icon_state = "r_table"
health = 200
var/status = 2
parts = /obj/item/weapon/table_parts/reinforced
deconstruction_ready = FALSE
buildstack = /obj/item/stack/sheet/plasteel
canSmoothWith = list(/obj/structure/table/reinforced, /obj/structure/table)
max_integrity = 200
integrity_failure = 50
/obj/structure/table/reinforced/flip(var/direction)
if(status == 2)
/obj/structure/table/reinforced/deconstruction_hints(mob/user)
if(deconstruction_ready)
to_chat(user, "<span class='notice'>The top cover has been <i>welded</i> loose and the main frame's <b>bolts</b> are exposed.</span>")
else
to_chat(user, "<span class='notice'>The top cover is firmly <b>welded</b> on.</span>")
/obj/structure/table/reinforced/flip(direction)
if(!deconstruction_ready)
return 0
else
return ..()
/obj/structure/table/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/weldingtool))
/obj/structure/table/reinforced/attackby(obj/item/weapon/W, mob/user, params)
if(iswelder(W))
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user))
if(src.status == 2)
to_chat(user, "<span class='notice'>Now weakening the reinforced table</span>")
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 50 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
to_chat(user, "<span class='notice'>Table weakened</span>")
src.status = 1
playsound(loc, W.usesound, 50, 1)
if(deconstruction_ready)
to_chat(user, "<span class='notice'>You start strengthening the reinforced table...</span>")
if (do_after(user, 50*W.toolspeed, target = src))
if(!src || !WT.isOn())
return
to_chat(user, "<span class='notice'>You strengthen the table.</span>")
deconstruction_ready = FALSE
else
to_chat(user, "<span class='notice'>Now strengthening the reinforced table</span>")
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 50 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
to_chat(user, "<span class='notice'>Table strengthened</span>")
src.status = 2
return
return
if(istype(W, /obj/item/weapon/wrench))
if(src.status == 2)
return
..()
to_chat(user, "<span class='notice'>You start weakening the reinforced table...</span>")
if (do_after(user, 50*W.toolspeed, target = src))
if(!src || !WT.isOn())
return
to_chat(user, "<span class='notice'>You weaken the table.</span>")
deconstruction_ready = TRUE
else
. = ..()
/*
* Racks
@@ -556,42 +573,42 @@
desc = "Different from the Middle Ages version."
icon = 'icons/obj/objects.dmi'
icon_state = "rack"
layer = TABLE_LAYER
density = 1
anchored = 1.0
anchored = 1
pass_flags = LETPASSTHROW
var/parts = /obj/item/weapon/rack_parts
var/health = 5
max_integrity = 20
/obj/structure/rack/proc/destroy()
new parts(loc)
density = 0
qdel(src)
/obj/structure/rack/examine(mob/user)
..()
to_chat(user, "<span class='notice'>It's held together by a couple of <b>bolts</b>.</span>")
/obj/structure/rack/ex_act(severity)
switch(severity)
if(1.0)
if(1)
qdel(src)
if(2.0)
if(2)
qdel(src)
if(prob(50))
new /obj/item/weapon/rack_parts(src.loc)
if(3.0)
new /obj/item/weapon/rack_parts(loc)
if(3)
if(prob(25))
qdel(src)
new /obj/item/weapon/rack_parts(src.loc)
new /obj/item/weapon/rack_parts(loc)
/obj/structure/rack/blob_act()
if(prob(75))
qdel(src)
return
else if(prob(50))
new /obj/item/weapon/rack_parts(src.loc)
new /obj/item/weapon/rack_parts(loc)
qdel(src)
return
/obj/structure/rack/CanPass(atom/movable/mover, turf/target, height=0)
if(height==0) return 1
if(src.density == 0) //Because broken racks -Agouri |TODO: SPRITE!|
if(height==0)
return 1
if(density == 0) //Because broken racks -Agouri |TODO: SPRITE!|
return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
@@ -606,7 +623,7 @@
var/atom/movable/mover = caller
. = . || mover.checkpass(PASSTABLE)
/obj/structure/rack/MouseDrop_T(obj/O as obj, mob/user as mob)
/obj/structure/rack/MouseDrop_T(obj/O, mob/user)
if((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
return
if(isrobot(user))
@@ -615,13 +632,11 @@
return
if(O.loc != src.loc)
step(O, get_dir(O, src))
return
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
new /obj/item/weapon/rack_parts( src.loc )
playsound(src.loc, W.usesound, 50, 1)
qdel(src)
/obj/structure/rack/attackby(obj/item/weapon/W, mob/user, params)
if(iswrench(W) && can_deconstruct)
playsound(loc, W.usesound, 50, 1)
deconstruct(TRUE)
return
if(isrobot(user))
return
@@ -634,38 +649,47 @@
if(HULK in user.mutations)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
destroy()
deconstruct()
else
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
playsound(loc, 'sound/items/dodgeball.ogg', 80, 1)
user.visible_message("<span class='warning'>[user] kicks [src].</span>", \
"<span class='danger'>You kick [src].</span>")
health -= rand(1,2)
obj_integrity -= rand(1,2)
healthcheck()
/obj/structure/rack/mech_melee_attack(obj/mecha/M)
visible_message("<span class='danger'>[M] smashes [src] apart!</span>")
destroy()
deconstruct()
/obj/structure/rack/attack_alien(mob/living/user)
user.do_attack_animation(src)
visible_message("<span class='danger'>[user] slices [src] apart!</span>")
destroy()
deconstruct()
/obj/structure/rack/attack_animal(mob/living/simple_animal/user)
if(user.environment_smash)
user.do_attack_animation(src)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
destroy()
deconstruct()
/obj/structure/rack/attack_tk() // no telehulk sorry
return
/obj/structure/rack/proc/healthcheck()
if(health <= 0)
destroy()
if(obj_integrity <= 0)
deconstruct()
/obj/structure/rack/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
if(BRUTE)
if(damage_amount)
playsound(loc, 'sound/items/dodgeball.ogg', 80, 1)
else
playsound(loc, 'sound/weapons/tap.ogg', 50, 1)
if(BURN)
playsound(loc, 'sound/items/welder.ogg', 40, 1)
/obj/structure/rack/skeletal_bar
name = "skeletal minibar"
@@ -678,3 +702,49 @@
/obj/structure/rack/skeletal_bar/right
icon_state = "minibar_right"
/*
* Rack destruction
*/
/obj/structure/rack/deconstruct(disassembled = TRUE)
if(can_deconstruct)
density = FALSE
var/obj/item/weapon/rack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
qdel(src)
/*
* Rack Parts
*/
/obj/item/weapon/rack_parts
name = "rack parts"
desc = "Parts of a rack."
icon = 'icons/obj/items.dmi'
icon_state = "rack_parts"
flags = CONDUCT
materials = list(MAT_METAL=2000)
var/building = FALSE
/obj/item/weapon/rack_parts/attackby(obj/item/weapon/W, mob/user, params)
if(iswrench(W))
new /obj/item/stack/sheet/metal(user.loc)
qdel(src)
else
. = ..()
/obj/item/weapon/rack_parts/attack_self(mob/user)
if(building)
return
building = TRUE
to_chat(user, "<span class='notice'>You start constructing a rack...</span>")
if(do_after(user, 50, target = user, progress=TRUE))
if(!user.drop_item(src))
return
var/obj/structure/rack/R = new /obj/structure/rack(user.loc)
user.visible_message("<span class='notice'>[user] assembles \a [R].\
</span>", "<span class='notice'>You assemble \a [R].</span>")
R.add_fingerprint(user)
qdel(src)
building = FALSE