code:
/datum/proximity_monitor
	var/atom/host //the atom we are tracking
	var/atom/hasprox_receiver //the atom that will receive HasProximity calls.
	var/atom/last_host_loc
	var/list/checkers //list of /obj/effect/abstract/proximity_checkers
	var/current_range
	var/ignore_if_not_on_turf //don't check turfs in range if the host's loc isn't a turf
	var/wire = FALSE

/datum/proximity_monitor/New(atom/_host, range, _ignore_if_not_on_turf = TRUE)
	checkers = list()
	last_host_loc = _host.loc
	ignore_if_not_on_turf = _ignore_if_not_on_turf
	current_range = range
	SetHost(_host)

/datum/proximity_monitor/proc/SetHost(atom/H,atom/R)
	if(H == host)
		return
	if(host)
		UnregisterSignal(host, COMSIG_MOVABLE_MOVED)
	if(R)
		hasprox_receiver = R
	else if(hasprox_receiver == host) //Default case
		hasprox_receiver = H
	host = H
	RegisterSignal(host, COMSIG_MOVABLE_MOVED, .proc/HandleMove)
	last_host_loc = host.loc
	SetRange(current_range,TRUE)

/datum/proximity_monitor/Destroy()
	host = null
	last_host_loc = null
	hasprox_receiver = null
	QDEL_LAZYLIST(checkers)
	return ..()

/datum/proximity_monitor/proc/HandleMove()
	SIGNAL_HANDLER

	var/atom/_host = host
	var/atom/new_host_loc = _host.loc
	if(last_host_loc != new_host_loc)
		last_host_loc = new_host_loc //hopefully this won't cause GC issues with containers
		var/curr_range = current_range
		SetRange(curr_range, TRUE)
		if(curr_range)
			testing("HasProx: [host] -> [host]")
			hasprox_receiver.HasProximity(host) //if we are processing, we're guaranteed to be a movable

/datum/proximity_monitor/proc/SetRange(range, force_rebuild = FALSE)
	if(!force_rebuild && range == current_range)
		return FALSE
	. = TRUE

	LAZYINITLIST(checkers)

	current_range = range

	var/list/checkers_local = checkers
	var/old_checkers_len = checkers_local.len

	var/atom/_host = host

	var/atom/loc_to_use = ignore_if_not_on_turf ? _host.loc : get_turf(_host)
	if(wire && !isturf(loc_to_use)) //it makes assemblies attached on wires work
		loc_to_use = get_turf(loc_to_use)
	if(!isturf(loc_to_use)) //only check the host's loc
		if(range)
			var/obj/effect/abstract/proximity_checker/pc
			if(old_checkers_len)
				pc = checkers_local[old_checkers_len]
				--checkers_local.len
				QDEL_LAZYLIST(checkers_local)
			else
				pc = new(loc_to_use, src)

			checkers_local += pc //only check the host's loc
		return

	var/list/turfs = RANGE_TURFS(range, loc_to_use)
	var/turfs_len = turfs.len
	var/old_checkers_used = min(turfs_len, old_checkers_len)

	//reuse what we can
	for(var/I in 1 to old_checkers_len)
		if(I <= old_checkers_used)
			var/obj/effect/abstract/proximity_checker/pc = checkers_local[I]
			pc.forceMove(turfs[I])
		else
			qdel(checkers_local[I]) //delete the leftovers

	if(old_checkers_len < turfs_len)
		//create what we lack
		for(var/I in (old_checkers_used + 1) to turfs_len)
			checkers_local += new /obj/effect/abstract/proximity_checker(turfs[I], src)
	else
		checkers_local.Cut(old_checkers_used + 1, old_checkers_len)

/obj/effect/abstract/proximity_checker
	invisibility = INVISIBILITY_ABSTRACT
	anchored = TRUE
	var/datum/proximity_monitor/monitor

/obj/effect/abstract/proximity_checker/Initialize(mapload, datum/proximity_monitor/_monitor)
	. = ..()
	if(_monitor)
		monitor = _monitor
	else
		stack_trace("proximity_checker created without host")
		return INITIALIZE_HINT_QDEL
	var/static/list/loc_connections = list(
		COMSIG_ATOM_ENTERED = .proc/on_entered,
		COMSIG_ATOM_EXITED =.proc/on_uncrossed,
	)
	AddElement(/datum/element/connect_loc, loc_connections)

/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/gone, direction)
	SIGNAL_HANDLER
	return

/obj/effect/abstract/proximity_checker/Destroy()
	LAZYREMOVE(monitor.checkers, src)
	monitor = null
	return ..()

/obj/effect/abstract/proximity_checker/proc/on_entered(datum/source, atom/movable/AM)
	SIGNAL_HANDLER
	monitor?.hasprox_receiver?.HasProximity(AM)


code:
/**
 * Spawns a TTV.
 *
 */
/obj/effect/spawner/newbomb
	name = "bomb"
	icon = 'icons/hud/screen_gen.dmi'
	icon_state = "x"
	/// The initial temperature of the plasma tank.
	var/temp_p = 1413
	/// The initial temperature of the oxygen tank.
	var/temp_o = 141.3
	/// The initial pressure of the plasma tank.
	var/pressure_p = TANK_LEAK_PRESSURE - 1
	/// The initial pressure of the oxygen tank.
	var/pressure_o = TANK_LEAK_PRESSURE - 1
	/// The typepath of the assembly to attach to the TTV.
	var/assembly_type

/obj/effect/spawner/newbomb/Initialize(mapload)
	. = ..()
	var/obj/item/transfer_valve/ttv = new(loc)
	var/obj/item/tank/internals/plasma/plasma_tank = new(ttv)
	var/obj/item/tank/internals/oxygen/oxygen_tank = new(ttv)

	var/datum/gas_mixture/plasma_mix = plasma_tank.return_air()
	plasma_mix.assert_gas(/datum/gas/plasma)
	plasma_mix.gases[/datum/gas/plasma][MOLES] = pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*temp_p)
	plasma_mix.temperature = temp_p

	var/datum/gas_mixture/oxygen_mix = oxygen_tank.return_air()
	oxygen_mix.assert_gas(/datum/gas/oxygen)
	oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*temp_o)
	oxygen_mix.temperature = temp_o

	ttv.tank_one = plasma_tank
	ttv.tank_two = oxygen_tank
	plasma_tank.master = ttv
	oxygen_tank.master = ttv

	if(assembly_type)
		var/obj/item/assembly/detonator = new assembly_type(ttv)
		ttv.attached_device = detonator
		detonator.holder = ttv

	ttv.update_appearance()

	return INITIALIZE_HINT_QDEL

/obj/effect/spawner/newbomb/timer
	assembly_type = /obj/item/assembly/timer

/obj/effect/spawner/newbomb/proximity
	assembly_type = /obj/item/assembly/prox_sensor

/obj/effect/spawner/newbomb/radio
	assembly_type = /obj/item/assembly/signaler

repo_name: AnalWerewolf/sundown

license: mit


code:
/obj/effect/spawner/costume
	name = "costume spawner"
	icon = 'icons/hud/screen_gen.dmi'
	icon_state = "x2"
	color = "#00FF00"

	var/list/items

/obj/effect/spawner/costume/Initialize(mapload)
	..()
	if(items?.len)
		for(var/path in items)
			new path(loc)
	return INITIALIZE_HINT_QDEL

/obj/effect/spawner/costume/chicken
	name = "chicken costume spawner"
	items = list(
		/obj/item/clothing/suit/chickensuit,
		/obj/item/clothing/head/chicken,
		/obj/item/food/egg,
	)

/obj/effect/spawner/costume/gladiator
	name = "gladiator costume spawner"
	items = list(
		/obj/item/clothing/under/costume/gladiator,
		/obj/item/clothing/head/helmet/gladiator,
	)

/obj/effect/spawner/costume/madscientist
	name = "mad scientist costume spawner"
	items = list(
		/obj/item/clothing/under/rank/captain/suit,
		/obj/item/clothing/head/flatcap,
		/obj/item/clothing/suit/toggle/labcoat/mad,
	)

/obj/effect/spawner/costume/elpresidente
	name = "el presidente costume spawner"
	items = list(
		/obj/item/clothing/under/rank/captain/suit,
		/obj/item/clothing/head/flatcap,
		/obj/item/clothing/mask/cigarette/cigar/havana,
		/obj/item/clothing/shoes/jackboots,
	)

/obj/effect/spawner/costume/nyangirl
	name = "nyangirl costume spawner"
	items = list(
		/obj/item/clothing/under/costume/schoolgirl,
		/obj/item/clothing/head/kitty,
		/obj/item/clothing/glasses/blindfold,
	)

/obj/effect/spawner/costume/maid
	name = "maid costume spawner"
	items = list(
		/obj/item/clothing/under/dress/skirt,
		/obj/effect/spawner/random/clothing/beret_or_rabbitears,
		/obj/item/clothing/glasses/blindfold,
	)

/obj/effect/spawner/costume/butler
	name = "butler costume spawner"
	items = list(
		/obj/item/clothing/accessory/waistcoat,
		/obj/item/clothing/under/suit/black,
		/obj/item/clothing/head/that,
	)

/obj/effect/spawner/costume/referee
	name = "referee costume spawner"
	items = list(
		/obj/item/clothing/mask/whistle,
		/obj/item/clothing/gloves/color/latex,
		/obj/item/clothing/shoes/laceup,
		/obj/item/clothing/head/soft/black,
		/obj/item/clothing/under/costume/referee,
	)

/obj/effect/spawner/costume/highlander
	name = "highlander costume spawner"
	items = list(
		/obj/item/clothing/under/costume/kilt,
		/obj/item/clothing/head/beret,
	)

/obj/effect/spawner/costume/prig
	name = "prig costume spawner"
	items = list(
		/obj/item/clothing/accessory/waistcoat,
		/obj/item/clothing/glasses/monocle,
		/obj/effect/spawner/random/clothing/bowler_or_that,
		/obj/item/clothing/shoes/sneakers/black,
		/obj/item/cane,
		/obj/item/clothing/under/suit/sl,
		/obj/item/clothing/mask/fakemoustache,
	)

/obj/effect/spawner/costume/plaguedoctor
	name = "plague doctor costume spawner"
	items = list(
		/obj/item/clothing/suit/bio_suit/plaguedoctorsuit,
		/obj/item/clothing/head/plaguedoctorhat,
		/obj/item/clothing/mask/gas/plaguedoctor,
	)

/obj/effect/spawner/costume/nightowl
	name = "night owl costume spawner"
	items = list(
		/obj/item/clothing/suit/toggle/owlwings,
		/obj/item/clothing/under/costume/owl,
		/obj/item/clothing/mask/gas/owl_mask,
	)

/obj/effect/spawner/costume/griffin
	name = "griffin costume spawner"
	items = list(
		/obj/item/clothing/suit/toggle/owlwings/griffinwings,
		/obj/item/clothing/shoes/griffin,
		/obj/item/clothing/under/costume/griffin,
		/obj/item/clothing/head/griffin,
	)

/obj/effect/spawner/costume/waiter
	name = "waiter costume spawner"
	items = list(
		/obj/item/clothing/under/suit/waiter,
		/obj/effect/spawner/random/clothing/kittyears_or_rabbitears,
		/obj/item/clothing/suit/apron,
	)

/obj/effect/spawner/costume/pirate
	name = "pirate costume spawner"
	items = list(
		/obj/item/clothing/under/costume/pirate,
		/obj/item/clothing/suit/pirate,
		/obj/effect/spawner/random/clothing/pirate_or_bandana,
		/obj/item/clothing/glasses/eyepatch,
	)

/obj/effect/spawner/costume/commie
	name = "commie costume spawner"
	items = list(
		/obj/item/clothing/under/costume/soviet,
		/obj/item/clothing/head/ushanka,
	)

/obj/effect/spawner/costume/imperium_monk
	name = "imperium monk costume spawner"
	items = list(
		/obj/item/clothing/suit/imperium_monk,
		/obj/effect/spawner/random/clothing/twentyfive_percent_cyborg_mask,
	)

/obj/effect/spawner/costume/holiday_priest
	name = "holiday priest costume spawner"
	items = list(/obj/item/clothing/suit/chaplainsuit/holidaypriest)

/obj/effect/spawner/costume/marisawizard
	name = "marisa wizard costume spawner"
	items = list(
		/obj/item/clothing/shoes/sneakers/marisa,
		/obj/item/clothing/head/wizard/marisa/fake,
		/obj/item/clothing/suit/wizrobe/marisa/fake,
	)

/obj/effect/spawner/costume/cutewitch
	name = "cute witch costume spawner"
	items = list(
		/obj/item/clothing/under/dress/sundress,
		/obj/item/clothing/head/witchwig,
		/obj/item/staff/broom,
	)

/obj/effect/spawner/costume/wizard
	name = "wizard costume spawner"
	items = list(
		/obj/item/clothing/shoes/sandal,
		/obj/item/clothing/suit/wizrobe/fake,
		/obj/item/clothing/head/wizard/fake,
		/obj/item/staff,
	)

/obj/effect/spawner/costume/sexyclown
	name = "sexy clown costume spawner"
	items = list(
		/obj/item/clothing/mask/gas/sexyclown,
		/obj/item/clothing/under/rank/civilian/clown/sexy,
	)

/obj/effect/spawner/costume/sexymime
	name = "sexy mime costume spawner"
	items = list(
		/obj/item/clothing/mask/gas/sexymime,
		/obj/item/clothing/under/rank/civilian/mime/sexy,
	)

/obj/effect/spawner/costume/mafia
	name = "black mafia outfit spawner"
	items = list(
		/obj/item/clothing/head/fedora,
		/obj/item/clothing/under/suit/blacktwopiece,
		/obj/item/clothing/shoes/laceup,
	)

/obj/effect/spawner/costume/mafia/white
	name = "white mafia outfit spawner"
	items = list(
		/obj/item/clothing/head/fedora/white,
		/obj/item/clothing/under/suit/white,
		/obj/item/clothing/shoes/laceup,
	)

/obj/effect/spawner/costume/mafia/checkered
	name = "checkered mafia outfit spawner"
	items = list(
		/obj/item/clothing/head/fedora,
		/obj/item/clothing/under/suit/checkered,
		/obj/item/clothing/shoes/laceup,
	)

/obj/effect/spawner/costume/mafia/beige
	name = "beige mafia outfit spawner"
	items = list(
		/obj/item/clothing/head/fedora/beige,
		/obj/item/clothing/under/suit/beige,
		/obj/item/clothing/shoes/laceup,
	)


code:
/obj/effect/gibspawner
	icon_state = "gibspawner"// For the map editor
	var/sparks = 0 //whether sparks spread
	var/virusProb = 20 //the chance for viruses to spread on the gibs
	var/gib_mob_type  //generate a fake mob to transfer DNA from if we weren't passed a mob.
	var/sound_to_play = 'sound/effects/blobattack.ogg'
	var/sound_vol = 60
	var/list/gibtypes = list() //typepaths of the gib decals to spawn
	var/list/gibamounts = list() //amount to spawn for each gib decal type we'll spawn.
	var/list/gibdirections = list() //of lists of possible directions to spread each gib decal type towards.

/obj/effect/gibspawner/Initialize(mapload, mob/living/source_mob, list/datum/disease/diseases)
	. = ..()

	if(gibtypes.len != gibamounts.len)
		stack_trace("Gib list amount length mismatch!")
		return
	if(gibamounts.len != gibdirections.len)
		stack_trace("Gib list dir length mismatch!")
		return

	var/obj/effect/decal/cleanable/blood/gibs/gib = null

	if(sound_to_play && isnum(sound_vol))
		playsound(src, sound_to_play, sound_vol, TRUE)

	if(sparks)
		var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
		s.set_up(2, 1, loc)
		s.start()

	var/list/dna_to_add //find the dna to pass to the spawned gibs. do note this can be null if the mob doesn't have blood. add_blood_DNA() has built in null handling.
	if(source_mob)
		dna_to_add = source_mob.get_blood_dna_list() //ez pz
	else if(gib_mob_type)
		var/mob/living/temp_mob = new gib_mob_type(src) //generate a fake mob so that we pull the right type of DNA for the gibs.
		dna_to_add = temp_mob.get_blood_dna_list()
		qdel(temp_mob)
	else
		dna_to_add = list("Non-human DNA" = random_blood_type()) //else, generate a random bloodtype for it.

	for(var/i = 1, i<= gibtypes.len, i++)
		if(gibamounts[i])
			for(var/j = 1, j<= gibamounts[i], j++)
				var/gibType = gibtypes[i]
				gib = new gibType(loc, diseases)

				gib.add_blood_DNA(dna_to_add)

				var/list/directions = gibdirections[i]
				if(isturf(loc))
					if(directions.len)
						gib.streak(directions, mapload)

	return INITIALIZE_HINT_QDEL

/obj/effect/gibspawner/generic
	gibtypes = list(/obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/core)
	gibamounts = list(2, 2, 1)
	sound_vol = 40

/obj/effect/gibspawner/generic/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(WEST, NORTHWEST, SOUTHWEST, NORTH),list(EAST, NORTHEAST, SOUTHEAST, SOUTH), list())
	return ..()

/obj/effect/gibspawner/generic/animal
	gib_mob_type = /mob/living/simple_animal/pet

/obj/effect/gibspawner/human
	gibtypes = list(/obj/effect/decal/cleanable/blood/gibs/up, /obj/effect/decal/cleanable/blood/gibs/down, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/body, /obj/effect/decal/cleanable/blood/gibs/limb, /obj/effect/decal/cleanable/blood/gibs/core)
	gibamounts = list(1, 1, 1, 1, 1, 1, 1)
	gib_mob_type = /mob/living/carbon/human
	sound_vol = 50

/obj/effect/gibspawner/human/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, GLOB.alldirs, list())
	return ..()

/obj/effect/gibspawner/human/bodypartless //only the gibs that don't look like actual full bodyparts (except torso).
	gibtypes = list(/obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/core, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/core, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/torso)
	gibamounts = list(1, 1, 1, 1, 1, 1)

/obj/effect/gibspawner/human/bodypartless/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, list())
	return ..()

/obj/effect/gibspawner/xeno
	gibtypes = list(/obj/effect/decal/cleanable/xenoblood/xgibs/up, /obj/effect/decal/cleanable/xenoblood/xgibs/down, /obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/xenoblood/xgibs/body, /obj/effect/decal/cleanable/xenoblood/xgibs/limb, /obj/effect/decal/cleanable/xenoblood/xgibs/core)
	gibamounts = list(1, 1, 1, 1, 1, 1, 1)
	gib_mob_type = /mob/living/carbon/alien

/obj/effect/gibspawner/xeno/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, GLOB.alldirs, list())
	return ..()

/obj/effect/gibspawner/xeno/bodypartless //only the gibs that don't look like actual full bodyparts (except torso).
	gibtypes = list(/obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/xenoblood/xgibs/core, /obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/xenoblood/xgibs/core, /obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/xenoblood/xgibs/torso)
	gibamounts = list(1, 1, 1, 1, 1, 1)

/obj/effect/gibspawner/xeno/bodypartless/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, list())
	return ..()

/obj/effect/gibspawner/larva
	gibtypes = list(/obj/effect/decal/cleanable/xenoblood/xgibs/larva, /obj/effect/decal/cleanable/xenoblood/xgibs/larva, /obj/effect/decal/cleanable/xenoblood/xgibs/larva/body, /obj/effect/decal/cleanable/xenoblood/xgibs/larva/body)
	gibamounts = list(1, 1, 1, 1)
	gib_mob_type = /mob/living/carbon/alien/larva

/obj/effect/gibspawner/larva/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST), list(), GLOB.alldirs)
	return ..()

/obj/effect/gibspawner/larva/bodypartless
	gibtypes = list(/obj/effect/decal/cleanable/xenoblood/xgibs/larva, /obj/effect/decal/cleanable/xenoblood/xgibs/larva, /obj/effect/decal/cleanable/xenoblood/xgibs/larva)
	gibamounts = list(1, 1, 1)

/obj/effect/gibspawner/larva/bodypartless/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST), list())
	return ..()

/obj/effect/gibspawner/robot
	sparks = 1
	gibtypes = list(/obj/effect/decal/cleanable/robot_debris/up, /obj/effect/decal/cleanable/robot_debris/down, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris/limb)
	gibamounts = list(1, 1, 1, 1, 1, 1)
	gib_mob_type = /mob/living/silicon

/obj/effect/gibspawner/robot/Initialize(mapload)
	if(!gibdirections.len)
		gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, GLOB.alldirs)
	gibamounts[6] = pick(0, 1, 2)
	return ..()


code:
/obj/effect/spawner/lootdrop
	icon = 'icons/effects/landmarks_static.dmi'
	icon_state = "random_loot"
	layer = OBJ_LAYER
	anchored = TRUE // Stops persistent lootdrop spawns from being shoved into lockers
	var/lootcount = 1 //how many items will be spawned
	var/lootdoubles = TRUE //if the same item can be spawned twice
	var/list/loot //a list of possible items to spawn e.g. list(/obj/item, /obj/structure, /obj/effect)
	var/fan_out_items = FALSE //Whether the items should be distributed to offsets 0,1,-1,2,-2,3,-3.. This overrides pixel_x/y on the spawner itself
	/// Whether the spawner should immediately spawn loot and cleanup on Initialize()
	var/spawn_on_init = TRUE

/obj/effect/spawner/lootdrop/Initialize(mapload)
	. = ..()

	if(spawn_on_init)
		spawn_loot()
		return INITIALIZE_HINT_QDEL

///If the spawner has any loot defined, randomly picks some and spawns it. Does not cleanup the spawner.
/obj/effect/spawner/lootdrop/proc/spawn_loot(lootcount_override)
	var/lootcount = isnull(lootcount_override) ? src.lootcount : lootcount_override

	if(loot?.len)
		var/loot_spawned = 0
		while((lootcount-loot_spawned) && loot.len)
			var/lootspawn = pickweight(loot)
			while(islist(lootspawn))
				lootspawn = pickweight(lootspawn)
			if(!lootdoubles)
				loot.Remove(lootspawn)

			if(lootspawn)
				var/atom/movable/spawned_loot = new lootspawn(loc)
				if (!fan_out_items)
					if (pixel_x != 0)
						spawned_loot.pixel_x = pixel_x
					if (pixel_y != 0)
						spawned_loot.pixel_y = pixel_y
				else
					if (loot_spawned)
						spawned_loot.pixel_x = spawned_loot.pixel_y = ((!(loot_spawned%2)*loot_spawned/2)*-1)+((loot_spawned%2)*(loot_spawned+1)/2*1)
			loot_spawned++

/obj/effect/spawner/lootdrop/donkpockets
	name = "donk pocket box spawner"
	lootdoubles = FALSE

	loot = list(
			/obj/item/storage/box/donkpockets/donkpocketspicy = 1,
			/obj/item/storage/box/donkpockets/donkpocketteriyaki = 1,
			/obj/item/storage/box/donkpockets/donkpocketpizza = 1,
			/obj/item/storage/box/donkpockets/donkpocketberry = 1,
			/obj/item/storage/box/donkpockets/donkpockethonk = 1,
		)

/obj/effect/spawner/lootdrop/arcade_boards
	name = "arcade board spawner"
	lootdoubles = FALSE
	loot = list()

/obj/effect/spawner/lootdrop/arcade_boards/Initialize(mapload)
	loot += subtypesof(/obj/item/circuitboard/computer/arcade)
	return ..()

/obj/effect/spawner/lootdrop/armory_contraband
	name = "armory contraband gun spawner"
	lootdoubles = FALSE

	loot = list(
				/obj/item/gun/ballistic/automatic/pistol = 8,
				/obj/item/gun/ballistic/shotgun/automatic/combat = 5,
				/obj/item/gun/ballistic/automatic/pistol/deagle,
				/obj/item/gun/ballistic/revolver/mateba
				)

/obj/effect/spawner/lootdrop/armory_contraband/metastation
	loot = list(/obj/item/gun/ballistic/automatic/pistol = 5,
				/obj/item/gun/ballistic/shotgun/automatic/combat = 5,
				/obj/item/gun/ballistic/automatic/pistol/deagle,
				/obj/item/storage/box/syndie_kit/throwing_weapons = 3,
				/obj/item/gun/ballistic/revolver/mateba)

/obj/effect/spawner/lootdrop/armory_contraband/donutstation
	loot = list(/obj/item/grenade/clusterbuster/teargas = 5,
				/obj/item/gun/ballistic/shotgun/automatic/combat = 5,
				/obj/item/bikehorn/golden,
				/obj/item/grenade/clusterbuster,
				/obj/item/storage/box/syndie_kit/throwing_weapons = 3,
				/obj/item/gun/ballistic/revolver/mateba)

/obj/effect/spawner/lootdrop/prison_contraband
	name = "prison contraband loot spawner"
	loot = list(/obj/item/clothing/mask/cigarette/space_cigarette = 4,
				/obj/item/clothing/mask/cigarette/robust = 2,
				/obj/item/clothing/mask/cigarette/carp = 3,
				/obj/item/clothing/mask/cigarette/uplift = 2,
				/obj/item/clothing/mask/cigarette/dromedary = 3,
				/obj/item/clothing/mask/cigarette/robustgold = 1,
				/obj/item/storage/fancy/cigarettes/cigpack_uplift = 3,
				/obj/item/storage/fancy/cigarettes = 3,
				/obj/item/clothing/mask/cigarette/rollie/cannabis = 4,
				/obj/item/toy/crayon/spraycan = 2,
				/obj/item/crowbar = 1,
				/obj/item/assembly/flash/handheld = 1,
				/obj/item/restraints/handcuffs/cable/zipties = 1,
				/obj/item/restraints/handcuffs = 1,
				/obj/item/radio/off = 1,
				/obj/item/lighter = 3,
				/obj/item/storage/box/matches = 3,
				/obj/item/reagent_containers/syringe/contraband/space_drugs = 1,
				/obj/item/reagent_containers/syringe/contraband/krokodil = 1,
				/obj/item/reagent_containers/syringe/contraband/saturnx = 1,
				/obj/item/reagent_containers/syringe/contraband/methamphetamine = 1,
				/obj/item/reagent_containers/syringe/contraband/bath_salts = 1,
				/obj/item/reagent_containers/syringe/contraband/fentanyl = 1,
				/obj/item/reagent_containers/syringe/contraband/morphine = 1,
				/obj/item/storage/pill_bottle/happy = 1,
				/obj/item/storage/pill_bottle/lsd = 1,
				/obj/item/storage/pill_bottle/psicodine = 1,
				/obj/item/reagent_containers/food/drinks/bottle/beer = 4,
				/obj/item/reagent_containers/food/drinks/bottle/whiskey = 1,
				/obj/item/paper/fluff/jobs/prisoner/letter = 1,
				/obj/item/grenade/smokebomb = 1,
				/obj/item/flashlight/seclite = 1,
				/obj/item/tailclub = 1, //want to buy makeshift wooden club sprite
				/obj/item/kitchen/knife/shiv = 4,
				/obj/item/kitchen/knife/shiv/carrot = 1,
				/obj/item/kitchen/knife = 1,
				/obj/item/storage/wallet/random = 1,
				/obj/item/pda = 1
				)

/obj/effect/spawner/lootdrop/gambling
	name = "gambling valuables spawner"
	loot = list(
				/obj/item/gun/ballistic/revolver/russian = 5,
				/obj/item/clothing/head/ushanka = 3,
				/obj/item/storage/box/syndie_kit/throwing_weapons,
				/obj/item/coin/gold,
				/obj/item/reagent_containers/food/drinks/bottle/vodka/badminka,
				)

/obj/effect/spawner/lootdrop/garbage_spawner
	name = "garbage_spawner"
	loot = list(/obj/effect/spawner/lootdrop/food_packaging = 56,
				/obj/item/trash/can = 8,
				/obj/item/shard = 8,
				/obj/effect/spawner/lootdrop/botanical_waste = 8,
				/obj/effect/spawner/lootdrop/cigbutt = 8,
				/obj/item/reagent_containers/syringe = 5,
				/obj/item/food/deadmouse = 2,
				/obj/item/light/tube/broken = 3,
				/obj/item/light/tube/broken = 1,
				/obj/item/trash/candle = 1)

/obj/effect/spawner/lootdrop/cigbutt
	name = "cigarette butt spawner"
	loot = list(/obj/item/cigbutt = 65,
				/obj/item/cigbutt/roach = 20,
				/obj/item/cigbutt/cigarbutt = 15)

/obj/effect/spawner/lootdrop/food_packaging
	name = "food packaging spawner"
	loot = list(/obj/item/trash/raisins = 20,
				/obj/item/trash/cheesie = 10,
				/obj/item/trash/candy = 10,
				/obj/item/trash/chips = 10,
				/obj/item/trash/sosjerky = 10,
				/obj/item/trash/pistachios = 10,
				/obj/item/trash/boritos = 8,
				/obj/item/trash/can/food/beans = 6,
				/obj/item/trash/popcorn = 5,
				/obj/item/trash/energybar = 5,
				/obj/item/trash/can/food/peaches/maint = 4,
				/obj/item/trash/semki = 2)

/obj/effect/spawner/lootdrop/botanical_waste
	name = "botanical waste spawner"
	loot = list(/obj/item/grown/bananapeel = 60,
				/obj/item/grown/corncob = 30,
				/obj/item/food/grown/bungopit = 10)

/obj/effect/spawner/lootdrop/refreshing_beverage
	name = "good soda spawner"
	loot = list(/obj/item/reagent_containers/food/drinks/drinkingglass/filled/nuka_cola = 15,
				/obj/item/reagent_containers/food/drinks/soda_cans/grey_bull = 15,
				/obj/item/reagent_containers/food/drinks/soda_cans/monkey_energy = 10,
				/obj/item/reagent_containers/food/drinks/soda_cans/thirteenloko = 10,
				/obj/item/reagent_containers/food/drinks/bottle/beer/light = 10,
				/obj/item/reagent_containers/food/drinks/soda_cans/shamblers = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/pwr_game = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/dr_gibb = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/space_mountain_wind = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/starkist = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/space_up = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/sol_dry = 5,
				/obj/item/reagent_containers/food/drinks/soda_cans/cola = 5)

/obj/effect/spawner/lootdrop/maint_drugs
	name = "maint drugs spawner"
	loot = list(/obj/item/reagent_containers/food/drinks/bottle/hooch = 50,
				/obj/item/clothing/mask/cigarette/rollie/cannabis = 15,
				/obj/item/clothing/mask/cigarette/rollie/mindbreaker = 5,
				/obj/item/reagent_containers/syringe = 15,
				/obj/item/cigbutt/roach = 15)

/obj/effect/spawner/lootdrop/grille_or_trash
	name = "maint grille or trash spawner"
	loot = list(/obj/structure/grille = 5,
			/obj/item/cigbutt = 1,
			/obj/item/trash/cheesie = 1,
			/obj/item/trash/candy = 1,
			/obj/item/trash/chips = 1,
			/obj/item/food/deadmouse = 1,
			/obj/item/trash/pistachios = 1,
			/obj/item/trash/popcorn = 1,
			/obj/item/trash/raisins = 1,
			/obj/item/trash/sosjerky = 1,
			/obj/item/trash/syndi_cakes = 1)

/obj/effect/spawner/lootdrop/three_course_meal
	name = "three course meal spawner"
	lootcount = 3
	lootdoubles = FALSE
	var/soups = list(
			/obj/item/food/soup/beet,
			/obj/item/food/soup/sweetpotato,
			/obj/item/food/soup/stew,
			/obj/item/food/soup/hotchili,
			/obj/item/food/soup/nettle,
			/obj/item/food/soup/meatball)
	var/salads = list(
			/obj/item/food/salad/herbsalad,
			/obj/item/food/salad/validsalad,
			/obj/item/food/salad/fruit,
			/obj/item/food/salad/jungle,
			/obj/item/food/salad/aesirsalad)
	var/mains = list(
			/obj/item/food/bearsteak,
			/obj/item/food/enchiladas,
			/obj/item/food/stewedsoymeat,
			/obj/item/food/burger/bigbite,
			/obj/item/food/burger/superbite,
			/obj/item/food/burger/fivealarm)

/obj/effect/spawner/lootdrop/three_course_meal/Initialize(mapload)
	loot = list(pick(soups) = 1,pick(salads) = 1,pick(mains) = 1)
	. = ..()

/obj/effect/spawner/lootdrop/maintenance
	name = "maintenance loot spawner"
	desc = "Come on Lady Luck, spawn me a pair of sunglasses."
	spawn_on_init = FALSE
	// see code/_globalvars/lists/maintenance_loot.dm for loot table

/obj/effect/spawner/lootdrop/maintenance/examine(mob/user)
	. = ..()
	. += span_info("This spawner has an effective loot count of [get_effective_lootcount()].")

/obj/effect/spawner/lootdrop/maintenance/Initialize(mapload)
	. = ..()
	// There is a single callback in SSmapping to spawn all delayed maintenance loot
	// so we don't just make one callback per loot spawner
	GLOB.maintenance_loot_spawners += src
	loot = GLOB.maintenance_loot

	// Late loaded templates like shuttles can have maintenance loot
	if(SSticker.current_state >= GAME_STATE_SETTING_UP)
		spawn_loot()
		hide()

/obj/effect/spawner/lootdrop/maintenance/Destroy()
	GLOB.maintenance_loot_spawners -= src
	return ..()

/obj/effect/spawner/lootdrop/maintenance/proc/hide()
	invisibility = INVISIBILITY_ABSTRACT

/obj/effect/spawner/lootdrop/maintenance/proc/get_effective_lootcount()
	var/effective_lootcount = lootcount

	if(HAS_TRAIT(SSstation, STATION_TRAIT_FILLED_MAINT))
		effective_lootcount = FLOOR(lootcount * 1.5, 1)

	else if(HAS_TRAIT(SSstation, STATION_TRAIT_EMPTY_MAINT))
		effective_lootcount = FLOOR(lootcount * 0.5, 1)

	return effective_lootcount

/obj/effect/spawner/lootdrop/maintenance/spawn_loot(lootcount_override)
	if(isnull(lootcount_override))
		lootcount_override = get_effective_lootcount()
	. = ..()

	// In addition, closets that are closed will have the maintenance loot inserted inside.
	for(var/obj/structure/closet/closet in get_turf(src))
		if(!closet.opened)
			closet.take_contents()

/obj/effect/spawner/lootdrop/maintenance/two
	name = "2 x maintenance loot spawner"
	lootcount = 2

/obj/effect/spawner/lootdrop/maintenance/three
	name = "3 x maintenance loot spawner"
	lootcount = 3

/obj/effect/spawner/lootdrop/maintenance/four
	name = "4 x maintenance loot spawner"
	lootcount = 4

/obj/effect/spawner/lootdrop/maintenance/five
	name = "5 x maintenance loot spawner"
	lootcount = 5

/obj/effect/spawner/lootdrop/maintenance/six
	name = "6 x maintenance loot spawner"
	lootcount = 6

/obj/effect/spawner/lootdrop/maintenance/seven
	name = "7 x maintenance loot spawner"
	lootcount = 7

/obj/effect/spawner/lootdrop/maintenance/eight
	name = "8 x maintenance loot spawner"
	lootcount = 8

/obj/effect/spawner/lootdrop/crate_spawner
	name = "lootcrate spawner" //USE PROMO CODE "SELLOUT" FOR 20% OFF!
	lootdoubles = FALSE

	loot = list(
				/obj/structure/closet/crate/secure/loot = 20,
				"" = 80
				)

/obj/effect/spawner/lootdrop/organ_spawner
	name = "ayylien organ spawner"
	loot = list(
		/obj/item/organ/heart/gland/electric = 3,
		/obj/item/organ/heart/gland/trauma = 4,
		/obj/item/organ/heart/gland/egg = 7,
		/obj/item/organ/heart/gland/chem = 5,
		/obj/item/organ/heart/gland/mindshock = 5,
		/obj/item/organ/heart/gland/plasma = 7,
		/obj/item/organ/heart/gland/transform = 5,
		/obj/item/organ/heart/gland/slime = 4,
		/obj/item/organ/heart/gland/spiderman = 5,
		/obj/item/organ/heart/gland/ventcrawling = 1,
		/obj/item/organ/body_egg/alien_embryo = 1,
		/obj/item/organ/regenerative_core = 2)
	lootcount = 3

/obj/effect/spawner/lootdrop/memeorgans
	name = "meme organ spawner"
	loot = list(
		/obj/item/organ/ears/penguin,
		/obj/item/organ/ears/cat,
		/* SEPTIC EDIT REMOVAL
		/obj/item/organ/eyes/moth,
		/obj/item/organ/eyes/snail,
		*/
		/obj/item/organ/tongue/bone,
		/obj/item/organ/tongue/fly,
		/obj/item/organ/tongue/snail,
		/obj/item/organ/tongue/lizard,
		/obj/item/organ/tongue/alien,
		/obj/item/organ/tongue/ethereal,
		/obj/item/organ/tongue/robot,
		/obj/item/organ/tongue/zombie,
		/obj/item/organ/appendix,
		/obj/item/organ/liver/fly,
		/obj/item/organ/lungs/plasmaman,
		/obj/item/organ/tail/cat,
		/obj/item/organ/tail/lizard)
	lootcount = 5

/obj/effect/spawner/lootdrop/two_percent_xeno_egg_spawner
	name = "2% chance xeno egg spawner"
	loot = list(
		/obj/effect/decal/remains/xeno = 49,
		/obj/effect/spawner/xeno_egg_delivery = 1)

/obj/effect/spawner/lootdrop/costume
	name = "random costume spawner"

/obj/effect/spawner/lootdrop/costume/Initialize()
	loot = list()
	for(var/path in subtypesof(/obj/effect/spawner/bundle/costume))
		loot[path] = TRUE
	. = ..()

// Minor lootdrops follow

/obj/effect/spawner/lootdrop/minor/beret_or_rabbitears
	name = "beret or rabbit ears spawner"
	loot = list(
		/obj/item/clothing/head/beret = 1,
		/obj/item/clothing/head/rabbitears = 1)

/obj/effect/spawner/lootdrop/minor/bowler_or_that
	name = "bowler or top hat spawner"
	loot = list(
		/obj/item/clothing/head/bowler = 1,
		/obj/item/clothing/head/that = 1)

/obj/effect/spawner/lootdrop/minor/kittyears_or_rabbitears
	name = "kitty ears or rabbit ears spawner"
	loot = list(
		/obj/item/clothing/head/kitty = 1,
		/obj/item/clothing/head/rabbitears = 1)

/obj/effect/spawner/lootdrop/minor/pirate_or_bandana
	name = "pirate hat or bandana spawner"
	loot = list(
		/obj/item/clothing/head/pirate = 1,
		/obj/item/clothing/head/bandana = 1)

/obj/effect/spawner/lootdrop/minor/twentyfive_percent_cyborg_mask
	name = "25% cyborg mask spawner"
	loot = list(
		/obj/item/clothing/mask/gas/cyborg = 25,
		"" = 75)

/obj/effect/spawner/lootdrop/aimodule_harmless // These shouldn't allow the AI to start butchering people
	name = "harmless AI module spawner"
	loot = list(
				/obj/item/ai_module/core/full/asimov,
				/obj/item/ai_module/core/full/asimovpp,
				/obj/item/ai_module/core/full/hippocratic,
				/obj/item/ai_module/core/full/paladin_devotion,
				/obj/item/ai_module/core/full/paladin
				)

/obj/effect/spawner/lootdrop/aimodule_neutral // These shouldn't allow the AI to start butchering people without reason
	name = "neutral AI module spawner"
	loot = list(
				/obj/item/ai_module/core/full/corp,
				/obj/item/ai_module/core/full/maintain,
				/obj/item/ai_module/core/full/drone,
				/obj/item/ai_module/core/full/peacekeeper,
				/obj/item/ai_module/core/full/reporter,
				/obj/item/ai_module/core/full/robocop,
				/obj/item/ai_module/core/full/liveandletlive,
				/obj/item/ai_module/core/full/hulkamania
				)

/obj/effect/spawner/lootdrop/aimodule_harmful // These will get the shuttle called
	name = "harmful AI module spawner"
	loot = list(
				/obj/item/ai_module/core/full/antimov,
				/obj/item/ai_module/core/full/balance,
				/obj/item/ai_module/core/full/tyrant,
				/obj/item/ai_module/core/full/thermurderdynamic,
				/obj/item/ai_module/core/full/damaged,
				/obj/item/ai_module/reset/purge
				)

// Tech storage circuit board spawners

/obj/effect/spawner/lootdrop/techstorage
	name = "generic circuit board spawner"
	lootdoubles = FALSE
	fan_out_items = TRUE
	lootcount = INFINITY

/obj/effect/spawner/lootdrop/techstorage/service
	name = "service circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/arcade/battle,
				/obj/item/circuitboard/computer/arcade/orion_trail,
				/obj/item/circuitboard/machine/autolathe,
				/obj/item/circuitboard/computer/mining,
				/obj/item/circuitboard/machine/ore_redemption,
				/obj/item/circuitboard/machine/mining_equipment_vendor,
				/obj/item/circuitboard/machine/microwave,
				/obj/item/circuitboard/machine/chem_dispenser/drinks,
				/obj/item/circuitboard/machine/chem_dispenser/drinks/beer,
				/obj/item/circuitboard/computer/slot_machine
				)

/obj/effect/spawner/lootdrop/techstorage/rnd
	name = "RnD circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/aifixer,
				/obj/item/circuitboard/machine/rdserver,
				/obj/item/circuitboard/machine/mechfab,
				/obj/item/circuitboard/machine/circuit_imprinter/department,
				/obj/item/circuitboard/computer/teleporter,
				/obj/item/circuitboard/machine/destructive_analyzer,
				/obj/item/circuitboard/computer/rdconsole,
				/obj/item/circuitboard/computer/scan_consolenew,
				/obj/item/circuitboard/machine/dnascanner
				)

/obj/effect/spawner/lootdrop/techstorage/security
	name = "security circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/secure_data,
				/obj/item/circuitboard/computer/security,
				/obj/item/circuitboard/computer/prisoner
				)

/obj/effect/spawner/lootdrop/techstorage/engineering
	name = "engineering circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/atmos_alert,
				/obj/item/circuitboard/computer/stationalert,
				/obj/item/circuitboard/computer/powermonitor
				)

/obj/effect/spawner/lootdrop/techstorage/tcomms
	name = "tcomms circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/message_monitor,
				/obj/item/circuitboard/machine/telecomms/broadcaster,
				/obj/item/circuitboard/machine/telecomms/bus,
				/obj/item/circuitboard/machine/telecomms/server,
				/obj/item/circuitboard/machine/telecomms/receiver,
				/obj/item/circuitboard/machine/telecomms/processor,
				/obj/item/circuitboard/machine/announcement_system,
				/obj/item/circuitboard/computer/comm_server,
				/obj/item/circuitboard/computer/comm_monitor
				)

/obj/effect/spawner/lootdrop/techstorage/medical
	name = "medical circuit board spawner"
	loot = list(
				/obj/item/circuitboard/machine/chem_dispenser,
				/obj/item/circuitboard/computer/med_data,
				/obj/item/circuitboard/machine/smoke_machine,
				/obj/item/circuitboard/machine/chem_master,
				/obj/item/circuitboard/computer/pandemic
				)

/obj/effect/spawner/lootdrop/techstorage/ai
	name = "secure AI circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/aiupload,
				/obj/item/circuitboard/computer/borgupload,
				/obj/item/circuitboard/aicore
				)

/obj/effect/spawner/lootdrop/techstorage/command
	name = "secure command circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/crew,
				/obj/item/circuitboard/computer/communications
				)

/obj/effect/spawner/lootdrop/techstorage/rnd_secure
	name = "secure RnD circuit board spawner"
	loot = list(
				/obj/item/circuitboard/computer/mecha_control,
				/obj/item/circuitboard/computer/apc_control,
				/obj/item/circuitboard/computer/robotics
				)

/obj/effect/spawner/lootdrop/mafia_outfit
	name = "mafia outfit spawner"
	loot = list(
				/obj/effect/spawner/bundle/costume/mafia = 20,
				/obj/effect/spawner/bundle/costume/mafia/white = 5,
				/obj/effect/spawner/bundle/costume/mafia/checkered = 2,
				/obj/effect/spawner/bundle/costume/mafia/beige = 5
				)

//finds the probabilities of items spawning from a loot spawner's loot pool
/obj/item/loot_table_maker
	icon = 'icons/effects/landmarks_static.dmi'
	icon_state = "random_loot"
	var/spawner_to_test = /obj/effect/spawner/lootdrop/maintenance //what lootdrop spawner to use the loot pool of
	var/loot_count = 180 //180 is about how much maint loot spawns per map as of 11/14/2019
	//result outputs
	var/list/spawned_table //list of all items "spawned" and how many
	var/list/stat_table //list of all items "spawned" and their occurrance probability

/obj/item/loot_table_maker/Initialize()
	. = ..()
	make_table()

/obj/item/loot_table_maker/attack_self(mob/user)
	to_chat(user, "Loot pool re-rolled.")
	make_table()

/obj/item/loot_table_maker/proc/make_table()
	spawned_table = list()
	stat_table = list()
	var/obj/effect/spawner/lootdrop/spawner_to_table = new spawner_to_test
	var/lootpool = spawner_to_table.loot
	qdel(spawner_to_table)
	for(var/i in 1 to loot_count)
		var/loot_spawn = pick_loot(lootpool)
		if(!(loot_spawn in spawned_table))
			spawned_table[loot_spawn] = 1
		else
			spawned_table[loot_spawn] += 1
	stat_table += spawned_table
	for(var/item in stat_table)
		stat_table[item] /= loot_count

/obj/item/loot_table_maker/proc/pick_loot(lootpool) //selects path from loot table and returns it
	var/lootspawn = pickweight(lootpool)
	while(islist(lootspawn))
		lootspawn = pickweight(lootspawn)
	return lootspawn

/obj/effect/spawner/lootdrop/space
	name = "generic space ruin loot spawner"
	lootcount = 1

/// Space loot spawner. Randomlu picks 5 wads of space cash.
/obj/effect/spawner/lootdrop/space/cashmoney
	lootcount = 5
	fan_out_items = TRUE
	loot = list(
		/obj/item/stack/spacecash/c1 = 100,
		/obj/item/stack/spacecash/c10 = 80,
		/obj/item/stack/spacecash/c20 = 60,
		/obj/item/stack/spacecash/c50 = 40,
		/obj/item/stack/spacecash/c100 = 30,
		/obj/item/stack/spacecash/c200 = 20,
		/obj/item/stack/spacecash/c500 = 10,
		/obj/item/stack/spacecash/c1000 = 5,
		/obj/item/stack/spacecash/c10000 = 1
	)

/// Space loot spawner. Couple of random bits of technology-adjacent stuff including anomaly cores and BEPIS techs.
/obj/effect/spawner/lootdrop/space/fancytech
	lootcount = 2
	loot = list(
		/obj/item/raw_anomaly_core/random = 1,
		/obj/item/disk/tech_disk/spaceloot = 1,
		/obj/item/camera_bug = 1
	)

/// Space loot spawner. Some sort of random and rare tool. Only a single drop.
/obj/effect/spawner/lootdrop/space/fancytool
	lootcount = 1
	loot = list(
		/obj/item/wrench/abductor = 1,
		/obj/item/wirecutters/abductor = 1,
		/obj/item/screwdriver/abductor = 1,
		/obj/item/crowbar/abductor = 1,
		/obj/item/weldingtool/abductor = 1,
		/obj/item/multitool/abductor = 1,
		/obj/item/scalpel/alien = 1,
		/obj/item/hemostat/alien = 1,
		/obj/item/retractor/alien = 1,
		/obj/item/circular_saw/alien = 1,
		/obj/item/surgicaldrill/alien = 1,
		/obj/item/cautery/alien = 1,
		/obj/item/wrench/caravan = 1,
		/obj/item/wirecutters/caravan = 1,
		/obj/item/screwdriver/caravan = 1,
		/obj/item/crowbar/red/caravan = 1
	)

/// Mail loot spawner. Some sort of random and rare building tool. No alien tech here.
/obj/effect/spawner/lootdrop/space/fancytool/engineonly
	loot = list(
		/obj/item/wrench/caravan = 1,
		/obj/item/wirecutters/caravan = 1,
		/obj/item/screwdriver/caravan = 1,
		/obj/item/crowbar/red/caravan = 1
	)

/// Mail loot spawner. Drop pool of advanced medical tools typically from research. Not endgame content.
/obj/effect/spawner/lootdrop/space/fancytool/advmedicalonly
	loot = list(
		/obj/item/scalpel/advanced = 1,
		/obj/item/retractor/advanced = 1,
		/obj/item/cautery/advanced = 1
	)

/// Mail loot spawner. Some sort of random and rare surgical tool. Alien tech found here.
/obj/effect/spawner/lootdrop/space/fancytool/raremedicalonly
	loot = list(
		/obj/item/scalpel/alien = 1,
		/obj/item/hemostat/alien = 1,
		/obj/item/retractor/alien = 1,
		/obj/item/circular_saw/alien = 1,
		/obj/item/surgicaldrill/alien = 1,
		/obj/item/cautery/alien = 1
	)

/// Space loot spawner. A bunch of rarer seeds. /obj/item/seeds/random is not a random seed, but an exotic seed.
/obj/effect/spawner/lootdrop/space/rareseed
	lootcount = 5
	loot = list(
		/obj/item/seeds/random = 30,
		/obj/item/seeds/angel = 1,
		/obj/item/seeds/glowshroom/glowcap = 1,
		/obj/item/seeds/glowshroom/shadowshroom = 1,
		/obj/item/seeds/liberty = 5,
		/obj/item/seeds/nettle/death = 1,
		/obj/item/seeds/plump/walkingmushroom = 1,
		/obj/item/seeds/reishi = 5,
		/obj/item/seeds/cannabis/rainbow = 1,
		/obj/item/seeds/cannabis/death = 1,
		/obj/item/seeds/cannabis/white = 1,
		/obj/item/seeds/cannabis/ultimate = 1,
		/obj/item/seeds/replicapod = 5,
		/obj/item/seeds/kudzu = 1
	)

/// Space loot spawner. A single roundstart species language book.
/obj/effect/spawner/lootdrop/space/languagebook
	lootcount = 1
	loot = list(
		/obj/item/language_manual/roundstart_species = 100,
		/obj/item/language_manual/roundstart_species/five = 3,
		/obj/item/language_manual/roundstart_species/unlimited = 1
	)

/// Space loot spawner. Random selecton of a few rarer materials.
/obj/effect/spawner/lootdrop/space/material
	lootcount = 3
	loot = list(
		/obj/item/stack/sheet/plastic/fifty = 5,
		/obj/item/stack/sheet/runed_metal/ten = 20,
		/obj/item/stack/sheet/runed_metal/fifty = 5,
		/obj/item/stack/sheet/mineral/diamond{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/uranium{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/plasma{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/gold{amount = 15} = 15,
	)

/// A selection of cosmetic syndicate items. Just a couple. No hardsuits or weapons.
/obj/effect/spawner/lootdrop/space/syndiecosmetic
	lootcount = 2
	loot = list(
		/obj/item/clothing/under/syndicate = 10,
		/obj/item/clothing/under/syndicate/skirt = 10,
		/obj/item/clothing/under/syndicate/bloodred = 10,
		/obj/item/clothing/under/syndicate/bloodred/sleepytime = 5,
		/obj/item/clothing/under/syndicate/tacticool = 10,
		/obj/item/clothing/under/syndicate/tacticool/skirt = 10,
		/obj/item/clothing/under/syndicate/sniper = 10,
		/obj/item/clothing/under/syndicate/camo = 10,
		/obj/item/clothing/under/syndicate/soviet = 10,
		/obj/item/clothing/under/syndicate/combat = 10,
		/obj/item/clothing/under/syndicate/rus_army = 10,
		/obj/item/storage/fancy/cigarettes/cigpack_syndicate = 7,
		/obj/item/storage/fancy/cigarettes/cigpack_uplift = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_candy = 2,
		/obj/item/storage/fancy/cigarettes/cigpack_robust = 2,
		/obj/item/storage/fancy/cigarettes/cigpack_carp = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_midori = 1
	)

/obj/effect/spawner/lootdrop/decorative_material
	lootcount = 1
	loot = list(
		/obj/item/stack/sheet/sandblock{amount = 30} = 25,
		/obj/item/stack/sheet/mineral/wood{amount = 30} = 25,
		/obj/item/stack/sheet/bronze/thirty = 20,
		/obj/item/stack/tile/noslip{amount = 20} = 10,
		/obj/item/stack/sheet/plastic{amount = 30} = 10,
		/obj/item/stack/tile/pod{amount = 20} = 4,
		/obj/item/stack/tile/pod/light{amount = 20} = 3,
		/obj/item/stack/tile/pod/dark{amount = 20} = 3,
	)

/obj/effect/spawner/lootdrop/maintenance_carpet
	lootcount = 1
	loot = list(
		/obj/item/stack/tile/carpet{amount = 30} = 35,
		/obj/item/stack/tile/carpet/black{amount = 30} = 20,
		/obj/item/stack/tile/carpet/donk/thirty = 15,
		/obj/item/stack/tile/carpet/stellar/thirty = 15,
		/obj/item/stack/tile/carpet/executive/thirty = 15,
	)

/obj/effect/spawner/lootdrop/decorations_spawner
	lootcount = 1
	loot = list(
	/obj/effect/spawner/lootdrop/maintenance_carpet = 25,
	/obj/effect/spawner/lootdrop/decorative_material = 25,
	/obj/item/sign = 10,
	/obj/item/flashlight/lamp/green = 10,
	/obj/item/plaque = 5,
	/obj/item/flashlight/lantern/jade = 5,
	/obj/item/phone = 5,
	/obj/item/flashlight/lamp/bananalamp = 3
	)

/obj/effect/spawner/lootdrop/wallet_loot
	lootcount = 1
	loot = list(
		list(
			// Same weights as contraband loot cigarettes (with no packs)
			/obj/item/clothing/mask/cigarette/space_cigarette = 4,
			/obj/item/clothing/mask/cigarette/robust = 2,
			/obj/item/clothing/mask/cigarette/carp = 3,
			/obj/item/clothing/mask/cigarette/uplift = 2,
			/obj/item/clothing/mask/cigarette/dromedary = 3,
			/obj/item/clothing/mask/cigarette/robustgold = 1,
			/obj/item/clothing/mask/cigarette/rollie/cannabis = 4,
		) = 1,
		list(
			/obj/item/flashlight/pen = 90,
			/obj/item/flashlight/pen/paramedic = 10,
		) = 1,
		list( // The same seeds in the Supply "Seeds Crate"
			/obj/item/seeds/chili = 1,
			/obj/item/seeds/cotton = 1,
			/obj/item/seeds/berry = 1,
			/obj/item/seeds/corn = 1,
			/obj/item/seeds/eggplant = 1,
			/obj/item/seeds/tomato = 1,
			/obj/item/seeds/soya = 1,
			/obj/item/seeds/wheat = 1,
			/obj/item/seeds/wheat/rice = 1,
			/obj/item/seeds/carrot = 1,
			/obj/item/seeds/sunflower = 1,
			/obj/item/seeds/rose = 1,
			/obj/item/seeds/chanter = 1,
			/obj/item/seeds/potato = 1,
			/obj/item/seeds/sugarcane = 1,
		) = 1,
		list(
			/obj/item/stack/medical/suture = 1,
			/obj/item/stack/medical/mesh = 1,
			/obj/item/stack/medical/gauze = 1,
		) = 1,
		list(
			/obj/item/toy/crayon/red = 1,
			/obj/item/toy/crayon/orange = 1,
			/obj/item/toy/crayon/yellow = 1,
			/obj/item/toy/crayon/green = 1,
			/obj/item/toy/crayon/blue = 1,
			/obj/item/toy/crayon/purple = 1,
			/obj/item/toy/crayon/black = 1,
			/obj/item/toy/crayon/rainbow = 1,
		) = 1,
		list(
			/obj/item/coin/iron = 1,
			/obj/item/coin/silver = 1,
			/obj/item/coin/diamond = 1,
			/obj/item/coin/plasma = 1,
			/obj/item/coin/uranium = 1,
			/obj/item/coin/titanium = 1,
			/obj/item/coin/bananium = 1,
			/obj/item/coin/adamantine = 1,
			/obj/item/coin/mythril = 1,
			/obj/item/coin/plastic = 1,
			/obj/item/coin/runite = 1,
			/obj/item/coin/twoheaded = 1,
			/obj/item/coin/antagtoken = 1,
		) = 1,
		list(
			/obj/item/dice/d4 = 1,
			/obj/item/dice/d6 = 1,
			/obj/item/dice/d8 = 1,
			/obj/item/dice/d10 = 1,
			/obj/item/dice/d12 = 1,
			/obj/item/dice/d20 = 1,
		) = 1,
		list(
			/obj/item/disk/data = 99,
			/obj/item/disk/nuclear/fake/obvious = 1,
		) = 1,
		/obj/item/implanter = 1,
		list(
			/obj/item/lighter = 25,
			/obj/item/lighter/greyscale = 75,
		) = 1,
		/obj/item/lipstick/random = 1,
		/obj/item/match = 1,
		/obj/item/paper/pamphlet/gateway = 1,
		list(
			/obj/item/pen = 1,
			/obj/item/pen/blue = 1,
			/obj/item/pen/red = 1,
			/obj/item/pen/fourcolor = 1,
			/obj/item/pen/fountain = 1,
		) = 1,
		// random photos would go here. IF I HAD ONE. :'(
		/obj/item/reagent_containers/dropper = 1,
		/obj/item/reagent_containers/syringe = 1,
		/obj/item/reagent_containers/pill/maintenance = 1,
		/obj/item/screwdriver = 1,
		list(
			/obj/item/stamp = 50,
			/obj/item/stamp/denied = 50,
		) = 1,
	)


code:
/obj/effect/spawner/random/aimodule
	name = "AI module spawner"
	desc = "State laws human."
	icon_state = "circuit"

/obj/effect/spawner/random/aimodule/harmless
	name = "harmless AI module spawner"
	loot = list( // These shouldn't allow the AI to start butchering people
		/obj/item/ai_module/core/full/asimov,
		/obj/item/ai_module/core/full/asimovpp,
		/obj/item/ai_module/core/full/hippocratic,
		/obj/item/ai_module/core/full/paladin_devotion,
		/obj/item/ai_module/core/full/paladin,
	)

/obj/effect/spawner/random/aimodule/neutral
	name = "neutral AI module spawner"
	loot = list( // These shouldn't allow the AI to start butchering people without reason
		/obj/item/ai_module/core/full/corp,
		/obj/item/ai_module/core/full/maintain,
		/obj/item/ai_module/core/full/drone,
		/obj/item/ai_module/core/full/peacekeeper,
		/obj/item/ai_module/core/full/reporter,
		/obj/item/ai_module/core/full/robocop,
		/obj/item/ai_module/core/full/liveandletlive,
		/obj/item/ai_module/core/full/hulkamania,
	)

/obj/effect/spawner/random/aimodule/harmful
	name = "harmful AI module spawner"
	loot = list( // These will get the shuttle called
		/obj/item/ai_module/core/full/antimov,
		/obj/item/ai_module/core/full/balance,
		/obj/item/ai_module/core/full/tyrant,
		/obj/item/ai_module/core/full/thermurderdynamic,
		/obj/item/ai_module/core/full/damaged,
		/obj/item/ai_module/reset/purge,
	)


code:
/obj/effect/spawner/random/bureaucracy
	name = "bureaucracy loot spawner"
	desc = "For the exotic art of paper shuffling."

/obj/effect/spawner/random/bureaucracy/pen
	name = "pen spawner"
	icon_state = "pen"
	loot = list(
		/obj/item/pen = 30,
		/obj/item/pen/blue = 5,
		/obj/item/pen/red = 5,
		/obj/item/flashlight/pen = 5,
		/obj/item/pen/fourcolor = 2,
		/obj/item/flashlight/pen/paramedic = 2,
		/obj/item/pen/fountain = 1,
	)

/obj/effect/spawner/random/bureaucracy/stamp
	name = "stamp spawner"
	icon_state = "stamp"
	loot = list(
		/obj/item/stamp = 3,
		/obj/item/stamp/denied = 1,
	)

/obj/effect/spawner/random/bureaucracy/crayon
	name = "crayon spawner"
	icon_state = "crayon"
	loot = list(
		/obj/item/toy/crayon/red,
		/obj/item/toy/crayon/orange,
		/obj/item/toy/crayon/yellow,
		/obj/item/toy/crayon/green,
		/obj/item/toy/crayon/blue,
		/obj/item/toy/crayon/purple,
		/obj/item/toy/crayon/black,
		/obj/item/toy/crayon/white,
	)

/obj/effect/spawner/random/bureaucracy/paper
	name = "paper spawner"
	icon_state = "paper"
	loot = list(
		/obj/item/paper = 20,
		/obj/item/paper/crumpled = 2,
		/obj/item/paper/crumpled/bloody = 2,
		/obj/item/paper/crumpled/muddy = 2,
		/obj/item/paper/construction = 1,
		/obj/item/paper/carbon = 1,
	)

/obj/effect/spawner/random/bureaucracy/briefcase
	name = "briefcase spawner"
	icon_state = "briefcase"
	loot = list(
		/obj/item/storage/briefcase = 3,
		/obj/item/storage/secure/briefcase = 1,
	)

/obj/effect/spawner/random/bureaucracy/folder
	name = "folder spawner"
	icon_state = "folder"
	loot = list(
		/obj/item/folder/blue,
		/obj/item/folder/red,
		/obj/item/folder/yellow,
		/obj/item/folder/white,
		/obj/item/folder,
	)


code:
/obj/effect/spawner/random/clothing
	name = "clothing loot spawner"
	desc = "Time to look pretty."
	icon_state = "hat"

/obj/effect/spawner/random/clothing/costume
	name = "random costume spawner"
	icon_state = "costume"
	loot_subtype_path = /obj/effect/spawner/costume
	loot = list()

/obj/effect/spawner/random/clothing/beret_or_rabbitears
	name = "beret or rabbit ears spawner"
	loot = list(
		/obj/item/clothing/head/beret,
		/obj/item/clothing/head/rabbitears,
	)

/obj/effect/spawner/random/clothing/bowler_or_that
	name = "bowler or top hat spawner"
	loot = list(
		/obj/item/clothing/head/bowler,
		/obj/item/clothing/head/that,
	)

/obj/effect/spawner/random/clothing/kittyears_or_rabbitears
	name = "kitty ears or rabbit ears spawner"
	loot = list(
		/obj/item/clothing/head/kitty,
		/obj/item/clothing/head/rabbitears,
	)

/obj/effect/spawner/random/clothing/pirate_or_bandana
	name = "pirate hat or bandana spawner"
	loot = list(
		/obj/item/clothing/head/pirate,
		/obj/item/clothing/head/bandana,
	)

/obj/effect/spawner/random/clothing/twentyfive_percent_cyborg_mask
	name = "25% cyborg mask spawner"
	spawn_loot_chance = 25
	loot = list(/obj/item/clothing/mask/gas/cyborg)

/obj/effect/spawner/random/clothing/mafia_outfit
	name = "mafia outfit spawner"
	icon_state = "costume"
	loot = list(
		/obj/effect/spawner/costume/mafia = 20,
		/obj/effect/spawner/costume/mafia/white = 5,
		/obj/effect/spawner/costume/mafia/beige = 5,
		/obj/effect/spawner/costume/mafia/checkered = 2,
	)

/obj/effect/spawner/random/clothing/syndie
	name = "syndie outfit spawner"
	icon_state = "syndicate"
	loot = list(
		/obj/item/clothing/under/syndicate,
		/obj/item/clothing/under/syndicate/skirt,
		/obj/item/clothing/under/syndicate/bloodred,
		/obj/item/clothing/under/syndicate/tacticool,
		/obj/item/clothing/under/syndicate/tacticool/skirt,
		/obj/item/clothing/under/syndicate/sniper,
		/obj/item/clothing/under/syndicate/camo,
		/obj/item/clothing/under/syndicate/soviet,
		/obj/item/clothing/under/syndicate/combat,
		/obj/item/clothing/under/syndicate/rus_army,
		/obj/item/clothing/under/syndicate/bloodred/sleepytime,
	)

/obj/effect/spawner/random/clothing/gloves
	name = "random gloves"
	desc = "These gloves are supposed to be a random color..."
	icon_state = "gloves"
	loot = list(
		/obj/item/clothing/gloves/color/orange,
		/obj/item/clothing/gloves/color/red,
		/obj/item/clothing/gloves/color/blue,
		/obj/item/clothing/gloves/color/purple,
		/obj/item/clothing/gloves/color/green,
		/obj/item/clothing/gloves/color/grey,
		/obj/item/clothing/gloves/color/light_brown,
		/obj/item/clothing/gloves/color/brown,
		/obj/item/clothing/gloves/color/white,
		/obj/item/clothing/gloves/color/rainbow,
	)

/obj/effect/spawner/random/clothing/lizardboots
	name = "random lizard boot quality"
	desc = "Which ever gets picked, the lizard race loses"
	icon_state = "lizard_boots"
	loot = list(
		/obj/item/clothing/shoes/cowboy/lizard = 7,
		/obj/item/clothing/shoes/cowboy/lizard/masterwork = 1
	)

/obj/effect/spawner/random/clothing/wardrobe_closet
	name = "wardrobe closet spawner"
	icon_state = "locker_clothing"
	loot = list(
		/obj/structure/closet/gmcloset,
		/obj/structure/closet/chefcloset,
		/obj/structure/closet/jcloset,
		/obj/structure/closet/lawcloset,
		/obj/structure/closet/wardrobe/chaplain_black,
		/obj/structure/closet/wardrobe/red,
		/obj/structure/closet/wardrobe/cargotech,
		/obj/structure/closet/wardrobe/atmospherics_yellow,
		/obj/structure/closet/wardrobe/engineering_yellow,
		/obj/structure/closet/wardrobe/white/medical,
		/obj/structure/closet/wardrobe/robotics_black,
		/obj/structure/closet/wardrobe/chemistry_white,
		/obj/structure/closet/wardrobe/genetics_white,
		/obj/structure/closet/wardrobe/virology_white,
		/obj/structure/closet/wardrobe/science_white,
		/obj/structure/closet/wardrobe/botanist,
		/obj/structure/closet/wardrobe/curator,
		/obj/structure/closet/wardrobe/pjs,
	)

/obj/effect/spawner/random/clothing/wardrobe_closet_colored
	name = "colored uniform closet spawner"
	icon_state = "locker_clothing"
	loot = list(
		/obj/structure/closet/wardrobe/mixed,
		/obj/structure/closet/wardrobe,
		/obj/structure/closet/wardrobe/pink,
		/obj/structure/closet/wardrobe/black,
		/obj/structure/closet/wardrobe/green,
		/obj/structure/closet/wardrobe/orange,
		/obj/structure/closet/wardrobe/yellow,
		/obj/structure/closet/wardrobe/white,
		/obj/structure/closet/wardrobe/grey,
	)

/obj/effect/spawner/random/clothing/backpack
	name = "backpack spawner"
	icon_state = "backpack"
	loot = list(
		/obj/item/storage/backpack,
		/obj/item/storage/backpack/clown,
		/obj/item/storage/backpack/explorer,
		/obj/item/storage/backpack/mime,
		/obj/item/storage/backpack/medic,
		/obj/item/storage/backpack/security,
		/obj/item/storage/backpack/industrial,
		/obj/item/storage/backpack/botany,
		/obj/item/storage/backpack/chemistry,
		/obj/item/storage/backpack/genetics,
		/obj/item/storage/backpack/science,
		/obj/item/storage/backpack/virology,
		/obj/item/storage/backpack/satchel,
		/obj/item/storage/backpack/satchel/leather,
		/obj/item/storage/backpack/satchel/eng,
		/obj/item/storage/backpack/satchel/med,
		/obj/item/storage/backpack/satchel/vir,
		/obj/item/storage/backpack/satchel/chem,
		/obj/item/storage/backpack/satchel/gen,
		/obj/item/storage/backpack/satchel/science,
		/obj/item/storage/backpack/satchel/hyd,
		/obj/item/storage/backpack/satchel/sec,
		/obj/item/storage/backpack/satchel/explorer,
		/obj/item/storage/backpack/duffelbag,
		/obj/item/storage/backpack/duffelbag/med,
		/obj/item/storage/backpack/duffelbag/explorer,
		/obj/item/storage/backpack/duffelbag/hydroponics,
		/obj/item/storage/backpack/duffelbag/chemistry,
		/obj/item/storage/backpack/duffelbag/genetics,
		/obj/item/storage/backpack/duffelbag/science,
		/obj/item/storage/backpack/duffelbag/virology,
		/obj/item/storage/backpack/duffelbag/sec,
		/obj/item/storage/backpack/duffelbag/engineering,
		/obj/item/storage/backpack/duffelbag/clown,
	)


code:
/obj/effect/spawner/random/contraband
	name = "contraband loot spawner"
	desc = "Pstttthhh! Pass it under the table."
	icon_state = "prisoner"

/obj/effect/spawner/random/contraband/armory
	name = "armory loot spawner"
	icon_state = "pistol"
	loot = list(
		/obj/item/gun/ballistic/automatic/pistol = 8,
		/obj/item/gun/ballistic/shotgun/automatic/combat = 5,
		/obj/item/storage/box/syndie_kit/throwing_weapons = 3,
		/obj/item/grenade/clusterbuster/teargas = 2,
		/obj/item/grenade/clusterbuster = 2,
		/obj/item/gun/ballistic/automatic/pistol/deagle,
		/obj/item/gun/ballistic/revolver/mateba,
	)

/obj/effect/spawner/random/contraband/narcotics
	name = "narcotics loot spawner"
	icon_state = "pill"
	loot = list(
		/obj/item/reagent_containers/syringe/contraband/space_drugs,
		/obj/item/reagent_containers/syringe/contraband/krokodil,
		/obj/item/reagent_containers/syringe/contraband/methamphetamine,
		/obj/item/reagent_containers/syringe/contraband/bath_salts,
		/obj/item/reagent_containers/syringe/contraband/fentanyl,
		/obj/item/reagent_containers/syringe/contraband/morphine,
		/obj/item/reagent_containers/syringe/contraband/saturnx,
		/obj/item/storage/pill_bottle/happy,
		/obj/item/storage/pill_bottle/lsd,
		/obj/item/storage/pill_bottle/psicodine,
	)

/obj/effect/spawner/random/contraband/permabrig_weapon
	name = "permabrig weapon spawner"
	icon_state = "shiv"
	loot = list(
		/obj/item/knife/shiv = 5,
		/obj/item/knife/shiv/carrot = 5,
		/obj/item/tailclub = 5, //want to buy makeshift wooden club sprite
		/obj/item/knife = 3,
		/obj/item/assembly/flash/handheld = 1,
		/obj/item/grenade/smokebomb = 1,
	)

/obj/effect/spawner/random/contraband/permabrig_gear
	name = "permabrig gear spawner"
	icon_state = "handcuffs"
	loot = list(
		/obj/item/toy/crayon/spraycan,
		/obj/item/crowbar,
		/obj/item/flashlight/seclite,
		/obj/item/restraints/handcuffs/cable/zipties,
		/obj/item/restraints/handcuffs,
		/obj/item/paper/fluff/jobs/prisoner/letter,
		/obj/item/storage/wallet/random,
		/obj/item/pda,
		/obj/item/radio/off,
	)

/obj/effect/spawner/random/contraband/prison
	name = "prison loot spawner"
	icon_state = "prisoner_shoes"
	loot = list(
		/obj/effect/spawner/random/entertainment/cigarette = 20,
		/obj/effect/spawner/random/contraband/narcotics = 10,
		/obj/effect/spawner/random/contraband/permabrig_weapon = 10,
		/obj/effect/spawner/random/contraband/permabrig_gear = 10,
		/obj/effect/spawner/random/entertainment/cigarette_pack = 5,
		/obj/effect/spawner/random/entertainment/lighter = 5,
		/obj/effect/spawner/random/food_or_drink/booze = 5,
	)


code:
/obj/effect/spawner/random/decoration
	name = "decoration loot spawner"
	desc = "Time for some bling bling."
	icon_state = "lamp"

/obj/effect/spawner/random/decoration/material
	name = "decoration material spawner"
	icon_state = "tile"
	loot = list(
		/obj/item/stack/sheet/sandblock{amount = 30} = 25,
		/obj/item/stack/sheet/mineral/wood{amount = 30} = 25,
		/obj/item/stack/sheet/bronze/thirty = 20,
		/obj/item/stack/tile/noslip{amount = 20} = 10,
		/obj/item/stack/sheet/plastic{amount = 30} = 10,
		/obj/item/stack/tile/pod{amount = 20} = 4,
		/obj/item/stack/tile/pod/light{amount = 20} = 3,
		/obj/item/stack/tile/pod/dark{amount = 20} = 3,
	)

/obj/effect/spawner/random/decoration/carpet
	name = "carpet spawner"
	icon_state = "carpet"
	loot = list(
		/obj/item/stack/tile/carpet{amount = 30} = 35,
		/obj/item/stack/tile/carpet/black{amount = 30} = 20,
		/obj/item/stack/tile/carpet/donk/thirty = 15,
		/obj/item/stack/tile/carpet/stellar/thirty = 15,
		/obj/item/stack/tile/carpet/executive/thirty = 15,
	)

/obj/effect/spawner/random/decoration/ornament
	name = "ornament spawner"
	icon_state = "lamp"
	loot = list(
		/obj/item/sign = 10,
		/obj/item/flashlight/lamp/green = 10,
		/obj/item/plaque = 5,
		/obj/item/flashlight/lantern/jade = 5,
		/obj/item/phone = 5,
		/obj/item/flashlight/lamp/bananalamp = 3,
	)

/obj/effect/spawner/random/decoration/generic
	name = "generic decoration spawner"
	icon_state = "sandstone"
	loot = list(
		/obj/effect/spawner/random/decoration/ornament = 35,
		/obj/effect/spawner/random/decoration/carpet = 25,
		/obj/effect/spawner/random/decoration/material = 25,
	)

/obj/effect/spawner/random/decoration/statue
	name = "statue spawner"
	icon_state = "statue"
	loot = list(
		/obj/structure/statue/bronze/marx = 50,
		/obj/item/statuebust = 50,
		/obj/item/statuebust/hippocratic = 50,
		/obj/structure/statue/sandstone/assistant = 50,
		/obj/structure/statue/sandstone/venus = 50,
		/obj/structure/statue/silver/md = 20,
		/obj/structure/statue/silver/janitor = 20,
		/obj/structure/statue/silver/sec = 20,
		/obj/structure/statue/silver/secborg = 20,
		/obj/structure/statue/silver/medborg = 20,
		/obj/structure/statue/plasma/scientist = 15,
		/obj/structure/statue/plasma/xeno = 15,
		/obj/structure/statue/gold/hos = 5,
		/obj/structure/statue/gold/hop = 5,
		/obj/structure/statue/gold/cmo = 5,
		/obj/structure/statue/gold/ce = 5,
		/obj/structure/statue/gold/rd = 5,
		/obj/structure/statue/bananium/clown = 1,
		/obj/structure/statue/elder_atmosian = 1,
		/obj/structure/statue/uranium/nuke = 1,
		/obj/structure/statue/uranium/eng = 1,
		/obj/structure/statue/diamond/captain = 1,
		/obj/structure/statue/diamond/ai1 = 1,
		/obj/structure/statue/diamond/ai2 = 1,
	)

/obj/effect/spawner/random/decoration/showcase
	name = "showcase spawner"
	icon_state = "showcase"
	loot_type_path = /obj/structure/showcase
	loot = list()

/obj/effect/spawner/random/decoration/glowstick
	name = "random colored glowstick"
	icon_state = "glowstick"
	loot = list(
		/obj/item/flashlight/glowstick,
		/obj/item/flashlight/glowstick/red,
		/obj/item/flashlight/glowstick/blue,
		/obj/item/flashlight/glowstick/cyan,
		/obj/item/flashlight/glowstick/orange,
		/obj/item/flashlight/glowstick/yellow,
		/obj/item/flashlight/glowstick/pink,
	)

/obj/effect/spawner/random/decoration/paint
	name = "paint spawner"
	icon_state = "paint"
	loot_subtype_path = /obj/item/paint
	loot = list()


code:
/obj/effect/spawner/random/engineering
	name = "engineering loot spawner"
	desc = "All engineering related spawners go here"
	icon_state = "toolbox"

/obj/effect/spawner/random/engineering/tool
	name = "Tool spawner"
	icon_state = "wrench"
	loot = list(
		/obj/item/wrench = 2,
		/obj/item/wirecutters = 2,
		/obj/item/screwdriver = 2,
		/obj/item/crowbar = 2,
		/obj/item/weldingtool = 2,
		/obj/item/stack/cable_coil = 2,
		/obj/item/analyzer = 2,
		/obj/item/t_scanner = 2,
		/obj/item/multitool = 1,
		/obj/item/clothing/glasses/meson = 1,
		/obj/item/storage/belt/utility = 1,
		/obj/item/clothing/head/welding = 1,
	)

/obj/effect/spawner/random/engineering/tool_advanced
	name = "Advanced tool spawner"
	icon_state = "wrench"
	loot = list( // Mail loot spawner. Some sort of random and rare building tool. No alien tech here.
		/obj/item/wrench/caravan,
		/obj/item/wirecutters/caravan,
		/obj/item/screwdriver/caravan,
		/obj/item/crowbar/red/caravan,
		/obj/item/weldingtool/largetank,
	)

/obj/effect/spawner/random/engineering/tool_alien
	name = "Rare tool spawner"
	icon_state = "wrench"
	loot = list(
		/obj/item/wrench/abductor,
		/obj/item/wirecutters/abductor,
		/obj/item/screwdriver/abductor,
		/obj/item/crowbar/abductor,
		/obj/item/weldingtool/abductor,
		/obj/item/multitool/abductor,
	)

/obj/effect/spawner/random/engineering/material_cheap
	name = "Cheap material spawner"
	icon_state = "cardboard"
	loot = list(
		/obj/item/stack/sheet/mineral/wood{amount = 30},
		/obj/item/stack/sheet/cardboard{amount = 30},
		/obj/item/stack/sheet/mineral/sandstone/thirty,
	)

/obj/effect/spawner/random/engineering/material
	name = "Material spawner"
	icon_state = "metal"
	loot = list(
		/obj/item/stack/sheet/iron/fifty = 5,
		/obj/item/stack/sheet/glass/fifty = 5,
		/obj/item/stack/rods/fifty = 3,
		/obj/item/stack/sheet/rglass{amount = 30} = 2,
	)

/obj/effect/spawner/random/engineering/material_rare
	name = "Rare material spawner"
	icon_state = "diamond"
	spawn_loot_count = 3
	loot = list( // Space loot spawner. Random selecton of a few rarer materials.
		/obj/item/stack/sheet/runed_metal/ten = 20,
		/obj/item/stack/sheet/mineral/diamond{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/uranium{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/plasma{amount = 15} = 15,
		/obj/item/stack/sheet/mineral/gold{amount = 15} = 15,
		/obj/item/stack/sheet/plastic/fifty = 5,
		/obj/item/stack/sheet/runed_metal/fifty = 5,
	)

/obj/effect/spawner/random/engineering/toolbox
	name = "toolbox spawner"
	icon_state = "toolbox"
	loot = list(
		/obj/item/storage/toolbox/emergency = 4,
		/obj/item/storage/toolbox/electrical = 2,
		/obj/item/storage/toolbox/mechanical = 2,
	)

/obj/effect/spawner/random/engineering/flashlight
	name = "flashlight spawner"
	icon_state = "flashlight"
	loot = list(
		/obj/item/flashlight = 20,
		/obj/item/flashlight/flare = 10,
		/obj/effect/spawner/random/decoration/glowstick = 10,
		/obj/item/flashlight/lantern = 5,
		/obj/item/flashlight/seclite = 4,
		/obj/item/flashlight/lantern/jade = 1,
	)

/obj/effect/spawner/random/engineering/canister
	name = "air canister spawner"
	icon_state = "canister"
	loot = list( // use this for emergency storage areas and maint
		/obj/machinery/portable_atmospherics/canister/air = 4,
		/obj/machinery/portable_atmospherics/canister/oxygen = 1,
	)

/obj/effect/spawner/random/engineering/tank
	name = "tank spawner"
	icon_state = "tank"
	loot = list( // use this for emergency storage areas and maint
		/obj/structure/reagent_dispensers/fueltank = 5,
		/obj/structure/reagent_dispensers/watertank = 4,
		/obj/structure/reagent_dispensers/watertank/high = 1,
	)

/obj/effect/spawner/random/engineering/vending_restock
	name = "vending restock spawner"
	icon_state = "vending_restock"
	loot_subtype_path = /obj/item/vending_refill
	loot = list()

/obj/effect/spawner/random/engineering/atmospherics_portable
	name = "portable atmospherics machine spawner"
	icon_state = "heater"
	loot = list(
		/obj/machinery/space_heater = 8,
		/obj/machinery/portable_atmospherics/pump = 1,
		/obj/machinery/portable_atmospherics/scrubber = 1,
	)

/obj/effect/spawner/random/engineering/tracking_beacon
	name = "tracking beacon spawner"
	icon_state = "beacon"
	spawn_loot_chance = 50
	loot = list(/obj/item/beacon)


code:
/obj/effect/spawner/random/entertainment
	name = "entertainment loot spawner"
	desc = "It's time to paaaaaarty!"

/obj/effect/spawner/random/entertainment/arcade
	name = "spawn random arcade machine"
	desc = "Automagically transforms into a random arcade machine. If you see this while in a shift, please create a bug report."
	icon_state = "arcade"
	loot = list(
		/obj/machinery/computer/arcade/orion_trail = 49,
		/obj/machinery/computer/arcade/battle = 49,
		/obj/machinery/computer/arcade/amputation = 2,
	)

/obj/effect/spawner/random/entertainment/musical_instrument
	name = "musical instrument spawner"
	icon_state = "eguitar"
	loot = list(
		/obj/item/instrument/violin = 5,
		/obj/item/instrument/banjo = 5,
		/obj/item/instrument/guitar = 5,
		/obj/item/instrument/eguitar = 5,
		/obj/item/instrument/glockenspiel = 5,
		/obj/item/instrument/accordion = 5,
		/obj/item/instrument/trumpet = 5,
		/obj/item/instrument/saxophone = 5,
		/obj/item/instrument/trombone = 5,
		/obj/item/instrument/recorder = 5,
		/obj/item/instrument/harmonica = 5,
		/obj/item/instrument/bikehorn = 2,
		/obj/item/instrument/violin/golden = 2,
		/obj/item/instrument/musicalmoth = 1,
	)

/obj/effect/spawner/random/entertainment/gambling
	name = "gambling valuables spawner"
	icon_state = "dice"
	loot = list(
		/obj/item/gun/ballistic/revolver/russian = 5,
		/obj/item/clothing/head/ushanka = 3,
		/obj/effect/spawner/random/entertainment/coin = 3,
		/obj/effect/spawner/random/entertainment/money = 3,
		/obj/item/dice/d6 = 3,
		/obj/item/storage/box/syndie_kit/throwing_weapons = 1,
		/obj/item/reagent_containers/food/drinks/bottle/vodka/badminka = 1,
	)

/obj/effect/spawner/random/entertainment/coin
	name = "coin spawner"
	icon_state = "coin"
	loot = list(
		/obj/item/coin/iron = 5,
		/obj/item/coin/plastic = 5,
		/obj/item/coin/silver = 3,
		/obj/item/coin/plasma = 3,
		/obj/item/coin/uranium = 3,
		/obj/item/coin/titanium = 3,
		/obj/item/coin/diamond = 2,
		/obj/item/coin/bananium = 2,
		/obj/item/coin/adamantine = 2,
		/obj/item/coin/mythril = 2,
		/obj/item/coin/runite = 2,
		/obj/item/coin/twoheaded = 1,
		/obj/item/coin/antagtoken = 1,
	)

/obj/effect/spawner/random/entertainment/money_small
	name = "small money spawner"
	icon_state = "cash"
	spawn_loot_count = 3
	spawn_loot_split = TRUE
	loot = list(
		/obj/item/stack/spacecash/c1 = 5,
		/obj/item/stack/spacecash/c10 = 3,
		/obj/item/stack/spacecash/c20 = 2,
	)

/obj/effect/spawner/random/entertainment/money
	name = "money spawner"
	icon_state = "cash"
	spawn_loot_count = 3
	spawn_loot_split = TRUE
	loot = list(
		/obj/item/stack/spacecash/c1 = 10,
		/obj/item/stack/spacecash/c10 = 5,
		/obj/item/stack/spacecash/c20 = 3,
		/obj/item/stack/spacecash/c50 = 2,
		/obj/item/stack/spacecash/c100 = 1,
	)

/obj/effect/spawner/random/entertainment/money_large
	name = "large money spawner"
	icon_state = "cash"
	spawn_loot_count = 5
	spawn_loot_split = TRUE
	loot = list(
		/obj/item/stack/spacecash/c1 = 100,
		/obj/item/stack/spacecash/c10 = 80,
		/obj/item/stack/spacecash/c20 = 60,
		/obj/item/stack/spacecash/c50 = 40,
		/obj/item/stack/spacecash/c100 = 30,
		/obj/item/stack/spacecash/c200 = 20,
		/obj/item/stack/spacecash/c500 = 10,
		/obj/item/stack/spacecash/c1000 = 5,
		/obj/item/stack/spacecash/c10000 = 1,
	)

/obj/effect/spawner/random/entertainment/drugs
	name = "recreational drugs spawner"
	icon_state = "pill"
	loot = list(
		/obj/item/reagent_containers/food/drinks/bottle/hooch = 50,
		/obj/item/clothing/mask/cigarette/rollie/cannabis = 15,
		/obj/item/reagent_containers/syringe = 15,
		/obj/item/cigbutt/roach = 15,
		/obj/item/clothing/mask/cigarette/rollie/mindbreaker = 5,
	)

/obj/effect/spawner/random/entertainment/dice
	name = "dice spawner"
	icon_state = "dice_bag"
	loot = list(
		/obj/item/dice/d4,
		/obj/item/dice/d6,
		/obj/item/dice/d8,
		/obj/item/dice/d10,
		/obj/item/dice/d12,
		/obj/item/dice/d20,
	)

/obj/effect/spawner/random/entertainment/cigarette_pack
	name = "cigarette pack spawner"
	icon_state = "cigarettes"
	loot = list(
		/obj/item/storage/fancy/cigarettes = 3,
		/obj/item/storage/fancy/cigarettes/dromedaryco = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_uplift = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_robust = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_carp = 3,
		/obj/item/storage/fancy/cigarettes/cigpack_robustgold = 1,
		/obj/item/storage/fancy/cigarettes/cigpack_midori = 1,
		/obj/item/storage/fancy/cigarettes/cigpack_candy = 1,
	)

/obj/effect/spawner/random/entertainment/cigarette
	name = "cigarette spawner"
	icon_state = "cigarettes"
	loot = list(
		/obj/item/clothing/mask/cigarette/space_cigarette = 3,
		/obj/item/clothing/mask/cigarette/rollie/cannabis = 3,
		/obj/item/clothing/mask/cigarette/rollie/nicotine = 3,
		/obj/item/clothing/mask/cigarette/dromedary = 2,
		/obj/item/clothing/mask/cigarette/uplift = 2,
		/obj/item/clothing/mask/cigarette/robust = 2,
		/obj/item/clothing/mask/cigarette/carp = 1,
		/obj/item/clothing/mask/cigarette/robustgold = 1,
	)

/obj/effect/spawner/random/entertainment/cigar
	name = "cigar spawner"
	icon_state = "cigarettes"
	loot = list(
		/obj/item/clothing/mask/cigarette/cigar = 3,
		/obj/item/clothing/mask/cigarette/cigar/havana = 2,
		/obj/item/clothing/mask/cigarette/cigar/cohiba = 1,
	)

/obj/effect/spawner/random/entertainment/wallet_lighter
	name = "lighter wallet spawner"
	icon_state = "lighter"
	loot = list( // these fit inside a wallet
		/obj/item/match = 10,
		/obj/item/lighter/greyscale = 10,
		/obj/item/lighter = 1,
	)

/obj/effect/spawner/random/entertainment/lighter
	name = "lighter spawner"
	icon_state = "lighter"
	loot = list(
		/obj/item/storage/box/matches = 10,
		/obj/item/lighter/greyscale = 10,
		/obj/item/lighter = 1,
	)

/obj/effect/spawner/random/entertainment/wallet_storage
	name = "wallet contents spawner"
	icon_state = "wallet"
	spawn_loot_count = 1
	loot = list(	// random photos would go here. IF I HAD ONE. :'(
		/obj/item/lipstick/random,
		/obj/item/reagent_containers/pill/maintenance,
		/obj/effect/spawner/random/food_or_drink/seed,
		/obj/effect/spawner/random/medical/minor_healing,
		/obj/effect/spawner/random/medical/injector,
		/obj/effect/spawner/random/entertainment/coin,
		/obj/effect/spawner/random/entertainment/dice,
		/obj/effect/spawner/random/entertainment/cigarette,
		/obj/effect/spawner/random/entertainment/wallet_lighter,
		/obj/effect/spawner/random/bureaucracy/paper,
		/obj/effect/spawner/random/bureaucracy/crayon,
		/obj/effect/spawner/random/bureaucracy/pen,
		/obj/effect/spawner/random/bureaucracy/stamp,
		/obj/effect/spawner/random/techstorage/data_disk,
	)

/obj/effect/spawner/random/entertainment/deck
	name = "deck spawner"
	icon_state = "deck"
	loot = list(
		/obj/item/toy/cards/deck = 10,
		/obj/item/toy/cards/deck/kotahi = 3,
		/obj/item/toy/cards/deck/wizoff = 3,
		/obj/item/toy/cards/deck/tarot = 2,
		/obj/item/toy/cards/deck/cas = 1,
		/obj/item/toy/cards/deck/cas/black = 1,
	)

/obj/effect/spawner/random/entertainment/toy_figure
	name = "toy figure spawner"
	icon_state = "toy"
	loot_subtype_path = /obj/item/toy/figure
	loot = list()

/obj/effect/spawner/random/entertainment/toy
	name = "toy spawner"
	icon_state = "toy"
	loot = list()

/obj/effect/spawner/random/entertainment/toy/Initialize(mapload)
	loot += GLOB.arcade_prize_pool
	. = ..()
	return INITIALIZE_HINT_QDEL


code:
/obj/effect/spawner/random/exotic
	name = "exotic spawner"
	desc = "Super duper rare stuff."

/obj/effect/spawner/random/exotic/technology
	name = "technology spawner"
	icon_state = "disk"
	spawn_loot_count = 2
	loot = list( // Space loot spawner. Couple of random bits of technology-adjacent stuff including anomaly cores and BEPIS techs.
		/obj/item/raw_anomaly_core/random,
		/obj/item/disk/tech_disk/spaceloot,
		/obj/item/camera_bug,
	)

/obj/effect/spawner/random/exotic/languagebook
	name = "language book spawner"
	icon_state = "book"
	loot = list( // A single roundstart species language book.
		/obj/item/language_manual/roundstart_species = 100,
		/obj/item/language_manual/roundstart_species/five = 3,
		/obj/item/language_manual/roundstart_species/unlimited = 1,
	)

/obj/effect/spawner/random/exotic/tool
	name = "exotic tool spawner"
	icon_state = "wrench"
	loot = list( // Some sort of random and rare tool.
		/obj/effect/spawner/random/engineering/tool_alien,
		/obj/effect/spawner/random/medical/surgery_tool_alien,
		/obj/effect/spawner/random/engineering/tool_advanced,
	)

/obj/effect/spawner/random/exotic/syndie
	name = "syndie cosmetic spawner"
	icon_state = "syndicate"
	spawn_loot_count = 2
	loot = list( // A selection of cosmetic syndicate items. Just a couple. No hardsuits or weapons.
		/obj/effect/spawner/random/clothing/syndie = 8,
		/obj/item/storage/fancy/cigarettes/cigpack_syndicate = 1,
		/obj/effect/spawner/random/entertainment/cigarette_pack = 1,
	)

/obj/effect/spawner/random/exotic/antag_gear_weak
	name = "antag gear weak"
	icon_state = "syndi_toolbox"
	loot = list(
		/obj/item/storage/firstaid/regular = 45,
		/obj/item/storage/firstaid/toxin = 35,
		/obj/item/storage/firstaid/brute = 27,
		/obj/item/storage/firstaid/fire = 27,
		/obj/item/grenade/clusterbuster/smoke = 15,
		/obj/item/clothing/under/chameleon = 13,
		/obj/item/storage/toolbox/syndicate = 12,
		/obj/item/melee/baton/telescopic = 12,
		/obj/item/melee/baton = 11,
		/obj/item/book/granter/spell/smoke = 10,
		/obj/item/book/granter/spell/blind = 10,
		/obj/item/clothing/shoes/chameleon/noslip = 10,
		/obj/item/grenade/c4 = 7,
		/obj/item/borg/upgrade/ddrill = 3,
		/obj/item/borg/upgrade/soh = 3,
	)

/obj/effect/spawner/random/exotic/antag_gear
	name = "antag gear"
	icon_state = "esword"
	loot = list(
		/obj/item/storage/firstaid/tactical = 35,
		/obj/item/book/granter/spell/summonitem = 20,
		/obj/item/book/granter/spell/forcewall = 17,
		/obj/item/pneumatic_cannon = 15,
		/obj/item/book/granter/spell/knock = 15,
		/obj/item/storage/backpack/holding = 12,
		/obj/item/shield/riot/tele = 12,
		/obj/item/stack/sheet/mineral/diamond{amount = 15} = 10,
		/obj/item/stack/sheet/mineral/uranium{amount = 15} = 10,
		/obj/item/stack/sheet/mineral/plasma{amount = 15} = 10,
		/obj/item/stack/sheet/mineral/gold{amount = 15} = 10,
		/obj/item/grenade/spawnergrenade/spesscarp = 7,
		/obj/item/melee/energy/sword = 7,
		/obj/item/borg/upgrade/disablercooler = 7,
		/obj/item/dnainjector/lasereyesmut = 7,
		/obj/item/shield/energy = 6,
		/obj/item/pickaxe/drill/diamonddrill = 6,
		/obj/item/grenade/spawnergrenade/manhacks = 6,
		/obj/item/defibrillator/compact = 6,
		/obj/item/book/granter/spell/barnyard = 4,
		/obj/item/grenade/clusterbuster/inferno = 3,
		/obj/item/gun/magic/wand/fireball/inert = 3,
	)

/obj/effect/spawner/random/exotic/antag_gear_strong
	name = "antag gear strong"
	icon_state = "esword_dual"
	loot = list(
		/obj/item/pickaxe/drill/jackhammer = 30,
		/obj/item/singularityhammer = 25,
		/obj/item/fireaxe = 25,
		/obj/item/organ/brain/alien = 17,
		/obj/item/borg/upgrade/selfrepair = 17,
		/obj/item/gun/ballistic/automatic/c20r/unrestricted = 16,
		/obj/item/dualsaber = 15,
		/obj/item/gun/magic/wand/resurrection/inert = 15,
		/obj/item/grenade/clusterbuster/spawner_manhacks = 15,
		/obj/item/borg/upgrade/syndicate = 13,
		/obj/item/book/granter/spell/charge = 12,
		/obj/item/book/granter/spell/fireball = 10,
		/obj/item/gun/magic/wand/resurrection = 10,
		/obj/item/mjollnir = 10,
		/obj/item/organ/heart/demon = 7,
		/obj/item/uplink/old = 2,
	)

/obj/effect/spawner/random/exotic/snow_gear
	name = "snow gear"
	icon_state = "snowman"
	loot = list(
		/obj/item/toy/snowball = 6,
		/obj/item/stack/sheet/mineral/snow{amount = 25} = 2,
		/obj/item/shovel = 2,
	)

/obj/effect/spawner/random/exotic/ripley
	name = "ripley spawner"
	icon_state = "ripley"
	loot = list(
		/obj/structure/mecha_wreckage/ripley = 3,
		/obj/vehicle/sealed/mecha/working/ripley/mining = 1,
	)


code:
/obj/effect/spawner/random/food_or_drink
	name = "food or drink loot spawner"
	desc = "Nom nom nom"

/obj/effect/spawner/random/food_or_drink/donkpockets
	name = "donk pocket box spawner"
	icon_state = "donkpocket"
	loot = list(
		/obj/item/storage/box/donkpockets/donkpocketspicy,
		/obj/item/storage/box/donkpockets/donkpocketteriyaki,
		/obj/item/storage/box/donkpockets/donkpocketpizza,
		/obj/item/storage/box/donkpockets/donkpocketberry,
		/obj/item/storage/box/donkpockets/donkpockethonk,
	)

/obj/effect/spawner/random/food_or_drink/seed
	name = "seed spawner"
	icon_state = "seed"
	loot = list( // The same seeds in the Supply "Seeds Crate"
		/obj/item/seeds/chili,
		/obj/item/seeds/cotton,
		/obj/item/seeds/berry,
		/obj/item/seeds/corn,
		/obj/item/seeds/eggplant,
		/obj/item/seeds/tomato,
		/obj/item/seeds/soya,
		/obj/item/seeds/wheat,
		/obj/item/seeds/wheat/rice,
		/obj/item/seeds/carrot,
		/obj/item/seeds/sunflower,
		/obj/item/seeds/rose,
		/obj/item/seeds/chanter,
		/obj/item/seeds/potato,
		/obj/item/seeds/sugarcane,
	)

/obj/effect/spawner/random/food_or_drink/seed_rare
	spawn_loot_count = 5
	icon_state = "seed"
	loot = list( // /obj/item/seeds/random is not a random seed, but an exotic seed.
		/obj/item/seeds/random = 30,
		/obj/item/seeds/liberty = 5,
		/obj/item/seeds/replicapod = 5,
		/obj/item/seeds/reishi = 5,
		/obj/item/seeds/nettle/death = 1,
		/obj/item/seeds/plump/walkingmushroom = 1,
		/obj/item/seeds/cannabis/rainbow = 1,
		/obj/item/seeds/cannabis/death = 1,
		/obj/item/seeds/cannabis/white = 1,
		/obj/item/seeds/cannabis/ultimate = 1,
		/obj/item/seeds/kudzu = 1,
		/obj/item/seeds/angel = 1,
		/obj/item/seeds/glowshroom/glowcap = 1,
		/obj/item/seeds/glowshroom/shadowshroom = 1,
	)

/obj/effect/spawner/random/food_or_drink/soup
	name = "soup spawner"
	icon_state = "soup"
	loot = list(
		/obj/item/food/soup/beet,
		/obj/item/food/soup/sweetpotato,
		/obj/item/food/soup/stew,
		/obj/item/food/soup/hotchili,
		/obj/item/food/soup/nettle,
		/obj/item/food/soup/meatball,
	)

/obj/effect/spawner/random/food_or_drink/salad
	name = "salad spawner"
	icon_state = "soup"
	loot = list(
		/obj/item/food/salad/herbsalad,
		/obj/item/food/salad/validsalad,
		/obj/item/food/salad/fruit,
		/obj/item/food/salad/jungle,
		/obj/item/food/salad/aesirsalad,
	)

/obj/effect/spawner/random/food_or_drink/dinner
	name = "dinner spawner"
	icon_state = "soup"
	loot = list(
		/obj/item/food/bearsteak,
		/obj/item/food/enchiladas,
		/obj/item/food/stewedsoymeat,
		/obj/item/food/burger/bigbite,
		/obj/item/food/burger/superbite,
		/obj/item/food/burger/fivealarm,
	)

/obj/effect/spawner/random/food_or_drink/three_course_meal
	name = "three course meal spawner"
	icon_state = "soup"
	spawn_all_loot = TRUE
	loot = list(
		/obj/effect/spawner/random/food_or_drink/soup,
		/obj/effect/spawner/random/food_or_drink/salad,
		/obj/effect/spawner/random/food_or_drink/dinner,
	)

/obj/effect/spawner/random/food_or_drink/refreshing_beverage
	name = "good soda spawner"
	icon_state = "can"
	loot = list(
		/obj/item/reagent_containers/food/drinks/drinkingglass/filled/nuka_cola = 3,
		/obj/item/reagent_containers/food/drinks/soda_cans/grey_bull = 3,
		/obj/item/reagent_containers/food/drinks/soda_cans/monkey_energy = 2,
		/obj/item/reagent_containers/food/drinks/soda_cans/thirteenloko = 2,
		/obj/item/reagent_containers/food/drinks/bottle/beer/light = 2,
		/obj/item/reagent_containers/food/drinks/soda_cans/shamblers = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/pwr_game = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/dr_gibb = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/space_mountain_wind = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/starkist = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/space_up = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/sol_dry = 1,
		/obj/item/reagent_containers/food/drinks/soda_cans/cola = 1,
	)

/obj/effect/spawner/random/food_or_drink/booze
	name = "booze spawner"
	icon_state = "beer"
	loot = list(
		/obj/item/reagent_containers/food/drinks/bottle/beer = 75,
		/obj/item/reagent_containers/food/drinks/bottle/ale = 25,
		/obj/item/reagent_containers/food/drinks/bottle/beer/light = 5,
		/obj/item/reagent_containers/food/drinks/bottle/maltliquor = 5,
		/obj/item/reagent_containers/food/drinks/bottle/whiskey = 5,
		/obj/item/reagent_containers/food/drinks/bottle/gin = 5,
		/obj/item/reagent_containers/food/drinks/bottle/vodka = 5,
		/obj/item/reagent_containers/food/drinks/bottle/tequila = 5,
		/obj/item/reagent_containers/food/drinks/bottle/rum = 5,
		/obj/item/reagent_containers/food/drinks/bottle/vermouth = 5,
		/obj/item/reagent_containers/food/drinks/bottle/cognac = 5,
		/obj/item/reagent_containers/food/drinks/bottle/wine = 5,
		/obj/item/reagent_containers/food/drinks/bottle/kahlua = 5,
		/obj/item/reagent_containers/food/drinks/bottle/amaretto = 5,
		/obj/item/reagent_containers/food/drinks/bottle/hcider = 5,
		/obj/item/reagent_containers/food/drinks/bottle/absinthe = 5,
		/obj/item/reagent_containers/food/drinks/bottle/sake = 5,
		/obj/item/reagent_containers/food/drinks/bottle/grappa = 5,
		/obj/item/reagent_containers/food/drinks/bottle/applejack = 5,
		/obj/item/reagent_containers/glass/bottle/ethanol = 2,
		/obj/item/reagent_containers/food/drinks/bottle/fernet = 2,
		/obj/item/reagent_containers/food/drinks/bottle/champagne = 2,
		/obj/item/reagent_containers/food/drinks/bottle/absinthe/premium = 2,
		/obj/item/reagent_containers/food/drinks/bottle/goldschlager = 2,
		/obj/item/reagent_containers/food/drinks/bottle/patron = 1,
		/obj/item/reagent_containers/food/drinks/bottle/kong = 1,
		/obj/item/reagent_containers/food/drinks/bottle/lizardwine = 1,
		/obj/item/reagent_containers/food/drinks/bottle/vodka/badminka = 1,
		/obj/item/reagent_containers/food/drinks/bottle/trappist = 1,
	)

/obj/effect/spawner/random/food_or_drink/pizzaparty
	name = "pizza bomb spawner"
	icon_state = "pizzabox"
	loot = list(
		/obj/item/pizzabox/margherita = 2,
		/obj/item/pizzabox/meat = 2,
		/obj/item/pizzabox/mushroom = 2,
		/obj/item/pizzabox/pineapple = 2,
		/obj/item/pizzabox/vegetable = 2,
		/obj/item/pizzabox/bomb/armed = 1,

	)

/obj/effect/spawner/random/food_or_drink/seed_vault
	name = "seed vault seeds"
	icon_state = "seed"
	loot = list(
		/obj/item/seeds/gatfruit = 10,
		/obj/item/seeds/cherry/bomb = 10,
		/obj/item/seeds/berry/glow = 10,
		/obj/item/seeds/sunflower/moonflower = 8,
	)

/obj/effect/spawner/random/food_or_drink/snack
	name = "snack spawner"
	icon_state = "chips"
	loot = list(
		/obj/item/food/spacetwinkie = 5,
		/obj/item/food/cheesiehonkers = 5,
		/obj/item/food/candy = 5,
		/obj/item/food/chips = 5,
	  /obj/item/food/sosjerky = 5,
		/obj/item/food/no_raisin = 5,
		/obj/item/food/peanuts = 5,
		/obj/item/food/cnds = 5,
		/obj/item/food/energybar = 5,
		/obj/item/reagent_containers/food/drinks/dry_ramen = 5,
		/obj/item/food/peanuts/random = 3,
		/obj/item/food/cnds/random = 3,
		/obj/item/storage/box/gum = 3,
		/obj/item/food/syndicake = 1,
		/obj/item/food/peanuts/ban_appeal = 1,
		/obj/item/food/candy/bronx = 1
	)

/obj/effect/spawner/random/food_or_drink/condiment
	name = "condiment spawner"
	icon_state = "condiment"
	loot = list(
		/obj/item/reagent_containers/food/condiment/saltshaker = 3,
		/obj/item/reagent_containers/food/condiment/peppermill = 3,
		/obj/item/reagent_containers/food/condiment/pack/ketchup = 3,
		/obj/item/reagent_containers/food/condiment/pack/hotsauce = 3,
		/obj/item/reagent_containers/food/condiment/pack/astrotame = 3,
		/obj/item/reagent_containers/food/condiment/pack/bbqsauce = 3,
		/obj/item/reagent_containers/food/condiment/bbqsauce = 1,
		/obj/item/reagent_containers/food/condiment/soysauce = 1,
		/obj/item/reagent_containers/food/condiment/vinegar = 1,
		/obj/item/reagent_containers/food/condiment/quality_oil = 1,
	)

/obj/effect/spawner/random/food_or_drink/cups
	name = "cup spawner"
	icon_state = "box_small"
	loot = list(
		/obj/item/storage/box/drinkingglasses,
		/obj/item/storage/box/cups,
		/obj/item/storage/box/condimentbottles,
	)


code:
/obj/effect/spawner/random/maintenance
	name = "maintenance loot spawner"
	desc = "Come on Lady Luck, spawn me a pair of sunglasses."
	icon_state = "loot"
	spawn_on_init = FALSE
	// see code/_globalvars/lists/maintenance_loot.dm for loot table

/obj/effect/spawner/random/maintenance/examine(mob/user)
	. = ..()
	. += span_info("This spawner has an effective loot count of [get_effective_lootcount()].")

/obj/effect/spawner/random/maintenance/Initialize(mapload)
	loot = GLOB.maintenance_loot

	. = ..()

	GLOB.maintenance_loot_spawners += src

/obj/effect/spawner/random/maintenance/should_spawn_on_init()
	. = ..()

	if(.)
		return

	// Late loaded templates like shuttles can have maintenance loot.
	// Once the game state progresses to roundstart, new maint loot spawners should just instantly pop.
	return (SSticker.current_state >= GAME_STATE_SETTING_UP)

/obj/effect/spawner/random/maintenance/Destroy()
	GLOB.maintenance_loot_spawners -= src
	return ..()

/obj/effect/spawner/random/maintenance/proc/hide()
	invisibility = INVISIBILITY_OBSERVER
	alpha = 100

/obj/effect/spawner/random/maintenance/proc/get_effective_lootcount()
	var/effective_lootcount = spawn_loot_count

	if(HAS_TRAIT(SSstation, STATION_TRAIT_FILLED_MAINT))
		effective_lootcount = FLOOR(spawn_loot_count * 1.5, 1)

	else if(HAS_TRAIT(SSstation, STATION_TRAIT_EMPTY_MAINT))
		effective_lootcount = FLOOR(spawn_loot_count * 0.5, 1)

	return effective_lootcount

/obj/effect/spawner/random/maintenance/spawn_loot(lootcount_override)
	if(isnull(lootcount_override))
		lootcount_override = get_effective_lootcount()
	. = ..()

	// In addition, closets that are closed will have the maintenance loot inserted inside.
	for(var/obj/structure/closet/closet in get_turf(src))
		if(!closet.opened)
			closet.take_contents()

/obj/effect/spawner/random/maintenance/two
	name = "2 x maintenance loot spawner"
	spawn_loot_count = 2

/obj/effect/spawner/random/maintenance/three
	name = "3 x maintenance loot spawner"
	spawn_loot_count = 3

/obj/effect/spawner/random/maintenance/four
	name = "4 x maintenance loot spawner"
	spawn_loot_count = 4

/obj/effect/spawner/random/maintenance/five
	name = "5 x maintenance loot spawner"
	spawn_loot_count = 5

/obj/effect/spawner/random/maintenance/six
	name = "6 x maintenance loot spawner"
	spawn_loot_count = 6

/obj/effect/spawner/random/maintenance/seven
	name = "7 x maintenance loot spawner"
	spawn_loot_count = 7

/obj/effect/spawner/random/maintenance/eight
	name = "8 x maintenance loot spawner"
	spawn_loot_count = 8


code:
/obj/effect/spawner/random/medical
	name = "medical loot spawner"
	desc = "Doc, gimmie something good."

/obj/effect/spawner/random/medical/minor_healing
	name = "minor healing spawner"
	icon_state = "gauze"
	loot = list(
		/obj/item/stack/medical/suture,
		/obj/item/stack/medical/mesh,
		/obj/item/stack/medical/gauze,
	)

/obj/effect/spawner/random/medical/injector
	name = "injector spawner"
	icon_state = "syringe"
	loot = list(
		/obj/item/implanter,
		/obj/item/reagent_containers/dropper,
		/obj/item/reagent_containers/syringe,
	)

/obj/effect/spawner/random/medical/organs
	name = "ayylien organ spawner"
	icon_state = "eyes"
	spawn_loot_count = 3
	loot = list(
		/obj/item/organ/heart/gland/egg = 7,
		/obj/item/organ/heart/gland/plasma = 7,
		/obj/item/organ/heart/gland/chem = 5,
		/obj/item/organ/heart/gland/mindshock = 5,
		/obj/item/organ/heart/gland/transform = 5,
		/obj/item/organ/heart/gland/spiderman = 5,
		/obj/item/organ/heart/gland/slime = 4,
		/obj/item/organ/heart/gland/trauma = 4,
		/obj/item/organ/heart/gland/electric = 3,
		/obj/item/organ/regenerative_core = 2,
		/obj/item/organ/heart/gland/ventcrawling = 1,
		/obj/item/organ/body_egg/alien_embryo = 1,
	)

/obj/effect/spawner/random/medical/memeorgans
	name = "meme organ spawner"
	icon_state = "eyes"
	spawn_loot_count = 5
	loot = list(
		/obj/item/organ/ears/penguin,
		/obj/item/organ/ears/cat,
		/obj/item/organ/eyes/moth,
		/obj/item/organ/eyes/snail,
		/obj/item/organ/tongue/bone,
		/obj/item/organ/tongue/fly,
		/obj/item/organ/tongue/snail,
		/obj/item/organ/tongue/lizard,
		/obj/item/organ/tongue/alien,
		/obj/item/organ/tongue/ethereal,
		/obj/item/organ/tongue/robot,
		/obj/item/organ/tongue/zombie,
		/obj/item/organ/appendix,
		/obj/item/organ/liver/fly,
		/obj/item/organ/lungs/plasmaman,
		/obj/item/organ/tail/cat,
		/obj/item/organ/tail/lizard,
	)

/obj/effect/spawner/random/medical/two_percent_xeno_egg_spawner
	name = "2% chance xeno egg spawner"
	icon_state = "xeno_egg"
	loot = list(
		/obj/effect/decal/remains/xeno = 49,
		/obj/effect/spawner/xeno_egg_delivery = 1,
	)

/obj/effect/spawner/random/medical/surgery_tool
	name = "Surgery tool spawner"
	icon_state = "scapel"
	loot = list(
		/obj/item/scalpel,
		/obj/item/hemostat,
		/obj/item/retractor,
		/obj/item/circular_saw,
		/obj/item/surgicaldrill,
		/obj/item/cautery,
		/obj/item/bonesetter,
	)

/obj/effect/spawner/random/medical/surgery_tool_advanced
	name = "Advanced surgery tool spawner"
	icon_state = "scapel"
	loot = list( // Mail loot spawner. Drop pool of advanced medical tools typically from research. Not endgame content.
		/obj/item/scalpel/advanced,
		/obj/item/retractor/advanced,
		/obj/item/cautery/advanced,
	)

/obj/effect/spawner/random/medical/surgery_tool_alien
	name = "Rare surgery tool spawner"
	icon_state = "scapel"
	loot = list( // Mail loot spawner. Some sort of random and rare surgical tool. Alien tech found here.
		/obj/item/scalpel/alien,
		/obj/item/hemostat/alien,
		/obj/item/retractor/alien,
		/obj/item/circular_saw/alien,
		/obj/item/surgicaldrill/alien,
		/obj/item/cautery/alien,
	)

/obj/effect/spawner/random/medical/firstaid_rare
	name = "rare firstaid kit spawner"
	icon_state = "firstaid"
	loot = list(
		/obj/item/storage/firstaid/emergency,
		/obj/item/storage/firstaid/medical,
		/obj/item/storage/firstaid/advanced,
	)

/obj/effect/spawner/random/medical/firstaid
	name = "firstaid kit spawner"
	icon_state = "firstaid"
	loot = list(
		/obj/item/storage/firstaid/regular = 10,
		/obj/item/storage/firstaid/o2 = 10,
		/obj/item/storage/firstaid/fire = 10,
		/obj/item/storage/firstaid/brute = 10,
		/obj/item/storage/firstaid/toxin = 10,
		/obj/effect/spawner/random/medical/firstaid_rare = 1,
	)

/obj/effect/spawner/random/medical/patient_stretcher
	name = "patient stretcher spawner"
	icon_state = "rollerbed"
	loot = list(
		/obj/structure/bed/roller,
		/obj/vehicle/ridden/wheelchair,
	)

/obj/effect/spawner/random/medical/supplies
	name = "medical supplies spawner"
	icon_state = "box_small"
	loot = list(
		/obj/item/storage/box/hug,
		/obj/item/storage/box/pillbottles,
		/obj/item/storage/box/bodybags,
		/obj/item/storage/box/rxglasses,
		/obj/item/storage/box/beakers,
		/obj/item/storage/box/gloves,
		/obj/item/storage/box/masks,
		/obj/item/storage/box/syringes,
	)