Merge pull request #1772 from Yoshax/dressup

Splits suit jackets and ties from some suits
This commit is contained in:
EmperorJon
2016-05-27 23:59:52 +01:00
16 changed files with 229 additions and 109 deletions

View File

@@ -30,10 +30,17 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
if(2) H.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/captain(H), slot_back)
if(3) H.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/satchel/cap(H), slot_back)
if(4) H.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/satchel(H), slot_back)
var/obj/item/clothing/under/U = new /obj/item/clothing/under/rank/captain(H)
H.equip_to_slot_or_del(new /obj/item/clothing/under/rank/captain(H), slot_w_uniform)
if(H.age>49)
U.accessories += new /obj/item/clothing/accessory/medal/gold/captain(U)
H.equip_to_slot_or_del(U, slot_w_uniform)
// Since we can have something other than the default uniform at this
// point, check if we can actually attach the medal
var/obj/item/clothing/uniform = H.w_uniform
var/obj/item/clothing/accessory/medal/gold/captain/medal = new()
if(uniform && uniform.can_attach_accessory(medal))
uniform.attach_accessory(null, medal)
else
qdel(medal)
H.equip_to_slot_or_del(new /obj/item/device/pda/captain(H), slot_belt)
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/brown(H), slot_shoes)
H.equip_to_slot_or_del(new /obj/item/clothing/head/caphat(H), slot_head)

View File

@@ -4,6 +4,11 @@
var/list/species_restricted = null //Only these species can wear this kit.
var/gunshot_residue //Used by forensics.
var/list/accessories = list()
var/list/valid_accessory_slots
var/list/restricted_accessory_slots
var/list/starting_accessories
/*
Sprites used when the clothing item is refit. This is done by setting icon_override.
For best results, if this is set then sprite_sheets should be null and vice versa, but that is by no means necessary.
@@ -22,6 +27,13 @@
..()
gunshot_residue = null
/obj/item/clothing/New()
..()
if(starting_accessories)
for(var/T in starting_accessories)
var/obj/item/clothing/accessory/tie = new T(src)
src.attach_accessory(null, tie)
//BS12: Species-restricted clothing check.
/obj/item/clothing/mob_can_equip(M as mob, slot)
@@ -501,7 +513,6 @@
2 = Report detailed damages
3 = Report location
*/
var/list/accessories = list()
var/displays_id = 1
var/rolled_down = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled
var/rolled_sleeves = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled
@@ -512,6 +523,15 @@
//convenience var for defining the icon state for the overlay used when the clothing is worn.
//Also used by rolling/unrolling.
var/worn_state = null
valid_accessory_slots = list("utility","armband","decor")
restricted_accessory_slots = list("utility", "armband")
/obj/item/clothing/under/attack_hand(var/mob/user)
if(accessories && accessories.len)
..()
if ((ishuman(usr) || issmall(usr)) && src.loc == user)
return
/obj/item/clothing/under/New()
..()
@@ -578,69 +598,6 @@
var/mob/M = src.loc
M.update_inv_w_uniform()
/obj/item/clothing/under/proc/can_attach_accessory(obj/item/clothing/accessory/A)
if(istype(A))
.=1
else
return 0
if(accessories.len && (A.slot in list("utility","armband")))
for(var/obj/item/clothing/accessory/AC in accessories)
if (AC.slot == A.slot)
return 0
/obj/item/clothing/under/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/clothing/accessory))
var/obj/item/clothing/accessory/A = I
if(can_attach_accessory(A))
user.drop_item()
accessories += A
A.on_attached(src, user)
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
return
else
user << "<span class='notice'>You cannot attach more accessories of this type to [src].</span>"
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
A.attackby(I, user)
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(accessories.len && src.loc == user)
for(var/obj/item/clothing/accessory/A in accessories)
A.attack_hand(user)
return
if ((ishuman(usr) || issmall(usr)) && src.loc == user) //make it harder to accidentally undress yourself
return
..()
/obj/item/clothing/under/MouseDrop(obj/over_object as obj)
if (ishuman(usr) || issmall(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 ))
return
if (!usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.put_in_r_hand(src)
if("l_hand")
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
/obj/item/clothing/under/examine(mob/user)
..(user)
@@ -653,9 +610,6 @@
user << "Its vital tracker appears to be enabled."
if(3)
user << "Its vital tracker and tracking beacon appear to be enabled."
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
user << "\A [A] is attached to it."
/obj/item/clothing/under/proc/set_sensors(mob/usr as mob)
var/mob/M = usr
@@ -748,34 +702,7 @@
usr << "<span class='notice'>You roll down your [src]'s sleeves.</span>"
update_clothing_icon()
/obj/item/clothing/under/proc/remove_accessory(mob/user, obj/item/clothing/accessory/A)
if(!(A in accessories))
return
A.on_removed(user)
accessories -= A
update_clothing_icon()
/obj/item/clothing/under/verb/removetie()
set name = "Remove Accessory"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if(!accessories.len) return
var/obj/item/clothing/accessory/A
if(accessories.len > 1)
A = input("Select an accessory to remove from [src]") as null|anything in accessories
else
A = accessories[1]
src.remove_accessory(usr,A)
/obj/item/clothing/under/rank/New()
sensor_mode = pick(0,1,2,3)
..()
/obj/item/clothing/under/emp_act(severity)
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
A.emp_act(severity)
..()

View File

@@ -0,0 +1,107 @@
/obj/item/clothing/proc/can_attach_accessory(obj/item/clothing/accessory/A)
if(valid_accessory_slots && istype(A) && (A.slot in valid_accessory_slots))
.=1
else
return 0
if(accessories.len && restricted_accessory_slots && (A.slot in restricted_accessory_slots))
for(var/obj/item/clothing/accessory/AC in accessories)
if (AC.slot == A.slot)
return 0
/obj/item/clothing/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/clothing/accessory))
if(!valid_accessory_slots || !valid_accessory_slots.len)
usr << "<span class='warning'>You cannot attach accessories of any kind to \the [src].</span>"
return
var/obj/item/clothing/accessory/A = I
if(can_attach_accessory(A))
user.drop_item()
attach_accessory(user, A)
return
else
user << "<span class='warning'>You cannot attach more accessories of this type to [src].</span>"
return
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
A.attackby(I, user)
return
..()
/obj/item/clothing/attack_hand(var/mob/user)
//only forward to the attached accessory if the clothing is equipped (not in a storage)
if(accessories.len && src.loc == user)
for(var/obj/item/clothing/accessory/A in accessories)
A.attack_hand(user)
return
return ..()
/obj/item/clothing/MouseDrop(var/obj/over_object)
if (ishuman(usr) || issmall(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 ))
return
if (!usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.put_in_r_hand(src)
if("l_hand")
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
/obj/item/clothing/examine(var/mob/user)
..(user)
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
user << "\A [A] is attached to it."
/**
* Attach accessory A to src
*
* user is the user doing the attaching. Can be null, such as when attaching
* items on spawn
*/
/obj/item/clothing/proc/attach_accessory(mob/user, obj/item/clothing/accessory/A)
accessories += A
A.on_attached(src, user)
src.verbs |= /obj/item/clothing/proc/removetie_verb
update_clothing_icon()
/obj/item/clothing/proc/remove_accessory(mob/user, obj/item/clothing/accessory/A)
if(!(A in accessories))
return
A.on_removed(user)
accessories -= A
update_clothing_icon()
/obj/item/clothing/proc/removetie_verb()
set name = "Remove Accessory"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if(!accessories.len) return
var/obj/item/clothing/accessory/A
if(accessories.len > 1)
A = input("Select an accessory to remove from [src]") as null|anything in accessories
else
A = accessories[1]
src.remove_accessory(usr,A)
if(!accessories.len)
src.verbs -= /obj/item/clothing/proc/removetie_verb
/obj/item/clothing/emp_act(severity)
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
A.emp_act(severity)
..()

View File

@@ -210,8 +210,11 @@
if(!istype(user,/mob/living)) return
if(istype(W,/obj/item/clothing/accessory) || istype(W, /obj/item/weapon/hand_labeler))
return ..()
if(istype(src.loc,/mob/living))
user << "<span class='danger'>How do you propose to modify a voidsuit while it is being worn?</span>"
user << "<span class='warning'>You cannot modify \the [src] while it is being worn.</span>"
return
if(istype(W,/obj/item/weapon/screwdriver))

View File

@@ -7,11 +7,15 @@
slot_flags = SLOT_TIE
w_class = 2.0
var/slot = "decor"
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
var/obj/item/clothing/has_suit = null //the suit the tie may be attached to
var/image/inv_overlay = null //overlay used when attached to clothing.
var/image/mob_overlay = null
var/overlay_state = null
/obj/item/clothing/accessory/Destroy()
on_removed()
return ..()
/obj/item/clothing/accessory/proc/get_inv_overlay()
if(!inv_overlay)
if(!mob_overlay)
@@ -36,23 +40,27 @@
return mob_overlay
//when user attached an accessory to S
/obj/item/clothing/accessory/proc/on_attached(obj/item/clothing/under/S, mob/user as mob)
/obj/item/clothing/accessory/proc/on_attached(var/obj/item/clothing/S, var/mob/user)
if(!istype(S))
return
has_suit = S
loc = has_suit
has_suit.overlays += get_inv_overlay()
user << "<span class='notice'>You attach [src] to [has_suit].</span>"
src.add_fingerprint(user)
if(user)
user << "<span class='notice'>You attach \the [src] to \the [has_suit].</span>"
src.add_fingerprint(user)
/obj/item/clothing/accessory/proc/on_removed(mob/user as mob)
/obj/item/clothing/accessory/proc/on_removed(var/mob/user)
if(!has_suit)
return
has_suit.overlays -= get_inv_overlay()
has_suit = null
usr.put_in_hands(src)
src.add_fingerprint(user)
if(user)
usr.put_in_hands(src)
src.add_fingerprint(user)
else
src.forceMove(get_turf(src))
//default attackby behaviour
/obj/item/clothing/accessory/attackby(obj/item/I, mob/user)
@@ -72,10 +80,26 @@
name = "red tie"
icon_state = "redtie"
/obj/item/clothing/accessory/blue_clip
name = "blue tie with a clip"
icon_state = "bluecliptie"
/obj/item/clothing/accessory/red_long
name = "red long tie"
icon_state = "redlongtie"
/obj/item/clothing/accessory/black
name = "black tie"
icon_state = "blacktie"
/obj/item/clothing/accessory/yellow
name = "yellow tie"
icon_state = "yellowtie"
/obj/item/clothing/accessory/navy
name = "navy tie"
icon_state = "navytie"
/obj/item/clothing/accessory/horrible
name = "horrible tie"
desc = "A neosilk clip-on tie. This one is disgusting."

View File

@@ -0,0 +1,29 @@
/obj/item/clothing/accessory/vest
name = "black vest"
desc = "Slick black suit vest."
icon_state = "det_vest"
/obj/item/clothing/accessory/tan_jacket
name = "tan suit jacket"
desc = "Cozy suit jacket."
icon_state = "tan_jacket"
/obj/item/clothing/accessory/charcoal_jacket
name = "charcoal suit jacket"
desc = "Strict suit jacket."
icon_state = "charcoal_jacket"
/obj/item/clothing/accessory/navy_jacket
name = "navy suit jacket"
desc = "Official suit jacket."
icon_state = "navy_jacket"
/obj/item/clothing/accessory/burgundy_jacket
name = "burgundy suit jacket"
desc = "Expensive suit jacket."
icon_state = "burgundy_jacket"
/obj/item/clothing/accessory/checkered_jacket
name = "checkered suit jacket"
desc = "Lucky suit jacket."
icon_state = "checkered_jacket"

View File

@@ -115,6 +115,7 @@
item_state = "ba_suit"
worn_state = "internalaffairs"
rolled_sleeves = 0
starting_accessories = list(/obj/item/clothing/accessory/black)
/obj/item/clothing/under/rank/janitor
desc = "It's the official uniform of the station's janitor. It has minor protection from biohazards."
@@ -155,10 +156,11 @@
/obj/item/clothing/under/lawyer/bluesuit
name = "Blue Suit"
desc = "A classy suit and tie"
desc = "A classy suit."
icon_state = "bluesuit"
item_state = "ba_suit"
worn_state = "bluesuit"
starting_accessories = list(/obj/item/clothing/accessory/red)
/obj/item/clothing/under/lawyer/purpsuit
name = "Purple Suit"

View File

@@ -81,13 +81,14 @@
*/
/obj/item/clothing/under/det
name = "detective's suit"
desc = "A rumpled white dress shirt paired with well-worn grey slacks, complete with a blue striped tie and a faux-gold tie clip."
desc = "A rumpled white dress shirt paired with well-worn grey slacks."
icon_state = "detective"
item_state = "det"
worn_state = "detective"
armor = list(melee = 10, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
siemens_coefficient = 0.9
rolled_sleeves = 0
starting_accessories = list(/obj/item/clothing/accessory/blue_clip)
/*
/obj/item/clothing/under/det/verb/rollup()
@@ -103,13 +104,15 @@
/obj/item/clothing/under/det/grey
icon_state = "detective2"
worn_state = "detective2"
desc = "A serious-looking tan dress shirt paired with freshly-pressed black slacks, complete with a red striped tie."
desc = "A serious-looking tan dress shirt paired with freshly-pressed black slacks."
starting_accessories = list(/obj/item/clothing/accessory/red_long)
/obj/item/clothing/under/det/black
icon_state = "detective3"
worn_state = "detective3"
item_state = "sl_suit"
desc = "An immaculate white dress shirt, paired with a pair of dark grey dress pants, a red tie, and a charcoal vest."
starting_accessories = list(/obj/item/clothing/accessory/red_long, /obj/item/clothing/accessory/vest)
/obj/item/clothing/under/det/corporate
name = "detective's jumpsuit"

View File

@@ -488,6 +488,7 @@
icon_state = "charcoal_suit"
item_state = "bl_suit"
worn_state = "charcoal_suit"
starting_accessories = list(/obj/item/clothing/accessory/navy, /obj/item/clothing/accessory/charcoal_jacket)
/obj/item/clothing/under/suit_jacket/navy
name = "navy suit"
@@ -495,6 +496,7 @@
icon_state = "navy_suit"
item_state = "bl_suit"
worn_state = "navy_suit"
starting_accessories = list(/obj/item/clothing/accessory/red, /obj/item/clothing/accessory/navy_jacket)
/obj/item/clothing/under/suit_jacket/burgundy
name = "burgundy suit"
@@ -502,6 +504,7 @@
icon_state = "burgundy_suit"
item_state = "r_suit"
worn_state = "burgundy_suit"
starting_accessories = list(/obj/item/clothing/accessory/black, /obj/item/clothing/accessory/burgundy_jacket)
/obj/item/clothing/under/suit_jacket/checkered
name = "checkered suit"
@@ -509,13 +512,15 @@
icon_state = "checkered_suit"
item_state = "gy_suit"
worn_state = "checkered_suit"
starting_accessories = list(/obj/item/clothing/accessory/black, /obj/item/clothing/accessory/checkered_jacket)
/obj/item/clothing/under/suit_jacket/tan
name = "tan suit"
desc = "A tan suit with a yellow tie. Smart, but casual."
desc = "A tan suit. Smart, but casual."
icon_state = "tan_suit"
item_state = "lb_suit"
worn_state = "tan_suit"
starting_accessories = list(/obj/item/clothing/accessory/yellow, /obj/item/clothing/accessory/tan_jacket)
/obj/item/clothing/under/serviceoveralls
name = "workman outfit"

View File

@@ -772,6 +772,12 @@ var/global/list/damage_icon_parts = list()
bloodsies.color = wear_suit.blood_color
standing.overlays += bloodsies
// Accessories - copied from uniform, BOILERPLATE because fuck this system.
var/obj/item/clothing/suit/suit = wear_suit
if(istype(suit) && suit.accessories.len)
for(var/obj/item/clothing/accessory/A in suit.accessories)
standing.overlays |= A.get_mob_overlay()
overlays_standing[SUIT_LAYER] = standing
update_tail_showing(0)