Merge pull request #4838 from deathride58/loadoutsystem

[READY FOR TESTMERGE] Ports Hippie's loadout system
This commit is contained in:
LetterJay
2018-01-18 15:32:00 -06:00
committed by GitHub
23 changed files with 918 additions and 51 deletions
@@ -0,0 +1,169 @@
//This is the file that handles donator loadout items.
/datum/gear/pingcoderfailsafe
name = "IF YOU SEE THIS, PING A CODER RIGHT NOW!"
category = slot_in_backpack
path = /obj/item/bikehorn/golden
ckeywhitelist = list("This entry should never appear with this variable set.") //If it does, then that means somebody fucked up the whitelist system pretty hard
/datum/gear/donortestingbikehorn
name = "Donor item testing bikehorn"
category = slot_in_backpack
path = /obj/item/bikehorn
ckeywhitelist = list("jayehh","deathride58")
/datum/gear/kevhorn
name = "Airhorn"
category = slot_in_backpack
path = /obj/item/bikehorn/airhorn
ckeywhitelist = list("kevinz000")
/datum/gear/cebusoap
name = "Cebutris' soap"
category = slot_in_backpack
path = /obj/item/custom/ceb_soap
ckeywhitelist = list("cebutris")
/datum/gear/kiaracloak
name = "Kiara's cloak"
category = slot_neck
path = /obj/item/clothing/neck/cloak/inferno
ckeywhitelist = list("inferno707")
/datum/gear/kiaracollar
name = "Kiara's collar"
category = slot_neck
path = /obj/item/clothing/neck/petcollar/inferno
ckeywhitelist = list("inferno707")
/datum/gear/kiaramedal
name = "Insignia of Steele"
category = slot_in_backpack
path = /obj/item/clothing/accessory/medal/steele
ckeywhitelist = list("inferno707")
/datum/gear/sexymimemask
name = "The hollow heart"
category = slot_wear_mask
path = /obj/item/clothing/mask/sexymime
ckeywhitelist = list("inferno707")
/datum/gear/engravedzippo
name = "Engraved zippo"
category = slot_hands
path = /obj/item/lighter/gold
ckeywhitelist = list("dirtyoldharry")
/datum/gear/geisha
name = "Geisha suit"
category = slot_w_uniform
path = /obj/item/clothing/under/geisha
ckeywhitelist = list("atiefling")
/datum/gear/specialscarf
name = "Special scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/zomb
ckeywhitelist = list("zombierobin")
/datum/gear/redmadcoat
name = "The Mad's labcoat"
category = slot_wear_suit
path = /obj/item/clothing/suit/toggle/labcoat/mad/red
ckeywhitelist = list("zombierobin")
/datum/gear/santahat
name = "Santa hat"
category = slot_head
path = /obj/item/clothing/head/santa/fluff
ckeywhitelist = list("illotafv")
/datum/gear/reindeerhat
name = "Reindeer hat"
category = slot_head
path = /obj/item/clothing/head/hardhat/reindeer/fluff
ckeywhitelist = list("illotafv")
/datum/gear/treeplushie
name = "Christmas tree plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/tree
ckeywhitelist = list("illotafv")
/datum/gear/santaoutfit
name = "Santa costume"
category = slot_wear_suit
path = /obj/item/clothing/suit/space/santa/fluff
ckeywhitelist = list("illotafv")
/datum/gear/treecloak
name = "Christmas tree cloak"
category = slot_neck
path = /obj/item/clothing/neck/cloak/festive
ckeywhitelist = list("illotafv")
/datum/gear/carrotplush
name = "Carrot plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/carrot
ckeywhitelist = list("improvedname")
/datum/gear/carrotcloak
name = "Carrot cloak"
category = slot_neck
path = /obj/item/clothing/neck/cloak/carrot
ckeywhitelist = list("improvedname")
/datum/gear/albortorosamask
name = "Alborto Rosa mask"
category = slot_wear_mask
path = /obj/item/clothing/mask/luchador/zigfie
ckeywhitelist = list("zigfie")
/datum/gear/mankini
name = "Mankini"
category = slot_w_uniform
path = /obj/item/clothing/under/mankini
ckeywhitelist = list("zigfie")
/datum/gear/pinkshoes
name = "Pink shoes"
category = slot_shoes
path = /obj/item/clothing/shoes/sneakers/pink
ckeywhitelist = list("zigfie")
/datum/gear/reecesgreatcoat
name = "Reece's Great Coat"
category = slot_wear_suit
path = /obj/item/clothing/suit/trenchcoat/green
ckeywhitelist = list("geemiesif")
/datum/gear/russianflask
name = "Russian flask"
category = slot_in_backpack
path = /obj/item/reagent_containers/food/drinks/flask/russian
ckeywhitelist = list("slomka")
/datum/gear/stalkermask
name = "S.T.A.L.K.E.R. mask"
category = slot_wear_mask
path = /obj/item/clothing/mask/gas/stalker
ckeywhitelist = list("slomka")
/datum/gear/stripedcollar
name = "Striped collar"
category = slot_neck
path = /obj/item/clothing/neck/petcollar/stripe
ckeywhitelist = list("jademanique")
/datum/gear/performersoutfit
name = "Bluish performer's outfit"
category = slot_w_uniform
path = /obj/item/clothing/under/singery/custom
ckeywhitelist = list("killer402402")
/datum/gear/vermillion
name = "Vermillion clothing"
category = slot_w_uniform
path = /obj/item/clothing/suit/vermillion
ckeywhitelist = list("fractious")
@@ -0,0 +1,24 @@
/datum/gear/plushcarp
name = "Space carp plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/carpplushie
/datum/gear/plushliz
name = "Lizard plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/lizardplushie
/datum/gear/plushsnek
name = "Snake plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/snakeplushie
/datum/gear/plushslime
name = "Slime plushie"
category = slot_in_backpack
path = /obj/item/toy/plush/slimeplushie
/datum/gear/dildo
name = "Customizable dildo"
category = slot_in_backpack
path = /obj/item/dildo/custom
@@ -0,0 +1,39 @@
/datum/gear/cold
name = "Cold goggles"
category = slot_glasses
path = /obj/item/clothing/glasses/cold
/datum/gear/eyepatch
name = "Eyepatch"
category = slot_glasses
path = /obj/item/clothing/glasses/eyepatch
/datum/gear/heat
name = "Heat goggles"
category = slot_glasses
path = /obj/item/clothing/glasses/heat
/datum/gear/hipster
name = "Hipster glasses"
category = slot_glasses
path = /obj/item/clothing/glasses/regular/hipster
/datum/gear/jamjar
name = "Jamjar glasses"
category = slot_glasses
path = /obj/item/clothing/glasses/regular/jamjar
/datum/gear/monocle
name = "Monocle"
category = slot_glasses
path = /obj/item/clothing/glasses/monocle
/datum/gear/orange
name = "Orange glasses"
category = slot_glasses
path = /obj/item/clothing/glasses/orange
/datum/gear/prescription
name = "Prescription glasses"
category = slot_glasses
path = /obj/item/clothing/glasses/regular
@@ -0,0 +1,49 @@
/datum/gear/cane
name = "Cane"
category = slot_hands
path = /obj/item/cane
/datum/gear/cigarettes
name = "Cigarette pack"
category = slot_hands
path = /obj/item/storage/fancy/cigarettes
/datum/gear/dice
name = "Dice bag"
category = slot_hands
path = /obj/item/storage/pill_bottle/dice
/datum/gear/eightball
name = "Magic eightball"
category = slot_hands
path = /obj/item/toy/eightball
/datum/gear/matches
name = "Matchbox"
category = slot_hands
path = /obj/item/storage/box/matches
/datum/gear/cheaplighter
name = "Cheap lighter"
category = slot_hands
path = /obj/item/lighter/greyscale
/datum/gear/cards
name = "Playing cards"
category = slot_hands
path = /obj/item/toy/cards/deck
/datum/gear/skub
name = "Skub"
category = slot_hands
path = /obj/item/skub
/datum/gear/carpplushie
name = "Space carp plushie"
category = slot_hands
path = /obj/item/toy/plush/carpplushie
/datum/gear/wallet
name = "Wallet"
category = slot_hands
path = /obj/item/storage/wallet
@@ -0,0 +1,39 @@
/datum/gear/baseball
name = "Ballcap"
category = slot_head
path = /obj/item/clothing/head/soft/mime
/datum/gear/beanie
name = "Beanie"
category = slot_head
path = /obj/item/clothing/head/beanie
/datum/gear/beret
name = "Black beret"
category = slot_head
path = /obj/item/clothing/head/beret/black
/datum/gear/flatcap
name = "Flat cap"
category = slot_head
path = /obj/item/clothing/head/flatcap
/datum/gear/pirate
name = "Pirate hat"
category = slot_head
path = /obj/item/clothing/head/pirate
/datum/gear/rice_hat
name = "Rice hat"
category = slot_head
path = /obj/item/clothing/head/rice_hat
/datum/gear/ushanka
name = "Ushanka"
category = slot_head
path = /obj/item/clothing/head/ushanka
/datum/gear/slime
name = "Slime hat"
category = slot_head
path = /obj/item/clothing/head/collectable/slime
@@ -0,0 +1,31 @@
// Loadout system. All items are children of /datum/gear. To make a new item, you usually just define a new item like /datum/gear/example
// then set required vars like name(string), category(slot define, take them from code/__DEFINES/inventory.dm (the lowertext ones) (be sure that there is an entry in
// slot_to_string(slot) proc in hippiestation/code/_HELPERS/mobs.dm to show the category name in preferences menu) and path (the actual item path).
// description defaults to the path initial desc, cost defaults to 1 point but if you think your item requires more points, the framework allows that
// and lastly, restricted_roles list allows you to let someone spawn with certain items only if the job they spawned with is on the list.
GLOBAL_LIST_EMPTY(loadout_items)
/proc/initialize_global_loadout_items()
LAZYINITLIST(GLOB.loadout_items)
for(var/item in subtypesof(/datum/gear))
var/datum/gear/I = new item
if(!GLOB.loadout_items[slot_to_string(I.category)])
LAZYINITLIST(GLOB.loadout_items[slot_to_string(I.category)])
LAZYSET(GLOB.loadout_items[slot_to_string(I.category)], I.name, I)
/datum/gear
var/name
var/category
var/description
var/path //item-to-spawn path
var/cost = 1 //normally, each loadout costs a single point.
var/list/restricted_roles
var/list/ckeywhitelist
/datum/gear/New()
..()
if(!description && path)
var/obj/O = path
description = initial(O.desc)
@@ -0,0 +1,4 @@
/datum/gear/balaclava
name = "Balaclava"
category = slot_wear_mask
path = /obj/item/clothing/mask/balaclava
@@ -0,0 +1,90 @@
/datum/gear/bluetie
name = "Blue tie"
category = slot_neck
path = /obj/item/clothing/neck/tie/blue
/datum/gear/redtie
name = "Red tie"
category = slot_neck
path = /obj/item/clothing/neck/tie/red
/datum/gear/blacktie
name = "Black tie"
category = slot_neck
path = /obj/item/clothing/neck/tie/black
/datum/gear/collar
name = "Collar"
category = slot_neck
path = /obj/item/clothing/neck/petcollar
/datum/gear/stethoscope
name = "Stethoscope"
category = slot_neck
path = /obj/item/clothing/neck/stethoscope
restricted_roles = list("Medical Doctor", "Chief Medical Officer")
/datum/gear/scarf
name = "White scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf
/datum/gear/blackscarf
name = "Black scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/black
/datum/gear/redscarf
name = "Red scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/red
/datum/gear/greenscarf
name = "Green scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/green
/datum/gear/darkbluescarf
name = "Dark blue scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/darkblue
/datum/gear/purplescarf
name = "Purple scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/purple
/datum/gear/yellowscarf
name = "Yellow scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/yellow
/datum/gear/orangescarf
name = "Orange scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/orange
/datum/gear/cyanscarf
name = "Cyan scarf"
category = slot_neck
path = /obj/item/clothing/neck/scarf/cyan
/datum/gear/stripedredscarf
name = "Striped red scarf"
category = slot_neck
path = /obj/item/clothing/neck/stripedredscarf
/datum/gear/stripedbluescarf
name = "Striped blue scarf"
category = slot_neck
path = /obj/item/clothing/neck/stripedbluescarf
/datum/gear/stripedgreenscarf
name = "Striped green scarf"
category = slot_neck
path = /obj/item/clothing/neck/stripedgreenscarf
/datum/gear/headphones
name = "Headphones"
category = slot_neck
path = /obj/item/clothing/ears/headphones
@@ -0,0 +1,39 @@
/datum/gear/laceup
name = "Laceup shoes"
category = slot_shoes
path = /obj/item/clothing/shoes/laceup
/datum/gear/workboots
name = "Work boots"
category = slot_shoes
path = /obj/item/clothing/shoes/workboots
/datum/gear/jackboots
name = "Jackboots"
category = slot_shoes
path = /obj/item/clothing/shoes/jackboots
/datum/gear/winterboots
name = "Winter boots"
category = slot_shoes
path = /obj/item/clothing/shoes/winterboots
/datum/gear/sandals
name = "Sandals"
category = slot_shoes
path = /obj/item/clothing/shoes/sandal
/datum/gear/blackshoes
name = "Black shoes"
category = slot_shoes
path = /obj/item/clothing/shoes/sneakers/black
/datum/gear/brownshoes
name = "Brown shoes"
category = slot_shoes
path = /obj/item/clothing/shoes/sneakers/brown
/datum/gear/whiteshoes
name = "White shoes"
category = slot_shoes
path = /obj/item/clothing/shoes/sneakers/white
@@ -0,0 +1,59 @@
/datum/gear/poncho
name = "Poncho"
category = slot_wear_suit
path = /obj/item/clothing/suit/poncho
/datum/gear/ponchogreen
name = "Green poncho"
category = slot_wear_suit
path = /obj/item/clothing/suit/poncho/green
/datum/gear/ponchored
name = "Red poncho"
category = slot_wear_suit
path = /obj/item/clothing/suit/poncho/red
/datum/gear/jacketbomber
name = "Bomber jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket
/datum/gear/jacketleather
name = "Leather jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/leather
/datum/gear/overcoatleather
name = "Leather overcoat"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/leather/overcoat
/datum/gear/jacketpuffer
name = "Puffer jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/puffer
/datum/gear/vestpuffer
name = "Puffer vest"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/puffer/vest
/datum/gear/jacketlettermanbrown
name = "Brown letterman jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/letterman
/datum/gear/jacketlettermanred
name = "Red letterman jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/letterman_red
/datum/gear/jacketlettermanNT
name = "Nanotrasen letterman jacket"
category = slot_wear_suit
path = /obj/item/clothing/suit/jacket/letterman_nanotrasen
/datum/gear/coat
name = "Winter coat"
category = slot_wear_suit
path = /obj/item/clothing/suit/hooded/wintercoat
@@ -0,0 +1,79 @@
/datum/gear/suitblack
name = "Black suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket
/datum/gear/suitgreen
name = "Green suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/green
/datum/gear/suitred
name = "Red suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/red
/datum/gear/suitcharcoal
name = "Charcoal suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/charcoal
/datum/gear/suitnavy
name = "Navy suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/navy
/datum/gear/suitburgundy
name = "Burgundy suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/burgundy
/datum/gear/suittan
name = "Tan suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/tan
/datum/gear/suitwhite
name = "White suit"
category = slot_w_uniform
path = /obj/item/clothing/under/suit_jacket/white
/datum/gear/assistantformal
name = "Assistant's formal uniform"
category = slot_w_uniform
path = /obj/item/clothing/under/assistantformal
/datum/gear/maidcostume
name = "Maid costume"
category = slot_w_uniform
path = /obj/item/clothing/under/maid
/datum/gear/mailmanuniform
name = "Mailman's jumpsuit"
category = slot_w_uniform
path = /obj/item/clothing/under/rank/mailman
/datum/gear/skirtblack
name = "Black skirt"
category = slot_w_uniform
path = /obj/item/clothing/under/skirt/black
/datum/gear/skirtblue
name = "Blue skirt"
category = slot_w_uniform
path = /obj/item/clothing/under/skirt/blue
/datum/gear/skirtred
name = "Red skirt"
category = slot_w_uniform
path = /obj/item/clothing/under/skirt/red
/datum/gear/skirtpurple
name = "Purple skirt"
category = slot_w_uniform
path = /obj/item/clothing/under/skirt/purple
/datum/gear/kilt
name = "Kilt"
category = slot_w_uniform
path = /obj/item/clothing/under/kilt
@@ -0,0 +1,31 @@
#define DEFAULT_SLOT_AMT 2
#define HANDS_SLOT_AMT 2
#define BACKPACK_SLOT_AMT 4
/datum/preferences
var/gear_points = 10
var/list/gear_categories
var/list/chosen_gear
var/gear_tab
/datum/preferences/New(client/C)
..()
LAZYINITLIST(chosen_gear)
/datum/preferences/proc/is_loadout_slot_available(slot)
var/list/L
LAZYINITLIST(L)
for(var/i in chosen_gear)
var/datum/gear/G = i
var/occupied_slots = L[slot_to_string(initial(G.category))] ? L[slot_to_string(initial(G.category))] + 1 : 1
LAZYSET(L, slot_to_string(initial(G.category)), occupied_slots)
switch(slot)
if(slot_in_backpack)
if(L[slot_to_string(slot_in_backpack)] < BACKPACK_SLOT_AMT)
return TRUE
if(slot_hands)
if(L[slot_to_string(slot_hands)] < HANDS_SLOT_AMT)
return TRUE
else
if(L[slot_to_string(slot)] < DEFAULT_SLOT_AMT)
return TRUE
@@ -0,0 +1,72 @@
/datum/preferences/proc/cit_character_pref_load(savefile/S)
//Citadel
features["flavor_text"] = sanitize_text(features["flavor_text"], initial(features["flavor_text"]))
if(!features["mcolor2"] || features["mcolor"] == "#000")
features["mcolor2"] = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F")
if(!features["mcolor3"] || features["mcolor"] == "#000")
features["mcolor3"] = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F")
features["mcolor2"] = sanitize_hexcolor(features["mcolor2"], 3, 0)
features["mcolor3"] = sanitize_hexcolor(features["mcolor3"], 3, 0)
//gear loadout
var/text_to_load
S["loadout"] >> text_to_load
var/list/saved_loadout_paths = splittext(text_to_load, "|")
LAZYCLEARLIST(chosen_gear)
gear_points = initial(gear_points)
for(var/i in saved_loadout_paths)
var/datum/gear/path = text2path(i)
if(path)
LAZYADD(chosen_gear, path)
gear_points -= initial(path.cost)
/datum/preferences/proc/cit_character_pref_save(savefile/S)
//Citadel
WRITE_FILE(S["feature_genitals_use_skintone"], features["genitals_use_skintone"])
WRITE_FILE(S["feature_exhibitionist"], features["exhibitionist"])
WRITE_FILE(S["feature_mcolor2"], features["mcolor2"])
WRITE_FILE(S["feature_mcolor3"], features["mcolor3"])
WRITE_FILE(S["feature_mam_body_markings"], features["mam_body_markings"])
WRITE_FILE(S["feature_mam_tail"], features["mam_tail"])
WRITE_FILE(S["feature_mam_ears"], features["mam_ears"])
WRITE_FILE(S["feature_mam_tail_animated"], features["mam_tail_animated"])
WRITE_FILE(S["feature_taur"], features["taur"])
//Xeno features
WRITE_FILE(S["feature_xeno_tail"], features["xenotail"])
WRITE_FILE(S["feature_xeno_dors"], features["xenodorsal"])
WRITE_FILE(S["feature_xeno_head"], features["xenohead"])
//cock features
WRITE_FILE(S["feature_has_cock"], features["has_cock"])
WRITE_FILE(S["feature_cock_shape"], features["cock_shape"])
WRITE_FILE(S["feature_cock_color"], features["cock_color"])
WRITE_FILE(S["feature_cock_length"], features["cock_length"])
WRITE_FILE(S["feature_cock_girth"], features["cock_girth"])
WRITE_FILE(S["feature_has_sheath"], features["sheath_color"])
//balls features
WRITE_FILE(S["feature_has_balls"], features["has_balls"])
WRITE_FILE(S["feature_balls_color"], features["balls_color"])
WRITE_FILE(S["feature_balls_size"], features["balls_size"])
WRITE_FILE(S["feature_balls_sack_size"], features["balls_sack_size"])
WRITE_FILE(S["feature_balls_fluid"], features["balls_fluid"])
//breasts features
WRITE_FILE(S["feature_has_breasts"], features["has_breasts"])
WRITE_FILE(S["feature_breasts_size"], features["breasts_size"])
WRITE_FILE(S["feature_breasts_shape"], features["breasts_shape"])
WRITE_FILE(S["feature_breasts_color"], features["breasts_color"])
WRITE_FILE(S["feature_breasts_fluid"], features["breasts_fluid"])
//vagina features
WRITE_FILE(S["feature_has_vag"], features["has_vag"])
WRITE_FILE(S["feature_vag_shape"], features["vag_shape"])
WRITE_FILE(S["feature_vag_color"], features["vag_color"])
//womb features
WRITE_FILE(S["feature_has_womb"], features["has_womb"])
//flavor text
WRITE_FILE(S["feature_flavor_text"], features["flavor_text"])
//gear loadout
if(islist(chosen_gear))
if(chosen_gear.len)
var/text_to_save = chosen_gear.Join("|")
S["loadout"] << text_to_save
else
S["loadout"] << "" //empty string to reset the value