Files
DragonTrance b4039d7cbb various fixes v2
1 - Loadout items no longer duplicate backpack items, and all items get stored into backpacks properly
2 - Fixed a runtime with captain's job on roundstart. They will now be announced when they join at the start of the shift.
3 - Fixed filter runtime when transferring ckeys
4 - Economy SS no longer fires, so it will no longer clutter runtime logs
5 - Fixed laughing peas not being able to be taken out of seed extractors by lazily renaming them
2021-04-20 00:52:33 -07:00

63 lines
2.7 KiB
Plaintext

// 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)
GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
/proc/load_loadout_config(loadout_config)
if(!loadout_config)
loadout_config = "config/loadout_config.txt"
LAZYINITLIST(GLOB.loadout_whitelist_ids)
var/list/file_lines = world.file2list(loadout_config)
for(var/line in file_lines)
if(!line || line[1] == "#")
continue
var/list/lineinfo = splittext(line, "|")
var/lineID = lineinfo[1]
for(var/subline in lineinfo)
var/sublinetypedef = findtext(subline, "=")
if(sublinetypedef)
var/sublinetype = copytext(subline, 1, sublinetypedef)
var/list/sublinecontent = splittext(copytext(subline, sublinetypedef+ length(sublinetypedef)), ",")
if(sublinetype == "WHITELIST")
GLOB.loadout_whitelist_ids["[lineID]"] = sublinecontent
/proc/initialize_global_loadout_items()
LAZYINITLIST(GLOB.loadout_items)
load_loadout_config()
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)
if(islist(I.geargroupID))
var/list/ggidlist = I.geargroupID
I.ckeywhitelist = list()
for(var/entry in ggidlist)
if(entry in GLOB.loadout_whitelist_ids)
I.ckeywhitelist |= GLOB.loadout_whitelist_ids["[entry]"]
else if(I.geargroupID in GLOB.loadout_whitelist_ids)
I.ckeywhitelist = GLOB.loadout_whitelist_ids["[I.geargroupID]"]
/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/geargroupID //defines the ID that the gear inherits from the config
var/list/restricted_roles = list()
var/list/ckeywhitelist = list()
var/restricted_desc
var/blacklist_join_equip = FALSE //If we don't equip this when we join
/datum/gear/New()
..()
if(!description && path)
var/obj/O = path
description = initial(O.desc)