Merge pull request #4963 from mwerezak/accessory-fix

Accessories
This commit is contained in:
Ccomp5950
2014-05-12 11:43:05 -05:00
4 changed files with 38 additions and 14 deletions
+14 -10
View File
@@ -248,7 +248,6 @@ BLIND // can't see anything
var/rolled_down = 0
var/basecolor
/obj/item/clothing/under/attackby(obj/item/I, mob/user)
if(hastie)
hastie.attackby(I, user)
@@ -257,7 +256,7 @@ BLIND // can't see anything
if(!hastie && istype(I, /obj/item/clothing/tie))
user.drop_item()
hastie = I
hastie.attach_to(src, user)
hastie.on_attached(src, user)
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
@@ -274,7 +273,7 @@ BLIND // can't see anything
return
..()
//This is to allow people to take off suits when there is an attached accessory
//This is to ensure people can take off suits when there is an attached accessory
/obj/item/clothing/under/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.
@@ -352,6 +351,17 @@ BLIND // can't see anything
else
usr << "<span class='notice'>You cannot roll down the uniform!</span>"
/obj/item/clothing/under/proc/remove_accessory(mob/user as mob)
if(!hastie)
return
hastie.on_removed(user)
hastie = null
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
/obj/item/clothing/under/verb/removetie()
set name = "Remove Accessory"
set category = "Object"
@@ -359,13 +369,7 @@ BLIND // can't see anything
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if(hastie)
hastie.remove(usr)
hastie = null
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
src.remove_accessory(usr)
/obj/item/clothing/under/rank/New()
sensor_mode = pick(0,1,2,3)
+23 -4
View File
@@ -9,23 +9,42 @@
slot_flags = 0
w_class = 2.0
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
var/image/inv_overlay = null //overlay used when attached to clothing.
/obj/item/clothing/tie/New()
..()
inv_overlay = image("icon" = 'icons/obj/clothing/ties_overlay.dmi', "icon_state" = "[item_color? "[item_color]" : "[icon_state]"]")
//when user attached an accessory to S
/obj/item/clothing/tie/proc/attach_to(obj/item/clothing/under/S, mob/user as mob)
/obj/item/clothing/tie/proc/on_attached(obj/item/clothing/under/S, mob/user as mob)
if(!istype(S))
return
has_suit = S
loc = has_suit
has_suit.overlays += inv_overlay
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)
/obj/item/clothing/tie/proc/on_removed(mob/user as mob)
if(!has_suit)
return
has_suit.overlays -= inv_overlay
has_suit = null
usr.put_in_hands(src)
src.add_fingerprint(user)
//default attackby behaviour
/obj/item/clothing/tie/attackby(obj/item/I, mob/user)
..()
//default attack_hand behaviour
/obj/item/clothing/tie/attack_hand(mob/user as mob)
if(has_suit)
has_suit.remove_accessory(user)
return //we aren't an object on the ground so don't call parent
..()
/obj/item/clothing/tie/blue
name = "blue tie"
icon_state = "bluetie"
@@ -244,11 +263,11 @@
else
usr << "It is empty."
/obj/item/clothing/tie/holster/attach_to(obj/item/clothing/under/S, mob/user as mob)
/obj/item/clothing/tie/holster/on_attached(obj/item/clothing/under/S, mob/user as mob)
..()
has_suit.verbs += /obj/item/clothing/tie/holster/verb/holster_verb
/obj/item/clothing/tie/holster/remove(mob/user as mob)
/obj/item/clothing/tie/holster/on_removed(mob/user as mob)
has_suit.verbs -= /obj/item/clothing/tie/holster/verb/holster_verb
..()
@@ -501,6 +501,7 @@ proc/get_damage_icon_part(damage_state, body_part)
overlays_standing[UNIFORM_LAYER] = standing
else
overlays_standing[UNIFORM_LAYER] = null
// This really, really seems like it should not be mixed in the middle of display code...
// Automatically drop anything in store / id / belt if you're not wearing a uniform. //CHECK IF NECESARRY
for( var/obj/item/thing in list(r_store, l_store, wear_id, belt) ) //
if(thing) //