From 6f1852449deeb361afc199016b3e4c997ba9f7cb Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 30 Oct 2012 02:27:51 +0400 Subject: [PATCH] Ported custom items system. --- baystation12.dme | 3 +- code/game/gamemodes/gameticker.dm | 1 + code/modules/customitems/item_defines.dm | 11 +-- code/modules/customitems/item_spawning.dm | 7 +- code/modules/mob/inventory.dm | 91 +++++++++++++++++++++- code/modules/mob/new_player/new_player.dm | 1 + icons/obj/custom_items.dmi | Bin 33394 -> 33394 bytes 7 files changed, 98 insertions(+), 16 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index f7982b9280f..039a5b9c8bb 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -253,7 +253,6 @@ #define FILE_DIR "interface" #define FILE_DIR "maps" #define FILE_DIR "maps/RandomZLevels" -#define FILE_DIR "maps/RandomZLevels/backup" #define FILE_DIR "sound" #define FILE_DIR "sound/AI" #define FILE_DIR "sound/ambience" @@ -975,6 +974,8 @@ #include "code\modules\critters\critter_defenses.dm" #include "code\modules\critters\critters.dm" #include "code\modules\critters\hivebots\hivebot.dm" +#include "code\modules\customitems\item_defines.dm" +#include "code\modules\customitems\item_spawning.dm" #include "code\modules\DetectiveWork\detective_work.dm" #include "code\modules\DetectiveWork\evidence.dm" #include "code\modules\DetectiveWork\footprints_and_rag.dm" diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index ae0c93ef040..8dce6c6e441 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -287,6 +287,7 @@ var/global/datum/controller/gameticker/ticker captainless=0 if(player.mind.assigned_role != "MODE") job_master.EquipRank(player, player.mind.assigned_role, 0) + EquipCustomItems(player) if(captainless) world << "Captainship not forced on anyone." diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm index 31ef7244605..88c8ec828b5 100644 --- a/code/modules/customitems/item_defines.dm +++ b/code/modules/customitems/item_defines.dm @@ -284,17 +284,8 @@ name = "old red flashlight" desc = "A very old, childlike flashlight." icon = 'custom_items.dmi' - icon_state = "wolfflight0" - w_class = 2 + icon_state = "wolfflight" item_state = "wolfflight" - flags = FPRINT | TABLEPASS | CONDUCT - slot_flags = SLOT_BELT - m_amt = 50 - g_amt = 20 - on = 0 - brightness_on = 4 //luminosity when on - icon_on = "wolfflight1" - icon_off = "wolfflight0" ////////////////////////////////// //////////// Clothing //////////// diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index ec0eddf98a3..e202e4e8c76 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -39,7 +39,6 @@ I.registered_name = M.real_name I.access = C.access I.assignment = C.assignment - I.over_jumpsuit = C.over_jumpsuit I.blood_type = C.blood_type I.dna_hash = C.dna_hash I.fingerprint_hash = C.fingerprint_hash @@ -50,13 +49,13 @@ I.name = "[M.real_name]'s Lifetime ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])" else if(M.ckey == "nerezza" && M.real_name == "Asher Spock") //This is an Odysseus Specialist ID I.name = "[M.real_name]'s Odysseus Specialist ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])" - I.access += list(ACCESS_ROBOTICS) //Station-based mecha pilots need this to access the recharge bay. + I.access += list(access_robotics) //Station-based mecha pilots need this to access the recharge bay. else if(M.ckey == "roaper" && M.real_name == "Ian Colm") //This is a Technician ID I.name = "[M.real_name]'s Technician ID ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])" //replace old ID del(C) - ok = M.equip_if_possible(I, M.slot_wear_id, 0) //if 1, last argument deletes on fail + ok = M.equip_if_possible(I, slot_wear_id, 0) //if 1, last argument deletes on fail break else if(istype(M.back,/obj/item/weapon/storage) && M.back:contents.len < M.back:storage_slots) // Try to place it in something on the mob's back Item.loc = M.back @@ -64,7 +63,7 @@ else for(var/obj/item/weapon/storage/S in M.contents) // Try to place it in any item that can store stuff, on the mob. - if (S:len < S:storage_slots) + if (S.contents.len < S.storage_slots) Item.loc = S ok = 1 break diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 4457c5e1526..cf27948e896 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -225,4 +225,93 @@ return l_hand else return r_hand - return + 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 + switch(slot) + if(slot_back) + if(!src.back) + src.back = W + equipped = 1 + if(slot_wear_mask) + if(!src.wear_mask) + src.wear_mask = W + equipped = 1 + if(slot_handcuffed) + if(!src.handcuffed) + src.handcuffed = W + equipped = 1 + if(slot_l_hand) + if(!src.l_hand) + src.l_hand = W + equipped = 1 + if(slot_r_hand) + if(!src.r_hand) + src.r_hand = W + equipped = 1 + if(slot_belt) + if(!src.belt && src.w_uniform) + src.belt = W + equipped = 1 + if(slot_wear_id) + if(!src.wear_id && src.w_uniform) + src.wear_id = W + equipped = 1 + if(slot_ears) + if(!src.ears) + src.ears = W + equipped = 1 + if(slot_glasses) + if(!src.glasses) + src.glasses = W + equipped = 1 + if(slot_gloves) + if(!src.gloves) + src.gloves = W + equipped = 1 + if(slot_head) + if(!src.head) + src.head = W + equipped = 1 + if(slot_shoes) + if(!src.shoes) + src.shoes = W + equipped = 1 + if(slot_wear_suit) + if(!src.wear_suit) + src.wear_suit = W + equipped = 1 + if(slot_w_uniform) + if(!src.w_uniform) + src.w_uniform = W + equipped = 1 + if(slot_l_store) + if(!src.l_store && src.w_uniform) + src.l_store = W + equipped = 1 + if(slot_r_store) + if(!src.r_store && src.w_uniform) + src.r_store = W + equipped = 1 + if(slot_s_store) + if(!src.s_store && src.wear_suit) + src.s_store = W + equipped = 1 + if(slot_in_backpack) + if (src.back && istype(src.back, /obj/item/weapon/storage/backpack)) + var/obj/item/weapon/storage/backpack/B = src.back + if(B.contents.len < B.storage_slots && W.w_class <= B.max_w_class) + W.loc = B + equipped = 1 + + if(equipped) + W.layer = 20 + if(src.back && W.loc != src.back) + W.loc = src + else + if (del_on_fail) + del(W) + return equipped + diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index b26a2bef6dc..1d7a7705ec4 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -370,6 +370,7 @@ var/mob/living/carbon/human/character = create_character() //creates the human and transfers vars and mind job_master.EquipRank(character, rank, 1) //equips the human + EquipCustomItems(character) character.loc = pick(latejoin) character.lastarea = get_area(loc) diff --git a/icons/obj/custom_items.dmi b/icons/obj/custom_items.dmi index bcaf7e5e7af3f56d252fb4d8f2eadd33238afd18..96061e3b4cdf915f72cade868c233f94afd7003f 100644 GIT binary patch delta 539 zcmV+$0_6SjgaYz}0+2g@j@vj4Jttoww1-}@#bi1Q>?N0Ciee7a!~TFkOSHvU5)Dd@ z;raR=2GiYaniVrQ8+ebR9w|P4G+)1cfBIn_pP#lTltP@%!90Av+in)}HJF3>a=+aK zq#@MTpHiWsIhYR%7F#%ikllaSZahgb2eaR9dVz$m-@m{oa+SrAy3K!kPC~TFWu&OM zr(m5pYE^tiJD9Xc&DF{RRTHw0FeE7Lo@RkOpo4@0?GXqG1uXY{yPK)UN(t#|<8K1j zGI2ErbN}aVe^%-Q0(PW0K^1bNqBaqs29%DumbQu&PiT)Evd*|5l0%!E6I5B_8GLS6 ztAecAj?}A+ah*r932J|ty)OJYK`Z4ET)TZdoXFcAa;7|JEILqL`>5$m%v>z^2%3H8 zh=OUg3&&o8ULaN!+X?fiSrfVlZq!b=H|Tpt+?xk<9@pd zNJFTvKczxNb14ragI^a2TAzu&z2SxOV$^IFYwK|rtBWU)W zBMPR~E*yIWdVyF`Y$wd4W=-fKxKZnHZ_tle+}jN3X36!pDe&z*l1a zb&=QZB0on1=llOYMahrXwkHk05@hQIOZ$y`oQv(^j3p4p_V|CzED&rbGz^-SIEO19 zp`h1w&>Qe0{R1VS*fO!oGuf}D;9P8((An!w{Z4pxzYt{oQp}NO$q*Hr;U%Y?*ab(i z<6d$UMlE1F5UU;O1LqgkRq-F_N9wq6?E6SVs0uTC$F@bP=t3q(kTvBl6FP!u9b~)) d{%pSgd^C^GPumK=0YdR;?YMe*>9Y<4WPdYX5pDng