Webbings now use internal storage

Clothing no longer manipulates webbing members for better encapsulation.
Instead attackby() and attack_hand() are forwarded to accessories if
they are present.
Removed "Look in Storage" verb for less verb clutter.
This commit is contained in:
Mike
2014-04-29 20:34:01 -04:00
parent 172bda548e
commit ae49ba210b
4 changed files with 87 additions and 49 deletions
+33 -31
View File
@@ -250,18 +250,18 @@ BLIND // can't see anything
/obj/item/clothing/under/attackby(obj/item/I, mob/user)
if(hastie)
hastie.attackby(I, user)
return
if(!hastie && istype(I, /obj/item/clothing/tie))
user.drop_item()
hastie = I
I.loc = src
user << "<span class='notice'>You attach [I] to [src].</span>"
hastie.attach_to(src, user)
if (istype(hastie,/obj/item/clothing/tie/holster))
verbs += /obj/item/clothing/under/proc/holster
if (istype(hastie,/obj/item/clothing/tie/storage))
verbs += /obj/item/clothing/under/proc/storage
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
@@ -269,6 +269,33 @@ BLIND // can't see anything
return
..()
/obj/item/clothing/under/attack_hand(mob/user as mob)
//only forward to the attached accessory if the clothing is equipped (not in a storage)
if(hastie && src.loc == user)
hastie.attack_hand(user)
return
..()
//This is to allow people to take off suits when there is an attached accessory
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj)
if (ishuman(usr) || ismonkey(usr))
//makes sure that the clothing is equipped so that we can't drag it into our hand from miles away.
if (!(src.loc == usr))
return
if (!( usr.restrained() ) && !( usr.stat ))
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
return
return
/obj/item/clothing/under/examine()
set src in view()
@@ -340,13 +367,7 @@ BLIND // can't see anything
if (istype(hastie,/obj/item/clothing/tie/holster))
verbs -= /obj/item/clothing/under/proc/holster
if (istype(hastie,/obj/item/clothing/tie/storage))
verbs -= /obj/item/clothing/under/proc/storage
var/obj/item/clothing/tie/storage/W = hastie
if (W.hold)
W.hold.close(usr)
usr.put_in_hands(hastie)
hastie.remove(usr)
hastie = null
if(istype(loc, /mob/living/carbon/human))
@@ -393,22 +414,3 @@ BLIND // can't see anything
"\blue You draw \the [H.holstered], pointing it at the ground.")
usr.put_in_hands(H.holstered)
H.holstered = null
/obj/item/clothing/under/proc/storage()
set name = "Look in storage"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if (!hastie || !istype(hastie,/obj/item/clothing/tie/storage))
usr << "\red You need something to store items in for that!"
return
var/obj/item/clothing/tie/storage/W = hastie
if (!istype(W.hold))
return
W.hold.open(usr)
+49 -13
View File
@@ -8,6 +8,23 @@
flags = FPRINT | TABLEPASS
slot_flags = 0
w_class = 2.0
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
//when user attached an accessory to S
/obj/item/clothing/tie/proc/attach_to(obj/item/clothing/under/S, mob/user as mob)
if(!istype(S))
return
has_suit = S
loc = has_suit
user << "<span class='notice'>You attach [src] to [has_suit].</span>"
src.add_fingerprint(user)
/obj/item/clothing/tie/proc/remove(mob/user as mob)
if(!has_suit)
return
has_suit = null
usr.put_in_hands(src)
src.add_fingerprint(user)
/obj/item/clothing/tie/blue
name = "blue tie"
@@ -116,7 +133,7 @@
//Armbands
/obj/item/clothing/tie/armband
name = "red armband"
desc = "An fancy red armband!"
desc = "A fancy red armband!"
icon_state = "red"
item_color = "red"
@@ -177,17 +194,44 @@
/obj/item/clothing/tie/storage
name = "load bearing equipment"
desc = "Used to hold things when you don't have enough hands for that."
desc = "Used to hold things when you don't have enough hands."
icon_state = "webbing"
item_color = "webbing"
var/slots = 3
var/obj/item/weapon/storage/pockets/hold
var/obj/item/weapon/storage/internal/hold
/obj/item/clothing/tie/storage/New()
hold = new /obj/item/weapon/storage/pockets(src)
hold.master_item = src
..()
hold = new/obj/item/weapon/storage/internal(src)
hold.storage_slots = slots
/obj/item/clothing/tie/storage/attack_hand(mob/user as mob)
if (has_suit) //if we are part of a suit
hold.open(user)
return
if (hold.handle_attack_hand(user)) //otherwise interact as a regular storage item
..(user)
/obj/item/clothing/tie/storage/MouseDrop(obj/over_object as obj)
if (has_suit)
return
if (hold.handle_mousedrop(usr, over_object))
..(over_object)
/obj/item/clothing/tie/storage/attackby(obj/item/W as obj, mob/user as mob)
..()
hold.attackby(W, user)
/obj/item/clothing/tie/storage/emp_act(severity)
hold.emp_act(severity)
..()
/obj/item/clothing/tie/storage/hear_talk(mob/M, var/msg)
hold.hear_talk(M, msg)
..()
/obj/item/clothing/tie/storage/attack_self(mob/user as mob)
user << "<span class='notice'>You empty [src].</span>"
var/turf/T = get_turf(src)
@@ -196,14 +240,6 @@
hold.remove_from_storage(I, T)
src.add_fingerprint(user)
/obj/item/clothing/tie/storage/attackby(obj/item/weapon/W as obj, mob/user as mob)
hold.attackby(W,user)
src.add_fingerprint(user)
/obj/item/weapon/storage/pockets
name = "storage"
var/master_item //item it belongs to
/obj/item/clothing/tie/storage/webbing
name = "webbing"
desc = "Strudy mess of synthcotton belts and buckles, ready to share your burden."