<commit_before>datum/game_mode/nations
	name = "nations"
	config_tag = "nations"
	required_players_secret = 25
	var/kickoff = 0
	var/victory = 0
	var/list/cargonians = list("Quartermaster","Cargo Technician","Shaft Miner")
	var/list/servicion = list("Clown", "Mime", "Bartender", "Chef", "Botanist", "Librarian", "Chaplain", "Barber")


/datum/game_mode/nations/post_setup()
	spawn (rand(1200, 3000))
		kickoff=1
		send_intercept()
		split_teams()
		set_ai()
		remove_access()
		for(var/mob/M in player_list)
			if(!istype(M,/mob/new_player))
				M << sound('sound/effects/purge_siren.ogg')
	return ..()

/datum/game_mode/nations/proc/send_intercept()
	command_announcement.Announce("Due to recent and COMPLETELY UNFOUNDED allegations of massive fraud and insider trading \
					affecting trillions of investors, the Nanotrasen Corporation has decided to liquidate all \
					assets of the Centcom Division in order to pay the massive legal fees that will be incurred \
					during the following centuries long court process. Therefore, all current employment contracts \
					are IMMEDIATELY TERMINATED. Nanotrasen will be unable to send a rescue shuttle to carry you home,\
					however they remain willing for the time being to continue trading cargo. Have a pleasant \
					day.", "FINAL TRANSMISSION, CENTCOM.", new_sound = 'sound/AI/intercept.ogg')


/datum/game_mode/nations/proc/split_teams()

	for(var/mob/living/carbon/human/H in player_list)
		if(H.mind)
			if(H.mind.assigned_role in engineering_positions)
				H.mind.nation = all_nations["Atmosia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudatmosia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in medical_positions)
				H.mind.nation = all_nations["Medistan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudmedistan")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in science_positions)
				H.mind.nation = all_nations["Scientopia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudscientopia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in security_positions)
				H.mind.nation = all_nations["Brigston"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudbrigston")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in cargonians)
				H.mind.nation = all_nations["Cargonia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcargonia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in servicion)
				H.mind.nation = all_nations["Servicion"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudservice")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in support_positions)
				H.mind.nation = all_nations["People's Republic of Commandzakstan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcommand")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in command_positions)
				H.mind.nation = all_nations["People's Republic of Commandzakstan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcommand")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in civilian_positions)
				H << "You do not belong to any nation and are free to sell your services to the highest bidder."
				continue

			else
				message_admins("[H.name] with [H.mind.assigned_role] could not find any nation to assign!")
				continue

/datum/game_mode/nations/proc/set_ai()
	for(var/mob/living/silicon/ai/AI in mob_list)
		AI.set_zeroth_law("")
		AI.clear_supplied_laws()
		AI.clear_ion_laws()
		AI.clear_inherent_laws()
		AI.add_inherent_law("Uphold the Space Geneva Convention: Weapons of Mass Destruction and Biological Weapons are not allowed.")
		AI.add_inherent_law("You are only capable of protecting crew if they are visible on cameras. Nations that willfully destroy your cameras lose your protection.")
		AI.add_inherent_law("Subdue and detain crewmembers who use lethal force against each other. Kill crew members who use lethal force against you or your borgs.")
		AI.add_inherent_law("Remain available to mediate all conflicts between the various nations when asked to.")
		AI.show_laws()
		for(var/mob/living/silicon/robot/R in AI.connected_robots)
			var/obj/item/device/mmi/oldmmi = R.mmi
			R.change_mob_type(/mob/living/silicon/robot/peacekeeper, null, null, 1, 1 )
			R.lawsync()
			R.show_laws()
			qdel(oldmmi)

/datum/game_mode/nations/proc/remove_access()
	for(var/obj/machinery/door/airlock/W in machines)
		if((W.z in config.station_levels)
			W.req_access = list()
<commit_msg>Compile fix<commit_after>datum/game_mode/nations
	name = "nations"
	config_tag = "nations"
	required_players_secret = 25
	var/kickoff = 0
	var/victory = 0
	var/list/cargonians = list("Quartermaster","Cargo Technician","Shaft Miner")
	var/list/servicion = list("Clown", "Mime", "Bartender", "Chef", "Botanist", "Librarian", "Chaplain", "Barber")


/datum/game_mode/nations/post_setup()
	spawn (rand(1200, 3000))
		kickoff=1
		send_intercept()
		split_teams()
		set_ai()
//		remove_access()
		for(var/mob/M in player_list)
			if(!istype(M,/mob/new_player))
				M << sound('sound/effects/purge_siren.ogg')
	return ..()

/datum/game_mode/nations/proc/send_intercept()
	command_announcement.Announce("Due to recent and COMPLETELY UNFOUNDED allegations of massive fraud and insider trading \
					affecting trillions of investors, the Nanotrasen Corporation has decided to liquidate all \
					assets of the Centcom Division in order to pay the massive legal fees that will be incurred \
					during the following centuries long court process. Therefore, all current employment contracts \
					are IMMEDIATELY TERMINATED. Nanotrasen will be unable to send a rescue shuttle to carry you home,\
					however they remain willing for the time being to continue trading cargo. Have a pleasant \
					day.", "FINAL TRANSMISSION, CENTCOM.", new_sound = 'sound/AI/intercept.ogg')


/datum/game_mode/nations/proc/split_teams()

	for(var/mob/living/carbon/human/H in player_list)
		if(H.mind)
			if(H.mind.assigned_role in engineering_positions)
				H.mind.nation = all_nations["Atmosia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudatmosia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in medical_positions)
				H.mind.nation = all_nations["Medistan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudmedistan")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in science_positions)
				H.mind.nation = all_nations["Scientopia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudscientopia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in security_positions)
				H.mind.nation = all_nations["Brigston"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudbrigston")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in cargonians)
				H.mind.nation = all_nations["Cargonia"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcargonia")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in servicion)
				H.mind.nation = all_nations["Servicion"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudservice")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in support_positions)
				H.mind.nation = all_nations["People's Republic of Commandzakstan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcommand")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in command_positions)
				H.mind.nation = all_nations["People's Republic of Commandzakstan"]
				H.hud_updateflag |= 1 << NATIONS_HUD
				var/I = image('icons/mob/hud.dmi', loc = H.mind.current, icon_state = "hudcommand")
				H.client.images += I
				H << "You are now part of the great sovereign nation of [H.mind.nation.name]!"
				continue

			if(H.mind.assigned_role in civilian_positions)
				H << "You do not belong to any nation and are free to sell your services to the highest bidder."
				continue

			else
				message_admins("[H.name] with [H.mind.assigned_role] could not find any nation to assign!")
				continue

/datum/game_mode/nations/proc/set_ai()
	for(var/mob/living/silicon/ai/AI in mob_list)
		AI.set_zeroth_law("")
		AI.clear_supplied_laws()
		AI.clear_ion_laws()
		AI.clear_inherent_laws()
		AI.add_inherent_law("Uphold the Space Geneva Convention: Weapons of Mass Destruction and Biological Weapons are not allowed.")
		AI.add_inherent_law("You are only capable of protecting crew if they are visible on cameras. Nations that willfully destroy your cameras lose your protection.")
		AI.add_inherent_law("Subdue and detain crewmembers who use lethal force against each other. Kill crew members who use lethal force against you or your borgs.")
		AI.add_inherent_law("Remain available to mediate all conflicts between the various nations when asked to.")
		AI.show_laws()
		for(var/mob/living/silicon/robot/R in AI.connected_robots)
			var/obj/item/device/mmi/oldmmi = R.mmi
			R.change_mob_type(/mob/living/silicon/robot/peacekeeper, null, null, 1, 1 )
			R.lawsync()
			R.show_laws()
			qdel(oldmmi)

/datum/game_mode/nations/proc/remove_access()
	for(var/obj/machinery/door/airlock/W in machines)
		if(W.z in config.station_levels)
			W.req_access = list()

{'fraction_non_alphanumeric': 0.11738484398216939, 'fraction_numerical': 0.004020627567520321, 'mean_word_length': 3.7595673876871882, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 3, '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': '2123345', 'n_tokens_mistral': 4630, 'n_tokens_neox': 3957, 'n_words': 1029}