I started with the desire to fix issue 634. It sounded like a simple issue, right? Well one complete rewrite of how equipping and stripping works later, this commit fixes issue 645

Code-wide changes: /mob -level procs:
equip_if_possible() is now known as equip_to_slot_or_del() to prevent confusion with equip_to_slot_if_possible() and to better describe what it does.

equip_to_slot_if_possible(item, slot, del_on_fail, disable_warning, redraw_mob)

equip_to_appropriate_slot() is now a /mob - level proc.

equip_to_slot() is an unsafe proc, which just handles the final step of actually getting an item onto the mob. It has no checks of whether it can or can't do that. Use equip_to_slot_if_possible() for that purpose.

New /obj/item -level proc:
/obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = 0)

This proc can be used to determine whehter a mob can pick up an item from the item's side.

Carn, I'll need you to review code/modules/mob/living/carbon/human/inventory.dm to ensure that I'm not redrawing the mob too many times.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4423 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-08-15 23:15:55 +00:00
parent ae6e120533
commit 5a199fc564
43 changed files with 1326 additions and 1733 deletions

View File

@@ -40,18 +40,18 @@
M.real_name = newname
M.name = newname // there are WAY more things than this to change, I'm almost certain
M.equip_if_possible(new /obj/item/clothing/under/color/black(M), M.slot_w_uniform)
M.equip_if_possible(new /obj/item/clothing/shoes/black(M), M.slot_shoes)
M.equip_if_possible(new /obj/item/clothing/suit/swat_suit/death_commando(M), M.slot_wear_suit)
M.equip_if_possible(new /obj/item/clothing/mask/gas/death_commando(M), M.slot_wear_mask)
M.equip_if_possible(new /obj/item/clothing/gloves/swat(M), M.slot_gloves)
M.equip_if_possible(new /obj/item/clothing/glasses/thermal(M), M.slot_glasses)
M.equip_if_possible(new /obj/item/weapon/gun/energy/pulse_rifle(M), M.slot_l_hand)
M.equip_if_possible(new /obj/item/weapon/m_pill/cyanide(M), M.slot_l_store)
M.equip_if_possible(new /obj/item/weapon/flashbang(M), M.slot_r_store)
M.equip_to_slot_or_del(new /obj/item/clothing/under/color/black(M), slot_w_uniform)
M.equip_to_slot_or_del(new /obj/item/clothing/shoes/black(M), slot_shoes)
M.equip_to_slot_or_del(new /obj/item/clothing/suit/swat_suit/death_commando(M), slot_wear_suit)
M.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/death_commando(M), slot_wear_mask)
M.equip_to_slot_or_del(new /obj/item/clothing/gloves/swat(M), slot_gloves)
M.equip_to_slot_or_del(new /obj/item/clothing/glasses/thermal(M), slot_glasses)
M.equip_to_slot_or_del(new /obj/item/weapon/gun/energy/pulse_rifle(M), slot_l_hand)
M.equip_to_slot_or_del(new /obj/item/weapon/m_pill/cyanide(M), slot_l_store)
M.equip_to_slot_or_del(new /obj/item/weapon/flashbang(M), slot_r_store)
var/obj/item/weapon/tank/air/O = new(M)
M.equip_if_possible(O, M.slot_back)
M.equip_to_slot_or_del(O, slot_back)
M.internal = O
var/obj/item/weapon/card/id/W = new(M)
@@ -59,7 +59,7 @@
W.name = "[newname]'s ID card (Death Commando)"
W.assignment = "Death Commando"
W.registered_name = newname
M.equip_if_possible(W, M.slot_wear_id)
M.equip_to_slot_or_del(W, slot_wear_id)
..()
check_win()

View File

@@ -193,22 +193,22 @@ proc/dress_for_job_default(var/mob/living/carbon/human/employee as mob, var/job_
var/datum/job/JOB = jobs.get_job(job_alias)
if(JOB)
var/item = JOB.equipment_ears[1]
employee.equip_if_possible(new item(employee), employee.slot_ears)
employee.equip_to_slot_or_del(new item(employee), employee.slot_ears)
item = JOB.equipment_under[1]
employee.equip_if_possible(new item(employee), employee.slot_w_uniform)
employee.equip_to_slot_or_del(new item(employee), employee.slot_w_uniform)
/*
src.equip_if_possible(new /obj/item/weapon/storage/backpack/industrial (src), slot_back)
src.equip_if_possible(new /obj/item/weapon/storage/box/engineer(src), slot_in_backpack)
src.equip_if_possible(new /obj/item/device/radio/headset/headset_eng (src), slot_ears) // -- TLE
src.equip_if_possible(new /obj/item/device/pda/engineering(src), slot_belt)
src.equip_if_possible(new /obj/item/clothing/under/rank/engineer(src), slot_w_uniform)
src.equip_if_possible(new /obj/item/clothing/shoes/orange(src), slot_shoes)
src.equip_if_possible(new /obj/item/clothing/head/helmet/hardhat(src), slot_head)
src.equip_if_possible(new /obj/item/weapon/storage/utilitybelt/full(src), slot_l_hand) //currently spawns in hand due to traitor assignment requiring a PDA to be on the belt. --Errorage
//src.equip_if_possible(new /obj/item/clothing/gloves/yellow(src), slot_gloves) removed as part of Dangercon 2011, approved by Urist_McDorf --Errorage
src.equip_if_possible(new /obj/item/device/t_scanner(src), slot_r_store)
src.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/industrial (src), slot_back)
src.equip_to_slot_or_del(new /obj/item/weapon/storage/box/engineer(src), slot_in_backpack)
src.equip_to_slot_or_del(new /obj/item/device/radio/headset/headset_eng (src), slot_ears) // -- TLE
src.equip_to_slot_or_del(new /obj/item/device/pda/engineering(src), slot_belt)
src.equip_to_slot_or_del(new /obj/item/clothing/under/rank/engineer(src), slot_w_uniform)
src.equip_to_slot_or_del(new /obj/item/clothing/shoes/orange(src), slot_shoes)
src.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/hardhat(src), slot_head)
src.equip_to_slot_or_del(new /obj/item/weapon/storage/utilitybelt/full(src), slot_l_hand) //currently spawns in hand due to traitor assignment requiring a PDA to be on the belt. --Errorage
//src.equip_to_slot_or_del(new /obj/item/clothing/gloves/yellow(src), slot_gloves) removed as part of Dangercon 2011, approved by Urist_McDorf --Errorage
src.equip_to_slot_or_del(new /obj/item/device/t_scanner(src), slot_r_store)
*/