<commit_before>/mob/living/carbon/human/virtual_reality
	var/datum/mind/real_mind // where is my mind t. pixies
	var/obj/machinery/vr_sleeper/vr_sleeper
	var/datum/action/quit_vr/quit_action

/mob/living/carbon/human/virtual_reality/Initialize()
	. = ..()
	quit_action = new()
	quit_action.Grant(src)
	check_area()

/mob/living/carbon/human/virtual_reality/Moved()
	. = ..()
	check_area()

/mob/living/carbon/human/virtual_reality/death()
	revert_to_reality()
	. = ..()

/mob/living/carbon/human/virtual_reality/Destroy()
	revert_to_reality()
	return ..()

/mob/living/carbon/human/virtual_reality/Life()
	. = ..()
	if(real_mind)
		var/mob/living/real_me = real_mind.current
		if (real_me && real_me.stat == CONSCIOUS)
			return
		revert_to_reality(FALSE)

/mob/living/carbon/human/virtual_reality/ghostize()
	if(!real_mind && !vr_sleeper)
		return ..()
	stack_trace("Ghostize was called on a virtual reality mob")

/mob/living/carbon/human/virtual_reality/ghost()
	set category = "OOC"
	set name = "Ghost"
	set desc = "Relinquish your life and enter the land of the dead."
	revert_to_reality(FALSE)

/mob/living/carbon/human/virtual_reality/proc/check_area()
	var/area/check = get_area(src)
	if(!check || !istype(check, /area/awaymission/vr))
		return
	var/area/awaymission/vr/A = check
	if(A.death)
		to_chat(src, "<span class='userdanger'>It is unwise to attempt to break Virtual Reality.</span>")
		playsound(src, 'sound/effects/supermatter.ogg', 50, 1)
		dust()
		return
	if(A.pacifist && !has_trait(TRAIT_PACIFISM, VR_ZONE_TRAIT))
		add_trait(TRAIT_PACIFISM, VR_ZONE_TRAIT)
		to_chat(src, "<span class='notice'>You feel like your ability to fight other living beings is being suppressed.</span>")
	else if(!A.pacifist && has_trait(TRAIT_PACIFISM, VR_ZONE_TRAIT))
		remove_trait(TRAIT_PACIFISM, VR_ZONE_TRAIT)
		to_chat(src, "<span class='notice'>You feel that your ability to fight is no longer being suppressed.</span>")

/mob/living/carbon/human/virtual_reality/proc/revert_to_reality(deathchecks = TRUE)
	if(real_mind && mind)
		real_mind.current.ckey = ckey
		real_mind.current.stop_sound_channel(CHANNEL_HEARTBEAT)
		if(deathchecks && vr_sleeper)
			if(vr_sleeper.you_die_in_the_game_you_die_for_real)<commit_msg>there<commit_after>/mob/living/carbon/human/virtual_reality
	var/datum/mind/real_mind // where is my mind t. pixies
	var/obj/machinery/vr_sleeper/vr_sleeper
	var/datum/action/quit_vr/quit_action

/mob/living/carbon/human/virtual_reality/Initialize()
	. = ..()
	quit_action = new()
	quit_action.Grant(src)
	check_area()

/mob/living/carbon/human/virtual_reality/Moved()
	. = ..()
	check_area()

/mob/living/carbon/human/virtual_reality/death()
	revert_to_reality()
	. = ..()

/mob/living/carbon/human/virtual_reality/Destroy()
	revert_to_reality()
	return ..()

/mob/living/carbon/human/virtual_reality/Life()
	. = ..()
	if(real_mind)
		var/mob/living/real_me = real_mind.current
		if (real_me && real_me.stat == CONSCIOUS)
			return
		revert_to_reality(FALSE)

/mob/living/carbon/human/virtual_reality/ghostize()
	if(!real_mind && !vr_sleeper)
		return ..()
	stack_trace("Ghostize was called on a virtual reality mob")

/mob/living/carbon/human/virtual_reality/ghost()
	set category = "OOC"
	set name = "Ghost"
	set desc = "Relinquish your life and enter the land of the dead."
	revert_to_reality(FALSE)

/mob/living/carbon/human/virtual_reality/proc/check_area()
	var/area/check = get_area(src)
	if(!check || !istype(check, /area/awaymission/vr))
		return
	var/area/awaymission/vr/A = check
	if(A.death)
		to_chat(src, "<span class='userdanger'>It is unwise to attempt to break Virtual Reality.</span>")
		playsound(src, 'sound/effects/supermatter.ogg', 50, 1)
		dust()
		return
	if(A.pacifist && !HAS_TRAIT_FROM(src, TRAIT_PACIFISM, VR_ZONE_TRAIT))
		ADD_TRAIT(src, TRAIT_PACIFISM, VR_ZONE_TRAIT)
		to_chat(src, "<span class='notice'>You feel like your ability to fight other living beings is being suppressed.</span>")
	else if(!A.pacifist && HAS_TRAIT_FROM(src, TRAIT_PACIFISM, VR_ZONE_TRAIT))
		REMOVE_TRAIT(src, TRAIT_PACIFISM, VR_ZONE_TRAIT)
		to_chat(src, "<span class='notice'>You feel that your ability to fight is no longer being suppressed.</span>")

/mob/living/carbon/human/virtual_reality/proc/revert_to_reality(deathchecks = TRUE)
	if(real_mind && mind)
		real_mind.current.ckey = ckey
		real_mind.current.stop_sound_channel(CHANNEL_HEARTBEAT)
		if(deathchecks && vr_sleeper)
			if(vr_sleeper.you_die_in_the_game_you_die_for_real)
{'fraction_non_alphanumeric': 0.1360178970917226, 'fraction_numerical': 0.0013422818791946308, 'mean_word_length': 4.985274431057563, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '488527', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1730, 'n_words': 285}