Files
Bubberstation/code/game/objects/structures/extinguisher.dm
supersayu c172e52dce 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.
2013-09-17 18:19:09 -04:00

64 lines
1.8 KiB
Plaintext

/obj/structure/extinguisher_cabinet
name = "extinguisher cabinet"
desc = "A small wall mounted cabinet designed to hold a fire extinguisher."
icon = 'icons/obj/closet.dmi'
icon_state = "extinguisher_closed"
anchored = 1
density = 0
var/obj/item/weapon/extinguisher/has_extinguisher = new/obj/item/weapon/extinguisher
var/opened = 0
/obj/structure/extinguisher_cabinet/attackby(obj/item/O, mob/user)
if(isrobot(user) || isalien(user))
return
if(istype(O, /obj/item/weapon/extinguisher))
if(!has_extinguisher && opened)
user.drop_item(O)
contents += O
has_extinguisher = O
user << "<span class='notice'>You place [O] in [src].</span>"
else
opened = !opened
else
opened = !opened
update_icon()
/obj/structure/extinguisher_cabinet/attack_hand(mob/user)
if(isrobot(user) || isalien(user))
return
if(has_extinguisher)
user.put_in_hands(has_extinguisher)
user << "<span class='notice'>You take [has_extinguisher] from [src].</span>"
has_extinguisher = null
opened = 1
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)
return
/obj/structure/extinguisher_cabinet/update_icon()
if(!opened)
icon_state = "extinguisher_closed"
return
if(has_extinguisher)
if(istype(has_extinguisher, /obj/item/weapon/extinguisher/mini))
icon_state = "extinguisher_mini"
else
icon_state = "extinguisher_full"
else
icon_state = "extinguisher_empty"