Fixes a silly mistake I made with db_click which was causing null.slot_flags errors.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4069 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-07-14 13:44:43 +00:00
parent b358572f2f
commit 2d814e05cf
3 changed files with 241 additions and 225 deletions

View File

@@ -21,36 +21,34 @@
/mob/living/carbon/alien/humanoid/db_click(text, t1)
var/obj/item/W = get_active_hand()
if(W && !istype(W))
return
switch(text)
if("o_clothing")
if(wear_suit)
if(!W) wear_suit.attack_alien(src)
return
return
if("head")
if(head)
if(!W) head.attack_alien(src)
return
return
if("storage1")
if(l_store)
if(!W) l_store.attack_alien(src)
return
if(W.w_class > 3)
return
u_equip(W)
l_store = W
update_inv_pockets()
if("storage2")
if(r_store)
if(!W) r_store.attack_alien(src)
return
if(W.w_class > 3)
return
u_equip(W)
r_store = W
update_inv_pockets()
return
if(W)
if(!istype(W)) return
switch(text)
// if("o_clothing")
// if("head")
if("storage1")
if(l_store)
return
if(W.w_class > 3)
return
u_equip(W)
l_store = W
update_inv_pockets()
if("storage2")
if(r_store)
return
if(W.w_class > 3)
return
u_equip(W)
r_store = W
update_inv_pockets()
else
switch(text)
if("o_clothing")
if(wear_suit) wear_suit.attack_alien(src)
if("head")
if(head) head.attack_alien(src)
if("storage1")
if(l_store) l_store.attack_alien(src)
if("storage2")
if(r_store) r_store.attack_alien(src)

View File

@@ -1013,173 +1013,190 @@ It can still be worn/put on as normal.
/mob/living/carbon/human/db_click(text, t1)
var/obj/item/W = get_active_hand()
if(W && !istype(W)) return
if(W)
if(!istype(W)) return
switch(text)
if("mask")
if(wear_mask)
return
if( !(W.slot_flags & SLOT_MASK) )
return
u_equip(W)
wear_mask = W
if(wear_mask.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
W.equipped(src, text)
update_inv_wear_mask()
if("back")
if(back)
return
if( !(W.slot_flags & SLOT_BACK) )
return
if(istype(W,/obj/item/weapon/twohanded) && W:wielded) //TODO
usr << "<span class='warning'>Unwield the [initial(W.name)] first!</span>"
return
u_equip(W)
back = W
W.equipped(src, text)
update_inv_back()
if("o_clothing")
if(wear_suit)
return
if( !(W.slot_flags & SLOT_OCLOTHING) )
return
if( !(W.flags & ONESIZEFITSALL) && (FAT in mutations) )
src << "\red You're too fat to wear the [W.name]!"
return
u_equip(W)
wear_suit = W
W.equipped(src, text)
update_inv_wear_suit()
if("gloves")
if(gloves)
return
if( !(W.slot_flags & SLOT_GLOVES) )
return
u_equip(W)
gloves = W
W.equipped(src, text)
update_inv_gloves()
if("shoes")
if(shoes)
return
if( !( W.slot_flags & SLOT_FEET) )
return
u_equip(W)
shoes = W
W.equipped(src, text)
update_inv_shoes()
if("belt")
if(belt)
return
if(!w_uniform)
return
if( !(W.slot_flags & SLOT_BELT) )
return
u_equip(W)
belt = W
W.equipped(src, text)
update_inv_belt()
if("eyes")
if(glasses)
return
if( !(W.slot_flags & SLOT_EYES) )
return
u_equip(W)
glasses = W
W.equipped(src, text)
update_inv_glasses()
if("head")
if(head)
return
if( !(W.slot_flags & SLOT_HEAD) )
return
u_equip(W)
head = W
if(head.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
if(istype(W,/obj/item/clothing/head/kitty))
W.update_icon(src)
W.equipped(src, text)
update_inv_head()
if("ears")
if(ears)
return
if( !(W.slot_flags & SLOT_EARS) )
return
u_equip(W)
ears = W
W.equipped(src, text)
update_inv_ears()
if("i_clothing")
if(w_uniform)
return
if( !(W.slot_flags & SLOT_ICLOTHING) )
return
if( !(W.flags & ONESIZEFITSALL) && (FAT in src.mutations) )
src << "\red You're too fat to wear the [W.name]!"
return
u_equip(W)
w_uniform = W
W.equipped(src, text)
update_inv_w_uniform()
if("id")
if(wear_id)
return
if(!w_uniform)
return
if( !(W.slot_flags & SLOT_ID) )
return
u_equip(W)
wear_id = W
W.equipped(src, text)
update_inv_wear_id()
if("storage1")
if(l_store)
return
if(!w_uniform)
return
if(W.slot_flags & SLOT_DENYPOCKET)
return
if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) )
u_equip(W)
l_store = W
update_inv_pockets()
if("storage2")
if(r_store)
return
if(!w_uniform)
return
if(W.slot_flags & SLOT_DENYPOCKET)
return
if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) )
u_equip(W)
r_store = W
update_inv_pockets()
if("suit storage")
if(s_store)
return
if(!wear_suit)
return
if(!wear_suit.allowed)
usr << "You somehow have a suit with no defined allowed items for suit storage, stop that."
return
if( istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen) || is_type_in_list(W, wear_suit.allowed) )
u_equip(W)
s_store = W
update_inv_s_store()
else
switch(text)
if("mask")
if(wear_mask) wear_mask.attack_hand(src)
if("back")
if(back) back.attack_hand(src)
if("o_clothing")
if(wear_suit) wear_suit.attack_hand(src)
if("gloves")
if(gloves) gloves.attack_hand(src)
if("shoes")
if(shoes) shoes.attack_hand(src)
if("belt")
if(belt) belt.attack_hand(src)
if("eyes")
if(glasses) glasses.attack_hand(src)
if("head")
if(head) head.attack_hand(src)
if("ears")
if(ears) ears.attack_hand(src)
if("i_clothing")
if(w_uniform) w_uniform.attack_hand(src)
if("id")
if(wear_id) wear_id.attack_hand(src)
if("storage1")
if(l_store) l_store.attack_hand(src)
if("storage2")
if(r_store) r_store.attack_hand(src)
if("suit storage")
if(s_store) s_store.attack_hand(src)
return
switch(text)
if("mask")
if(wear_mask)
if(!W) wear_mask.attack_hand(src)
return
if( !(W.slot_flags & SLOT_MASK) )
return
u_equip(W)
wear_mask = W
if(wear_mask.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
W.equipped(src, text)
update_inv_wear_mask()
if("back")
if(back)
if(!W) back.attack_hand(src)
return
if( !(W.slot_flags & SLOT_BACK) )
return
if(istype(W,/obj/item/weapon/twohanded) && W:wielded) //TODO
usr << "<span class='warning'>Unwield the [initial(W.name)] first!</span>"
return
u_equip(W)
back = W
W.equipped(src, text)
update_inv_back()
if("o_clothing")
if(wear_suit)
if(!W) wear_suit.attack_hand(src)
return
if( !(W.slot_flags & SLOT_OCLOTHING) )
return
if( !(W.flags & ONESIZEFITSALL) && (FAT in mutations) )
src << "\red You're too fat to wear the [W.name]!"
return
u_equip(W)
wear_suit = W
W.equipped(src, text)
update_inv_wear_suit()
if("gloves")
if(gloves)
if(!W) gloves.attack_hand(src)
return
if( !(W.slot_flags & SLOT_GLOVES) )
return
u_equip(W)
gloves = W
W.equipped(src, text)
update_inv_gloves()
if("shoes")
if(shoes)
if(!W) shoes.attack_hand(src)
return
if( !( W.slot_flags & SLOT_FEET) )
return
u_equip(W)
shoes = W
W.equipped(src, text)
update_inv_shoes()
if("belt")
if(belt)
if(!W) belt.attack_hand(src)
return
if(!w_uniform)
return
if( !(W.slot_flags & SLOT_BELT) )
return
u_equip(W)
belt = W
W.equipped(src, text)
update_inv_belt()
if("eyes")
if(glasses)
if(!W) glasses.attack_hand(src)
return
if( !(W.slot_flags & SLOT_EYES) )
return
u_equip(W)
glasses = W
W.equipped(src, text)
update_inv_glasses()
if("head")
if(head)
if(!W) head.attack_hand(src)
return
if( !(W.slot_flags & SLOT_HEAD) )
return
u_equip(W)
head = W
if(head.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
if(istype(W,/obj/item/clothing/head/kitty))
W.update_icon(src)
W.equipped(src, text)
update_inv_head()
if("ears")
if(ears)
if(!W) ears.attack_hand(src)
return
if( !(W.slot_flags & SLOT_EARS) )
return
u_equip(W)
ears = W
W.equipped(src, text)
update_inv_ears()
if("i_clothing")
if(w_uniform)
if(!W) w_uniform.attack_hand(src)
return
if( !(W.slot_flags & SLOT_ICLOTHING) )
return
if( !(W.flags & ONESIZEFITSALL) && (FAT in src.mutations) )
src << "\red You're too fat to wear the [W.name]!"
return
u_equip(W)
w_uniform = W
W.equipped(src, text)
update_inv_w_uniform()
if("id")
if(wear_id)
if(!W) wear_id.attack_hand(src)
return
if(!w_uniform)
return
if( !(W.slot_flags & SLOT_ID) )
return
u_equip(W)
wear_id = W
W.equipped(src, text)
update_inv_wear_id()
if("storage1")
if(l_store)
if(!W) l_store.attack_hand(src)
return
if(!w_uniform)
return
if(W.slot_flags & SLOT_DENYPOCKET)
return
if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) )
u_equip(W)
l_store = W
update_inv_pockets()
if("storage2")
if(r_store)
if(!W) r_store.attack_hand(src)
return
if(!w_uniform)
return
if(W.slot_flags & SLOT_DENYPOCKET)
return
if( W.w_class <= 2 || (W.slot_flags & SLOT_POCKET) )
u_equip(W)
r_store = W
update_inv_pockets()
if("suit storage")
if(s_store)
if(!W) s_store.attack_hand(src)
return
if(!wear_suit)
return
if(!wear_suit.allowed)
usr << "You somehow have a suit with no defined allowed items for suit storage, stop that."
return
if( istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen) || is_type_in_list(W, wear_suit.allowed) )
u_equip(W)
s_store = W
update_inv_s_store()
return

View File

@@ -109,29 +109,30 @@
//Used by monkeys, *chimpers* //TODO: eliminate this convoluted proc it's incredibly shitty. ~Carn
/mob/proc/db_click(text, t1)
var/obj/item/W = get_active_hand()
if(W && !istype(W)) return
switch(text)
if("mask")
if(wear_mask)
return
if( !(W.slot_flags & SLOT_MASK) )
return
u_equip(W)
wear_mask = W
W.equipped(src, text)
update_inv_wear_mask()
if("back")
if(back)
return
if( !(W.slot_flags & SLOT_BACK) )
return
if( istype(W,/obj/item/weapon/twohanded) && W:wielded ) //TODO: Carn
usr << "<span class='warning'>Unwield the [initial(W.name)] first!</span>"
return
u_equip(W)
back = W
W.equipped(src, text)
update_inv_back()
if(W)
if(!istype(W)) return
switch(text)
if("mask")
if(wear_mask)
return
if( !(W.slot_flags & SLOT_MASK) )
return
u_equip(W)
wear_mask = W
W.equipped(src, text)
update_inv_wear_mask()
if("back")
if(back)
return
if( !(W.slot_flags & SLOT_BACK) )
return
if( istype(W,/obj/item/weapon/twohanded) && W:wielded ) //TODO: Carn
usr << "<span class='warning'>Unwield the [initial(W.name)] first!</span>"
return
u_equip(W)
back = W
W.equipped(src, text)
update_inv_back()
return
/mob/proc/reset_view(atom/A)