<commit_before>var/datum/virtual_reality_controller/vr_controller


/*
* VR Controller
*/

/datum/virtual_reality_controller
	var/area/crew_destination
	var/area/perseus_destination

	var/list/contained_clients = list() // List of clients who are inside the VR
	var/list/copies = list()
	var/list/goggles = list()

	var/can_enter = 1

	var/list/forbidden_types = list()

	New()
		..()

		// If for some reason it already exists, replace it with the new one.
		if(vr_controller)
			vr_controller = src

		crew_destination = locate(/area/virtual_reality/start_crew)
		perseus_destination = locate(/area/virtual_reality/start_perseus)

		LoadForbiddenTypes()

	Del()

		// Make sure we get rid of all the people in the VR.
		for(var/mob/living/L in copies)
			if(L.client)
				var/obj/item/clothing/glasses/virtual/V = GetGogglesFromClient(L.client)
				if(V)
					L << "\red <b>You were removed from the VR. (Reason: VR controller restarting.)</b>"
					V.LeaveVR()

		..()

	proc/UpdateClients()
		for(var/obj/item/clothing/glasses/virtual/V in goggles)
			if(!V.original_mob)
				continue
			for(var/mob/living/L in copies)
				if(V.original_mob.computer_id == L.computer_id)
					V.using_client = L.client

	proc/LoadForbiddenTypes(var/file = "config/forbidden_vr_types.txt")
		if(fexists(file))
			var/list/lines = file2list(file)
			for(var/line in lines)
				if(!line)	continue

				line = trim(line)
				if(!length(line))	continue
				else if(copytext(line, 1, 2) == "#")	continue

				if(!ispath(line))
					line = text2path(line)

				if(!line)
					continue

				forbidden_types += line

	proc/CreateMob(var/mob/living/carbon/human/H, var/glasses_type)
		var/area/destination

		if(glasses_type == 0)
			destination = crew_destination
		else if(glasses_type == 1)
			destination = perseus_destination

		var/has_headset = 0
		var/keyslot1
		var/keyslot2
		var/syndie = 0

		if(istype(H.ears, /obj/item/device/radio/headset))
			has_headset = 1
			var/obj/item/device/radio/headset/headset = H.ears
			if(headset.keyslot1) keyslot1 = headset.keyslot1.type
			if(headset.keyslot2) keyslot2 = headset.keyslot2.type
			syndie = headset.syndie
<commit_msg>Virtual Headsets will not appear outside of comms range.<commit_after>var/datum/virtual_reality_controller/vr_controller


/*
* VR Controller
*/

/datum/virtual_reality_controller
	var/area/crew_destination
	var/area/perseus_destination

	var/list/contained_clients = list() // List of clients who are inside the VR
	var/list/copies = list()
	var/list/goggles = list()

	var/can_enter = 1

	var/list/forbidden_types = list()

	New()
		..()

		// If for some reason it already exists, replace it with the new one.
		if(vr_controller)
			vr_controller = src

		crew_destination = locate(/area/virtual_reality/start_crew)
		perseus_destination = locate(/area/virtual_reality/start_perseus)

		LoadForbiddenTypes()

	Del()

		// Make sure we get rid of all the people in the VR.
		for(var/mob/living/L in copies)
			if(L.client)
				var/obj/item/clothing/glasses/virtual/V = GetGogglesFromClient(L.client)
				if(V)
					L << "\red <b>You were removed from the VR. (Reason: VR controller restarting.)</b>"
					V.LeaveVR()

		..()

	proc/UpdateClients()
		for(var/obj/item/clothing/glasses/virtual/V in goggles)
			if(!V.original_mob)
				continue
			for(var/mob/living/L in copies)
				if(V.original_mob.computer_id == L.computer_id)
					V.using_client = L.client

	proc/LoadForbiddenTypes(var/file = "config/forbidden_vr_types.txt")
		if(fexists(file))
			var/list/lines = file2list(file)
			for(var/line in lines)
				if(!line)	continue

				line = trim(line)
				if(!length(line))	continue
				else if(copytext(line, 1, 2) == "#")	continue

				if(!ispath(line))
					line = text2path(line)

				if(!line)
					continue

				forbidden_types += line

	proc/CreateMob(var/mob/living/carbon/human/H, var/glasses_type)
		var/area/destination

		if(glasses_type == 0)
			destination = crew_destination
		else if(glasses_type == 1)
			destination = perseus_destination

		var/has_headset = 0
		var/keyslot1
		var/keyslot2
		var/syndie = 0

		if(istype(H.ears, /obj/item/device/radio/headset))
			has_headset = 1
			var/obj/item/device/radio/headset/headset = H.ears
			if(headset.keyslot1) keyslot1 = headset.keyslot1.type
			if(headset.keyslot2) keyslot2 = headset.keyslot2.type
			syndie = headset.syndie
			//determining if comms is in range
			if(H.z != 1)
				has_headset = 0
				for(var/obj/machinery/telecomms/relay/T in machines)
					if(T.z != H.z) continue
					if(!T.toggled) continue
					if(T.stat & BROKEN) continue
					if(T.stat & NOPOWER) continue
					has_headset = 1

{'fraction_non_alphanumeric': 0.1209051724137931, 'fraction_numerical': 0.008405172413793103, 'mean_word_length': 3.411596958174905, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2355120', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1684, 'n_words': 334}