diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 6d8392e4ad..0921cfabd9 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -206,14 +206,6 @@ name = "warning cone" icon_state = "cone" -/obj/item/weapon/rack_parts - name = "rack parts" - desc = "Parts of a rack." - icon = 'icons/obj/items.dmi' - icon_state = "rack_parts" - flags = FPRINT | TABLEPASS| CONDUCT - matter = list("metal" = 3750) - /*/obj/item/weapon/syndicate_uplink name = "station bounced radio" desc = "Remain silent about this..." @@ -292,36 +284,6 @@ w_class = 2.0 flags = FPRINT | TABLEPASS | NOSHIELD -/obj/item/weapon/table_parts - name = "table parts" - desc = "Parts of a table. Poor table." - gender = PLURAL - icon = 'icons/obj/items.dmi' - icon_state = "table_parts" - matter = list("metal" = 3750) - flags = FPRINT | TABLEPASS| CONDUCT - attack_verb = list("slammed", "bashed", "battered", "bludgeoned", "thrashed", "whacked") - -/obj/item/weapon/table_parts/reinforced - name = "reinforced table parts" - desc = "Hard table parts. Well...harder..." - icon = 'icons/obj/items.dmi' - icon_state = "reinf_tableparts" - matter = list("metal" = 7500) - flags = FPRINT | TABLEPASS| CONDUCT - -/obj/item/weapon/table_parts/wood - name = "wooden table parts" - desc = "Keep away from fire." - icon_state = "wood_tableparts" - flags = null - -/obj/item/weapon/table_parts/gambling - name = "gamble table parts" - desc = "Keep away from security." - icon_state = "gamble_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/weapons/table_rack_parts.dm b/code/game/objects/items/weapons/table_rack_parts.dm index 1082723b24..fff0deed5f 100644 --- a/code/game/objects/items/weapons/table_rack_parts.dm +++ b/code/game/objects/items/weapons/table_rack_parts.dm @@ -1,124 +1,101 @@ -/* Table parts and rack parts - * Contains: - * Table Parts - * Reinforced Table Parts - * Wooden Table Parts - * Rack Parts - */ +// Table parts and rack parts +/obj/item/weapon/table_parts + name = "table parts" + desc = "Parts of a table. Poor table." + gender = PLURAL + icon = 'icons/obj/items.dmi' + icon_state = "table_parts" + matter = list("metal" = 3750) + flags = FPRINT | TABLEPASS| CONDUCT + attack_verb = list("slammed", "bashed", "battered", "bludgeoned", "thrashed", "whacked") + var/build_type = /obj/structure/table + var/alter_type = /obj/item/weapon/table_parts/reinforced + var/alter_with = /obj/item/stack/rods + var/alter_cost = 4 + var/list/stack_types = list(/obj/item/stack/sheet/metal) -/* - * Table Parts - */ /obj/item/weapon/table_parts/attackby(obj/item/weapon/W as obj, mob/user as mob) - ..() if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/stack/sheet/metal( user.loc ) - //SN src = null + for(var/material_type in stack_types) + new material_type(get_turf(user)) del(src) - if (istype(W, /obj/item/stack/rods)) - var/obj/item/stack/rods/R = W - if (R.use(4)) - new /obj/item/weapon/table_parts/reinforced(get_turf(loc)) - user << "You reinforce the [name]." - del(src) - else - user << "You need at least four rods to reinforce the [name]." + return + else + if(alter_type && alter_with && istype(W,alter_with)) + var/obj/item/stack/R = W + if (R.use(alter_cost)) + var/obj/item/new_parts = new alter_type (get_turf(loc)) + user << "You modify \the [name] into \a [new_parts]." + del(src) + else + user << "You need at least [alter_cost] sheets to reinforce the [name]." + return + ..() /obj/item/weapon/table_parts/attack_self(mob/user as mob) if(locate(/obj/structure/table) in user.loc) user << "There is already a table here." return - new /obj/structure/table( user.loc ) + new build_type( user.loc ) user.drop_item() del(src) return +/obj/item/weapon/table_parts/reinforced + name = "reinforced table parts" + desc = "Hard table parts. Well... harder." + icon = 'icons/obj/items.dmi' + icon_state = "reinf_tableparts" + matter = list("metal" = 7500) + flags = FPRINT | TABLEPASS| CONDUCT -/* - * Reinforced Table Parts - */ -/obj/item/weapon/table_parts/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/stack/sheet/metal( get_turf(loc) ) - new /obj/item/stack/rods( get_turf(loc) ) - del(src) + stack_types = list(/obj/item/stack/sheet/metal, /obj/item/stack/rods) + build_type = /obj/structure/table/reinforced + alter_type = null + alter_with = null + alter_cost = null -/obj/item/weapon/table_parts/reinforced/attack_self(mob/user as mob) - if(locate(/obj/structure/table/reinforced) in user.loc) - user << "There is already a table here." - return +/obj/item/weapon/table_parts/wood + name = "wooden table parts" + desc = "Keep away from fire." + icon_state = "wood_tableparts" + flags = null - new /obj/structure/table/reinforced( user.loc ) - user.drop_item() - del(src) - return + stack_types = list(/obj/item/stack/sheet/wood) + build_type = /obj/structure/table/woodentable + alter_type = /obj/item/weapon/table_parts/gambling + alter_with = /obj/item/stack/tile/carpet + alter_cost = 1 -/* - * Wooden Table Parts - */ -/obj/item/weapon/table_parts/wood/attackby(obj/item/weapon/W as obj, mob/user as mob) - ..() - if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/stack/sheet/wood( get_turf(loc) ) - //SN src = null - del(src) - if (istype(W, /obj/item/stack/tile/carpet)) - var/obj/item/stack/tile/carpet/C = W - if (C.use(1)) - new /obj/item/weapon/table_parts/gambling(get_turf(loc)) - user << "You put a layer of carpet on the table." - del(src) +/obj/item/weapon/table_parts/gambling + name = "gambling table parts" + desc = "Keep away from security." + icon_state = "gamble_tableparts" + flags = null -/obj/item/weapon/table_parts/wood/attack_self(mob/user as mob) - if(locate(/obj/structure/table/woodentable) in user.loc) - user << "There is already a table here." - return + stack_types = list(/obj/item/stack/tile/carpet,/obj/item/stack/sheet/wood) + build_type = /obj/structure/table/gamblingtable + alter_type = null + alter_with = null + alter_cost = null - new /obj/structure/table/woodentable( user.loc ) - user.drop_item() - del(src) - return - -/* - * Gambling Table Parts - */ /obj/item/weapon/table_parts/gambling/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/stack/sheet/wood( get_turf(loc) ) - new /obj/item/stack/tile/carpet( get_turf(loc) ) - del(src) if (istype(W, /obj/item/weapon/crowbar)) new /obj/item/stack/tile/carpet( get_turf(loc) ) new /obj/item/weapon/table_parts/wood( get_turf(loc) ) user << "You pry the carpet out of the table." del(src) - -/obj/item/weapon/table_parts/gambling/attack_self(mob/user as mob) - new /obj/structure/table/gamblingtable( user.loc ) - user.drop_item() - del(src) - return -/* - * Rack Parts - */ -/obj/item/weapon/rack_parts/attackby(obj/item/weapon/W as obj, mob/user as mob) ..() - if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/stack/sheet/metal( get_turf(loc) ) - del(src) - return - return -/obj/item/weapon/rack_parts/attack_self(mob/user as mob) - if(locate(/obj/structure/rack) in user.loc) - user << "There is already a rack here." - return - - var/obj/structure/rack/R = new /obj/structure/rack( user.loc ) - R.add_fingerprint(user) - user.drop_item() - del(src) - return +/obj/item/weapon/table_parts/rack + name = "rack parts" + desc = "Parts of a rack." + icon_state = "rack_parts" + stack_types = list(/obj/item/stack/sheet/metal) + build_type = /obj/structure/table/rack + alter_type = null + alter_with = null + alter_cost = null \ No newline at end of file diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 683168defc..bca29c689f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -1,24 +1,14 @@ -/* Tables and Racks - * Contains: - * Tables - * Wooden tables - * Reinforced tables - * Racks - */ +// Tables and racks. - -/* - * Tables - */ /obj/structure/table name = "table" desc = "A square piece of metal standing on four metal legs. It can not move." icon = 'icons/obj/structures.dmi' icon_state = "table" density = 1 - anchored = 1.0 + anchored = 1 layer = 2.8 - throwpass = 1 //You can throw objects over this, despite it's density.") + throwpass = 1 climbable = 1 breakable = 1 parts = /obj/item/weapon/table_parts @@ -26,6 +16,39 @@ var/flipped = 0 var/health = 100 +/obj/structure/table/woodentable + name = "wooden table" + desc = "Do not apply fire to this. Rumour says it burns easily." + icon_state = "wood_table" + parts = /obj/item/weapon/table_parts/wood + health = 50 + +/obj/structure/table/gamblingtable + name = "gambling table" + desc = "A curved wooden table with a thin carpet of green fabric." + icon_state = "gamble_table" + parts = /obj/item/weapon/table_parts/gambling + health = 50 + +/obj/structure/table/reinforced + icon_state = "reinf_table" + health = 200 + parts = /obj/item/weapon/table_parts/reinforced + +/obj/structure/table/rack + name = "rack" + desc = "Different from the Middle Ages version." + icon = 'icons/obj/objects.dmi' + icon_state = "rack" + health = 100 + parts = /obj/item/weapon/table_parts/rack + flipped = -1 //Cannot flip. + +/obj/structure/table/examine() + ..() + if(health > 100) + usr << "This one looks like it has been reinforced." + /obj/structure/table/proc/update_adjacent() for(var/direction in list(1,2,4,8,5,6,9,10)) if(locate(/obj/structure/table,get_step(src,direction))) @@ -45,14 +68,18 @@ ..() /obj/structure/table/update_icon() + + if(health > 100) + name = "reinforced [initial(name)]" + spawn(2) //So it properly updates when deleting - if(flipped) + if(flipped == 1) var/type = 0 var/tabledirs = 0 for(var/direction in list(turn(dir,90), turn(dir,-90)) ) var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction)) - if (T && T.flipped && T.dir == src.dir) + if (T && T.flipped == 1 && T.dir == src.dir) type++ tabledirs |= direction var/base = "table" @@ -100,7 +127,7 @@ continue if(!skip_sum) //means there is a window between the two tiles in this direction var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction)) - if(T && !T.flipped) + if(T && T.flipped == 0) // This should let us ignore racks for table icons/flipping. Should. if(direction <5) dir_sum += direction else @@ -265,7 +292,7 @@ return 1 if(locate(/obj/structure/table) in get_turf(mover)) return 1 - if (flipped) + if (flipped == 1) if (get_dir(loc, target) == dir) return !density else @@ -274,7 +301,13 @@ //checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops. /obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from) - var/turf/cover = flipped ? get_turf(src) : get_step(loc, get_dir(from, loc)) + var/turf/cover + if(flipped==1) + cover = get_turf(src) + else if(flipped==0) + cover = get_step(loc, get_dir(from, loc)) + if(!cover) + return 1 if (get_dist(P.starting, loc) <= 1) //Tables won't help you if people are THIS close return 1 if (get_turf(P.original) == cover) @@ -283,7 +316,7 @@ var/mob/M = P.original if (M.lying) chance += 20 //Lying down lets you catch less bullets - if(flipped) + if(flipped==1) if(get_dir(loc, from) == dir) //Flipped tables catch mroe bullets chance += 20 else @@ -302,7 +335,7 @@ /obj/structure/table/CheckExit(atom/movable/O as mob|obj, target as turf) if(istype(O) && O.checkpass(PASSTABLE)) return 1 - if (flipped) + if (flipped==1) if (get_dir(loc, target) == dir) return !density else @@ -323,6 +356,8 @@ /obj/structure/table/attackby(obj/item/W as obj, mob/user as mob) if (!W) return + + // Handle harm intent grabbing/tabling. if (istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2) var/obj/item/weapon/grab/G = W if (istype(G.affecting, /mob/living)) @@ -331,25 +366,56 @@ if(user.a_intent == "hurt") if (prob(15)) M.Weaken(5) M.apply_damage(8,def_zone = "head") - visible_message("\red [G.assailant] slams [G.affecting]'s face against \the [src]!") + visible_message("[G.assailant] slams [G.affecting]'s face against \the [src]!") playsound(src.loc, 'sound/weapons/tablehit1.ogg', 50, 1) else - user << "\red You need a better grip to do that!" + user << "You need a better grip to do that!" return else G.affecting.loc = src.loc G.affecting.Weaken(5) - visible_message("\red [G.assailant] puts [G.affecting] on \the [src].") + visible_message("[G.assailant] puts [G.affecting] on \the [src].") del(W) return + // Handle dissembly. if (istype(W, /obj/item/weapon/wrench)) - user << "\blue Now disassembling table" + if(health > 100) + user << "\The [src] is too well constructed to be collapsed. Weaken it first." + return + user << "You locate the bolts and begin disassembling \the [src]..." playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user,50)) destroy() return + // Handle weakening. + if (istype(W, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/WT = W + if(WT.isOn()) + if(initial(health)>100) + if(WT.remove_fuel(0, user)) + if(src.health>100) + user << "You start weakening \the [src]..." + playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) + if(!do_after(user, 50) || !src || health<100 || !WT.isOn()) + return + user << "You have weakened \the [src]." + health -= 100 + else if(src.health <= 100) + user << "You start strengthening \the [src]..." + playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) + if(!do_after(user, 50) || !src || health > 100 || !WT.isOn()) + return + user << "You have strengthened \the [src]." + health += 100 + update_icon() + else + user << "\The [src] is too flimsy to be reinforced or weakened." + return + + + // Handle dismantling or placing things on the table from here on. if(isrobot(user)) return @@ -362,8 +428,7 @@ 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 [src] was sliced apart by [user]!", 1, "\red You hear [src] coming apart.", 2) + user.visible_message("The [src] was sliced apart by [user]!") destroy() user.drop_item(src) @@ -373,14 +438,14 @@ var/obj/structure/table/T for(var/angle in list(-90,90)) T = locate() in get_step(src.loc,turn(direction,angle)) - if(T && !T.flipped) + if(T && T.flipped == 0) return 0 T = locate() in get_step(src.loc,direction) - if (!T || T.flipped) + if (!T || T.flipped == 1) return 1 if (istype(T,/obj/structure/table/reinforced/)) var/obj/structure/table/reinforced/R = T - if (R.status == 2) + if (R.health > 100) return 0 return T.straight_table_check(direction) @@ -393,7 +458,7 @@ if (!can_touch(usr) || ismouse(usr)) return - if(!flip(get_cardinal_dir(usr,src))) + if(flipped < 0 || !flip(get_cardinal_dir(usr,src))) usr << "It won't budge." return @@ -417,7 +482,7 @@ for(var/new_dir in L) var/obj/structure/table/T = locate() in get_step(src.loc,new_dir) if(T) - if(T.flipped && T.dir == src.dir && !T.unflipping_check(new_dir)) + if(T.flipped == 1 && T.dir == src.dir && !T.unflipping_check(new_dir)) return 0 return 1 @@ -456,7 +521,7 @@ flags |= ON_BORDER for(var/D in list(turn(direction, 90), turn(direction, -90))) var/obj/structure/table/T = locate() in get_step(src,D) - if(T && !T.flipped) + if(T && T.flipped == 0) T.flip(direction) update_icon() update_adjacent() @@ -473,120 +538,19 @@ flags &= ~ON_BORDER for(var/D in list(turn(dir, 90), turn(dir, -90))) var/obj/structure/table/T = locate() in get_step(src.loc,D) - if(T && T.flipped && T.dir == src.dir) + if(T && T.flipped == 1 && T.dir == src.dir) T.unflip() update_icon() update_adjacent() return 1 -/* - * Wooden tables - */ -/obj/structure/table/woodentable - name = "wooden table" - desc = "Do not apply fire to this. Rumour says it burns easily." - icon_state = "wood_table" - parts = /obj/item/weapon/table_parts/wood - health = 50 -/* - * Gambling tables - */ -/obj/structure/table/gamblingtable - name = "gambling table" - desc = "A curved wooden table with a thin carpet of green fabric." - icon_state = "gamble_table" - parts = /obj/item/weapon/table_parts/gambling - health = 50 -/* - * Reinforced tables - */ -/obj/structure/table/reinforced - name = "reinforced table" - desc = "A version of the four legged table. It is stronger." - icon_state = "reinf_table" - health = 200 - var/status = 2 - parts = /obj/item/weapon/table_parts/reinforced +// No need to handle any of this, racks are not contiguous.. +/obj/structure/table/rack/update_icon() + return +/obj/structure/table/rack/update_adjacent() + return -/obj/structure/table/reinforced/flip(var/direction) - if (status == 2) - return 0 - else - return ..() - -/obj/structure/table/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = W - if(WT.remove_fuel(0, user)) - if(src.status == 2) - user << "\blue Now weakening the reinforced table" - playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) - if (do_after(user, 50)) - if(!src || !WT.isOn()) return - user << "\blue Table weakened" - src.status = 1 - else - user << "\blue Now strengthening the reinforced table" - playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) - if (do_after(user, 50)) - if(!src || !WT.isOn()) return - user << "\blue Table strengthened" - src.status = 2 - return - return - - if (istype(W, /obj/item/weapon/wrench)) - if(src.status == 2) - return - - ..() - -/* - * Racks - */ +// Dummied out to stop compile errors. /obj/structure/rack - name = "rack" - desc = "Different from the Middle Ages version." - icon = 'icons/obj/objects.dmi' - icon_state = "rack" - density = 1 - flags = FPRINT - anchored = 1.0 - throwpass = 1 //You can throw objects over this, despite it's density. - breakable = 1 - climbable = 1 - parts = /obj/item/weapon/rack_parts - -/obj/structure/rack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - if(src.density == 0) //Because broken racks -Agouri |TODO: SPRITE!| - return 1 - if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 - -/obj/structure/rack/MouseDrop_T(obj/O as obj, mob/user as mob) - if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O)) - return - if(isrobot(user)) - return - user.drop_item() - 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) - if (istype(W, /obj/item/weapon/wrench)) - new /obj/item/weapon/rack_parts( src.loc ) - playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - del(src) - return - if(isrobot(user)) - return - if(W.loc != user) // This should stop mounted modules ending up outside the module. - return - user.drop_item() - if(W && W.loc) W.loc = src.loc - return +/obj/item/weapon/rack_parts \ No newline at end of file