ID:139035
 
Code:
/proc
{
InitItemLists()
{
for(var/T in typesof(/obj/item)){ //Get types of ALL items in game.
var/obj/item/I = new T // Create one
if(I.rarity == 1){ //Check rarity
world << "[I.name]"; //debug
}
}
}


Problem description:
Proc either isn't ending or takes ages to complete, without printing to world. A proc that executes after the shown proc doesn't get to completion. No errors on compile or at runtime - the expected messages to world don't show up either.

The intent here is to be able to create items in the code and have their types added to the proper lists at runtime without any manual maintenance whatsoever. If at all possible, without creating objects to reduce overhead.

EDIT: /obj/item/var/rarity = 1. In all cases, for testing purposes. I am attempting to modify existing code to be more flexible in the future.
Bumping this back up to the first page.

(If this was too early, tell me and I'll avoid early bumps in the future.)
In response to Yoran91
I've copied and pasted your code and it works perfectly for me, at an instant.

/proc
{
InitItemLists()
{
for(var/T in typesof(/obj/numbers)){ //Get types of ALL items in game.
var/obj/numbers/I = new T // Create one
if(I.rarity == 1){ //Check rarity
world << "[I.name]"; //debug
}
}
}
}

client/verb/test()

InitItemLists()

obj

numbers

var rarity = 0

one

rarity = 1

two

three

rarity = 1
In response to Neimo
That's weird. I just un-commented it and it seems to be working for me now, too. It literally used to hang my world initialization, as the proc is called in world.New().

Any way to get rid of the ugly item creation part though? The end result of this proc will be lists of types rather than objects.

Good to see I was doing it right though, I thought I'd made a stupid mistake somewhere.