var/list/loadout_categories = list() var/list/gear_datums = list() /datum/loadout_category var/category = "" var/list/gear = list() var/donor_only = FALSE /datum/loadout_category/New(cat) category = cat ..() /hook/startup/proc/populate_gear_list() //create a list of gear datums to sort for(var/geartype in subtypesof(/datum/gear)) var/datum/gear/G = geartype var/use_name = initial(G.display_name) var/use_category = initial(G.sort_category) if(G == initial(G.subtype_path)) continue if(!use_name) error("Loadout - Missing display name: [G]") continue if(!initial(G.cost)) error("Loadout - Missing cost: [G]") continue if(!initial(G.path)) error("Loadout - Missing path definition: [G]") continue if(!loadout_categories[use_category]) loadout_categories[use_category] = new /datum/loadout_category(use_category) var/datum/loadout_category/LC = loadout_categories[use_category] if(initial(G.donor_only)) LC.donor_only = TRUE gear_datums[use_name] = new geartype LC.gear[use_name] = gear_datums[use_name] loadout_categories = sortAssoc(loadout_categories) for(var/loadout_category in loadout_categories) var/datum/loadout_category/LC = loadout_categories[loadout_category] LC.gear = sortAssoc(LC.gear) return 1 /datum/gear var/display_name //Name/index. Must be unique. var/description //Description of this gear. If left blank will default to the description of the pathed item. var/path //Path to item. var/cost = 1 //Number of points used. Items in general cost 1 point, storage/armor/gloves/special use costs 2 points. var/slot //Slot to equip to. var/list/allowed_roles //Roles that can spawn with this item. var/whitelisted //Term to check the whitelist for.. var/sort_category = "General" var/list/gear_tweaks = list() //List of datums which will alter the item after it has been spawned. var/subtype_path = /datum/gear //for skipping organizational subtypes (optional) var/subtype_cost_overlap = TRUE //if subtypes can take points at the same time var/donor_only = FALSE // if it's only available to donors /datum/gear/New() ..() if(!description) var/obj/O = path description = initial(O.desc) /datum/gear_data var/path var/location /datum/gear_data/New(npath, nlocation) path = npath location = nlocation /datum/gear/proc/spawn_item(location, metadata) var/datum/gear_data/gd = new(path, location) for(var/datum/gear_tweak/gt in gear_tweaks) gt.tweak_gear_data(metadata["[gt]"], gd) var/item = new gd.path(gd.location) for(var/datum/gear_tweak/gt in gear_tweaks) gt.tweak_item(item, metadata["[gt]"]) return item