Adds a "params" parameter to attackby(), so it keeps track of pixel_x and pixel_y among other things

This commit is contained in:
Markolie
2015-02-22 22:12:11 +01:00
parent aee4626ed9
commit 672305e034
456 changed files with 714 additions and 1182 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ LINEN BINS
else icon_state = "linenbin-full"
/obj/structure/bedsheetbin/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/bedsheetbin/attackby(obj/item/I as obj, mob/user as mob, params)
if(istype(I, /obj/item/weapon/bedsheet))
user.drop_item()
I.loc = src
+1 -1
View File
@@ -13,7 +13,7 @@
coat = null
update_icon()
/obj/structure/coatrack/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/coatrack/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
var/can_hang = 0
for (var/T in allowed)
if(istype(W,T))
@@ -182,7 +182,7 @@
src.dump_contents()
del(src)
/obj/structure/closet/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/closet/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/rcs) && !src.opened)
var/obj/item/weapon/rcs/E = W
if(E.rcharges != 0)
@@ -58,7 +58,7 @@
new /obj/item/device/radio/headset( src )
return
/obj/structure/closet/secure_closet/personal/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/closet/secure_closet/personal/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (src.opened)
if (istype(W, /obj/item/weapon/grab))
src.MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet
@@ -65,7 +65,7 @@
else
user << "<span class='notice'>Access Denied</span>"
/obj/structure/closet/secure_closet/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/closet/secure_closet/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(src.opened)
if(istype(W, /obj/item/weapon/grab))
if(src.large)
@@ -122,7 +122,7 @@
M.meteorhit(O)
shatter(M)
/obj/structure/closet/statue/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/closet/statue/attackby(obj/item/I as obj, mob/user as mob, params)
health -= I.force
visible_message("\red [user] strikes [src] with [I].")
if(health <= 0)
@@ -67,7 +67,7 @@
src.opened = 0
return 1
/obj/structure/closet/crate/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/closet/crate/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/rcs) && !src.opened)
var/obj/item/weapon/rcs/E = W
if(E.rcharges != 0)
@@ -246,7 +246,7 @@
else
src.toggle(user)
/obj/structure/closet/crate/secure/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/closet/crate/secure/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(is_type_in_list(W, list(/obj/item/stack/packageWrap, /obj/item/stack/cable_coil, /obj/item/device/radio/electropack, /obj/item/weapon/wirecutters)))
return ..()
if(locked && (istype(W, /obj/item/weapon/card/emag)||istype(W, /obj/item/weapon/melee/energy/blade)))
@@ -9,7 +9,7 @@
user << "<span class='notice'>You need a crowbar to pry this open!</span>"
return
/obj/structure/largecrate/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
new /obj/item/stack/sheet/wood(src)
var/turf/T = get_turf(src)
@@ -37,7 +37,7 @@
name = "cow crate"
icon_state = "lisacrate"
/obj/structure/largecrate/cow/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/cow/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
new /mob/living/simple_animal/cow(loc)
..()
@@ -46,7 +46,7 @@
name = "goat crate"
icon_state = "lisacrate"
/obj/structure/largecrate/goat/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/goat/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
new /mob/living/simple_animal/hostile/retaliate/goat(loc)
..()
@@ -55,7 +55,7 @@
name = "chicken crate"
icon_state = "lisacrate"
/obj/structure/largecrate/chick/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/chick/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
var/num = rand(4, 6)
for(var/i = 0, i < num, i++)
@@ -66,7 +66,7 @@
name = "Mysterious Crate"
icon_state = "lisacrate"
/obj/structure/largecrate/ninja/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/ninja/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
new /obj/item/clothing/gloves/space_ninja(loc)
new /obj/item/clothing/mask/gas/voice/space_ninja(loc)
@@ -80,7 +80,7 @@
name = "cat crate"
icon_state = "lisacrate"
/obj/structure/largecrate/cat/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/largecrate/cat/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
new /mob/living/simple_animal/cat(loc)
..()
+2 -2
View File
@@ -5,7 +5,7 @@
var/obj/item/weapon/airlock_electronics/circuit = null
var/state=0
/obj/structure/displaycase_frame/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/displaycase_frame/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
var/pstate=state
var/turf/T=get_turf(src)
switch(state)
@@ -162,7 +162,7 @@
return
/obj/structure/displaycase/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/displaycase/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/card))
var/obj/item/weapon/card/id/I=W
if(!check_access(I))
@@ -135,7 +135,7 @@ obj/structure/door_assembly
/obj/structure/door_assembly/attackby(obj/item/W as obj, mob/user as mob)
/obj/structure/door_assembly/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/pen))
var/t = copytext(stripped_input(user, "Enter the name for the door.", src.name, src.created_name),1,MAX_NAME_LEN)
if(!t) return
@@ -12,7 +12,7 @@
overlays += image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir)
return
/obj/structure/stool/bed/chair/e_chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/bed/chair/e_chair/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
var/obj/structure/stool/bed/chair/C = new /obj/structure/stool/bed/chair(loc)
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
+1 -1
View File
@@ -20,7 +20,7 @@
updateUsrDialog()
user << "<span class='notice'>You put [I] into [src].</span>"
return
/obj/structure/engineeringcart/attackby(obj/item/I, mob/user)
/obj/structure/engineeringcart/attackby(obj/item/I, mob/user, params)
var/fail_msg = "<span class='notice'>There is already one of those in [src].</span>"
if(!I.is_robot_module())
if(istype(I, /obj/item/stack/sheet/glass))
+1 -1
View File
@@ -9,7 +9,7 @@
var/opened = 0
/obj/structure/extinguisher_cabinet/attackby(obj/item/O, mob/user)
/obj/structure/extinguisher_cabinet/attackby(obj/item/O, mob/user, params)
if(isrobot(user) || isalien(user))
return
if(istype(O, /obj/item/weapon/extinguisher))
+2 -2
View File
@@ -165,7 +165,7 @@
qdel(src)
return T
/obj/structure/falsewall/attackby(obj/item/weapon/W, mob/user)
/obj/structure/falsewall/attackby(obj/item/weapon/W, mob/user, params)
if(opening)
user << "<span class='warning'>You must wait until the door has stopped moving.</span>"
return
@@ -271,7 +271,7 @@
var/active = null
var/last_event = 0
/obj/structure/falsewall/uranium/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/falsewall/uranium/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
radiate()
..()
+1 -1
View File
@@ -29,7 +29,7 @@
user << "<span class='notice'>You put [I] into [src].</span>"
return
/obj/structure/foodcart/attackby(obj/item/I, mob/user)
/obj/structure/foodcart/attackby(obj/item/I, mob/user, params)
var/fail_msg = "<span class='notice'>There are no open spaces for this in [src].</span>"
if(!I.is_robot_module())
if(istype(I, /obj/item/weapon/reagent_containers/food/snacks))
+2 -2
View File
@@ -6,7 +6,7 @@
var/state = 0
var/health = 200
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob)
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench) && state == 0)
if(anchored && !istype(src,/obj/structure/girder/displaced))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
@@ -231,7 +231,7 @@
layer = 2
var/health = 250
/obj/structure/cultgirder/attackby(obj/item/W as obj, mob/user as mob)
/obj/structure/cultgirder/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now disassembling the girder"
+1 -1
View File
@@ -142,7 +142,7 @@
healthcheck()
return
/obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
user.changeNext_move(CLICK_CD_MELEE)
if(iswirecutter(W))
if(!shock(user, 100))
+1 -1
View File
@@ -101,7 +101,7 @@
attack_generic(user, rand(10, 15))
attackby(obj/item/weapon/W as obj, mob/user as mob)
attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(!istype(W)) return
if (can_puncture(W))
+4 -4
View File
@@ -38,7 +38,7 @@
if((INFINITY * -1) to 0)
usr << "It appears completely unsalvageable"
/obj/structure/stool/bed/chair/cart/attackby(obj/item/W, mob/user)
/obj/structure/stool/bed/chair/cart/attackby(obj/item/W, mob/user, params)
if (istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0))
@@ -287,7 +287,7 @@
if(mybag)
usr << "\A [mybag] is hanging on the [name]."
/obj/structure/stool/bed/chair/cart/janicart/attackby(obj/item/W, mob/user)
/obj/structure/stool/bed/chair/cart/janicart/attackby(obj/item/W, mob/user, params)
..()
if(istype(W, /obj/item/weapon/mop))
if(reagents.total_volume >= 2)
@@ -442,7 +442,7 @@
return
/obj/structure/janitorialcart/attackby(obj/item/I, mob/user)
/obj/structure/janitorialcart/attackby(obj/item/I, mob/user, params)
var/fail_msg = "<span class='notice'>There is already one of those in [src].</span>"
if(!I.is_robot_module())
@@ -504,7 +504,7 @@
"You hear ratchet.")
anchored = 0
else if(mybag)
mybag.attackby(I, user)
mybag.attackby(I, user, params)
else
usr << "<span class='warning'>You cannot interface your modules [src]!</span>"
@@ -15,7 +15,7 @@
attack_paw(mob/user as mob)
return src.attack_hand(usr)
attackby(obj/item/weapon/grab/G as obj, mob/user as mob)
attackby(obj/item/weapon/grab/G as obj, mob/user as mob, params)
if(!istype(G, /obj/item/weapon/grab))
return
if(istype(G.affecting, /mob/living/carbon/monkey))
+1 -1
View File
@@ -69,5 +69,5 @@
/obj/structure/ladder/attack_paw(mob/user as mob)
return attack_hand(user)
/obj/structure/ladder/attackby(obj/item/weapon/W, mob/user as mob)
/obj/structure/ladder/attackby(obj/item/weapon/W, mob/user as mob, params)
return attack_hand(user)
+1 -1
View File
@@ -66,7 +66,7 @@
return
/obj/structure/lamarr/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/lamarr/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
src.health -= W.force
src.healthcheck()
..()
+1 -1
View File
@@ -49,7 +49,7 @@
else
return
/obj/structure/lattice/attackby(obj/item/C as obj, mob/user as mob)
/obj/structure/lattice/attackby(obj/item/C as obj, mob/user as mob, params)
if (istype(C, /obj/item/stack/tile/plasteel) || istype(C, /obj/item/stack/rods))
var/turf/T = get_turf(src)
@@ -102,7 +102,7 @@
else
icon_state = mineralType
attackby(obj/item/weapon/W as obj, mob/user as mob)
attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/weapon/pickaxe))
var/obj/item/weapon/pickaxe/digTool = W
user << "You start digging the [name]."
@@ -187,7 +187,7 @@
/obj/structure/mineral_door/transparent/plasma
mineralType = "plasma"
attackby(obj/item/weapon/W as obj, mob/user as mob)
attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user))
+1 -1
View File
@@ -71,7 +71,7 @@
..()
/obj/structure/mirror/attackby(obj/item/I as obj, mob/living/user as mob)
/obj/structure/mirror/attackby(obj/item/I as obj, mob/living/user as mob, params)
user.do_attack_animation(src)
if(shattered)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
+1 -1
View File
@@ -19,7 +19,7 @@
usr << text("\icon[] [] contains [] units of water left!", src, src.name, src.reagents.total_volume)
..()
/obj/structure/mopbucket/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/mopbucket/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (istype(W, /obj/item/weapon/mop))
if (src.reagents.total_volume >= 2)
src.reagents.trans_to(W, 2)
+2 -2
View File
@@ -104,7 +104,7 @@
update()
return
/obj/structure/morgue/attackby(P as obj, mob/user as mob)
/obj/structure/morgue/attackby(P as obj, mob/user as mob, params)
if (istype(P, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.get_active_hand() != P)
@@ -278,7 +278,7 @@
src.add_fingerprint(user)
update()
/obj/structure/crematorium/attackby(P as obj, mob/user as mob)
/obj/structure/crematorium/attackby(P as obj, mob/user as mob, params)
if (istype(P, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.get_active_hand() != P)
+1 -1
View File
@@ -332,7 +332,7 @@
user.set_machine(src)
song.interact(user)
/obj/structure/piano/attackby(obj/item/O as obj, mob/user as mob)
/obj/structure/piano/attackby(obj/item/O as obj, mob/user as mob, params)
if (istype(O, /obj/item/weapon/wrench))
if (!anchored && !isinspace())
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
+1 -1
View File
@@ -16,7 +16,7 @@
icon_state = "nboard0[notices]"
//attaching papers!!
/obj/structure/noticeboard/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob)
/obj/structure/noticeboard/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob, params)
if(istype(O, /obj/item/weapon/paper))
if(notices < 5)
O.add_fingerprint(user)
+1 -1
View File
@@ -142,7 +142,7 @@ FLOOR SAFES
updateUsrDialog()
/obj/structure/safe/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/safe/attackby(obj/item/I as obj, mob/user as mob, params)
if(open)
if(I.w_class + space <= maxspace)
space += I.w_class
@@ -70,7 +70,7 @@
overlays.Cut()
..()
/obj/structure/stool/bed/nest/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/bed/nest/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
var/aforce = W.force
health = max(0, health - aforce)
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
@@ -121,7 +121,7 @@
icon_state = "down"
anchored = 0
/obj/structure/stool/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/roller_holder))
if(buckled_mob)
manual_unbuckle()
@@ -145,7 +145,7 @@
R.add_fingerprint(user)
del(src)
/obj/item/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/roller/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/roller_holder))
var/obj/item/roller_holder/RH = W
@@ -16,7 +16,7 @@
handle_rotation()
return
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
..()
if(istype(W, /obj/item/assembly/shock_kit))
var/obj/item/assembly/shock_kit/SK = W
@@ -86,7 +86,7 @@
name = "wooden chair"
desc = "Old is never too old to not be in fashion."
/obj/structure/stool/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/wood(src.loc)
@@ -26,7 +26,7 @@
new /obj/item/stack/sheet/metal(src.loc)
del(src)
/obj/structure/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/stool/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
new /obj/item/stack/sheet/metal(src.loc)
+17 -5
View File
@@ -376,7 +376,7 @@
return
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob)
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, params)
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))
@@ -420,6 +420,10 @@
if(!(W.flags & ABSTRACT))
if(user.drop_item())
W.Move(loc)
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
W.pixel_x = (text2num(click_params["icon-x"]) - 16)
W.pixel_y = (text2num(click_params["icon-y"]) - 16)
return
/obj/structure/table/proc/straight_table_check(var/direction)
@@ -535,7 +539,7 @@
health = 50
autoignition_temperature = AUTOIGNITION_WOOD // TODO: Special ash subtype that looks like charred table legs.
/obj/structure/table/woodentable/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/table/woodentable/attackby(obj/item/I as obj, mob/user as mob, params)
if (istype(I, /obj/item/stack/tile/grass))
del(I)
@@ -585,6 +589,10 @@
if(!(I.flags & ABSTRACT))
if(user.drop_item())
I.Move(loc)
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
W.pixel_x = (text2num(click_params["icon-x"]) - 16)
W.pixel_y = (text2num(click_params["icon-y"]) - 16)
//if(W && W.loc) W.loc = src.loc
return 1
@@ -594,7 +602,7 @@
icon_state = "pokertable"
/obj/structure/table/woodentable/poker/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/table/woodentable/poker/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (istype(W, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = W
@@ -639,6 +647,10 @@
if(!(W.flags & ABSTRACT))
if(user.drop_item())
W.Move(loc)
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
W.pixel_x = (text2num(click_params["icon-x"]) - 16)
W.pixel_y = (text2num(click_params["icon-y"]) - 16)
return 1
@@ -659,7 +671,7 @@
else
return ..()
/obj/structure/table/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/table/reinforced/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user))
@@ -746,7 +758,7 @@
step(O, get_dir(O, src))
return
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/structure/rack/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if (istype(W, /obj/item/weapon/wrench))
new /obj/item/weapon/rack_parts( src.loc )
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
@@ -1,480 +0,0 @@
/* Tables and Racks
* Contains:
* Tables
* Wooden tables
* Reinforced tables
* 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
layer = 2.8
throwpass = 1 //You can throw objects over this, despite it's density.")
var/parts = /obj/item/weapon/table_parts
/obj/structure/table/New()
..()
for(var/obj/structure/table/T in src.loc)
if(T != src)
del(T)
update_icon()
for(var/direction in list(1,2,4,8,5,6,9,10))
if(locate(/obj/structure/table,get_step(src,direction)))
var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction))
T.update_icon()
/obj/structure/table/Del()
for(var/direction in list(1,2,4,8,5,6,9,10))
if(locate(/obj/structure/table,get_step(src,direction)))
var/obj/structure/table/T = locate(/obj/structure/table,get_step(src,direction))
T.update_icon()
..()
/obj/structure/table/proc/destroy()
new parts(loc)
density = 0
del(src)
/obj/structure/table/update_icon()
spawn(2) //So it properly updates when deleting
var/dir_sum = 0
for(var/direction in list(1,2,4,8,5,6,9,10))
var/skip_sum = 0
for(var/obj/structure/window/W in src.loc)
if(W.dir == direction) //So smooth tables don't go smooth through windows
skip_sum = 1
continue
var/inv_direction //inverse direction
switch(direction)
if(1)
inv_direction = 2
if(2)
inv_direction = 1
if(4)
inv_direction = 8
if(8)
inv_direction = 4
if(5)
inv_direction = 10
if(6)
inv_direction = 9
if(9)
inv_direction = 6
if(10)
inv_direction = 5
for(var/obj/structure/window/W in get_step(src,direction))
if(W.dir == inv_direction) //So smooth tables don't go smooth through windows when the window is on the other table's tile
skip_sum = 1
continue
if(!skip_sum) //means there is a window between the two tiles in this direction
if(locate(/obj/structure/table,get_step(src,direction)))
if(direction <5)
dir_sum += direction
else
if(direction == 5) //This permits the use of all table directions. (Set up so clockwise around the central table is a higher value, from north)
dir_sum += 16
if(direction == 6)
dir_sum += 32
if(direction == 8) //Aherp and Aderp. Jezes I am stupid. -- SkyMarshal
dir_sum += 8
if(direction == 10)
dir_sum += 64
if(direction == 9)
dir_sum += 128
var/table_type = 0 //stand_alone table
if(dir_sum%16 in cardinal)
table_type = 1 //endtable
dir_sum %= 16
if(dir_sum%16 in list(3,12))
table_type = 2 //1 tile thick, streight table
if(dir_sum%16 == 3) //3 doesn't exist as a dir
dir_sum = 2
if(dir_sum%16 == 12) //12 doesn't exist as a dir.
dir_sum = 4
if(dir_sum%16 in list(5,6,9,10))
if(locate(/obj/structure/table,get_step(src.loc,dir_sum%16)))
table_type = 3 //full table (not the 1 tile thick one, but one of the 'tabledir' tables)
else
table_type = 2 //1 tile thick, corner table (treated the same as streight tables in code later on)
dir_sum %= 16
if(dir_sum%16 in list(13,14,7,11)) //Three-way intersection
table_type = 5 //full table as three-way intersections are not sprited, would require 64 sprites to handle all combinations. TOO BAD -- SkyMarshal
switch(dir_sum%16) //Begin computation of the special type tables. --SkyMarshal
if(7)
if(dir_sum == 23)
table_type = 6
dir_sum = 8
else if(dir_sum == 39)
dir_sum = 4
table_type = 6
else if(dir_sum == 55 || dir_sum == 119 || dir_sum == 247 || dir_sum == 183)
dir_sum = 4
table_type = 3
else
dir_sum = 4
if(11)
if(dir_sum == 75)
dir_sum = 5
table_type = 6
else if(dir_sum == 139)
dir_sum = 9
table_type = 6
else if(dir_sum == 203 || dir_sum == 219 || dir_sum == 251 || dir_sum == 235)
dir_sum = 8
table_type = 3
else
dir_sum = 8
if(13)
if(dir_sum == 29)
dir_sum = 10
table_type = 6
else if(dir_sum == 141)
dir_sum = 6
table_type = 6
else if(dir_sum == 189 || dir_sum == 221 || dir_sum == 253 || dir_sum == 157)
dir_sum = 1
table_type = 3
else
dir_sum = 1
if(14)
if(dir_sum == 46)
dir_sum = 1
table_type = 6
else if(dir_sum == 78)
dir_sum = 2
table_type = 6
else if(dir_sum == 110 || dir_sum == 254 || dir_sum == 238 || dir_sum == 126)
dir_sum = 2
table_type = 3
else
dir_sum = 2 //These translate the dir_sum to the correct dirs from the 'tabledir' icon_state.
if(dir_sum%16 == 15)
table_type = 4 //4-way intersection, the 'middle' table sprites will be used.
if(istype(src,/obj/structure/table/reinforced))
switch(table_type)
if(0)
icon_state = "reinf_table"
if(1)
icon_state = "reinf_1tileendtable"
if(2)
icon_state = "reinf_1tilethick"
if(3)
icon_state = "reinf_tabledir"
if(4)
icon_state = "reinf_middle"
if(5)
icon_state = "reinf_tabledir2"
if(6)
icon_state = "reinf_tabledir3"
else if(istype(src,/obj/structure/table/woodentable))
switch(table_type)
if(0)
icon_state = "wood_table"
if(1)
icon_state = "wood_1tileendtable"
if(2)
icon_state = "wood_1tilethick"
if(3)
icon_state = "wood_tabledir"
if(4)
icon_state = "wood_middle"
if(5)
icon_state = "wood_tabledir2"
if(6)
icon_state = "wood_tabledir3"
else
switch(table_type)
if(0)
icon_state = "table"
if(1)
icon_state = "table_1tileendtable"
if(2)
icon_state = "table_1tilethick"
if(3)
icon_state = "tabledir"
if(4)
icon_state = "table_middle"
if(5)
icon_state = "tabledir2"
if(6)
icon_state = "tabledir3"
if (dir_sum in list(1,2,4,8,5,6,9,10))
dir = dir_sum
else
dir = 2
/obj/structure/table/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(50))
del(src)
return
if(3.0)
if (prob(25))
destroy()
else
return
/obj/structure/table/blob_act()
if(prob(75))
destroy()
/obj/structure/table/attack_paw(mob/user)
if(HULK in user.mutations)
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
visible_message("<span class='danger'>[user] smashes the [src] apart!</span>")
destroy()
/obj/structure/table/attack_alien(mob/user)
visible_message("<span class='danger'>[user] slices [src] apart!</span>")
/obj/structure/table/attack_animal(mob/living/simple_animal/user)
if(user.wall_smash)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
destroy()
/obj/structure/table/attack_hand(mob/user)
if(HULK in user.mutations)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
destroy()
/obj/structure/table/attack_tk() // no telehulk sorry
return
/obj/structure/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
else
return 0
/obj/structure/table/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/table/attackby(obj/item/W as obj, mob/user as mob)
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
if (G.state < 2)
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]!")
playsound(src.loc, 'sound/weapons/tablehit1.ogg', 50, 1)
else
user << "\red 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].")
del(W)
return
if (istype(W, /obj/item/weapon/wrench))
user << "\blue Now disassembling table"
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
if(do_after(user,50))
destroy()
return
if(isrobot(user))
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.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)
destroy()
user.drop_item(src)
return
/*
* 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
/*
* Reinforced tables
*/
/obj/structure/table/reinforced
name = "reinforced table"
desc = "A version of the four legged table. It is stronger."
icon_state = "reinf_table"
var/status = 2
parts = /obj/item/weapon/table_parts/reinforced
/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
*/
/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.
/obj/structure/rack/ex_act(severity)
switch(severity)
if(1.0)
del(src)
if(2.0)
del(src)
if(prob(50))
new /obj/item/weapon/rack_parts(src.loc)
if(3.0)
if(prob(25))
del(src)
new /obj/item/weapon/rack_parts(src.loc)
/obj/structure/rack/blob_act()
if(prob(75))
del(src)
return
else if(prob(50))
new /obj/item/weapon/rack_parts(src.loc)
del(src)
return
/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
user.drop_item()
if(W && W.loc) W.loc = src.loc
return
/obj/structure/rack/meteorhit(obj/O as obj)
del(src)
/obj/structure/table/attack_hand(mob/user)
if(HULK in user.mutations)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
new /obj/item/weapon/rack_parts(loc)
density = 0
del(src)
/obj/structure/rack/attack_paw(mob/user)
if(HULK in user.mutations)
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
new /obj/item/weapon/rack_parts(loc)
density = 0
del(src)
/obj/structure/rack/attack_alien(mob/user)
visible_message("<span class='danger'>[user] slices [src] apart!</span>")
new /obj/item/weapon/rack_parts(loc)
density = 0
del(src)
/obj/structure/rack/attack_animal(mob/living/simple_animal/user)
if(user.wall_smash)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
new /obj/item/weapon/rack_parts(loc)
density = 0
del(src)
/obj/structure/rack/attack_tk() // no telehulk sorry
return
@@ -42,7 +42,7 @@
return
/obj/structure/dispenser/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/dispenser/attackby(obj/item/I as obj, mob/user as mob, params)
if(istype(I, /obj/item/weapon/tank/oxygen) || istype(I, /obj/item/weapon/tank/air) || istype(I, /obj/item/weapon/tank/anesthetic))
if(oxygentanks < 10)
user.drop_item()
+1 -1
View File
@@ -18,7 +18,7 @@
pinned_target = null
density = 1
attackby(obj/item/W as obj, mob/user as mob)
attackby(obj/item/W as obj, mob/user as mob, params)
// Putting objects on the stake. Most importantly, targets
if(pinned_target)
return // get rid of that pinned target first!
@@ -67,7 +67,7 @@
break
/obj/structure/transit_tube/station/attackby(obj/item/W, mob/user)
/obj/structure/transit_tube/station/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/grab) && icon_state == "open")
var/obj/item/weapon/grab/G = W
if(ismob(G.affecting) && G.state >= GRAB_AGGRESSIVE)
+5 -5
View File
@@ -42,7 +42,7 @@
/obj/structure/toilet/update_icon()
icon_state = "toilet[open][cistern]"
/obj/structure/toilet/attackby(obj/item/I as obj, mob/living/user as mob)
/obj/structure/toilet/attackby(obj/item/I as obj, mob/living/user as mob, params)
if(istype(I, /obj/item/weapon/crowbar))
user << "<span class='notice'>You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"].</span>"
playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
@@ -99,7 +99,7 @@
density = 0
anchored = 1
/obj/structure/urinal/attackby(obj/item/I as obj, mob/user as mob)
/obj/structure/urinal/attackby(obj/item/I as obj, mob/user as mob, params)
if(istype(I, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = I
if(isliving(G.affecting))
@@ -149,7 +149,7 @@
for (var/atom/movable/G in src.loc)
G.clean_blood()
/obj/machinery/shower/attackby(obj/item/I as obj, mob/user as mob)
/obj/machinery/shower/attackby(obj/item/I as obj, mob/user as mob, params)
if(I.type == /obj/item/device/analyzer)
user << "<span class='notice'>The water temperature seems to be [watertemp].</span>"
if(istype(I, /obj/item/weapon/wrench))
@@ -360,7 +360,7 @@
V.show_message("\blue [user] washes their hands using \the [src].")
/obj/structure/sink/attackby(obj/item/O as obj, mob/user as mob)
/obj/structure/sink/attackby(obj/item/O as obj, mob/user as mob, params)
if(busy)
user << "\red Someone's already washing here."
return
@@ -424,7 +424,7 @@
..()
icon_state = "puddle"
/obj/structure/sink/puddle/attackby(obj/item/O as obj, mob/user as mob)
/obj/structure/sink/puddle/attackby(obj/item/O as obj, mob/user as mob, params)
icon_state = "puddle-splash"
..()
icon_state = "puddle"
@@ -57,7 +57,7 @@ obj/structure/windoor_assembly/Destroy()
return 1
/obj/structure/windoor_assembly/attackby(obj/item/W as obj, mob/user as mob)
/obj/structure/windoor_assembly/attackby(obj/item/W as obj, mob/user as mob, params)
//I really should have spread this out across more states but thin little windoors are hard to sprite.
add_fingerprint(user)
switch(state)
+3 -3
View File
@@ -212,7 +212,7 @@ var/global/wcColored
attack_generic(user, rand(10, 15))
/obj/structure/window/attackby(obj/item/weapon/W as obj, mob/living/user as mob)
/obj/structure/window/attackby(obj/item/weapon/W as obj, mob/living/user as mob, params)
if(!istype(W)) return//I really wish I did not need this
if (istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2)
var/obj/item/weapon/grab/G = W
@@ -283,7 +283,7 @@ var/global/wcColored
continue
if(G.amount>=G.max_amount)
continue
G.attackby(NG, user)
G.attackby(NG, user, params)
if (reinf)
var/obj/item/stack/rods/NR = new (src.loc)
@@ -292,7 +292,7 @@ var/global/wcColored
continue
if(R.amount>=R.max_amount)
continue
R.attackby(NR, user)
R.attackby(NR, user, params)
user << "<span class='notice'>You have disassembled the window.</span>"
disassembled = 1