Adds telekinesis to click code. Fixes issue #1202, #1129, #247.

This adds two atom procs, attack_tk() and attack_self_tk().  attack_tk is used as per attack_hand; attack_self_tk exists on all atoms (not just items) but is similar to the item proc, but without the assumption that it is in the user's hand.

Removes the functionality where entering throw mode would create a tk grab, as it is redundant.

As a default, attack_tk does the following:
* Creates a telekinetic throw for items and un-anchored objects
* Does an attack_hand (paw, animal, etc) for anchored objects
* Does nothing to mobs

As a default, attack_self_tk does nothing.  An attack_self_tk was added to closets to open and close them since that's a common thing.

The following items have added attack_tk procs:
* Fire axe cabinet, extinguisher cabinet, and bedsheet bin will drop into their square instead of putting it in your hand
* Doors only open telekinetically if they require no access
* Chairs will rotate if nobody is buckled to them
* Filing cabinets will remove a paper at random.
* Tables and racks return to prevent telehulk smash

This is INCOMPLETE.  Adding proper TK interaction to everything is something best done in pieces.

In particular, interacting with mobs and items both open up the floodgates for bugs, so we/I need to decide how we want it to go before we commit, and then fix bugs along the way.  Stumbling forward, fixing bugs, and then changing course halfway would be a bad idea.
This commit is contained in:
supersayu
2013-09-17 18:19:09 -04:00
parent 62f7bc11c2
commit c172e52dce
22 changed files with 341 additions and 185 deletions
+23 -1
View File
@@ -171,4 +171,26 @@ LINEN BINS
hidden = null
add_fingerprint(user)
add_fingerprint(user)
/obj/structure/bedsheetbin/attack_tk(mob/user as mob)
if(amount >= 1)
amount--
var/obj/item/weapon/bedsheet/B
if(sheets.len > 0)
B = sheets[sheets.len]
sheets.Remove(B)
else
B = new /obj/item/weapon/bedsheet(loc)
B.loc = loc
user << "<span class='notice'>You telekinetically remove [B] from [src].</span>"
update_icon()
if(hidden)
hidden.loc = loc
hidden = null
add_fingerprint(user)
@@ -177,6 +177,8 @@
src.MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
else
user << "<span class='notice'>The locker is too small to stuff [W] into!</span>"
if(istype(W,/obj/item/tk_grab))
return 0
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
@@ -192,10 +194,7 @@
if(isrobot(user))
return
user.drop_item()
if(W)
W.loc = src.loc
user.drop_item(src)
else if(istype(W, /obj/item/weapon/packageWrap))
return
@@ -260,6 +259,13 @@
if(!src.toggle())
usr << "<span class='notice'>It won't budge!</span>"
// tk grab then use on self
/obj/structure/closet/attack_self_tk(mob/user as mob)
src.add_fingerprint(user)
if(!src.toggle())
usr << "<span class='notice'>It won't budge!</span>"
/obj/structure/closet/verb/verb_toggleopen()
set src in oview(1)
set category = "Object"
@@ -137,6 +137,15 @@
src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
attack_tk(mob/user as mob)
if(localopened && fireaxe)
fireaxe.loc = loc
user << "\blue You telekinetically remove the fire axe."
fireaxe = null
update_icon()
return
attack_hand(user)
verb/toggle_openness() //nice name, huh? HUH?! -Erro //YEAH -Agouri
set name = "Open/Close"
set category = "Object"
+3 -1
View File
@@ -7,11 +7,13 @@
anchored = 1
/obj/structure/dresser/attack_hand(mob/user as mob)
if(!Adjacent(user))//no tele-grooming
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/new_undies = input(user, "Select your underwear", "Changing") as null|anything in underwear_all
if(!in_range(src, user))//no tele-grooming
if(!Adjacent(user))//no tele-grooming
return
if(new_undies)
H.underwear = new_undies
+9 -1
View File
@@ -36,7 +36,15 @@
else
opened = !opened
update_icon()
/obj/structure/extinguisher_cabinet/attack_tk(mob/user)
if(has_extinguisher)
has_extinguisher.loc = loc
user << "<span class='notice'>You telekinetically remove [has_extinguisher] from [src].</span>"
has_extinguisher = null
opened = 1
else
opened = !opened
update_icon()
/obj/structure/extinguisher_cabinet/attack_paw(mob/user)
attack_hand(user)
@@ -26,6 +26,12 @@
SK.loc = E
SK.master = E
del(src)
/obj/structure/stool/bed/chair/attack_tk(mob/user as mob)
if(buckled_mob)
..()
else
rotate()
return
/obj/structure/stool/bed/chair/proc/handle_rotation() //making this into a seperate proc so office chairs can call it on Move()
if(src.dir == NORTH)
+6 -2
View File
@@ -260,6 +260,8 @@
density = 0
del(src)
/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
@@ -281,7 +283,7 @@
return
/obj/structure/table/attackby(obj/item/weapon/W, mob/user)
/obj/structure/table/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/weapon/grab) && get_dist(src, user) < 2)
var/obj/item/weapon/grab/G = W
if(G.affecting.buckled)
@@ -564,4 +566,6 @@
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
new /obj/item/weapon/rack_parts(loc)
density = 0
del(src)
del(src)
/obj/structure/rack/attack_tk() // no telehulk sorry
return
@@ -67,7 +67,7 @@
/obj/structure/dispenser/Topic(href, href_list)
if(usr.stat || usr.restrained())
return
if(get_dist(src, usr) <= 1)
if(Adjacent(usr))
usr.set_machine(src)
if(href_list["oxygen"])
if(oxygentanks > 0)
+3 -3
View File
@@ -337,20 +337,20 @@
/obj/structure/sink/attack_hand(mob/user)
if(isrobot(user) || isAI(user))
return
if(!Adjacent(user))
return
if(busy)
user << "<span class='notice'>Someone's already washing here.</span>"
return
var/turf/location = user.loc
if(!isturf(location)) return
user << "<span class='notice'>You start washing your hands.</span>"
busy = 1
sleep(40)
busy = 0
if(user.loc != location) return //Person has moved away from the sink
if(!Adjacent(user)) return //Person has moved away from the sink
user.clean_blood()
user.visible_message("<span class='notice'>[user] washes their hands in [src].</span>")