mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 19:15:11 +01:00
Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings * Whitespace changes * Comment out merger hooks in gitattributes Corrupt maps would have to be resolved in repo before hooks could be updated * Revert "Whitespace changes" This reverts commitafbdd1d844. * Whitespace again minus example * Gitignore example changelog * Restore changelog merge setting * Keep older dmi hook attribute until hooks can be updated * update vscode settings too * Renormalize remaining * Revert "Gitignore example changelog" This reverts commitde22ad375d. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
|
||||
// Mostly for debugging table connections
|
||||
// This file is not #included in the .dme.
|
||||
|
||||
/obj/structure/table/debug
|
||||
New()
|
||||
material = get_material_by_name("debugium")
|
||||
..()
|
||||
|
||||
/datum/material/debug
|
||||
name = "debugium"
|
||||
stack_type = /obj/item/stack/material/debug
|
||||
icon_base = "debug"
|
||||
icon_reinf = "rdebug"
|
||||
icon_colour = "#FFFFFF"
|
||||
|
||||
/obj/item/stack/material/debug
|
||||
name = "debugium"
|
||||
icon = 'icons/obj/tables.dmi'
|
||||
icon_state = "debugium"
|
||||
default_type = "debugium"
|
||||
|
||||
|
||||
// Mostly for debugging table connections
|
||||
// This file is not #included in the .dme.
|
||||
|
||||
/obj/structure/table/debug
|
||||
New()
|
||||
material = get_material_by_name("debugium")
|
||||
..()
|
||||
|
||||
/datum/material/debug
|
||||
name = "debugium"
|
||||
stack_type = /obj/item/stack/material/debug
|
||||
icon_base = "debug"
|
||||
icon_reinf = "rdebug"
|
||||
icon_colour = "#FFFFFF"
|
||||
|
||||
/obj/item/stack/material/debug
|
||||
name = "debugium"
|
||||
icon = 'icons/obj/tables.dmi'
|
||||
icon_state = "debugium"
|
||||
default_type = "debugium"
|
||||
|
||||
|
||||
+117
-117
@@ -1,118 +1,118 @@
|
||||
|
||||
/obj/structure/table/proc/straight_table_check(var/direction)
|
||||
if(health > 100)
|
||||
return 0
|
||||
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 == 0 && T.material.name == material.name)
|
||||
return 0
|
||||
T = locate() in get_step(src.loc,direction)
|
||||
if (!T || T.flipped == 1 || T.material != material)
|
||||
return 1
|
||||
return T.straight_table_check(direction)
|
||||
|
||||
/obj/structure/table/verb/do_flip()
|
||||
set name = "Flip table"
|
||||
set desc = "Flips a non-reinforced table"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (!can_touch(usr) || ismouse(usr))
|
||||
return
|
||||
|
||||
if(flipped < 0 || !flip(get_cardinal_dir(usr,src)))
|
||||
to_chat(usr, "<span class='notice'>It won't budge.</span>")
|
||||
return
|
||||
|
||||
usr.visible_message("<span class='warning'>[usr] flips \the [src]!</span>")
|
||||
|
||||
if(climbable)
|
||||
structure_shaken()
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/table/proc/unflipping_check(var/direction)
|
||||
|
||||
for(var/mob/M in oview(src,0))
|
||||
return 0
|
||||
|
||||
var/obj/occupied = turf_is_crowded()
|
||||
if(occupied)
|
||||
to_chat(usr, "<span class='filter_notice'>There's \a [occupied] in the way.</span>")
|
||||
return 0
|
||||
|
||||
var/list/L = list()
|
||||
if(direction)
|
||||
L.Add(direction)
|
||||
else
|
||||
L.Add(turn(src.dir,-90))
|
||||
L.Add(turn(src.dir,90))
|
||||
for(var/new_dir in L)
|
||||
var/obj/structure/table/T = locate() in get_step(src.loc,new_dir)
|
||||
if(T && T.material && T.material.name == material.name)
|
||||
if(T.flipped == 1 && T.dir == src.dir && !T.unflipping_check(new_dir))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/do_put()
|
||||
set name = "Put table back"
|
||||
set desc = "Puts flipped table back"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (!can_touch(usr))
|
||||
return
|
||||
|
||||
if (!unflipping_check())
|
||||
to_chat(usr, "<span class='notice'>It won't budge.</span>")
|
||||
return
|
||||
unflip()
|
||||
|
||||
/obj/structure/table/proc/flip(var/direction)
|
||||
if( !straight_table_check(turn(direction,90)) || !straight_table_check(turn(direction,-90)) )
|
||||
return 0
|
||||
|
||||
verbs -=/obj/structure/table/verb/do_flip
|
||||
verbs +=/obj/structure/table/proc/do_put
|
||||
|
||||
var/list/targets = list(get_step(src,dir),get_step(src,turn(dir, 45)),get_step(src,turn(dir, -45)))
|
||||
for (var/atom/movable/A in get_turf(src))
|
||||
if (!A.anchored)
|
||||
spawn(0)
|
||||
A.throw_at(pick(targets),1,1)
|
||||
|
||||
set_dir(direction)
|
||||
if(dir != NORTH)
|
||||
plane = MOB_PLANE
|
||||
layer = ABOVE_MOB_LAYER
|
||||
//climbable = FALSE //flipping tables allows them to be used as makeshift barriers
|
||||
flipped = 1
|
||||
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 == 0 && material && T.material && T.material.name == material.name)
|
||||
T.flip(direction)
|
||||
take_damage(rand(5, 10))
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/unflip()
|
||||
verbs -=/obj/structure/table/proc/do_put
|
||||
verbs +=/obj/structure/table/verb/do_flip
|
||||
|
||||
reset_plane_and_layer()
|
||||
flipped = 0
|
||||
//climbable = initial(climbable)
|
||||
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 == 1 && T.dir == src.dir && material && T.material&& T.material.name == material.name)
|
||||
T.unflip()
|
||||
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/structure/table/proc/straight_table_check(var/direction)
|
||||
if(health > 100)
|
||||
return 0
|
||||
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 == 0 && T.material.name == material.name)
|
||||
return 0
|
||||
T = locate() in get_step(src.loc,direction)
|
||||
if (!T || T.flipped == 1 || T.material != material)
|
||||
return 1
|
||||
return T.straight_table_check(direction)
|
||||
|
||||
/obj/structure/table/verb/do_flip()
|
||||
set name = "Flip table"
|
||||
set desc = "Flips a non-reinforced table"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (!can_touch(usr) || ismouse(usr))
|
||||
return
|
||||
|
||||
if(flipped < 0 || !flip(get_cardinal_dir(usr,src)))
|
||||
to_chat(usr, "<span class='notice'>It won't budge.</span>")
|
||||
return
|
||||
|
||||
usr.visible_message("<span class='warning'>[usr] flips \the [src]!</span>")
|
||||
|
||||
if(climbable)
|
||||
structure_shaken()
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/table/proc/unflipping_check(var/direction)
|
||||
|
||||
for(var/mob/M in oview(src,0))
|
||||
return 0
|
||||
|
||||
var/obj/occupied = turf_is_crowded()
|
||||
if(occupied)
|
||||
to_chat(usr, "<span class='filter_notice'>There's \a [occupied] in the way.</span>")
|
||||
return 0
|
||||
|
||||
var/list/L = list()
|
||||
if(direction)
|
||||
L.Add(direction)
|
||||
else
|
||||
L.Add(turn(src.dir,-90))
|
||||
L.Add(turn(src.dir,90))
|
||||
for(var/new_dir in L)
|
||||
var/obj/structure/table/T = locate() in get_step(src.loc,new_dir)
|
||||
if(T && T.material && T.material.name == material.name)
|
||||
if(T.flipped == 1 && T.dir == src.dir && !T.unflipping_check(new_dir))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/do_put()
|
||||
set name = "Put table back"
|
||||
set desc = "Puts flipped table back"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (!can_touch(usr))
|
||||
return
|
||||
|
||||
if (!unflipping_check())
|
||||
to_chat(usr, "<span class='notice'>It won't budge.</span>")
|
||||
return
|
||||
unflip()
|
||||
|
||||
/obj/structure/table/proc/flip(var/direction)
|
||||
if( !straight_table_check(turn(direction,90)) || !straight_table_check(turn(direction,-90)) )
|
||||
return 0
|
||||
|
||||
verbs -=/obj/structure/table/verb/do_flip
|
||||
verbs +=/obj/structure/table/proc/do_put
|
||||
|
||||
var/list/targets = list(get_step(src,dir),get_step(src,turn(dir, 45)),get_step(src,turn(dir, -45)))
|
||||
for (var/atom/movable/A in get_turf(src))
|
||||
if (!A.anchored)
|
||||
spawn(0)
|
||||
A.throw_at(pick(targets),1,1)
|
||||
|
||||
set_dir(direction)
|
||||
if(dir != NORTH)
|
||||
plane = MOB_PLANE
|
||||
layer = ABOVE_MOB_LAYER
|
||||
//climbable = FALSE //flipping tables allows them to be used as makeshift barriers
|
||||
flipped = 1
|
||||
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 == 0 && material && T.material && T.material.name == material.name)
|
||||
T.flip(direction)
|
||||
take_damage(rand(5, 10))
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/unflip()
|
||||
verbs -=/obj/structure/table/proc/do_put
|
||||
verbs +=/obj/structure/table/verb/do_flip
|
||||
|
||||
reset_plane_and_layer()
|
||||
flipped = 0
|
||||
//climbable = initial(climbable)
|
||||
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 == 1 && T.dir == src.dir && material && T.material&& T.material.name == material.name)
|
||||
T.unflip()
|
||||
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
|
||||
return 1
|
||||
+163
-163
@@ -1,163 +1,163 @@
|
||||
/obj/structure/table/CanPass(atom/movable/mover, turf/target)
|
||||
if(istype(mover,/obj/item/projectile))
|
||||
return (check_cover(mover,target))
|
||||
if(flipped == 1)
|
||||
if(get_dir(mover, target) == reverse_dir[dir]) // From elsewhere to here, can't move against our dir
|
||||
return !density
|
||||
return TRUE
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return TRUE
|
||||
if(locate(/obj/structure/table/bench) in get_turf(mover))
|
||||
return FALSE
|
||||
var/obj/structure/table/table = locate(/obj/structure/table) in get_turf(mover)
|
||||
if(table && !(table.flipped == 1))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/structure/table/climb_to(mob/living/mover)
|
||||
if(flipped == 1 && mover.loc == loc)
|
||||
var/turf/T = get_step(src, dir)
|
||||
if(T.Enter(mover))
|
||||
return T
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/Uncross(atom/movable/mover, turf/target)
|
||||
if(flipped == 1 && (get_dir(mover, target) == dir)) // From here to elsewhere, can't move in our dir
|
||||
return !density
|
||||
return TRUE
|
||||
|
||||
//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
|
||||
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)
|
||||
var/chance = 20
|
||||
if (ismob(P.original))
|
||||
var/mob/M = P.original
|
||||
if (M.lying)
|
||||
chance += 20 //Lying down lets you catch less bullets
|
||||
if(flipped==1)
|
||||
if(get_dir(loc, from) == dir) //Flipped tables catch mroe bullets
|
||||
chance += 20
|
||||
else
|
||||
return 1 //But only from one side
|
||||
if(prob(chance))
|
||||
health -= P.damage/2
|
||||
if (health > 0)
|
||||
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
|
||||
return 0
|
||||
else
|
||||
visible_message("<span class='warning'>[src] breaks down!</span>")
|
||||
break_to_parts()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
/obj/structure/table/MouseDrop_T(obj/O, mob/user, src_location, over_location, src_control, over_control, params)
|
||||
if(ismob(O.loc)) //If placing an item
|
||||
if(!isitem(O) || user.get_active_hand() != O)
|
||||
return ..()
|
||||
if(isrobot(user))
|
||||
return
|
||||
user.drop_item()
|
||||
if(O.loc != src.loc)
|
||||
step(O, get_dir(O, src))
|
||||
|
||||
else if(isturf(O.loc) && isitem(O)) //If pushing an item on the tabletop
|
||||
var/obj/item/I = O
|
||||
if(I.anchored)
|
||||
return
|
||||
|
||||
if((isliving(user)) && (Adjacent(user)) && !(user.incapacitated()))
|
||||
if(O.w_class <= user.can_pull_size)
|
||||
O.forceMove(loc)
|
||||
auto_align(I, params, TRUE)
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [I] is too big for you to move!"))
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, var/hit_modifier, var/click_parameters)
|
||||
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))
|
||||
var/mob/living/M = G.affecting
|
||||
var/obj/occupied = turf_is_crowded()
|
||||
if(occupied)
|
||||
to_chat(user, "<span class='danger'>There's \a [occupied] in the way.</span>")
|
||||
return
|
||||
if(!user.Adjacent(M))
|
||||
return
|
||||
if (G.state < 2)
|
||||
if(user.a_intent == I_HURT)
|
||||
if (prob(15)) M.Weaken(5)
|
||||
M.apply_damage(8,def_zone = BP_HEAD)
|
||||
visible_message("<span class='danger'>[G.assailant] slams [G.affecting]'s face against \the [src]!</span>")
|
||||
if(material)
|
||||
playsound(src, material.tableslam_noise, 50, 1)
|
||||
else
|
||||
playsound(src, 'sound/weapons/tablehit1.ogg', 50, 1)
|
||||
var/list/L = take_damage(rand(1,5))
|
||||
// Shards. Extra damage, plus potentially the fact YOU LITERALLY HAVE A PIECE OF GLASS/METAL/WHATEVER IN YOUR FACE
|
||||
for(var/obj/item/weapon/material/shard/S in L)
|
||||
if(prob(50))
|
||||
M.visible_message("<span class='danger'>\The [S] slices [M]'s face messily!</span>",
|
||||
"<span class='danger'>\The [S] slices your face messily!</span>")
|
||||
M.apply_damage(10, def_zone = BP_HEAD)
|
||||
if(prob(2))
|
||||
M.embed(S, def_zone = BP_HEAD)
|
||||
else
|
||||
to_chat(user, "<span class='danger'>You need a better grip to do that!</span>")
|
||||
return
|
||||
else if(G.state > GRAB_AGGRESSIVE || world.time >= (G.last_action + UPGRADE_COOLDOWN))
|
||||
M.forceMove(get_turf(src))
|
||||
M.Weaken(5)
|
||||
visible_message("<span class='danger'>[G.assailant] puts [G.affecting] on \the [src].</span>")
|
||||
qdel(W)
|
||||
return
|
||||
|
||||
// Handle dismantling or placing things on the table from here on.
|
||||
if(isrobot(user))
|
||||
return
|
||||
|
||||
if(W.loc != user) // This should stop mounted modules ending up outside the module.
|
||||
return
|
||||
|
||||
if(istype(W, /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, 'sound/weapons/blade1.ogg', 50, 1)
|
||||
playsound(src, "sparks", 50, 1)
|
||||
user.visible_message("<span class='danger'>\The [src] was sliced apart by [user]!</span>")
|
||||
break_to_parts()
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/melee/changeling/arm_blade))
|
||||
user.visible_message("<span class='danger'>\The [src] was sliced apart by [user]!</span>")
|
||||
break_to_parts()
|
||||
return
|
||||
|
||||
if(can_plate && !material)
|
||||
to_chat(user, "<span class='warning'>There's nothing to put \the [W] on! Try adding plating to \the [src] first.</span>")
|
||||
return
|
||||
|
||||
// Placing stuff on tables
|
||||
if(user.unEquip(W, 0, src.loc) && user.is_preference_enabled(/datum/client_preference/precision_placement))
|
||||
auto_align(W, click_parameters)
|
||||
return 1
|
||||
|
||||
/obj/structure/table/attack_tk() // no telehulk sorry
|
||||
return
|
||||
/obj/structure/table/CanPass(atom/movable/mover, turf/target)
|
||||
if(istype(mover,/obj/item/projectile))
|
||||
return (check_cover(mover,target))
|
||||
if(flipped == 1)
|
||||
if(get_dir(mover, target) == reverse_dir[dir]) // From elsewhere to here, can't move against our dir
|
||||
return !density
|
||||
return TRUE
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return TRUE
|
||||
if(locate(/obj/structure/table/bench) in get_turf(mover))
|
||||
return FALSE
|
||||
var/obj/structure/table/table = locate(/obj/structure/table) in get_turf(mover)
|
||||
if(table && !(table.flipped == 1))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/structure/table/climb_to(mob/living/mover)
|
||||
if(flipped == 1 && mover.loc == loc)
|
||||
var/turf/T = get_step(src, dir)
|
||||
if(T.Enter(mover))
|
||||
return T
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/Uncross(atom/movable/mover, turf/target)
|
||||
if(flipped == 1 && (get_dir(mover, target) == dir)) // From here to elsewhere, can't move in our dir
|
||||
return !density
|
||||
return TRUE
|
||||
|
||||
//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
|
||||
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)
|
||||
var/chance = 20
|
||||
if (ismob(P.original))
|
||||
var/mob/M = P.original
|
||||
if (M.lying)
|
||||
chance += 20 //Lying down lets you catch less bullets
|
||||
if(flipped==1)
|
||||
if(get_dir(loc, from) == dir) //Flipped tables catch mroe bullets
|
||||
chance += 20
|
||||
else
|
||||
return 1 //But only from one side
|
||||
if(prob(chance))
|
||||
health -= P.damage/2
|
||||
if (health > 0)
|
||||
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
|
||||
return 0
|
||||
else
|
||||
visible_message("<span class='warning'>[src] breaks down!</span>")
|
||||
break_to_parts()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
/obj/structure/table/MouseDrop_T(obj/O, mob/user, src_location, over_location, src_control, over_control, params)
|
||||
if(ismob(O.loc)) //If placing an item
|
||||
if(!isitem(O) || user.get_active_hand() != O)
|
||||
return ..()
|
||||
if(isrobot(user))
|
||||
return
|
||||
user.drop_item()
|
||||
if(O.loc != src.loc)
|
||||
step(O, get_dir(O, src))
|
||||
|
||||
else if(isturf(O.loc) && isitem(O)) //If pushing an item on the tabletop
|
||||
var/obj/item/I = O
|
||||
if(I.anchored)
|
||||
return
|
||||
|
||||
if((isliving(user)) && (Adjacent(user)) && !(user.incapacitated()))
|
||||
if(O.w_class <= user.can_pull_size)
|
||||
O.forceMove(loc)
|
||||
auto_align(I, params, TRUE)
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [I] is too big for you to move!"))
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, var/hit_modifier, var/click_parameters)
|
||||
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))
|
||||
var/mob/living/M = G.affecting
|
||||
var/obj/occupied = turf_is_crowded()
|
||||
if(occupied)
|
||||
to_chat(user, "<span class='danger'>There's \a [occupied] in the way.</span>")
|
||||
return
|
||||
if(!user.Adjacent(M))
|
||||
return
|
||||
if (G.state < 2)
|
||||
if(user.a_intent == I_HURT)
|
||||
if (prob(15)) M.Weaken(5)
|
||||
M.apply_damage(8,def_zone = BP_HEAD)
|
||||
visible_message("<span class='danger'>[G.assailant] slams [G.affecting]'s face against \the [src]!</span>")
|
||||
if(material)
|
||||
playsound(src, material.tableslam_noise, 50, 1)
|
||||
else
|
||||
playsound(src, 'sound/weapons/tablehit1.ogg', 50, 1)
|
||||
var/list/L = take_damage(rand(1,5))
|
||||
// Shards. Extra damage, plus potentially the fact YOU LITERALLY HAVE A PIECE OF GLASS/METAL/WHATEVER IN YOUR FACE
|
||||
for(var/obj/item/weapon/material/shard/S in L)
|
||||
if(prob(50))
|
||||
M.visible_message("<span class='danger'>\The [S] slices [M]'s face messily!</span>",
|
||||
"<span class='danger'>\The [S] slices your face messily!</span>")
|
||||
M.apply_damage(10, def_zone = BP_HEAD)
|
||||
if(prob(2))
|
||||
M.embed(S, def_zone = BP_HEAD)
|
||||
else
|
||||
to_chat(user, "<span class='danger'>You need a better grip to do that!</span>")
|
||||
return
|
||||
else if(G.state > GRAB_AGGRESSIVE || world.time >= (G.last_action + UPGRADE_COOLDOWN))
|
||||
M.forceMove(get_turf(src))
|
||||
M.Weaken(5)
|
||||
visible_message("<span class='danger'>[G.assailant] puts [G.affecting] on \the [src].</span>")
|
||||
qdel(W)
|
||||
return
|
||||
|
||||
// Handle dismantling or placing things on the table from here on.
|
||||
if(isrobot(user))
|
||||
return
|
||||
|
||||
if(W.loc != user) // This should stop mounted modules ending up outside the module.
|
||||
return
|
||||
|
||||
if(istype(W, /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, 'sound/weapons/blade1.ogg', 50, 1)
|
||||
playsound(src, "sparks", 50, 1)
|
||||
user.visible_message("<span class='danger'>\The [src] was sliced apart by [user]!</span>")
|
||||
break_to_parts()
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/melee/changeling/arm_blade))
|
||||
user.visible_message("<span class='danger'>\The [src] was sliced apart by [user]!</span>")
|
||||
break_to_parts()
|
||||
return
|
||||
|
||||
if(can_plate && !material)
|
||||
to_chat(user, "<span class='warning'>There's nothing to put \the [W] on! Try adding plating to \the [src] first.</span>")
|
||||
return
|
||||
|
||||
// Placing stuff on tables
|
||||
if(user.unEquip(W, 0, src.loc) && user.is_preference_enabled(/datum/client_preference/precision_placement))
|
||||
auto_align(W, click_parameters)
|
||||
return 1
|
||||
|
||||
/obj/structure/table/attack_tk() // no telehulk sorry
|
||||
return
|
||||
|
||||
+248
-248
@@ -1,249 +1,249 @@
|
||||
//TABLE PRESETS
|
||||
/obj/structure/table/standard
|
||||
icon_state = "plain_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/standard/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/steel
|
||||
icon_state = "plain_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/steel/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/marble
|
||||
icon_state = "stone_preview"
|
||||
color = "#CCCCCC"
|
||||
|
||||
/obj/structure/table/marble/New()
|
||||
material = get_material_by_name("marble")
|
||||
..()
|
||||
|
||||
/obj/structure/table/reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/reinforced/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/steel_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/steel_reinforced/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/wooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/wooden_reinforced/New()
|
||||
material = get_material_by_name("wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/woodentable
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/woodentable/New()
|
||||
material = get_material_by_name("wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/sifwoodentable
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/sifwoodentable/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/sifwooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/sifwooden_reinforced/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/hardwoodtable
|
||||
icon_state = "stone_preview"
|
||||
color = "#42291a"
|
||||
|
||||
/obj/structure/table/hardwoodtable/Initialize(mapload)
|
||||
material = get_material_by_name("hardwood")
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/gamblingtable
|
||||
icon_state = "gamble_preview"
|
||||
|
||||
/obj/structure/table/gamblingtable/New()
|
||||
material = get_material_by_name("wood")
|
||||
carpeted = 1
|
||||
..()
|
||||
|
||||
/obj/structure/table/glass
|
||||
icon_state = "plain_preview"
|
||||
color = "#00E1FF"
|
||||
alpha = 77 // 0.3 * 255
|
||||
|
||||
/obj/structure/table/glass/New()
|
||||
material = get_material_by_name("glass")
|
||||
..()
|
||||
|
||||
/obj/structure/table/borosilicate
|
||||
icon_state = "plain_preview"
|
||||
color = "#4D3EAC"
|
||||
alpha = 77
|
||||
|
||||
/obj/structure/table/borosilicate/New()
|
||||
material = get_material_by_name("borosilicate glass")
|
||||
..()
|
||||
|
||||
/obj/structure/table/holotable
|
||||
icon_state = "holo_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/holotable/New()
|
||||
material = get_material_by_name("holo[DEFAULT_TABLE_MATERIAL]")
|
||||
..()
|
||||
|
||||
/obj/structure/table/woodentable/holotable
|
||||
icon_state = "holo_preview"
|
||||
|
||||
/obj/structure/table/woodentable/holotable/New()
|
||||
material = get_material_by_name("holowood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/alien
|
||||
name = "alien table"
|
||||
desc = "Advanced flat surface technology at work!"
|
||||
icon_state = "alien_preview"
|
||||
can_reinforce = FALSE
|
||||
can_plate = FALSE
|
||||
|
||||
/obj/structure/table/alien/New()
|
||||
material = get_material_by_name("alium")
|
||||
verbs -= /obj/structure/table/verb/do_flip
|
||||
verbs -= /obj/structure/table/proc/do_put
|
||||
..()
|
||||
|
||||
/obj/structure/table/alien/dismantle(obj/item/weapon/tool/wrench/W, mob/user)
|
||||
to_chat(user, "<span class='warning'>You cannot dismantle \the [src].</span>")
|
||||
return
|
||||
|
||||
//BENCH PRESETS
|
||||
/obj/structure/table/bench/standard
|
||||
icon_state = "plain_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/standard/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/steel
|
||||
icon_state = "plain_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/bench/steel/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
|
||||
/obj/structure/table/bench/marble
|
||||
icon_state = "stone_preview"
|
||||
color = "#CCCCCC"
|
||||
|
||||
/obj/structure/table/bench/marble/New()
|
||||
material = get_material_by_name("marble")
|
||||
..()
|
||||
/*
|
||||
/obj/structure/table/bench/reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/reinforced/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/steel_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/bench/steel_reinforced/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/wooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/wooden_reinforced/New()
|
||||
material = get_material_by_name("wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
*/
|
||||
/obj/structure/table/bench/wooden
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/wooden/New()
|
||||
material = get_material_by_name("wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/sifwooden
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/sifwooden/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/sifwooden/padded
|
||||
icon_state = "padded_preview"
|
||||
carpeted = 1
|
||||
|
||||
/obj/structure/table/bench/padded
|
||||
icon_state = "padded_preview"
|
||||
|
||||
/obj/structure/table/bench/padded/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
carpeted = 1
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/glass
|
||||
icon_state = "plain_preview"
|
||||
color = "#00E1FF"
|
||||
alpha = 77 // 0.3 * 255
|
||||
|
||||
/obj/structure/table/bench/glass/New()
|
||||
material = get_material_by_name("glass")
|
||||
..()
|
||||
|
||||
/*
|
||||
/obj/structure/table/bench/holotable
|
||||
icon_state = "holo_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/holotable/New()
|
||||
material = get_material_by_name("holo[DEFAULT_TABLE_MATERIAL]")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/wooden/holotable
|
||||
icon_state = "holo_preview"
|
||||
|
||||
/obj/structure/table/bench/wooden/holotable/New()
|
||||
material = get_material_by_name("holowood")
|
||||
..()
|
||||
//TABLE PRESETS
|
||||
/obj/structure/table/standard
|
||||
icon_state = "plain_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/standard/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/steel
|
||||
icon_state = "plain_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/steel/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/marble
|
||||
icon_state = "stone_preview"
|
||||
color = "#CCCCCC"
|
||||
|
||||
/obj/structure/table/marble/New()
|
||||
material = get_material_by_name("marble")
|
||||
..()
|
||||
|
||||
/obj/structure/table/reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/reinforced/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/steel_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/steel_reinforced/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/wooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/wooden_reinforced/New()
|
||||
material = get_material_by_name("wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/woodentable
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/woodentable/New()
|
||||
material = get_material_by_name("wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/sifwoodentable
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/sifwoodentable/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/sifwooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/sifwooden_reinforced/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/hardwoodtable
|
||||
icon_state = "stone_preview"
|
||||
color = "#42291a"
|
||||
|
||||
/obj/structure/table/hardwoodtable/Initialize(mapload)
|
||||
material = get_material_by_name("hardwood")
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/gamblingtable
|
||||
icon_state = "gamble_preview"
|
||||
|
||||
/obj/structure/table/gamblingtable/New()
|
||||
material = get_material_by_name("wood")
|
||||
carpeted = 1
|
||||
..()
|
||||
|
||||
/obj/structure/table/glass
|
||||
icon_state = "plain_preview"
|
||||
color = "#00E1FF"
|
||||
alpha = 77 // 0.3 * 255
|
||||
|
||||
/obj/structure/table/glass/New()
|
||||
material = get_material_by_name("glass")
|
||||
..()
|
||||
|
||||
/obj/structure/table/borosilicate
|
||||
icon_state = "plain_preview"
|
||||
color = "#4D3EAC"
|
||||
alpha = 77
|
||||
|
||||
/obj/structure/table/borosilicate/New()
|
||||
material = get_material_by_name("borosilicate glass")
|
||||
..()
|
||||
|
||||
/obj/structure/table/holotable
|
||||
icon_state = "holo_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/holotable/New()
|
||||
material = get_material_by_name("holo[DEFAULT_TABLE_MATERIAL]")
|
||||
..()
|
||||
|
||||
/obj/structure/table/woodentable/holotable
|
||||
icon_state = "holo_preview"
|
||||
|
||||
/obj/structure/table/woodentable/holotable/New()
|
||||
material = get_material_by_name("holowood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/alien
|
||||
name = "alien table"
|
||||
desc = "Advanced flat surface technology at work!"
|
||||
icon_state = "alien_preview"
|
||||
can_reinforce = FALSE
|
||||
can_plate = FALSE
|
||||
|
||||
/obj/structure/table/alien/New()
|
||||
material = get_material_by_name("alium")
|
||||
verbs -= /obj/structure/table/verb/do_flip
|
||||
verbs -= /obj/structure/table/proc/do_put
|
||||
..()
|
||||
|
||||
/obj/structure/table/alien/dismantle(obj/item/weapon/tool/wrench/W, mob/user)
|
||||
to_chat(user, "<span class='warning'>You cannot dismantle \the [src].</span>")
|
||||
return
|
||||
|
||||
//BENCH PRESETS
|
||||
/obj/structure/table/bench/standard
|
||||
icon_state = "plain_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/standard/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/steel
|
||||
icon_state = "plain_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/bench/steel/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
|
||||
/obj/structure/table/bench/marble
|
||||
icon_state = "stone_preview"
|
||||
color = "#CCCCCC"
|
||||
|
||||
/obj/structure/table/bench/marble/New()
|
||||
material = get_material_by_name("marble")
|
||||
..()
|
||||
/*
|
||||
/obj/structure/table/bench/reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/reinforced/New()
|
||||
material = get_material_by_name(DEFAULT_TABLE_MATERIAL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/steel_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#666666"
|
||||
|
||||
/obj/structure/table/bench/steel_reinforced/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/wooden_reinforced
|
||||
icon_state = "reinf_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/wooden_reinforced/New()
|
||||
material = get_material_by_name("wood")
|
||||
reinforced = get_material_by_name(MAT_STEEL)
|
||||
..()
|
||||
*/
|
||||
/obj/structure/table/bench/wooden
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/wooden/New()
|
||||
material = get_material_by_name("wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/sifwooden
|
||||
icon_state = "plain_preview"
|
||||
color = "#824B28"
|
||||
|
||||
/obj/structure/table/bench/sifwooden/New()
|
||||
material = get_material_by_name("alien wood")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/sifwooden/padded
|
||||
icon_state = "padded_preview"
|
||||
carpeted = 1
|
||||
|
||||
/obj/structure/table/bench/padded
|
||||
icon_state = "padded_preview"
|
||||
|
||||
/obj/structure/table/bench/padded/New()
|
||||
material = get_material_by_name(MAT_STEEL)
|
||||
carpeted = 1
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/glass
|
||||
icon_state = "plain_preview"
|
||||
color = "#00E1FF"
|
||||
alpha = 77 // 0.3 * 255
|
||||
|
||||
/obj/structure/table/bench/glass/New()
|
||||
material = get_material_by_name("glass")
|
||||
..()
|
||||
|
||||
/*
|
||||
/obj/structure/table/bench/holotable
|
||||
icon_state = "holo_preview"
|
||||
color = "#EEEEEE"
|
||||
|
||||
/obj/structure/table/bench/holotable/New()
|
||||
material = get_material_by_name("holo[DEFAULT_TABLE_MATERIAL]")
|
||||
..()
|
||||
|
||||
/obj/structure/table/bench/wooden/holotable
|
||||
icon_state = "holo_preview"
|
||||
|
||||
/obj/structure/table/bench/wooden/holotable/New()
|
||||
material = get_material_by_name("holowood")
|
||||
..()
|
||||
*/
|
||||
+28
-28
@@ -1,28 +1,28 @@
|
||||
/obj/structure/table/rack
|
||||
name = "rack"
|
||||
desc = "Different from the Middle Ages version."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "rack"
|
||||
can_plate = 0
|
||||
can_reinforce = 0
|
||||
flipped = -1
|
||||
|
||||
/obj/structure/table/rack/New()
|
||||
..()
|
||||
verbs -= /obj/structure/table/verb/do_flip
|
||||
verbs -= /obj/structure/table/proc/do_put
|
||||
|
||||
/obj/structure/table/rack/update_connections()
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/update_desc()
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/update_icon()
|
||||
if(material) //VOREStation Add for rack colors based on materials
|
||||
color = material.icon_colour
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/holorack/dismantle(obj/item/weapon/tool/wrench/W, mob/user)
|
||||
to_chat(user, "<span class='warning'>You cannot dismantle \the [src].</span>")
|
||||
return
|
||||
/obj/structure/table/rack
|
||||
name = "rack"
|
||||
desc = "Different from the Middle Ages version."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "rack"
|
||||
can_plate = 0
|
||||
can_reinforce = 0
|
||||
flipped = -1
|
||||
|
||||
/obj/structure/table/rack/New()
|
||||
..()
|
||||
verbs -= /obj/structure/table/verb/do_flip
|
||||
verbs -= /obj/structure/table/proc/do_put
|
||||
|
||||
/obj/structure/table/rack/update_connections()
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/update_desc()
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/update_icon()
|
||||
if(material) //VOREStation Add for rack colors based on materials
|
||||
color = material.icon_colour
|
||||
return
|
||||
|
||||
/obj/structure/table/rack/holorack/dismantle(obj/item/weapon/tool/wrench/W, mob/user)
|
||||
to_chat(user, "<span class='warning'>You cannot dismantle \the [src].</span>")
|
||||
return
|
||||
|
||||
+476
-476
@@ -1,476 +1,476 @@
|
||||
var/list/table_icon_cache = list()
|
||||
|
||||
/obj/structure/table
|
||||
name = "table frame"
|
||||
icon = 'icons/obj/tables.dmi'
|
||||
icon_state = "frame"
|
||||
desc = "It's a table, for putting things on. Or standing on, if you really want to."
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
climbable = TRUE
|
||||
layer = TABLE_LAYER
|
||||
throwpass = 1
|
||||
surgery_odds = 50 //VOREStation Edit
|
||||
var/flipped = 0
|
||||
var/maxhealth = 10
|
||||
var/health = 10
|
||||
|
||||
// For racks.
|
||||
var/can_reinforce = 1
|
||||
var/can_plate = 1
|
||||
|
||||
var/manipulating = 0
|
||||
var/datum/material/material = null
|
||||
var/datum/material/reinforced = null
|
||||
|
||||
// Gambling tables. I'd prefer reinforced with carpet/felt/cloth/whatever, but AFAIK it's either harder or impossible to get /obj/item/stack/material of those.
|
||||
// Convert if/when you can easily get stacks of these.
|
||||
var/carpeted = 0
|
||||
var/carpeted_type = /obj/item/stack/tile/carpet
|
||||
|
||||
/obj/structure/table/examine_icon()
|
||||
return icon(icon=initial(icon), icon_state=initial(icon_state)) //Basically the map preview version
|
||||
|
||||
/obj/structure/table/proc/update_material()
|
||||
var/old_maxhealth = maxhealth
|
||||
if(!material)
|
||||
maxhealth = 10
|
||||
else
|
||||
maxhealth = material.integrity / 2
|
||||
|
||||
if(reinforced)
|
||||
maxhealth += reinforced.integrity / 2
|
||||
|
||||
health += maxhealth - old_maxhealth
|
||||
|
||||
/obj/structure/table/take_damage(amount)
|
||||
// If the table is made of a brittle material, and is *not* reinforced with a non-brittle material, damage is multiplied by TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
if(material && material.is_brittle())
|
||||
if(reinforced)
|
||||
if(reinforced.is_brittle())
|
||||
amount *= TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
else
|
||||
amount *= TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
health -= amount
|
||||
if(health <= 0)
|
||||
visible_message("<span class='warning'>\The [src] breaks down!</span>")
|
||||
return break_to_parts() // if we break and form shards, return them to the caller to do !FUN! things with
|
||||
|
||||
/obj/structure/table/blob_act()
|
||||
take_damage(100)
|
||||
|
||||
/obj/structure/table/Initialize()
|
||||
. = ..()
|
||||
|
||||
// One table per turf.
|
||||
for(var/obj/structure/table/T in loc)
|
||||
if(T != src)
|
||||
// There's another table here that's not us, break to metal.
|
||||
// break_to_parts calls qdel(src)
|
||||
break_to_parts(full_return = 1)
|
||||
return
|
||||
|
||||
// reset color/alpha, since they're set for nice map previews
|
||||
color = "#ffffff"
|
||||
alpha = 255
|
||||
update_connections(ticker && ticker.current_state == GAME_STATE_PLAYING)
|
||||
update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
|
||||
/obj/structure/table/Destroy()
|
||||
material = null
|
||||
reinforced = null
|
||||
update_connections(1) // Update tables around us to ignore us (material=null forces no connections)
|
||||
for(var/obj/structure/table/T in oview(src, 1))
|
||||
T.update_icon()
|
||||
. = ..()
|
||||
|
||||
/obj/structure/table/examine(mob/user)
|
||||
. = ..()
|
||||
if(health < maxhealth)
|
||||
switch(health / maxhealth)
|
||||
if(0.0 to 0.5)
|
||||
. += "<span class='warning'>It looks severely damaged!</span>"
|
||||
if(0.25 to 0.5)
|
||||
. += "<span class='warning'>It looks damaged!</span>"
|
||||
if(0.5 to 1.0)
|
||||
. += "<span class='notice'>It has a few scrapes and dents.</span>"
|
||||
|
||||
/obj/structure/table/attackby(obj/item/weapon/W, mob/user)
|
||||
|
||||
if(reinforced && W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
remove_reinforced(W, user)
|
||||
if(!reinforced)
|
||||
update_desc()
|
||||
update_icon()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
if(carpeted && W.has_tool_quality(TOOL_CROWBAR))
|
||||
user.visible_message("<b>\The [user]</b> removes the carpet from \the [src].",
|
||||
"<span class='notice'>You remove the carpet from \the [src].</span>")
|
||||
new carpeted_type(loc)
|
||||
carpeted = 0
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
if(!carpeted && material && istype(W, /obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/C = W
|
||||
if(C.use(1))
|
||||
user.visible_message("<b>\The [user]</b> adds \the [C] to \the [src].",
|
||||
"<span class='notice'>You add \the [C] to \the [src].</span>")
|
||||
carpeted = 1
|
||||
carpeted_type = W.type
|
||||
update_icon()
|
||||
return 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You don't have enough carpet!</span>")
|
||||
|
||||
if(!reinforced && !carpeted && material && W.has_tool_quality(TOOL_WRENCH))
|
||||
remove_material(W, user)
|
||||
if(!material)
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
for(var/obj/structure/table/T in oview(src, 1))
|
||||
T.update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
if(!carpeted && !reinforced && !material && W.has_tool_quality(TOOL_WRENCH))
|
||||
dismantle(W, user)
|
||||
return 1
|
||||
|
||||
if(health < maxhealth && W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/F = W.get_welder()
|
||||
if(F.welding)
|
||||
to_chat(user, "<span class='notice'>You begin reparing damage to \the [src].</span>")
|
||||
playsound(src, F.usesound, 50, 1)
|
||||
if(!do_after(user, 20 * F.toolspeed) || !F.remove_fuel(1, user))
|
||||
return
|
||||
user.visible_message("<b>\The [user]</b> repairs some damage to \the [src].",
|
||||
"<span class='notice'>You repair some damage to \the [src].</span>")
|
||||
health = max(health+(maxhealth/5), maxhealth) // 20% repair per application
|
||||
return 1
|
||||
|
||||
if(!material && can_plate && istype(W, /obj/item/stack/material))
|
||||
material = common_material_add(W, user, "plat")
|
||||
if(material)
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/attack_hand(mob/user as mob)
|
||||
if(istype(user, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/X = user
|
||||
if(istype(X.species, /datum/species/xenos))
|
||||
src.attack_alien(user)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/structure/table/attack_alien(mob/user as mob)
|
||||
visible_message("<span class='danger'>\The [user] tears apart \the [src]!</span>")
|
||||
src.break_to_parts()
|
||||
|
||||
/obj/structure/table/attack_generic(mob/user as mob, var/damage)
|
||||
if(damage >= 10)
|
||||
if(reinforced && prob(70))
|
||||
visible_message("<span class='danger'>\The [user] smashes against \the [src]!</span>")
|
||||
take_damage(damage/2)
|
||||
user.do_attack_animation(src)
|
||||
..()
|
||||
else
|
||||
visible_message("<span class='danger'>\The [user] tears apart \the [src]!</span>")
|
||||
src.break_to_parts()
|
||||
user.do_attack_animation(src)
|
||||
return 1
|
||||
visible_message("<b>\The [user]</b> scratches at \the [src]!")
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/MouseDrop_T(obj/item/stack/material/what)
|
||||
if(can_reinforce && isliving(usr) && (!usr.stat) && istype(what) && usr.get_active_hand() == what && Adjacent(usr))
|
||||
reinforce_table(what, usr)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/proc/reinforce_table(obj/item/stack/material/S, mob/user)
|
||||
if(reinforced)
|
||||
to_chat(user, "<span class='warning'>\The [src] is already reinforced!</span>")
|
||||
return
|
||||
|
||||
if(!can_reinforce)
|
||||
to_chat(user, "<span class='warning'>\The [src] cannot be reinforced!</span>")
|
||||
return
|
||||
|
||||
if(!material)
|
||||
to_chat(user, "<span class='warning'>Plate \the [src] before reinforcing it!</span>")
|
||||
return
|
||||
|
||||
if(flipped)
|
||||
to_chat(user, "<span class='warning'>Put \the [src] back in place before reinforcing it!</span>")
|
||||
return
|
||||
|
||||
reinforced = common_material_add(S, user, "reinforc")
|
||||
if(reinforced)
|
||||
update_desc()
|
||||
update_icon()
|
||||
update_material()
|
||||
|
||||
/obj/structure/table/proc/update_desc()
|
||||
if(material)
|
||||
name = "[material.display_name] table"
|
||||
else
|
||||
name = "table frame"
|
||||
|
||||
if(reinforced)
|
||||
name = "reinforced [name]"
|
||||
desc = "[initial(desc)] This one seems to be reinforced with [reinforced.display_name]."
|
||||
else
|
||||
desc = initial(desc)
|
||||
|
||||
// Returns the material to set the table to.
|
||||
/obj/structure/table/proc/common_material_add(obj/item/stack/material/S, mob/user, verb) // Verb is actually verb without 'e' or 'ing', which is added. Works for 'plate'/'plating' and 'reinforce'/'reinforcing'.
|
||||
var/datum/material/M = S.get_material()
|
||||
if(!istype(M))
|
||||
to_chat(user, "<span class='warning'>You cannot [verb]e \the [src] with \the [S].</span>")
|
||||
return null
|
||||
|
||||
if(manipulating) return M
|
||||
manipulating = 1
|
||||
to_chat(user, "<span class='notice'>You begin [verb]ing \the [src] with [M.display_name].</span>")
|
||||
if(!do_after(user, 20) || !S.use(1))
|
||||
manipulating = 0
|
||||
return null
|
||||
user.visible_message("<span class='notice'>\The [user] [verb]es \the [src] with [M.display_name].</span>", "<span class='notice'>You finish [verb]ing \the [src].</span>")
|
||||
manipulating = 0
|
||||
return M
|
||||
|
||||
// Returns the material to set the table to.
|
||||
/obj/structure/table/proc/common_material_remove(mob/user, datum/material/M, delay, what, type_holding, sound)
|
||||
if(!M.stack_type)
|
||||
to_chat(user, "<span class='warning'>You are unable to remove the [what] from this [src]!</span>")
|
||||
return M
|
||||
|
||||
if(manipulating) return M
|
||||
manipulating = 1
|
||||
user.visible_message("<b>\The [user]</b> begins removing the [type_holding] holding \the [src]'s [M.display_name] [what] in place.",
|
||||
"<span class='notice'>You begin removing the [type_holding] holding \the [src]'s [M.display_name] [what] in place.</span>")
|
||||
if(sound)
|
||||
playsound(src, sound, 50, 1)
|
||||
if(!do_after(user, delay))
|
||||
manipulating = 0
|
||||
return M
|
||||
user.visible_message("<b>\The [user]</b> removes the [M.display_name] [what] from \the [src].",
|
||||
"<span class='notice'>You remove the [M.display_name] [what] from \the [src].</span>")
|
||||
new M.stack_type(src.loc)
|
||||
manipulating = 0
|
||||
return null
|
||||
|
||||
/obj/structure/table/proc/remove_reinforced(obj/item/weapon/S, mob/user)
|
||||
reinforced = common_material_remove(user, reinforced, 40 * S.toolspeed, "reinforcements", "screws", S.usesound)
|
||||
|
||||
/obj/structure/table/proc/remove_material(obj/item/weapon/W, mob/user)
|
||||
material = common_material_remove(user, material, 20 * W.toolspeed, "plating", "bolts", W.usesound)
|
||||
|
||||
/obj/structure/table/proc/dismantle(obj/item/W, mob/user)
|
||||
if(manipulating) return
|
||||
manipulating = 1
|
||||
user.visible_message("<b>\The [user]</b> begins dismantling \the [src].",
|
||||
"<span class='notice'>You begin dismantling \the [src].</span>")
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
if(!do_after(user, 20 * W.toolspeed))
|
||||
manipulating = 0
|
||||
return
|
||||
user.visible_message("<b>\The [user]</b> dismantles \the [src].",
|
||||
"<span class='notice'>You dismantle \the [src].</span>")
|
||||
new /obj/item/stack/material/steel(src.loc)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
// Returns a list of /obj/item/weapon/material/shard objects that were created as a result of this table's breakage.
|
||||
// Used for !fun! things such as embedding shards in the faces of tableslammed people.
|
||||
|
||||
// The repeated
|
||||
// S = [x].place_shard(loc)
|
||||
// if(S) shards += S
|
||||
// is to avoid filling the list with nulls, as place_shard won't place shards of certain materials (holo-wood, holo-steel)
|
||||
|
||||
/obj/structure/table/proc/break_to_parts(full_return = 0)
|
||||
var/list/shards = list()
|
||||
var/obj/item/weapon/material/shard/S = null
|
||||
if(reinforced)
|
||||
if(reinforced.stack_type && (full_return || prob(20)))
|
||||
reinforced.place_sheet(loc, 1)
|
||||
else
|
||||
S = reinforced.place_shard(loc)
|
||||
if(S) shards += S
|
||||
if(material)
|
||||
if(material.stack_type && (full_return || prob(20)))
|
||||
material.place_sheet(loc, 1)
|
||||
else
|
||||
S = material.place_shard(loc)
|
||||
if(S) shards += S
|
||||
if(carpeted && (full_return || prob(50))) // Higher chance to get the carpet back intact, since there's no non-intact option
|
||||
new carpeted_type(src.loc)
|
||||
if(full_return || prob(20))
|
||||
new /obj/item/stack/material/steel(src.loc)
|
||||
else
|
||||
var/datum/material/M = get_material_by_name(MAT_STEEL)
|
||||
S = M.place_shard(loc)
|
||||
if(S) shards += S
|
||||
qdel(src)
|
||||
return shards
|
||||
|
||||
/obj/structure/table/can_visually_connect_to(var/obj/structure/S)
|
||||
if(istype(S,/obj/structure/table/bench) && !istype(src,/obj/structure/table/bench))
|
||||
return FALSE
|
||||
if(istype(src,/obj/structure/table/bench) && !istype(S,/obj/structure/table/bench))
|
||||
return FALSE
|
||||
if(istype(S,/obj/structure/table/rack) && !istype(src,/obj/structure/table/rack))
|
||||
return FALSE
|
||||
if(istype(src,/obj/structure/table/rack) && !istype(S,/obj/structure/table/rack))
|
||||
return FALSE
|
||||
if(istype(S,/obj/structure/table))
|
||||
return TRUE
|
||||
..()
|
||||
|
||||
/proc/get_table_image(var/icon/ticon,var/ticonstate,var/tdir,var/tcolor,var/talpha)
|
||||
var/icon_cache_key = "\ref[ticon]-[ticonstate]-[tdir]-[tcolor]-[talpha]"
|
||||
var/image/I = table_icon_cache[icon_cache_key]
|
||||
if(!I)
|
||||
I = image(icon = ticon, icon_state = ticonstate, dir = tdir)
|
||||
if(tcolor)
|
||||
I.color = tcolor
|
||||
if(talpha)
|
||||
I.alpha = talpha
|
||||
table_icon_cache[icon_cache_key] = I
|
||||
|
||||
return I
|
||||
|
||||
/obj/structure/table/update_icon()
|
||||
if(flipped != 1)
|
||||
icon_state = "blank"
|
||||
cut_overlays()
|
||||
|
||||
// Base frame shape. Mostly done for glass/diamond tables, where this is visible.
|
||||
for(var/i = 1 to 4)
|
||||
var/image/I = get_table_image(icon, connections?[i] || 0, 1<<(i-1))
|
||||
add_overlay(I)
|
||||
|
||||
// Standard table image
|
||||
if(material)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "[material.table_icon_base]_[connect]", 1<<(i-1), material.icon_colour, 255 * material.opacity)
|
||||
add_overlay(I)
|
||||
|
||||
// Reinforcements
|
||||
if(reinforced)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connect]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity)
|
||||
add_overlay(I)
|
||||
|
||||
if(carpeted)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "carpet_[connect]", 1<<(i-1))
|
||||
add_overlay(I)
|
||||
else
|
||||
cut_overlays()
|
||||
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 == 1 && T.dir == src.dir && material && T.material && T.material.name == material.name)
|
||||
type++
|
||||
tabledirs |= direction
|
||||
|
||||
type = "[type]"
|
||||
if (type=="1")
|
||||
if (tabledirs & turn(dir,90))
|
||||
type += "-"
|
||||
if (tabledirs & turn(dir,-90))
|
||||
type += "+"
|
||||
|
||||
icon_state = "flip[type]"
|
||||
if(material)
|
||||
var/image/I = image(icon, "[material.table_icon_base]_flip[type]")
|
||||
I.color = material.icon_colour
|
||||
I.alpha = 255 * material.opacity
|
||||
add_overlay(I)
|
||||
name = "[material.display_name] table"
|
||||
else
|
||||
name = "table frame"
|
||||
|
||||
if(reinforced)
|
||||
var/image/I = image(icon, "[reinforced.icon_reinf]_flip[type]")
|
||||
I.color = reinforced.icon_colour
|
||||
I.alpha = 255 * reinforced.opacity
|
||||
add_overlay(I)
|
||||
|
||||
if(carpeted)
|
||||
add_overlay("carpet_flip[type]")
|
||||
|
||||
/obj/structure/table/proc/get_all_connected_tables(var/list/connections)
|
||||
if(!connections)
|
||||
connections = list(src)
|
||||
else
|
||||
connections |= src
|
||||
if(istype(src, /obj/structure/table/rack))
|
||||
return connections
|
||||
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(src, direction)
|
||||
if(T)
|
||||
var/obj/structure/table/nextT = locate(/obj/structure/table) in T
|
||||
if(!nextT || !istype(nextT))
|
||||
continue
|
||||
if(istype(nextT, /obj/structure/table/rack) || (istype(nextT, /obj/structure/table/bench) && !istype(src, /obj/structure/table/bench)) || (!istype(nextT, /obj/structure/table/bench) && istype(src, /obj/structure/table/bench)))
|
||||
continue
|
||||
if(!(nextT in connections))
|
||||
connections |= nextT.get_all_connected_tables(connections)
|
||||
|
||||
return connections
|
||||
|
||||
|
||||
#define CORNER_NONE 0
|
||||
#define CORNER_COUNTERCLOCKWISE 1
|
||||
#define CORNER_DIAGONAL 2
|
||||
#define CORNER_CLOCKWISE 4
|
||||
|
||||
/*
|
||||
turn() is weird:
|
||||
turn(icon, angle) turns icon by angle degrees clockwise
|
||||
turn(matrix, angle) turns matrix by angle degrees clockwise
|
||||
turn(dir, angle) turns dir by angle degrees counter-clockwise
|
||||
*/
|
||||
|
||||
/proc/dirs_to_corner_states(list/dirs)
|
||||
if(!istype(dirs))
|
||||
return
|
||||
|
||||
var/list/ret = list(NORTHWEST, SOUTHEAST, NORTHEAST, SOUTHWEST)
|
||||
|
||||
for(var/i = 1 to ret.len)
|
||||
var/dir = ret[i]
|
||||
. = CORNER_NONE
|
||||
if(dir in dirs)
|
||||
. |= CORNER_DIAGONAL
|
||||
if(turn(dir,45) in dirs)
|
||||
. |= CORNER_COUNTERCLOCKWISE
|
||||
if(turn(dir,-45) in dirs)
|
||||
. |= CORNER_CLOCKWISE
|
||||
ret[i] = "[.]"
|
||||
|
||||
return ret
|
||||
|
||||
#undef CORNER_NONE
|
||||
#undef CORNER_COUNTERCLOCKWISE
|
||||
#undef CORNER_DIAGONAL
|
||||
#undef CORNER_CLOCKWISE
|
||||
var/list/table_icon_cache = list()
|
||||
|
||||
/obj/structure/table
|
||||
name = "table frame"
|
||||
icon = 'icons/obj/tables.dmi'
|
||||
icon_state = "frame"
|
||||
desc = "It's a table, for putting things on. Or standing on, if you really want to."
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
climbable = TRUE
|
||||
layer = TABLE_LAYER
|
||||
throwpass = 1
|
||||
surgery_odds = 50 //VOREStation Edit
|
||||
var/flipped = 0
|
||||
var/maxhealth = 10
|
||||
var/health = 10
|
||||
|
||||
// For racks.
|
||||
var/can_reinforce = 1
|
||||
var/can_plate = 1
|
||||
|
||||
var/manipulating = 0
|
||||
var/datum/material/material = null
|
||||
var/datum/material/reinforced = null
|
||||
|
||||
// Gambling tables. I'd prefer reinforced with carpet/felt/cloth/whatever, but AFAIK it's either harder or impossible to get /obj/item/stack/material of those.
|
||||
// Convert if/when you can easily get stacks of these.
|
||||
var/carpeted = 0
|
||||
var/carpeted_type = /obj/item/stack/tile/carpet
|
||||
|
||||
/obj/structure/table/examine_icon()
|
||||
return icon(icon=initial(icon), icon_state=initial(icon_state)) //Basically the map preview version
|
||||
|
||||
/obj/structure/table/proc/update_material()
|
||||
var/old_maxhealth = maxhealth
|
||||
if(!material)
|
||||
maxhealth = 10
|
||||
else
|
||||
maxhealth = material.integrity / 2
|
||||
|
||||
if(reinforced)
|
||||
maxhealth += reinforced.integrity / 2
|
||||
|
||||
health += maxhealth - old_maxhealth
|
||||
|
||||
/obj/structure/table/take_damage(amount)
|
||||
// If the table is made of a brittle material, and is *not* reinforced with a non-brittle material, damage is multiplied by TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
if(material && material.is_brittle())
|
||||
if(reinforced)
|
||||
if(reinforced.is_brittle())
|
||||
amount *= TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
else
|
||||
amount *= TABLE_BRITTLE_MATERIAL_MULTIPLIER
|
||||
health -= amount
|
||||
if(health <= 0)
|
||||
visible_message("<span class='warning'>\The [src] breaks down!</span>")
|
||||
return break_to_parts() // if we break and form shards, return them to the caller to do !FUN! things with
|
||||
|
||||
/obj/structure/table/blob_act()
|
||||
take_damage(100)
|
||||
|
||||
/obj/structure/table/Initialize()
|
||||
. = ..()
|
||||
|
||||
// One table per turf.
|
||||
for(var/obj/structure/table/T in loc)
|
||||
if(T != src)
|
||||
// There's another table here that's not us, break to metal.
|
||||
// break_to_parts calls qdel(src)
|
||||
break_to_parts(full_return = 1)
|
||||
return
|
||||
|
||||
// reset color/alpha, since they're set for nice map previews
|
||||
color = "#ffffff"
|
||||
alpha = 255
|
||||
update_connections(ticker && ticker.current_state == GAME_STATE_PLAYING)
|
||||
update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
|
||||
/obj/structure/table/Destroy()
|
||||
material = null
|
||||
reinforced = null
|
||||
update_connections(1) // Update tables around us to ignore us (material=null forces no connections)
|
||||
for(var/obj/structure/table/T in oview(src, 1))
|
||||
T.update_icon()
|
||||
. = ..()
|
||||
|
||||
/obj/structure/table/examine(mob/user)
|
||||
. = ..()
|
||||
if(health < maxhealth)
|
||||
switch(health / maxhealth)
|
||||
if(0.0 to 0.5)
|
||||
. += "<span class='warning'>It looks severely damaged!</span>"
|
||||
if(0.25 to 0.5)
|
||||
. += "<span class='warning'>It looks damaged!</span>"
|
||||
if(0.5 to 1.0)
|
||||
. += "<span class='notice'>It has a few scrapes and dents.</span>"
|
||||
|
||||
/obj/structure/table/attackby(obj/item/weapon/W, mob/user)
|
||||
|
||||
if(reinforced && W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
remove_reinforced(W, user)
|
||||
if(!reinforced)
|
||||
update_desc()
|
||||
update_icon()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
if(carpeted && W.has_tool_quality(TOOL_CROWBAR))
|
||||
user.visible_message("<b>\The [user]</b> removes the carpet from \the [src].",
|
||||
"<span class='notice'>You remove the carpet from \the [src].</span>")
|
||||
new carpeted_type(loc)
|
||||
carpeted = 0
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
if(!carpeted && material && istype(W, /obj/item/stack/tile/carpet))
|
||||
var/obj/item/stack/tile/carpet/C = W
|
||||
if(C.use(1))
|
||||
user.visible_message("<b>\The [user]</b> adds \the [C] to \the [src].",
|
||||
"<span class='notice'>You add \the [C] to \the [src].</span>")
|
||||
carpeted = 1
|
||||
carpeted_type = W.type
|
||||
update_icon()
|
||||
return 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You don't have enough carpet!</span>")
|
||||
|
||||
if(!reinforced && !carpeted && material && W.has_tool_quality(TOOL_WRENCH))
|
||||
remove_material(W, user)
|
||||
if(!material)
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
for(var/obj/structure/table/T in oview(src, 1))
|
||||
T.update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
if(!carpeted && !reinforced && !material && W.has_tool_quality(TOOL_WRENCH))
|
||||
dismantle(W, user)
|
||||
return 1
|
||||
|
||||
if(health < maxhealth && W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/F = W.get_welder()
|
||||
if(F.welding)
|
||||
to_chat(user, "<span class='notice'>You begin reparing damage to \the [src].</span>")
|
||||
playsound(src, F.usesound, 50, 1)
|
||||
if(!do_after(user, 20 * F.toolspeed) || !F.remove_fuel(1, user))
|
||||
return
|
||||
user.visible_message("<b>\The [user]</b> repairs some damage to \the [src].",
|
||||
"<span class='notice'>You repair some damage to \the [src].</span>")
|
||||
health = max(health+(maxhealth/5), maxhealth) // 20% repair per application
|
||||
return 1
|
||||
|
||||
if(!material && can_plate && istype(W, /obj/item/stack/material))
|
||||
material = common_material_add(W, user, "plat")
|
||||
if(material)
|
||||
update_connections(1)
|
||||
update_icon()
|
||||
update_desc()
|
||||
update_material()
|
||||
return 1
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/attack_hand(mob/user as mob)
|
||||
if(istype(user, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/X = user
|
||||
if(istype(X.species, /datum/species/xenos))
|
||||
src.attack_alien(user)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/structure/table/attack_alien(mob/user as mob)
|
||||
visible_message("<span class='danger'>\The [user] tears apart \the [src]!</span>")
|
||||
src.break_to_parts()
|
||||
|
||||
/obj/structure/table/attack_generic(mob/user as mob, var/damage)
|
||||
if(damage >= 10)
|
||||
if(reinforced && prob(70))
|
||||
visible_message("<span class='danger'>\The [user] smashes against \the [src]!</span>")
|
||||
take_damage(damage/2)
|
||||
user.do_attack_animation(src)
|
||||
..()
|
||||
else
|
||||
visible_message("<span class='danger'>\The [user] tears apart \the [src]!</span>")
|
||||
src.break_to_parts()
|
||||
user.do_attack_animation(src)
|
||||
return 1
|
||||
visible_message("<b>\The [user]</b> scratches at \the [src]!")
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/MouseDrop_T(obj/item/stack/material/what)
|
||||
if(can_reinforce && isliving(usr) && (!usr.stat) && istype(what) && usr.get_active_hand() == what && Adjacent(usr))
|
||||
reinforce_table(what, usr)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/table/proc/reinforce_table(obj/item/stack/material/S, mob/user)
|
||||
if(reinforced)
|
||||
to_chat(user, "<span class='warning'>\The [src] is already reinforced!</span>")
|
||||
return
|
||||
|
||||
if(!can_reinforce)
|
||||
to_chat(user, "<span class='warning'>\The [src] cannot be reinforced!</span>")
|
||||
return
|
||||
|
||||
if(!material)
|
||||
to_chat(user, "<span class='warning'>Plate \the [src] before reinforcing it!</span>")
|
||||
return
|
||||
|
||||
if(flipped)
|
||||
to_chat(user, "<span class='warning'>Put \the [src] back in place before reinforcing it!</span>")
|
||||
return
|
||||
|
||||
reinforced = common_material_add(S, user, "reinforc")
|
||||
if(reinforced)
|
||||
update_desc()
|
||||
update_icon()
|
||||
update_material()
|
||||
|
||||
/obj/structure/table/proc/update_desc()
|
||||
if(material)
|
||||
name = "[material.display_name] table"
|
||||
else
|
||||
name = "table frame"
|
||||
|
||||
if(reinforced)
|
||||
name = "reinforced [name]"
|
||||
desc = "[initial(desc)] This one seems to be reinforced with [reinforced.display_name]."
|
||||
else
|
||||
desc = initial(desc)
|
||||
|
||||
// Returns the material to set the table to.
|
||||
/obj/structure/table/proc/common_material_add(obj/item/stack/material/S, mob/user, verb) // Verb is actually verb without 'e' or 'ing', which is added. Works for 'plate'/'plating' and 'reinforce'/'reinforcing'.
|
||||
var/datum/material/M = S.get_material()
|
||||
if(!istype(M))
|
||||
to_chat(user, "<span class='warning'>You cannot [verb]e \the [src] with \the [S].</span>")
|
||||
return null
|
||||
|
||||
if(manipulating) return M
|
||||
manipulating = 1
|
||||
to_chat(user, "<span class='notice'>You begin [verb]ing \the [src] with [M.display_name].</span>")
|
||||
if(!do_after(user, 20) || !S.use(1))
|
||||
manipulating = 0
|
||||
return null
|
||||
user.visible_message("<span class='notice'>\The [user] [verb]es \the [src] with [M.display_name].</span>", "<span class='notice'>You finish [verb]ing \the [src].</span>")
|
||||
manipulating = 0
|
||||
return M
|
||||
|
||||
// Returns the material to set the table to.
|
||||
/obj/structure/table/proc/common_material_remove(mob/user, datum/material/M, delay, what, type_holding, sound)
|
||||
if(!M.stack_type)
|
||||
to_chat(user, "<span class='warning'>You are unable to remove the [what] from this [src]!</span>")
|
||||
return M
|
||||
|
||||
if(manipulating) return M
|
||||
manipulating = 1
|
||||
user.visible_message("<b>\The [user]</b> begins removing the [type_holding] holding \the [src]'s [M.display_name] [what] in place.",
|
||||
"<span class='notice'>You begin removing the [type_holding] holding \the [src]'s [M.display_name] [what] in place.</span>")
|
||||
if(sound)
|
||||
playsound(src, sound, 50, 1)
|
||||
if(!do_after(user, delay))
|
||||
manipulating = 0
|
||||
return M
|
||||
user.visible_message("<b>\The [user]</b> removes the [M.display_name] [what] from \the [src].",
|
||||
"<span class='notice'>You remove the [M.display_name] [what] from \the [src].</span>")
|
||||
new M.stack_type(src.loc)
|
||||
manipulating = 0
|
||||
return null
|
||||
|
||||
/obj/structure/table/proc/remove_reinforced(obj/item/weapon/S, mob/user)
|
||||
reinforced = common_material_remove(user, reinforced, 40 * S.toolspeed, "reinforcements", "screws", S.usesound)
|
||||
|
||||
/obj/structure/table/proc/remove_material(obj/item/weapon/W, mob/user)
|
||||
material = common_material_remove(user, material, 20 * W.toolspeed, "plating", "bolts", W.usesound)
|
||||
|
||||
/obj/structure/table/proc/dismantle(obj/item/W, mob/user)
|
||||
if(manipulating) return
|
||||
manipulating = 1
|
||||
user.visible_message("<b>\The [user]</b> begins dismantling \the [src].",
|
||||
"<span class='notice'>You begin dismantling \the [src].</span>")
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
if(!do_after(user, 20 * W.toolspeed))
|
||||
manipulating = 0
|
||||
return
|
||||
user.visible_message("<b>\The [user]</b> dismantles \the [src].",
|
||||
"<span class='notice'>You dismantle \the [src].</span>")
|
||||
new /obj/item/stack/material/steel(src.loc)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
// Returns a list of /obj/item/weapon/material/shard objects that were created as a result of this table's breakage.
|
||||
// Used for !fun! things such as embedding shards in the faces of tableslammed people.
|
||||
|
||||
// The repeated
|
||||
// S = [x].place_shard(loc)
|
||||
// if(S) shards += S
|
||||
// is to avoid filling the list with nulls, as place_shard won't place shards of certain materials (holo-wood, holo-steel)
|
||||
|
||||
/obj/structure/table/proc/break_to_parts(full_return = 0)
|
||||
var/list/shards = list()
|
||||
var/obj/item/weapon/material/shard/S = null
|
||||
if(reinforced)
|
||||
if(reinforced.stack_type && (full_return || prob(20)))
|
||||
reinforced.place_sheet(loc, 1)
|
||||
else
|
||||
S = reinforced.place_shard(loc)
|
||||
if(S) shards += S
|
||||
if(material)
|
||||
if(material.stack_type && (full_return || prob(20)))
|
||||
material.place_sheet(loc, 1)
|
||||
else
|
||||
S = material.place_shard(loc)
|
||||
if(S) shards += S
|
||||
if(carpeted && (full_return || prob(50))) // Higher chance to get the carpet back intact, since there's no non-intact option
|
||||
new carpeted_type(src.loc)
|
||||
if(full_return || prob(20))
|
||||
new /obj/item/stack/material/steel(src.loc)
|
||||
else
|
||||
var/datum/material/M = get_material_by_name(MAT_STEEL)
|
||||
S = M.place_shard(loc)
|
||||
if(S) shards += S
|
||||
qdel(src)
|
||||
return shards
|
||||
|
||||
/obj/structure/table/can_visually_connect_to(var/obj/structure/S)
|
||||
if(istype(S,/obj/structure/table/bench) && !istype(src,/obj/structure/table/bench))
|
||||
return FALSE
|
||||
if(istype(src,/obj/structure/table/bench) && !istype(S,/obj/structure/table/bench))
|
||||
return FALSE
|
||||
if(istype(S,/obj/structure/table/rack) && !istype(src,/obj/structure/table/rack))
|
||||
return FALSE
|
||||
if(istype(src,/obj/structure/table/rack) && !istype(S,/obj/structure/table/rack))
|
||||
return FALSE
|
||||
if(istype(S,/obj/structure/table))
|
||||
return TRUE
|
||||
..()
|
||||
|
||||
/proc/get_table_image(var/icon/ticon,var/ticonstate,var/tdir,var/tcolor,var/talpha)
|
||||
var/icon_cache_key = "\ref[ticon]-[ticonstate]-[tdir]-[tcolor]-[talpha]"
|
||||
var/image/I = table_icon_cache[icon_cache_key]
|
||||
if(!I)
|
||||
I = image(icon = ticon, icon_state = ticonstate, dir = tdir)
|
||||
if(tcolor)
|
||||
I.color = tcolor
|
||||
if(talpha)
|
||||
I.alpha = talpha
|
||||
table_icon_cache[icon_cache_key] = I
|
||||
|
||||
return I
|
||||
|
||||
/obj/structure/table/update_icon()
|
||||
if(flipped != 1)
|
||||
icon_state = "blank"
|
||||
cut_overlays()
|
||||
|
||||
// Base frame shape. Mostly done for glass/diamond tables, where this is visible.
|
||||
for(var/i = 1 to 4)
|
||||
var/image/I = get_table_image(icon, connections?[i] || 0, 1<<(i-1))
|
||||
add_overlay(I)
|
||||
|
||||
// Standard table image
|
||||
if(material)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "[material.table_icon_base]_[connect]", 1<<(i-1), material.icon_colour, 255 * material.opacity)
|
||||
add_overlay(I)
|
||||
|
||||
// Reinforcements
|
||||
if(reinforced)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connect]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity)
|
||||
add_overlay(I)
|
||||
|
||||
if(carpeted)
|
||||
for(var/i = 1 to 4)
|
||||
var/connect = connections?[i] || 0
|
||||
var/image/I = get_table_image(icon, "carpet_[connect]", 1<<(i-1))
|
||||
add_overlay(I)
|
||||
else
|
||||
cut_overlays()
|
||||
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 == 1 && T.dir == src.dir && material && T.material && T.material.name == material.name)
|
||||
type++
|
||||
tabledirs |= direction
|
||||
|
||||
type = "[type]"
|
||||
if (type=="1")
|
||||
if (tabledirs & turn(dir,90))
|
||||
type += "-"
|
||||
if (tabledirs & turn(dir,-90))
|
||||
type += "+"
|
||||
|
||||
icon_state = "flip[type]"
|
||||
if(material)
|
||||
var/image/I = image(icon, "[material.table_icon_base]_flip[type]")
|
||||
I.color = material.icon_colour
|
||||
I.alpha = 255 * material.opacity
|
||||
add_overlay(I)
|
||||
name = "[material.display_name] table"
|
||||
else
|
||||
name = "table frame"
|
||||
|
||||
if(reinforced)
|
||||
var/image/I = image(icon, "[reinforced.icon_reinf]_flip[type]")
|
||||
I.color = reinforced.icon_colour
|
||||
I.alpha = 255 * reinforced.opacity
|
||||
add_overlay(I)
|
||||
|
||||
if(carpeted)
|
||||
add_overlay("carpet_flip[type]")
|
||||
|
||||
/obj/structure/table/proc/get_all_connected_tables(var/list/connections)
|
||||
if(!connections)
|
||||
connections = list(src)
|
||||
else
|
||||
connections |= src
|
||||
if(istype(src, /obj/structure/table/rack))
|
||||
return connections
|
||||
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(src, direction)
|
||||
if(T)
|
||||
var/obj/structure/table/nextT = locate(/obj/structure/table) in T
|
||||
if(!nextT || !istype(nextT))
|
||||
continue
|
||||
if(istype(nextT, /obj/structure/table/rack) || (istype(nextT, /obj/structure/table/bench) && !istype(src, /obj/structure/table/bench)) || (!istype(nextT, /obj/structure/table/bench) && istype(src, /obj/structure/table/bench)))
|
||||
continue
|
||||
if(!(nextT in connections))
|
||||
connections |= nextT.get_all_connected_tables(connections)
|
||||
|
||||
return connections
|
||||
|
||||
|
||||
#define CORNER_NONE 0
|
||||
#define CORNER_COUNTERCLOCKWISE 1
|
||||
#define CORNER_DIAGONAL 2
|
||||
#define CORNER_CLOCKWISE 4
|
||||
|
||||
/*
|
||||
turn() is weird:
|
||||
turn(icon, angle) turns icon by angle degrees clockwise
|
||||
turn(matrix, angle) turns matrix by angle degrees clockwise
|
||||
turn(dir, angle) turns dir by angle degrees counter-clockwise
|
||||
*/
|
||||
|
||||
/proc/dirs_to_corner_states(list/dirs)
|
||||
if(!istype(dirs))
|
||||
return
|
||||
|
||||
var/list/ret = list(NORTHWEST, SOUTHEAST, NORTHEAST, SOUTHWEST)
|
||||
|
||||
for(var/i = 1 to ret.len)
|
||||
var/dir = ret[i]
|
||||
. = CORNER_NONE
|
||||
if(dir in dirs)
|
||||
. |= CORNER_DIAGONAL
|
||||
if(turn(dir,45) in dirs)
|
||||
. |= CORNER_COUNTERCLOCKWISE
|
||||
if(turn(dir,-45) in dirs)
|
||||
. |= CORNER_CLOCKWISE
|
||||
ret[i] = "[.]"
|
||||
|
||||
return ret
|
||||
|
||||
#undef CORNER_NONE
|
||||
#undef CORNER_COUNTERCLOCKWISE
|
||||
#undef CORNER_DIAGONAL
|
||||
#undef CORNER_CLOCKWISE
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/obj/structure/window/New()
|
||||
..()
|
||||
for(var/obj/structure/table/T in view(src, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Destroy()
|
||||
var/oldloc = loc
|
||||
. = ..()
|
||||
for(var/obj/structure/table/T in view(oldloc, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Move()
|
||||
var/oldloc = loc
|
||||
. = ..()
|
||||
if(loc != oldloc)
|
||||
for(var/obj/structure/table/T in view(oldloc, 1) | view(loc, 1))
|
||||
T.update_connections()
|
||||
/obj/structure/window/New()
|
||||
..()
|
||||
for(var/obj/structure/table/T in view(src, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Destroy()
|
||||
var/oldloc = loc
|
||||
. = ..()
|
||||
for(var/obj/structure/table/T in view(oldloc, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
|
||||
/obj/structure/window/Move()
|
||||
var/oldloc = loc
|
||||
. = ..()
|
||||
if(loc != oldloc)
|
||||
for(var/obj/structure/table/T in view(oldloc, 1) | view(loc, 1))
|
||||
T.update_connections()
|
||||
T.update_icon()
|
||||
Reference in New Issue
Block a user