mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fix a runtime for Mloc
(mloc is so lazy) Also makes custom item spawning a tiny bit nicer! file will only be loaded once, instead of every time someone spawns
This commit is contained in:
@@ -4,12 +4,15 @@
|
|||||||
//for multiple items just add mutliple entries, unless i change it to be a listlistlist
|
//for multiple items just add mutliple entries, unless i change it to be a listlistlist
|
||||||
//yes, it has to be an item, you can't pick up nonitems
|
//yes, it has to be an item, you can't pick up nonitems
|
||||||
|
|
||||||
/proc/EquipCustomItems(mob/living/carbon/human/M)
|
/var/list/custom_items = list()
|
||||||
// load lines
|
|
||||||
var/file = file2text("config/custom_items.txt")
|
|
||||||
var/lines = text2list(file, "\n")
|
|
||||||
|
|
||||||
for(var/line in lines)
|
/hook/startup/proc/loadCustomItems()
|
||||||
|
var/custom_items_file = file2text("config/custom_items.txt")
|
||||||
|
custom_items = text2list(custom_items_file, "\n")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
/proc/EquipCustomItems(mob/living/carbon/human/M)
|
||||||
|
for(var/line in custom_items)
|
||||||
// split & clean up
|
// split & clean up
|
||||||
var/list/Entry = text2list(line, ":")
|
var/list/Entry = text2list(line, ":")
|
||||||
for(var/i = 1 to Entry.len)
|
for(var/i = 1 to Entry.len)
|
||||||
@@ -24,6 +27,8 @@
|
|||||||
var/ok = 0 // 1 if the item was placed successfully
|
var/ok = 0 // 1 if the item was placed successfully
|
||||||
P = trim(P)
|
P = trim(P)
|
||||||
var/path = text2path(P)
|
var/path = text2path(P)
|
||||||
|
if(!path) continue
|
||||||
|
|
||||||
var/obj/item/Item = new path()
|
var/obj/item/Item = new path()
|
||||||
if(istype(Item,/obj/item/weapon/card/id))
|
if(istype(Item,/obj/item/weapon/card/id))
|
||||||
//id card needs to replace the original ID
|
//id card needs to replace the original ID
|
||||||
|
|||||||
Reference in New Issue
Block a user