Files
Bubberstation/code/modules/clothing/under/_under.dm
vuonojenmustaturska 8ddc9677c7 examine-code refactor (#44636)
* 1/4 done? maybe?

* more

* stuff

* incremental stuff

* stuff

* stuff & things

* mostly done but not yet

* stuffing

* stuffing 2: electric boogaloo

* Git Commit and the Kingdom of the Crystal Skull

* make it actually compile

* found more stuff

* fixes

* fix AI laws appearing out of order

* fix windows

* should be the remaining stuff

* this time for real

* i guess it should compile too

* fix sechuds
2019-06-19 22:07:57 +02:00

176 lines
6.0 KiB
Plaintext

/obj/item/clothing/under
icon = 'icons/obj/clothing/uniforms.dmi'
name = "under"
body_parts_covered = CHEST|GROIN|LEGS|ARMS
permeability_coefficient = 0.9
slot_flags = ITEM_SLOT_ICLOTHING
armor = list("melee" = 0, "bullet" = 0, "laser" = 0,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
var/fitted = FEMALE_UNIFORM_FULL // For use in alternate clothing styles for women
var/has_sensor = HAS_SENSORS // For the crew computer
var/random_sensor = TRUE
var/sensor_mode = NO_SENSORS
var/can_adjust = TRUE
var/adjusted = NORMAL_STYLE
var/alt_covers_chest = FALSE // for adjusted/rolled-down jumpsuits, FALSE = exposes chest and arms, TRUE = exposes arms only
var/obj/item/clothing/accessory/attached_accessory
var/mutable_appearance/accessory_overlay
var/mutantrace_variation = NO_MUTANTRACE_VARIATION //Are there special sprites for specific situations? Don't use this unless you need to.
var/freshly_laundered = FALSE
var/dodgy_colours = FALSE
/obj/item/clothing/under/worn_overlays(isinhands = FALSE)
. = list()
if(!isinhands)
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damageduniform")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "uniformblood")
if(accessory_overlay)
. += accessory_overlay
/obj/item/clothing/under/attackby(obj/item/I, mob/user, params)
if((has_sensor == BROKEN_SENSORS) && istype(I, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = I
C.use(1)
has_sensor = HAS_SENSORS
to_chat(user,"<span class='notice'>You repair the suit sensors on [src] with [C].</span>")
return 1
if(!attach_accessory(I, user))
return ..()
/obj/item/clothing/under/update_clothes_damaged_state(damaging = TRUE)
..()
if(ismob(loc))
var/mob/M = loc
M.update_inv_w_uniform()
if(has_sensor > NO_SENSORS)
has_sensor = BROKEN_SENSORS
/obj/item/clothing/under/Initialize()
. = ..()
if(random_sensor)
//make the sensor mode favor higher levels, except coords.
sensor_mode = pick(SENSOR_OFF, SENSOR_LIVING, SENSOR_LIVING, SENSOR_VITALS, SENSOR_VITALS, SENSOR_VITALS, SENSOR_COORDS, SENSOR_COORDS)
/obj/item/clothing/under/emp_act()
. = ..()
if(has_sensor > NO_SENSORS)
sensor_mode = pick(SENSOR_OFF, SENSOR_OFF, SENSOR_OFF, SENSOR_LIVING, SENSOR_LIVING, SENSOR_VITALS, SENSOR_VITALS, SENSOR_COORDS)
if(ismob(loc))
var/mob/M = loc
to_chat(M,"<span class='warning'>The sensors on the [src] change rapidly!</span>")
/obj/item/clothing/under/equipped(mob/user, slot)
..()
if(adjusted)
adjusted = NORMAL_STYLE
fitted = initial(fitted)
if(!alt_covers_chest)
body_parts_covered |= CHEST
if(mutantrace_variation && ishuman(user))
var/mob/living/carbon/human/H = user
if(DIGITIGRADE in H.dna.species.species_traits)
adjusted = DIGITIGRADE_STYLE
H.update_inv_w_uniform()
if(slot == SLOT_W_UNIFORM && freshly_laundered)
freshly_laundered = FALSE
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "fresh_laundry", /datum/mood_event/fresh_laundry)
if(attached_accessory && slot != SLOT_HANDS && ishuman(user))
var/mob/living/carbon/human/H = user
attached_accessory.on_uniform_equip(src, user)
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
/obj/item/clothing/under/dropped(mob/user)
if(attached_accessory)
attached_accessory.on_uniform_dropped(src, user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
..()
/obj/item/clothing/under/proc/attach_accessory(obj/item/I, mob/user, notifyAttach = 1)
. = FALSE
if(istype(I, /obj/item/clothing/accessory))
var/obj/item/clothing/accessory/A = I
if(attached_accessory)
if(user)
to_chat(user, "<span class='warning'>[src] already has an accessory.</span>")
return
else
if(!A.can_attach_accessory(src, user)) //Make sure the suit has a place to put the accessory.
return
if(user && !user.temporarilyRemoveItemFromInventory(I))
return
if(!A.attach(src, user))
return
if(user && notifyAttach)
to_chat(user, "<span class='notice'>You attach [I] to [src].</span>")
var/accessory_color = attached_accessory.item_color
if(!accessory_color)
accessory_color = attached_accessory.icon_state
accessory_overlay = mutable_appearance('icons/mob/accessories.dmi', "[accessory_color]")
accessory_overlay.alpha = attached_accessory.alpha
accessory_overlay.color = attached_accessory.color
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
H.update_inv_wear_suit()
return TRUE
/obj/item/clothing/under/proc/remove_accessory(mob/user)
if(!isliving(user))
return
if(!can_use(user))
return
if(attached_accessory)
var/obj/item/clothing/accessory/A = attached_accessory
attached_accessory.detach(src, user)
if(user.put_in_hands(A))
to_chat(user, "<span class='notice'>You detach [A] from [src].</span>")
else
to_chat(user, "<span class='notice'>You detach [A] from [src] and it falls on the floor.</span>")
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform()
H.update_inv_wear_suit()
/obj/item/clothing/under/examine(mob/user)
. = ..()
if(dodgy_colours)
. += "The colours are a bit dodgy."
if(freshly_laundered)
. += "It looks fresh and clean."
if(can_adjust)
if(adjusted == ALT_STYLE)
. += "Alt-click on [src] to wear it normally."
else
. += "Alt-click on [src] to wear it casually."
if (has_sensor == BROKEN_SENSORS)
. += "Its sensors appear to be shorted out."
else if(has_sensor > NO_SENSORS)
switch(sensor_mode)
if(SENSOR_OFF)
. += "Its sensors appear to be disabled."
if(SENSOR_LIVING)
. += "Its binary life sensors appear to be enabled."
if(SENSOR_VITALS)
. += "Its vital tracker appears to be enabled."
if(SENSOR_COORDS)
. += "Its vital tracker and tracking beacon appear to be enabled."
if(attached_accessory)
. += "\A [attached_accessory] is attached to it."