This all worked nicely but the obvious error with this is since it loops through all the survivors, situations can arise where the program picks the same weapon twice or more, leading to strange situations where two people are apparently using the same baseball bat at the same time. What I hit upon was creating a temporary list of all the weapons available, and when a weapon is picked, remove it from the temporary list. The problem is, using
var/list/available_weapons = weapons_inv
and then removing an item from the available weapons list using the -= operator, it removes the item from the weapons_inv list as well. Can anyone suggest a way around this happening?
var/list/available_weapons = weapons_inv.Copy()