Merge pull request #7071 from Segrain/dev

Equipping custom loadout.
This commit is contained in:
PsiOmegaDelta
2014-11-21 08:03:24 +01:00
9 changed files with 121 additions and 53 deletions

View File

@@ -356,6 +356,8 @@ var/global/datum/controller/occupations/job_master
if(job)
//Equip custom gear loadout.
var/list/custom_equip_slots = list() //If more than one item takes the same slot, all after the first one spawn in storage.
var/list/custom_equip_leftovers = list()
if(H.client.prefs.gear && H.client.prefs.gear.len && job.title != "Cyborg" && job.title != "AI")
for(var/thing in H.client.prefs.gear)
@@ -376,9 +378,12 @@ var/global/datum/controller/occupations/job_master
H << "\red Your current job or whitelist status does not permit you to spawn with [thing]!"
continue
if(G.slot)
H.equip_to_slot_or_del(new G.path(H), G.slot)
H << "\blue Equipping you with [thing]!"
if(G.slot && !(G.slot in custom_equip_slots))
if(H.equip_to_slot_or_del(new G.path(H), G.slot))
H << "\blue Equipping you with [thing]!"
custom_equip_slots.Add(G.slot)
else
custom_equip_leftovers.Add(thing)
else
spawn_in_storage += thing
@@ -387,6 +392,17 @@ var/global/datum/controller/occupations/job_master
//Equip job items.
job.equip(H)
job.apply_fingerprints(H)
//If some custom items could not be equipped before, try again now.
for(var/thing in custom_equip_leftovers)
var/datum/gear/G = gear_datums[thing]
if(G.slot in custom_equip_slots)
spawn_in_storage += thing
else
if(H.equip_to_slot_or_del(new G.path(H), G.slot))
H << "\blue Equipping you with [thing]!"
custom_equip_slots.Add(G.slot)
else
spawn_in_storage += thing
else
H << "Your job is [rank] and the game just can't handle it! Please report this bug to an administrator."
@@ -630,4 +646,4 @@ var/global/datum/controller/occupations/job_master
else level4++ //not selected
tmp_str += "HIGH=[level1]|MEDIUM=[level2]|LOW=[level3]|NEVER=[level4]|BANNED=[level5]|YOUNG=[level6]|-"
feedback_add_details("job_preferences",tmp_str)
feedback_add_details("job_preferences",tmp_str)

View File

@@ -391,6 +391,19 @@
if(B.contents.len < B.storage_slots && w_class <= B.max_w_class)
return 1
return 0
if(slot_tie)
if(!H.w_uniform && (slot_w_uniform in mob_equip))
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
var/obj/item/clothing/under/uniform = H.w_uniform
if(uniform.hastie)
if (!disable_warning)
H << "\red You already have [uniform.hastie] attached to your [uniform]."
return 0
if( !(slot_flags & SLOT_TIE) )
return 0
return 1
return 0 //Unsupported slot
//END HUMAN

View File

@@ -6,7 +6,7 @@ var/global/list/gear_datums = list()
"[slot_glasses]" = list(),
"[slot_wear_mask]" = list(),
"[slot_w_uniform]" = list(),
"attachments" = list(),
"[slot_tie]" = list(),
"[slot_wear_suit]" = list(),
"[slot_gloves]" = list(),
"[slot_shoes]" = list(),
@@ -204,6 +204,13 @@ var/global/list/gear_datums = list()
cost = 2
slot = slot_head
// Wig by Earthcrusher, blame him.
/datum/gear/philosopher_wig
display_name = "natural philosopher's wig"
path = /obj/item/clothing/head/philosopher_wig
cost = 3
slot = slot_head
/datum/gear/ushanka
display_name = "ushanka"
path = /obj/item/clothing/head/ushanka
@@ -323,13 +330,6 @@ var/global/list/gear_datums = list()
cost = 1
allowed_roles = list("Captain")
// Wig by Earthcrusher, blame him.
/datum/gear/philosopher_wig
display_name = "natural philosopher's wig"
path = /obj/item/clothing/head/philosopher_wig
cost = 3
slot = slot_head
/datum/gear/corpsecsuit
display_name = "uniform, corporate (Security)"
path = /obj/item/clothing/under/rank/security/corp
@@ -363,88 +363,88 @@ var/global/list/gear_datums = list()
/datum/gear/armband_cargo
display_name = "armband, cargo"
path = /obj/item/clothing/tie/armband/cargo
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armband_emt
display_name = "armband, EMT"
path = /obj/item/clothing/tie/armband/medgreen
sort_category = "attachments"
slot = slot_tie
cost = 2
/datum/gear/armband_engineering
display_name = "armband, engineering"
path = /obj/item/clothing/tie/armband/engine
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armband_hydroponics
display_name = "armband, hydroponics"
path = /obj/item/clothing/tie/armband/hydro
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armband_medical
display_name = "armband, medical"
path = /obj/item/clothing/tie/armband/med
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armband
display_name = "armband, red"
path = /obj/item/clothing/tie/armband
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armband_science
display_name = "armband, science"
path = /obj/item/clothing/tie/armband/science
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/armpit
display_name = "shoulder holster"
path = /obj/item/clothing/tie/holster/armpit
sort_category = "attachments"
slot = slot_tie
cost = 2
allowed_roles = list("Captain", "Head of Personnel", "Security Officer", "Head of Security")
allowed_roles = list("Captain", "Head of Personnel", "Security Officer", "Warden", "Head of Security")
/datum/gear/tie_blue
display_name = "tie, blue"
path = /obj/item/clothing/tie/blue
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/tie_red
display_name = "tie, red"
path = /obj/item/clothing/tie/red
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/tie_horrible
display_name = "tie, socially disgraceful"
path = /obj/item/clothing/tie/horrible
sort_category = "attachments"
slot = slot_tie
cost = 1
/datum/gear/brown_vest
display_name = "webbing, engineering"
path = /obj/item/clothing/tie/storage/brown_vest
sort_category = "attachments"
slot = slot_tie
cost = 2
allowed_roles = list("Station Engineer","Atmospheric Technician","Chief Engineer")
/datum/gear/black_vest
display_name = "webbing, security"
path = /obj/item/clothing/tie/storage/black_vest
sort_category = "attachments"
slot = slot_tie
cost = 2
allowed_roles = list("Security Officer","Head of Security","Warden")
/datum/gear/webbing
display_name = "webbing, simple"
path = /obj/item/clothing/tie/storage/webbing
sort_category = "attachments"
slot = slot_tie
cost = 2
// Suit slot
@@ -710,11 +710,35 @@ var/global/list/gear_datums = list()
sort_category = "utility"
cost = 1
/datum/gear/matchbook
display_name = "matchbook"
path = /obj/item/weapon/storage/box/matches
/datum/gear/folder_blue
display_name = "folder, blue"
path = /obj/item/weapon/folder/blue
sort_category = "utility"
cost = 2
cost = 1
/datum/gear/folder_grey
display_name = "folder, grey"
path = /obj/item/weapon/folder
sort_category = "utility"
cost = 1
/datum/gear/folder_red
display_name = "folder, red"
path = /obj/item/weapon/folder/red
sort_category = "utility"
cost = 1
/datum/gear/folder_white
display_name = "folder, white"
path = /obj/item/weapon/folder/white
sort_category = "utility"
cost = 1
/datum/gear/folder_yellow
display_name = "folder, yellow"
path = /obj/item/weapon/folder/yellow
sort_category = "utility"
cost = 1
// The rest of the trash.
@@ -766,6 +790,12 @@ var/global/list/gear_datums = list()
sort_category = "misc"
cost = 1
/datum/gear/matchbook
display_name = "matchbook"
path = /obj/item/weapon/storage/box/matches
sort_category = "misc"
cost = 2
/datum/gear/comb
display_name = "purple comb"
path = /obj/item/weapon/haircomb

View File

@@ -6,7 +6,7 @@
item_state = "" //no inhands
item_color = "bluetie"
flags = FPRINT | TABLEPASS
slot_flags = 0
slot_flags = SLOT_TIE
w_class = 2.0
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
var/image/inv_overlay = null //overlay used when attached to clothing.
@@ -390,7 +390,7 @@
desc = "This glowing blue badge marks the holder as THE LAW."
icon_state = "holobadge"
item_color = "holobadge"
slot_flags = SLOT_BELT
slot_flags = SLOT_BELT | SLOT_TIE
var/emagged = 0 //Emagging removes Sec check.
var/stored_name = null
@@ -398,7 +398,7 @@
/obj/item/clothing/tie/holobadge/cord
icon_state = "holobadge-cord"
item_color = "holobadge-cord"
slot_flags = SLOT_MASK
slot_flags = SLOT_MASK | SLOT_TIE
/obj/item/clothing/tie/holobadge/attack_self(mob/user as mob)
if(!stored_name)

View File

@@ -1140,7 +1140,6 @@
item_color = "radi_pendant"
flags = FPRINT|TABLEPASS
w_class = 2.0
slot_flags = 0
//////////// Masks ////////////
@@ -1186,7 +1185,7 @@
slot_flags = 0
flags = FPRINT|TABLEPASS
w_class = 2
slot_flags = SLOT_MASK
slot_flags = SLOT_MASK | SLOT_TIE
////// Silver locket - Konaa Hirano - Konaa_Hirano
@@ -1200,7 +1199,7 @@
slot_flags = 0
flags = FPRINT|TABLEPASS
w_class = 2
slot_flags = SLOT_MASK
slot_flags = SLOT_MASK | SLOT_TIE
var/obj/item/held //Item inside locket.
/obj/item/clothing/tie/fluff/konaa_hirano/attack_self(mob/user as mob)
@@ -1230,7 +1229,7 @@
icon_state = "nasir_khayyam_1"
flags = FPRINT|TABLEPASS
w_class = 2
slot_flags = SLOT_MASK
slot_flags = SLOT_MASK | SLOT_TIE
////// Emerald necklace - Ty Foster - Nega
@@ -1458,7 +1457,7 @@
follow_dist = 2
var/near_dist = max(follow_dist - 3, 1)
var/current_dist = get_dist(src, bff)
if (movement_target != bff)
if (current_dist > follow_dist && !istype(movement_target, /mob/living/simple_animal/mouse) && (bff in oview(src)))
//stop existing movement
@@ -1469,7 +1468,7 @@
stop_automated_movement = 1
movement_target = bff
walk_to(src, movement_target, near_dist, 4)
//already following and close enough, stop
else if (current_dist <= near_dist)
walk_to(src,0)
@@ -1481,15 +1480,15 @@
/mob/living/simple_animal/cat/fluff/Life()
..()
if (stat || !bff)
if (stat || !bff)
return
if (get_dist(src, bff) <= 1)
if (bff.stat >= DEAD || bff.health <= config.health_threshold_softcrit)
if (prob((bff.stat < DEAD)? 50 : 15))
if (prob((bff.stat < DEAD)? 50 : 15))
audible_emote(pick("meows in distress.", "meows anxiously."))
else
if (prob(5))
visible_emote(pick("nuzzles [bff].",
if (prob(5))
visible_emote(pick("nuzzles [bff].",
"brushes against [bff].",
"rubs against [bff].",
"purrs."))

View File

@@ -73,6 +73,8 @@
return has_organ("chest")
if(slot_in_backpack)
return 1
if(slot_tie)
return 1
/mob/living/carbon/human/u_equip(obj/item/W as obj)
if(!W) return 0
@@ -202,13 +204,6 @@
if(!istype(W)) return
if(!has_organ_for_slot(slot)) return
if(W == src.l_hand)
src.l_hand = null
update_inv_l_hand() //So items actually disappear from hands.
else if(W == src.r_hand)
src.r_hand = null
update_inv_r_hand()
W.loc = src
switch(slot)
if(slot_back)
@@ -311,10 +306,20 @@
if(src.get_active_hand() == W)
src.u_equip(W)
W.loc = src.back
if(slot_tie)
var/obj/item/clothing/under/uniform = src.w_uniform
uniform.attackby(W,src)
else
src << "\red You are trying to eqip this item to an unsupported inventory slot. How the heck did you manage that? Stop it..."
return
if(W == src.l_hand)
src.l_hand = null
update_inv_l_hand() //So items actually disappear from hands.
else if(W == src.r_hand)
src.r_hand = null
update_inv_r_hand()
W.layer = 20
return
@@ -801,4 +806,4 @@ It can still be worn/put on as normal.
if(source && target)
if(source.machine == target)
target.show_inv(source)
del(src)
del(src)

View File

@@ -612,4 +612,7 @@
if(slot_back in equip_slots)
equip_slots |= slot_in_backpack
if(slot_w_uniform in equip_slots)
equip_slots |= slot_tie
equip_slots |= slot_legcuffed

View File

@@ -165,6 +165,7 @@ var/list/slot_equipment_priority = list( \
slot_glasses,\
slot_belt,\
slot_s_store,\
slot_tie,\
slot_l_store,\
slot_r_store\
)

View File

@@ -185,7 +185,7 @@ var/MAX_EXPLOSION_RANGE = 14
#define SLOT_POCKET 2048 //this is to allow items with a w_class of 3 or 4 to fit in pockets.
#define SLOT_DENYPOCKET 4096 //this is to deny items with a w_class of 2 or 1 to fit in pockets.
#define SLOT_TWOEARS 8192
#define SLOT_LEGS = 16384
#define SLOT_TIE 16384
//FLAGS BITMASK
#define STOPSPRESSUREDMAGE 1 //This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere
@@ -267,6 +267,7 @@ var/MAX_EXPLOSION_RANGE = 14
#define slot_legcuffed 19
#define slot_r_ear 20
#define slot_legs 21
#define slot_tie 22
//Cant seem to find a mob bitflags area other than the powers one