tg: - Added a equip_to_appropriate_slot() proc for later use with the UI to speed up

equipping yourself. Human mobs only.
Revision: r3667
Author: 	 baloh.matevz
This commit is contained in:
Erthilo
2012-05-29 00:43:50 +01:00
parent 835623de13
commit 340f4ced91
2 changed files with 146 additions and 23 deletions

View File

@@ -48,25 +48,24 @@ proc/countJob(rank)
jobCount++
return jobCount
/mob/living/carbon/human/var/const
slot_back = 1
slot_wear_mask = 2
slot_handcuffed = 3
slot_l_hand = 4
slot_r_hand = 5
slot_belt = 6
slot_wear_id = 7
slot_ears = 8
slot_glasses = 9
slot_gloves = 10
slot_head = 11
slot_shoes = 12
slot_wear_suit = 13
slot_w_uniform = 14
slot_l_store = 15
slot_r_store = 16
slot_s_store = 17
slot_in_backpack = 18
/mob/living/carbon/human/var/const/slot_back = 1
/mob/living/carbon/human/var/const/slot_wear_mask = 2
/mob/living/carbon/human/var/const/slot_handcuffed = 3
/mob/living/carbon/human/var/const/slot_l_hand = 4
/mob/living/carbon/human/var/const/slot_r_hand = 5
/mob/living/carbon/human/var/const/slot_belt = 6
/mob/living/carbon/human/var/const/slot_wear_id = 7
/mob/living/carbon/human/var/const/slot_ears = 8
/mob/living/carbon/human/var/const/slot_glasses = 9
/mob/living/carbon/human/var/const/slot_gloves = 10
/mob/living/carbon/human/var/const/slot_head = 11
/mob/living/carbon/human/var/const/slot_shoes = 12
/mob/living/carbon/human/var/const/slot_wear_suit = 13
/mob/living/carbon/human/var/const/slot_w_uniform = 14
/mob/living/carbon/human/var/const/slot_l_store = 15
/mob/living/carbon/human/var/const/slot_r_store = 16
/mob/living/carbon/human/var/const/slot_s_store = 17
/mob/living/carbon/human/var/const/slot_in_backpack = 18
/mob/living/carbon/human/proc/equip_in_one_of_slots(obj/item/W, list/slots, del_on_fail = 1)
for (var/slot in slots)
@@ -76,6 +75,130 @@ proc/countJob(rank)
del(W)
return null
/mob/living/carbon/human/proc/equip_to_appropriate_slot(obj/item/W)
if(!W)
return
if(!ishuman(src))
return
if(W.slot_flags & SLOT_BACK)
if(!src.back)
if( src.get_active_hand() == W )
src.u_equip(W)
src.back = W
update_clothing()
return
if(W.slot_flags & SLOT_ID)
if(!src.wear_id)
if( src.get_active_hand() == W )
src.u_equip(W)
src.wear_id = W
update_clothing()
return
if(W.slot_flags & SLOT_ICLOTHING)
if(!src.w_uniform)
if( src.get_active_hand() == W )
src.u_equip(W)
src.w_uniform = W
update_clothing()
return
if(W.slot_flags & SLOT_OCLOTHING)
if(!src.wear_suit)
if( src.get_active_hand() == W )
src.u_equip(W)
src.wear_suit = W
update_clothing()
return
if(W.slot_flags & SLOT_MASK)
if(!src.wear_mask)
if( src.get_active_hand() == W )
src.u_equip(W)
src.wear_mask = W
update_clothing()
return
if(W.slot_flags & SLOT_HEAD)
if(!src.head)
if( src.get_active_hand() == W )
src.u_equip(W)
src.head = W
update_clothing()
return
if(W.slot_flags & SLOT_FEET)
if(!src.shoes)
if( src.get_active_hand() == W )
src.u_equip(W)
src.shoes = W
update_clothing()
return
if(W.slot_flags & SLOT_GLOVES)
if(!src.gloves)
if( src.get_active_hand() == W )
src.u_equip(W)
src.gloves = W
update_clothing()
return
if(W.slot_flags & SLOT_EARS)
if(!src.ears)
if( src.get_active_hand() == W )
src.u_equip(W)
src.ears = W
update_clothing()
return
if(W.slot_flags & SLOT_EYES)
if(!src.glasses)
if( src.get_active_hand() == W )
src.u_equip(W)
src.glasses = W
update_clothing()
return
if(W.slot_flags & SLOT_BELT)
if(!src.belt)
if( src.get_active_hand() == W )
src.u_equip(W)
src.belt = W
update_clothing()
return
//Suit storage
var/confirm
if (wear_suit)
if(wear_suit.allowed)
if (istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen))
confirm = 1
if (is_type_in_list(W, wear_suit.allowed))
confirm = 1
if(confirm)
src.u_equip(W)
src.s_store = W
update_clothing()
return
//Pockets
if ( !( W.slot_flags & SLOT_DENYPOCKET ) )
if(!src.l_store)
if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) )
u_equip(W)
l_store = W
update_clothing()
return
if(!src.r_store)
if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) )
u_equip(W)
r_store = W
update_clothing()
return
/mob/living/carbon/human/proc/equip_if_possible(obj/item/W, slot, del_on_fail = 1) // since byond doesn't seem to have pointers, this seems like the best way to do this :/
//warning: icky code
var/equipped = 0

View File

@@ -77,7 +77,7 @@
/atom/proc/add_hiddenprint(mob/living/M as mob)
if(isnull(M)) return
if(isnull(M.key)) return
if (!( src.flags ) & 256)
if (!( src.flags ) & FPRINT)
return
if (ishuman(M))
var/mob/living/carbon/human/H = M
@@ -102,7 +102,7 @@
/atom/proc/add_fingerprint(mob/living/M as mob)
if(isnull(M)) return
if(isnull(M.key)) return
if (!( flags ) & 256)
if (!( src.flags ) & FPRINT)
return
//Smudge up dem prints some
for(var/P in fingerprints)
@@ -175,7 +175,7 @@
if (!istype(M.dna, /datum/dna))
M.dna = new /datum/dna(null)
M.check_dna()
if (!( src.flags ) & 256)
if (!( src.flags ) & FPRINT)
return 0
if(!blood_DNA || !istype(blood_DNA, /list)) //if our list of DNA doesn't exist yet (or isn't a list) initialise it.
blood_DNA = list()
@@ -291,7 +291,7 @@
/atom/proc/clean_blood()
if (!flags & 256)
if (!( src.flags ) & FPRINT)
return
if (blood_DNA )