Files
Paradise/code/game/objects/items/clothing.dm
elly1989@rocketmail.com 8961bd96d0 WARNING: This has been thoroughly tested and I'm happy that it's -stable- (it shouldn't runtime). However, it might have a few niggly bugs caused by specific items using no-standard or weird code. Most bugs will be stuff like it not updating overlays and such and can be fixed simply by dropping the item. That being said, if you're not comfortable with this, I'd suggest waiting to update past this revision.
update_clothing() has been broken up into it's key parts. A full explanation can be found in code/modules/mob/living/carbon/human/update_icons.dm
the tl;dr of it is that overlay updates are no longer called by the gameticker. Instead they are called by procs such as u_equip db_cick etc. This means faster updates (although admittedly, more of them can be called per tick). This however is offset by the fact that specific overlays can be updated now, vastly improving its efficiency. This will especially help when there are large numbers of dead mobs.

Fixed the throw code for TKgrab so it can be toggled.

Cloaking for aliens/humans/ninjas was changed. It's very crude at the moment and for that I apologise. But it works and is very efficient.It also stops cloaked individuals becomming invincible due to people being unable to hit them (even when they know exactly where  they are)

Fixed a bunch of bugs with damage-overlays. They  were updating FAR FAR to frequently. They were also horribly inefficient. They should now be virtually seamless when updating and only use cached icons, so they aren't affected by lag as badly. This may help with explosions lag a little.

There's still a tonne of stuff I need to refine with this. I'll be refining it down into some helper procs to reduce on code duplication and such

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3811 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-13 19:03:25 +00:00

420 lines
11 KiB
Plaintext

/*
CONTAINS:
ORANGE SHOES
MUZZLE
CAKEHAT
SUNGLASSES
SWAT SUIT
CHAMELEON JUMPSUIT
SYNDICATE SHOES
DEATH COMMANDO GAS MASK
THERMAL GLASSES
*/
/*
/obj/item/clothing/fire_burn(obj/fire/raging_fire, datum/air_group/environment)
if(raging_fire.internal_temperature > src.s_fire)
spawn( 0 )
var/t = src.icon_state
src.icon_state = ""
src.icon = 'b_items.dmi'
flick(text("[]", t), src)
spawn(14)
del(src)
return
return
return 0
return 1
*/ //TODO FIX
/obj/item/clothing/gloves/examine()
set src in usr
..()
return
/obj/item/clothing/gloves/latex/attackby(obj/item/weapon/cable_coil/O as obj, loc)
if (istype(O) && O.amount==1)
var/obj/item/latexballon/LB = new
if (usr.get_inactive_hand()==src)
usr.before_take_item(src)
usr.put_in_inactive_hand(LB)
else
LB.loc = src.loc
del(O)
del(src)
else
return ..()
/obj/item/clothing/shoes/orange/attack_self(mob/user as mob)
if (src.chained)
src.chained = null
src.slowdown = SHOES_SLOWDOWN
new /obj/item/weapon/handcuffs( user.loc )
src.icon_state = "orange"
return
/obj/item/clothing/shoes/orange/attackby(H as obj, loc)
..()
if ((istype(H, /obj/item/weapon/handcuffs) && !( src.chained )))
//H = null
del(H)
src.chained = 1
src.slowdown = 15
src.icon_state = "orange1"
return
/obj/item/clothing/mask/muzzle/attack_paw(mob/user as mob)
if (src == user.wear_mask)
return
else
..()
return
/obj/item/clothing/head/cakehat/var/processing = 0
/obj/item/clothing/head/cakehat/process()
if(!onfire)
processing_objects.Remove(src)
return
var/turf/location = src.loc
if(istype(location, /mob/))
var/mob/living/carbon/human/M = location
if(M.l_hand == src || M.r_hand == src || M.head == src)
location = M.loc
if (istype(location, /turf))
location.hotspot_expose(700, 1)
/obj/item/clothing/head/cakehat/attack_self(mob/user as mob)
if(status > 1) return
src.onfire = !( src.onfire )
if (src.onfire)
src.force = 3
src.damtype = "fire"
src.icon_state = "cake1"
processing_objects.Add(src)
else
src.force = null
src.damtype = "brute"
src.icon_state = "cake0"
return
/obj/item/clothing/under/chameleon/New()
..()
for(var/U in typesof(/obj/item/clothing/under/color)-(/obj/item/clothing/under/color))
var/obj/item/clothing/under/V = new U
src.clothing_choices += V
for(var/U in typesof(/obj/item/clothing/under/rank)-(/obj/item/clothing/under/rank))
var/obj/item/clothing/under/V = new U
src.clothing_choices += V
return
/obj/item/clothing/under/chameleon/all/New()
..()
var/blocked = list(/obj/item/clothing/under/chameleon, /obj/item/clothing/under/chameleon/all)
//to prevent an infinite loop
for(var/U in typesof(/obj/item/clothing/under)-blocked)
var/obj/item/clothing/under/V = new U
src.clothing_choices += V
/obj/item/clothing/under/chameleon/attackby(obj/item/clothing/under/U as obj, mob/user as mob)
..()
if(istype(U, /obj/item/clothing/under/chameleon))
user << "\red Nothing happens."
return
if(istype(U, /obj/item/clothing/under))
if(src.clothing_choices.Find(U))
user << "\red Pattern is already recognised by the suit."
return
src.clothing_choices += U
user << "\red Pattern absorbed by the suit."
/obj/item/clothing/under/chameleon/verb/change()
set name = "Change Color"
set category = "Object"
set src in usr
if(icon_state == "psyche")
usr << "\red Your suit is malfunctioning"
return
var/obj/item/clothing/under/A
A = input("Select Colour to change it to", "BOOYEA", A) in clothing_choices
if(!A)
return
desc = null
permeability_coefficient = 0.90
desc = A.desc
name = A.name
icon_state = A.icon_state
item_state = A.item_state
color = A.color
usr.update_inv_w_uniform() //so our overlays update.
/obj/item/clothing/under/chameleon/emp_act(severity)
name = "psychedelic"
desc = "Groovy!"
icon_state = "psyche"
color = "psyche"
spawn(200)
name = "Black Jumpsuit"
icon_state = "bl_suit"
color = "black"
desc = null
..()
/*
/obj/item/clothing/suit/swat_suit/death_commando
name = "Death Commando Suit"
icon_state = "death_commando_suit"
item_state = "death_commando_suit"
flags = FPRINT | TABLEPASS | SUITSPACE*/
/obj/item/clothing/mask/gas/death_commando
name = "Death Commando Mask"
icon_state = "death_commando_mask"
item_state = "death_commando_mask"
/obj/item/clothing/under/rank/New()
sensor_mode = pick(0,1,2,3)
..()
/obj/item/clothing/under/verb/toggle()
set name = "Toggle Suit Sensors"
set category = "Object"
set src in usr
var/mob/M = usr
if (istype(M, /mob/dead/)) return
if (usr.stat) return
if(src.has_sensor >= 2)
usr << "The controls are locked."
return 0
if(src.has_sensor <= 0)
usr << "This suit does not have any sensors"
return 0
src.sensor_mode += 1
if(src.sensor_mode > 3)
src.sensor_mode = 0
switch(src.sensor_mode)
if(0)
usr << "You disable your suit's remote sensing equipment."
if(1)
usr << "Your suit will now report whether you are live or dead."
if(2)
usr << "Your suit will now report your vital lifesigns."
if(3)
usr << "Your suit will now report your vital lifesigns as well as your coordinate position."
..()
/obj/item/clothing/under/examine()
set src in view()
..()
switch(src.sensor_mode)
if(0)
usr << "Its sensors appear to be disabled."
if(1)
usr << "Its binary life sensors appear to be enabled."
if(2)
usr << "Its vital tracker appears to be enabled."
if(3)
usr << "Its vital tracker and tracking beacon appear to be enabled."
/obj/item/clothing/head/helmet/welding/attack_self()
toggle()
/obj/item/clothing/head/helmet/welding/verb/toggle()
set category = "Object"
set name = "Adjust welding mask"
set src in usr
if(usr.canmove && !usr.stat && !usr.restrained())
if(src.up)
src.up = !src.up
src.see_face = !src.see_face
src.flags |= HEADCOVERSEYES
flags_inv |= HIDEMASK|HIDEEARS|HIDEEYES
icon_state = "welding"
usr << "You flip the mask down to protect your eyes."
else
src.up = !src.up
src.see_face = !src.see_face
src.flags &= ~HEADCOVERSEYES
flags_inv &= ~(HIDEMASK|HIDEEARS|HIDEEYES)
icon_state = "weldingup"
usr << "You push the mask up out of your face."
usr.update_inv_head() //so our mob-overlays update
/obj/item/clothing/head/cargosoft/dropped()
src.icon_state = "cargosoft"
src.flipped=0
..()
/obj/item/clothing/head/cargosoft/verb/flip()
set category = "Object"
set name = "Flip cap"
set src in usr
if(usr.canmove && !usr.stat && !usr.restrained())
src.flipped = !src.flipped
if(src.flipped)
icon_state = "cargosoft_flipped"
usr << "You flip the hat backwards."
else
icon_state = "cargosoft"
usr << "You flip the hat back in normal position."
usr.update_inv_head() //so our mob-overlays update
/obj/item/clothing/shoes/magboots/verb/toggle()
set name = "Toggle Magboots"
set category = "Object"
set src in usr
if(src.magpulse)
src.flags &= ~NOSLIP
src.slowdown = SHOES_SLOWDOWN
src.magpulse = 0
icon_state = "magboots0"
usr << "You disable the mag-pulse traction system."
else
src.flags |= NOSLIP
src.slowdown = 2
src.magpulse = 1
icon_state = "magboots1"
usr << "You enable the mag-pulse traction system."
usr.update_inv_shoes() //so our mob-overlays update
/obj/item/clothing/shoes/magboots/examine()
set src in view()
..()
var/state = "disabled"
if(src.flags&NOSLIP)
state = "enabled"
usr << "Its mag-pulse traction system appears to be [state]."
/obj/item/clothing/suit/suit/verb/toggle()
set name = "Toggle Jacket Buttons"
set category = "Object"
set src in usr
if(!usr.canmove || usr.stat || usr.restrained())
return 0
if(src.icon_state == "suitjacket_blue_open")
src.icon_state = "suitjacket_blue"
src.item_state = "suitjacket_blue"
usr << "You button up the suit jacket."
else if(src.icon_state == "suitjacket_blue")
src.icon_state = "suitjacket_blue_open"
src.item_state = "suitjacket_blue_open"
usr << "You unbutton the suit jacket."
else
usr << "You button-up some imaginary buttons on your [src]."
return
usr.update_inv_wear_suit()
/obj/item/clothing/suit/labcoat/verb/toggle()
set name = "Toggle Labcoat Buttons"
set category = "Object"
set src in usr
if(!usr.canmove || usr.stat || usr.restrained())
return 0
switch(icon_state)
if("labcoat_open")
src.icon_state = "labcoat"
usr << "You button up the labcoat."
if("labcoat")
src.icon_state = "labcoat_open"
usr << "You unbutton the labcoat."
if("labcoat_cmo_open")
src.icon_state = "labcoat_cmo"
usr << "You button up the labcoat."
if("labcoat_cmo")
src.icon_state = "labcoat_cmo_open"
usr << "You unbutton the labcoat."
if("labcoat_gen_open")
src.icon_state = "labcoat_gen"
usr << "You button up the labcoat."
if("labcoat_gen")
src.icon_state = "labcoat_gen_open"
usr << "You unbutton the labcoat."
if("labcoat_chem_open")
src.icon_state = "labcoat_chem"
usr << "You button up the labcoat."
if("labcoat_chem")
src.icon_state = "labcoat_chem_open"
usr << "You unbutton the labcoat."
if("labcoat_vir_open")
src.icon_state = "labcoat_vir"
usr << "You button up the labcoat."
if("labcoat_vir")
src.icon_state = "labcoat_vir_open"
usr << "You unbutton the labcoat."
if("labcoat_tox_open")
src.icon_state = "labcoat_tox"
usr << "You button up the labcoat."
if("labcoat_tox")
src.icon_state = "labcoat_tox_open"
usr << "You unbutton the labcoat."
if("labgreen_open")
src.icon_state = "labgreen"
usr << "You button up the labcoat."
if("labgreen")
src.icon_state = "labgreen_open"
usr << "You unbutton the labcoat."
else
usr << "You attempt to button-up the velcro on your [src], before promptly realising how retarded you are."
return
usr.update_inv_wear_suit() //so our overlays update
/obj/item/clothing/head/ushanka/attack_self(mob/user as mob)
if(src.icon_state == "ushankadown")
src.icon_state = "ushankaup"
src.item_state = "ushankaup"
user << "You raise the ear flaps on the ushanka."
else
src.icon_state = "ushankadown"
src.item_state = "ushankadown"
user << "You lower the ear flaps on the ushanka."
/obj/item/clothing/glasses/thermal/emp_act(severity)
if(istype(src.loc, /mob/living/carbon/human))
var/mob/living/carbon/human/M = src.loc
M << "\red The Optical Thermal Scanner overloads and blinds you!"
if(M.glasses == src)
M.eye_blind = 3
M.eye_blurry = 5
M.disabilities |= 1
spawn(100)
M.disabilities &= ~1
..()