Files
vgstation13/code/modules/clothing/clothing.dm
Wizardcrying 6ea0489065 Spelling/grammar/wording/etc fixes (#12993)
* mainly standardized the vending machine descriptions with exceptions

* oops

* more

* this time i changed a proc name but there was only one use of it

* everything gets changed!

* this commit sponsored by low-quality forum posting

* buisness

* i broke it

* but is it really robust?

* why didn't this commit

* finally, spent a lot of my morning for this

* colour

* sure it's not atomic, celt
2016-12-23 06:01:09 -05:00

587 lines
18 KiB
Plaintext

/obj/item/clothing
name = "clothing"
var/list/species_restricted = null //Only these species can wear this kit.
var/wizard_garb = 0 // Wearing this empowers a wizard.
var/eyeprot = 0 //for head and eyewear
//temperatures in Kelvin. These default values won't affect protections in any way.
var/cold_breath_protection = 300 //that cloth protects its wearer's breath from cold air down to that temperature
var/hot_breath_protection = 300 //that cloth protects its wearer's breath from hot air up to that temperature
var/cold_speed_protection = 300 //that cloth allows its wearer to keep walking at normal speed at lower temperatures
var/list/obj/item/clothing/accessory/accessories = list()
/obj/item/clothing/Destroy()
for(var/obj/item/clothing/accessory/A in accessories)
accessories.Remove(A)
qdel(A)
..()
/obj/item/clothing/examine(mob/user)
..()
for(var/obj/item/clothing/accessory/A in accessories)
to_chat(user, "<span class='info'>\A [A] is clipped to it.</span>")
/obj/item/clothing/emp_act(severity)
for(var/obj/item/clothing/accessory/accessory in accessories)
accessory.emp_act(severity)
..()
/obj/item/clothing/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/clothing/accessory))
var/obj/item/clothing/accessory/A = I
if(check_accessory_overlap(A))
to_chat(user, "<span class='notice'>You cannot attach more accessories of this type to [src].</span>")
return
if(!A.can_attach_to(src))
to_chat(user, "<span class='notice'>\The [A] cannot be attached to [src].</span>")
return
if(user.drop_item(I, src))
to_chat(user, "<span class='notice'>You attach [A] to [src].</span>")
attach_accessory(A)
A.add_fingerprint(user)
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_by_slot(slot_flags)
return 1
for(var/obj/item/clothing/accessory/accessory in priority_accessories())
if(accessory.attackby(I, user))
return 1
..()
/obj/item/clothing/attack_hand(mob/user)
if(accessories.len && src.loc == user)
var/list/delayed = list()
for(var/obj/item/clothing/accessory/A in priority_accessories())
switch(A.on_accessory_interact(user, 0))
if(1)
return 1
if(-1)
delayed.Add(A)
else
continue
for(var/obj/item/clothing/accessory/A in delayed)
if(A.on_accessory_interact(user, 1))
return 1
return
return ..()
/obj/item/clothing/proc/attach_accessory(obj/item/clothing/accessory/accessory)
accessories += accessory
accessory.forceMove(src)
accessory.on_attached(src)
update_verbs()
/obj/item/clothing/proc/priority_accessories()
if(!accessories.len)
return list()
var/list/unorg = accessories
var/list/prioritized = list()
for(var/obj/item/clothing/accessory/holster/H in accessories)
prioritized.Add(H)
for(var/obj/item/clothing/accessory/storage/S in accessories)
prioritized.Add(S)
for(var/obj/item/clothing/accessory/armband/A in accessories)
prioritized.Add(A)
prioritized |= unorg
return prioritized
/obj/item/clothing/proc/check_accessory_overlap(var/obj/item/clothing/accessory/accessory)
if(!accessory)
return
for(var/obj/item/clothing/accessory/A in accessories)
if(A.accessory_exclusion & accessory.accessory_exclusion)
return 1
/obj/item/clothing/proc/remove_accessory(mob/user, var/obj/item/clothing/accessory/accessory)
if(!accessory || !(accessory in accessories))
return
accessory.on_removed(user)
accessories.Remove(accessory)
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.update_inv_by_slot(slot_flags)
update_verbs()
/obj/item/clothing/verb/removeaccessory()
set name = "Remove Accessory"
set category = "Object"
set src in usr
if(usr.incapacitated())
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 anything in accessories
else
A = accessories[1]
src.remove_accessory(usr,A)
/obj/item/clothing/proc/update_verbs()
if(accessories.len)
verbs |= /obj/item/clothing/verb/removeaccessory
else
verbs -= /obj/item/clothing/verb/removeaccessory
/obj/item/clothing/New() //so sorry
..()
update_verbs()
//BS12: Species-restricted clothing check.
/obj/item/clothing/mob_can_equip(mob/M, slot, disable_warning = 0, automatic = 0)
. = ..() //Default return value. If 1, item can be equipped. If 0, it can't be.
if(!.)
return //Default return value is 0 - don't check for species
if(species_restricted && istype(M,/mob/living/carbon/human) && (slot != slot_l_store && slot != slot_r_store))
var/wearable = null
var/exclusive = null
var/mob/living/carbon/human/H = M
if("exclude" in species_restricted)
exclusive = 1
var/datum/species/base_species = H.species
if(!base_species)
return
var/base_species_can_wear = 1 //If the body's main species can wear this
if(exclusive)
if(!species_restricted.Find(base_species.name))
wearable = 1
else
base_species_can_wear = 0
else
if(species_restricted.Find(base_species.name))
wearable = 1
else
base_species_can_wear = 0
//Check ALL organs covered by the slot. If any of the organ's species can't wear this, return 0
for(var/datum/organ/external/OE in get_organs_by_slot(slot, H)) //Go through all organs covered by the item
if(!OE.species) //Species same as of the body
if(!base_species_can_wear) //And the body's species can't wear
wearable = 0
break
continue
if(exclusive)
if(!species_restricted.Find(OE.species.name))
wearable = 1
else
to_chat(M, "<span class='warning'>Your misshapen [OE.display_name] prevents you from wearing \the [src].</span>")
return CANNOT_EQUIP
else
if(species_restricted.Find(OE.species.name))
wearable = 1
else
to_chat(M, "<span class='warning'>Your misshapen [OE.display_name] prevents you from wearing \the [src].</span>")
return CANNOT_EQUIP
if(!wearable) //But we are a species that CAN'T wear it (sidenote: slots 15 and 16 are pockets)
to_chat(M, "<span class='warning'>Your species cannot wear [src].</span>")//Let us know
return CANNOT_EQUIP
//return ..()
/obj/item/clothing/before_stripped(mob/wearer as mob, mob/stripper as mob, slot)
..()
if(slot == slot_w_uniform) //this will cause us to drop our belt, ID, and pockets!
for(var/slotID in list(slot_wear_id, slot_belt, slot_l_store, slot_r_store))
var/obj/item/I = wearer.get_item_by_slot(slotID)
if(I)
I.on_found(stripper)
/obj/item/clothing/stripped(mob/wearer as mob, mob/stripper as mob, slot)
..()
if(slot == slot_w_uniform) //this will cause us to drop our belt, ID, and pockets!
for(var/slotID in list(slot_wear_id, slot_belt, slot_l_store, slot_r_store))
var/obj/item/I = wearer.get_item_by_slot(slotID)
if(I)
I.stripped(stripper)
/obj/item/clothing/become_defective()
if(!defective)
..()
for(var/A in armor)
armor[A] -= rand(armor[A]/3, armor[A])
//Ears: headsets, earmuffs and tiny objects
/obj/item/clothing/ears
name = "ears"
w_class = W_CLASS_TINY
throwforce = 2
slot_flags = SLOT_EARS
/obj/item/clothing/ears/attack_hand(mob/user as mob)
if (!user)
return
if (src.loc != user || !istype(user,/mob/living/carbon/human))
..()
return
var/mob/living/carbon/human/H = user
if(H.ears != src)
..()
return
if(!canremove)
return
var/obj/item/clothing/ears/O = src
user.u_equip(src,0)
if (O)
user.put_in_hands(O)
O.add_fingerprint(user)
/obj/item/clothing/ears/earmuffs
name = "earmuffs"
desc = "Protects your hearing from both loud and quiet noises."
icon_state = "earmuffs"
item_state = "earmuffs"
slot_flags = SLOT_EARS
//Glasses
/obj/item/clothing/glasses
name = "glasses"
icon = 'icons/obj/clothing/glasses.dmi'
w_class = W_CLASS_SMALL
body_parts_covered = EYES
slot_flags = SLOT_EYES
var/vision_flags = 0
var/darkness_view = 0//Base human is 2
var/invisa_view = 0
var/cover_hair = 0
var/see_invisible = 0
var/see_in_dark = 0
var/prescription = 0
min_harm_label = 12
harm_label_examine = list("<span class='info'>A label is covering one lens, but doesn't reach the other.</span>","<span class='warning'>A label covers the lenses!</span>")
species_restricted = list("exclude","Muton")
/*
SEE_SELF // can see self, no matter what
SEE_MOBS // can see all mobs, no matter what
SEE_OBJS // can see all objs, no matter what
SEE_TURFS // can see all turfs (and areas), no matter what
SEE_PIXELS// if an object is located on an unlit area, but some of its pixels are
// in a lit area (via pixel_x,y or smooth movement), can see those pixels
BLIND // can't see anything
*/
/obj/item/clothing/glasses/harm_label_update()
if(harm_labeled >= min_harm_label)
vision_flags |= BLIND
else
vision_flags &= ~BLIND
//Gloves
/obj/item/clothing/gloves
name = "gloves"
gender = PLURAL //Carn: for grammarically correct text-parsing
w_class = W_CLASS_SMALL
icon = 'icons/obj/clothing/gloves.dmi'
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/gloves.dmi', "right_hand" = 'icons/mob/in-hand/right/gloves.dmi')
siemens_coefficient = 0.50
var/wired = 0
var/obj/item/weapon/cell/cell = 0
var/clipped = 0
body_parts_covered = HANDS
slot_flags = SLOT_GLOVES
attack_verb = list("challenges")
species_restricted = list("exclude","Unathi","Tajaran","Muton")
var/pickpocket = 0 //Master pickpocket?
var/bonus_knockout = 0 //Knockout chance is multiplied by (1 + bonus_knockout) and is capped at 1/2. 0 = 1/12 chance, 1 = 1/6 chance, 2 = 1/4 chance, 3 = 1/3 chance, etc.
var/damage_added = 0 //Added to unarmed damage, doesn't affect knockout chance
/obj/item/clothing/gloves/emp_act(severity)
if(cell)
cell.charge -= 1000 / severity
if (cell.charge < 0)
cell.charge = 0
if(cell.reliability != 100 && prob(50/severity))
cell.reliability -= 10 / severity
..()
/obj/item/clothing/gloves/proc/dexterity_check(mob/user) //Set wearer's dexterity to the value returned by this proc. Doesn't override death or brain damage, and should always return 1 (unless intended otherwise)
return 1 //Setting this to 0 will make user NOT dexterious when wearing these gloves
// Called just before an attack_hand(), in mob/UnarmedAttack()
/obj/item/clothing/gloves/proc/Touch(var/atom/A, mob/user, proximity)
return 0 // return 1 to cancel attack_hand()
//Head
/obj/item/clothing/head
name = "head"
icon = 'icons/obj/clothing/hats.dmi'
body_parts_covered = HEAD
slot_flags = SLOT_HEAD
species_restricted = list("exclude","Muton")
//Mask
/obj/item/clothing/mask
name = "mask"
icon = 'icons/obj/clothing/masks.dmi'
body_parts_covered = MOUTH
slot_flags = SLOT_MASK
species_restricted = list("exclude","Muton")
var/can_flip = null
var/is_flipped = 1
var/ignore_flip = 0
action_button_name = "Toggle Mask"
heat_conductivity = MASK_HEAT_CONDUCTIVITY
/obj/item/clothing/mask/verb/togglemask()
set name = "Toggle Mask"
set category = "Object"
set src in usr
if(ignore_flip)
return
else
if(usr.incapacitated())
return
if(!can_flip)
to_chat(usr, "You try pushing \the [src] out of the way, but it is very uncomfortable and you look like a fool. You push it back into place.")
return
if(src.is_flipped == 2)
src.icon_state = initial(icon_state)
gas_transfer_coefficient = initial(gas_transfer_coefficient)
permeability_coefficient = initial(permeability_coefficient)
flags = initial(flags)
body_parts_covered = initial(body_parts_covered)
to_chat(usr, "You push \the [src] back into place.")
src.is_flipped = 1
else
src.icon_state = "[initial(icon_state)]_up"
to_chat(usr, "You push \the [src] out of the way.")
gas_transfer_coefficient = null
permeability_coefficient = null
flags = 0
src.is_flipped = 2
body_parts_covered &= ~(MOUTH|HEAD|BEARD|FACE)
usr.update_inv_wear_mask()
/obj/item/clothing/mask/New()
..()
if(!can_flip /*&& !istype(/obj/item/clothing/mask/gas/voice)*/) //the voice changer has can_flip = 1 anyways but it's worth noting that it exists if anybody changes this in the future
action_button_name = null
verbs -= /obj/item/clothing/mask/verb/togglemask
/obj/item/clothing/mask/attack_self()
togglemask()
/obj/item/clothing/mask/proc/treat_mask_speech(var/datum/speech/speech)
return
//Shoes
/obj/item/clothing/shoes
name = "shoes"
icon = 'icons/obj/clothing/shoes.dmi'
desc = "Comfortable-looking shoes."
gender = PLURAL //Carn: for grammarically correct text-parsing
var/chained = 0
var/chaintype = null // Type of chain.
var/bonus_kick_damage = 0
var/footprint_type = /obj/effect/decal/cleanable/blood/tracks/footprints //The type of footprint left by someone wearing these
siemens_coefficient = 0.9
body_parts_covered = FEET
slot_flags = SLOT_FEET
heat_conductivity = SHOE_HEAT_CONDUCTIVITY
permeability_coefficient = 0.50
slowdown = SHOES_SLOWDOWN
species_restricted = list("exclude","Unathi","Tajaran","Muton")
var/step_sound = ""
var/stepstaken = 1
/obj/item/clothing/shoes/proc/step_action()
stepstaken++
if(step_sound != "" && ishuman(loc))
var/mob/living/carbon/human/H = loc
switch(H.m_intent)
if("run")
if(stepstaken % 2 == 1)
playsound(H, step_sound, 50, 1) // this will NEVER GET ANNOYING!
if("walk")
playsound(H, step_sound, 20, 1)
/obj/item/clothing/shoes/proc/on_kick(mob/living/user, mob/living/victim)
return
/obj/item/clothing/shoes/clean_blood()
. = ..()
track_blood = 0
//Suit
/obj/item/clothing/suit
icon = 'icons/obj/clothing/suits.dmi'
name = "suit"
var/fire_resist = T0C+100
flags = FPRINT
allowed = list(/obj/item/weapon/tank/emergency_oxygen,/obj/item/weapon/tank/emergency_nitrogen)
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
slot_flags = SLOT_OCLOTHING
heat_conductivity = ARMOUR_HEAT_CONDUCTIVITY
body_parts_covered = ARMS|LEGS|FULL_TORSO
var/blood_overlay_type = "suit"
species_restricted = list("exclude","Muton")
siemens_coefficient = 0.9
//Spacesuit
//Note: Everything in modules/clothing/spacesuits should have the entire suit grouped together.
// Meaning the the suit is defined directly after the corrisponding helmet. Just like below!
/obj/item/clothing/head/helmet/space
name = "Space helmet"
icon_state = "space"
desc = "A special helmet designed for work in a hazardous, low-pressure environment."
flags = FPRINT
pressure_resistance = 5 * ONE_ATMOSPHERE
item_state = "space"
permeability_coefficient = 0.01
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 100, rad = 50)
body_parts_covered = FULL_HEAD|BEARD
siemens_coefficient = 0.9
heat_conductivity = SPACESUIT_HEAT_CONDUCTIVITY
species_restricted = list("exclude","Diona","Muton")
eyeprot = 1
cold_breath_protection = 230
/obj/item/clothing/suit/space
name = "Space suit"
desc = "A suit that protects against low pressure environments. Has a big \"13\" on the back."
icon_state = "space"
item_state = "s_suit"
w_class = W_CLASS_LARGE//bulky item
gas_transfer_coefficient = 0.01
permeability_coefficient = 0.02
flags = FPRINT
pressure_resistance = 5 * ONE_ATMOSPHERE
body_parts_covered = ARMS|LEGS|FULL_TORSO|FEET|HANDS
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/weapon/tank/emergency_nitrogen)
slowdown = 3
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 100, rad = 50)
siemens_coefficient = 0.9
species_restricted = list("exclude","Diona","Muton")
heat_conductivity = SPACESUIT_HEAT_CONDUCTIVITY
//Under clothing
/obj/item/clothing/under
icon = 'icons/obj/clothing/uniforms.dmi'
name = "under"
body_parts_covered = ARMS|LEGS|FULL_TORSO
permeability_coefficient = 0.90
flags = FPRINT
slot_flags = SLOT_ICLOTHING
heat_conductivity = JUMPSUIT_HEAT_CONDUCTIVITY
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
species_restricted = list("exclude","Muton")
var/has_sensor = 1 //For the crew computer 2 = unable to change mode
var/sensor_mode = 0
/*
1 = Report living/dead
2 = Report detailed damages
3 = Report location
*/
var/displays_id = 1
/obj/item/clothing/under/Destroy()
for(var/obj/machinery/computer/crew/C in machines)
if(C && src in C.tracked)
C.tracked -= src
..()
/obj/item/clothing/under/examine(mob/user)
..()
var/mode
switch(src.sensor_mode)
if(0)
mode = "Its sensors appear to be disabled."
if(1)
mode = "Its binary life sensors appear to be enabled."
if(2)
mode = "Its vital tracker appears to be enabled."
if(3)
mode = "Its vital tracker and tracking beacon appear to be enabled."
to_chat(user, "<span class='info'>" + mode + "</span>")
/obj/item/clothing/under/ui_action_click()
for(var/obj/item/clothing/accessory/holomap_chip/HC in accessories)
HC.togglemap()
/obj/item/clothing/under/proc/set_sensors(mob/user as mob)
if(user.incapacitated())
return
if(has_sensor >= 2)
to_chat(user, "<span class='warning'>The controls are locked.</span>")
return 0
if(has_sensor <= 0)
to_chat(user, "<span class='warning'>This suit does not have any sensors.</span>")
return 0
var/list/modes = list("Off", "Binary sensors", "Vitals tracker", "Tracking beacon")
var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes
if(get_dist(user, src) > 1)
to_chat(user, "<span class='warning'>You have moved too far away.</span>")
return
sensor_mode = modes.Find(switchMode) - 1
if(is_holder_of(user, src))
switch(sensor_mode) //i'm sure there's a more compact way to write this but c'mon
if(0)
to_chat(user, "<span class='notice'>You disable your suit's remote sensing equipment.</span>")
if(1)
to_chat(user, "<span class='notice'>Your suit will now report whether you are live or dead.</span>")
if(2)
to_chat(user, "<span class='notice'>Your suit will now report your vital lifesigns.</span>")
if(3)
to_chat(user, "<span class='notice'>Your suit will now report your vital lifesigns as well as your coordinate position.</span>")
else
switch(sensor_mode)
if(0)
to_chat(user, "<span class='notice'>You disable the suit's remote sensing equipment.</span>")
if(1)
to_chat(user, "<span class='notice'>The suit sensors will now report whether the wearer is live or dead.</span>")
if(2)
to_chat(user, "<span class='notice'>The suit sensors will now report the wearer's vital lifesigns.</span>")
if(3)
to_chat(user, "<span class='notice'>The suit sensors will now report the wearer's vital lifesigns as well as their coordinate position.</span>")
return switchMode
/obj/item/clothing/under/verb/toggle()
set name = "Toggle Suit Sensors"
set category = "Object"
set src in usr
set_sensors(usr)
..()
/obj/item/clothing/under/AltClick()
if(is_holder_of(usr, src))
set_sensors(usr)
/obj/item/clothing/under/rank/New()
. = ..()
sensor_mode = pick(0, 1, 2, 3)
//Capes?
/obj/item/clothing/back
name = "cape"
w_class = W_CLASS_SMALL
throwforce = 2
slot_flags = SLOT_BACK