anchor.diff:  		set hidden = 1
   
   obj/items/treasure
  +	var/event = "Treasure Hunt"
  +
  +	icon = 'Chest.dmi'
  +	icon_state = "red"
   
   	Take()
   		set src in oview(1)
   		loc = null
  +
  +		if(event == "Treasure Hunt")
  +			var/RandomEvent/TreasureHunt/e = locate() in events
  +			if(e && (usr.ckey in e.winners))
  +				usr << errormsg("You already found a chest!")
  +				return
  +
   		var/t = pickweight(list(/obj/items/chest/Basic     = 50,
   		                        /obj/items/chest/Wizard    = 20,
   		                        /obj/items/chest/Pentakill = 20,
  
positive.code: 
  			sleep(minutes * 600)
  
  
  			var/message = FALSE
  			for(var/obj/t in treasures)
  				treasures -= t
  				if(!t.loc) continue
  				message = TRUE
  				t.loc     = null
  
  			if(message)
  				Players << infomsg("Treasure Hunt is over.")
  
  			treasures = null
  
  			end()
  
  	Snitches
  		name = "Catch Snitches"
  
negative.code: 		var/obj/items/i = new t (usr)
  		usr:Resort_Stacking_Inv()
  
  		Players << infomsg("<b>[event]:</b> [usr] found a [i.name] chest!")
  
  		if(event == "Treasure Hunt")
  			var/RandomEvent/TreasureHunt/e = locate() in events
  			if(e && e.totalTreasures)
  				e.totalTreasures -= src
  
  				e.winners += usr.ckey
  
  				if(!e.totalTreasures.len)
  					e.totalTreasures = null
  					e.end()
  
  