<commit_before>
// TODO:
//	- Additional radio modules
//	- Potentially roll HUDs and Records into one
//	- Shock collar/lock system for prisoner pAIs?
//  - Put cable in user's hand instead of on the ground
//  - Camera jack

/*list(
															"crew manifest" = 5,
															"digital messenger" = 5,
															"medical records" = 15,
															"security records" = 15,
															//"camera jack" = 10,
															"door jack" = 30,
															"remote control" = 60,
															"atmosphere sensor" = 5,
															//"heartbeat sensor" = 10,
															"security HUD" = 20,
															"medical HUD" = 20,
															"universal translator" = 35,
															//"projection array" = 15
															"remote signaller" = 5,
															)*/

/mob/living/silicon/pai/verb/paiInterface()
	set category = "pAI Commands"
	set name = "Software Interface"
	var/dat = ""
	var/left_part = ""
	var/right_part = softwareMenu()
	src.set_machine(src)

	if(temp)
		left_part = temp
	else if(src.stat == 2)						// Show some flavor text if the pAI is dead
		left_part = "<b><font color=red>RrR a Rro</font></b>"
		right_part = "<pre>Program index hash not found</pre>"

	else
		for (var/S in src.pai_software)
			var/datum/pai/software/SW = S

			if (screen == SW.sid) //we have a screen set with software we have active, so lets display it:
				left_part = SW.action_menu(src)

		switch(src.screen)							// Determine which interface to show here
			if("main")
				left_part = ""
			if("directives")
				left_part = src.directives()
			if("buy")
				left_part = downloadSoftware()
	//usr << browse_rsc('windowbak.png')		// This has been moved to the mob's Login() proc


	// Declaring a doctype is necessary to enable BYOND's crappy browser's more advanced CSS functionality
	dat = {"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
			<html>
			<head>
				<style type=\"text/css\">
					body { background-image:url('html/paigrid.png'); }

					#header { text-align:center; color:white; font-size: 30px; height: 35px; width: 100%; letter-spacing: 2px; z-index: 5}
					#content {position: relative; left: 10px; height: 400px; width: 100%; z-index: 0}

					#leftmenu {color: #AAAAAA; background-color:#333333; width: 400px; height: auto; min-height: 340px; position: absolute; z-index: 0}
					#leftmenu a:link { color: #CCCCCC; }
					#leftmenu a:hover { color: #CC3333; }
					#leftmenu a:visited { color: #CCCCCC; }
					#leftmenu a:active { color: #000000; }

					#rightmenu {color: #CCCCCC; background-color:#555555; width: 200px ; height: auto; min-height: 340px; right: 10px; position: absolute; z-index: 1}
					#rightmenu a:link { color: #CCCCCC; }
					#rightmenu a:hover { color: #CC3333; }
					#rightmenu a:visited { color: #CCCCCC; }
					#rightmenu a:active { color: #000000; }

				</style>
				<script language='javascript' type='text/javascript'>
				[js_byjax]
				</script>
			</head>
			<body scroll=yes>
				<div id=\"header\">
					pAI OS
				</div>
				<div id=\"content\">
					<div id=\"leftmenu\">[left_part]</div>
					<div id=\"rightmenu\">[right_part]</div>
				</div>
			</body>
			</html>"} //"
	usr << browse(dat, "window=pai;size=640x480;border=0;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
	onclose(usr, "pai")
	temp = null
	return



/mob/living/silicon/pai/Topic(href, href_list)
	..()
	var/soft = href_list["software"]
	var/sub = href_list["sub"]
	if(soft)
		src.screen = soft
	if(sub)
		src.subscreen = text2num(sub)

	for (var/S in src.pai_software)
		var/datum/pai/software/SW = S

		if (soft == SW.sid) //if we've got a matching href tag, refer it to the software datum's use event
			SW.action_use(src, href_list)

	//LEGACY COMMANDS FROM OLD SOFTWARE SYSTEM, NEW SOFTWARE IS HANDLED AUTOMATICALLY IN /datum/pai/software
	switch(soft)
		// Purchasing new software
		if("buy")
			if(src.subscreen == 1)
				var/datum/pai/software/T = available_software[href_list["buy"]]

				if(istype(T, /datum/pai/software))
					var/cost = T.ram
					if(src.ram >= cost)
						src.ram -= cost
						src.pai_software.Add(T)
						T.action_installed(src) //throw installed event to allow huds to be attached, etc
					else
						src.temp = "Insufficient RAM available."<commit_msg>Fix refresh button in pAI software causing blank left-side display.<commit_after>
// TODO:
//	- Additional radio modules
//	- Potentially roll HUDs and Records into one
//	- Shock collar/lock system for prisoner pAIs?
//  - Put cable in user's hand instead of on the ground
//  - Camera jack

/*list(
															"crew manifest" = 5,
															"digital messenger" = 5,
															"medical records" = 15,
															"security records" = 15,
															//"camera jack" = 10,
															"door jack" = 30,
															"remote control" = 60,
															"atmosphere sensor" = 5,
															//"heartbeat sensor" = 10,
															"security HUD" = 20,
															"medical HUD" = 20,
															"universal translator" = 35,
															//"projection array" = 15
															"remote signaller" = 5,
															)*/

/mob/living/silicon/pai/verb/paiInterface()
	set category = "pAI Commands"
	set name = "Software Interface"
	var/dat = ""
	var/left_part = ""
	var/right_part = softwareMenu()
	src.set_machine(src)

	if(temp)
		left_part = temp
	else if(src.stat == 2)						// Show some flavor text if the pAI is dead
		left_part = "<b><font color=red>RrR a Rro</font></b>"
		right_part = "<pre>Program index hash not found</pre>"

	else
		for (var/S in src.pai_software)
			var/datum/pai/software/SW = S

			if (screen == SW.sid) //we have a screen set with software we have active, so lets display it:
				left_part = SW.action_menu(src)

		switch(src.screen)							// Determine which interface to show here
			if("main")
				left_part = ""
			if("directives")
				left_part = src.directives()
			if("buy")
				left_part = downloadSoftware()
	//usr << browse_rsc('windowbak.png')		// This has been moved to the mob's Login() proc


	// Declaring a doctype is necessary to enable BYOND's crappy browser's more advanced CSS functionality
	dat = {"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
			<html>
			<head>
				<style type=\"text/css\">
					body { background-image:url('html/paigrid.png'); }

					#header { text-align:center; color:white; font-size: 30px; height: 35px; width: 100%; letter-spacing: 2px; z-index: 5}
					#content {position: relative; left: 10px; height: 400px; width: 100%; z-index: 0}

					#leftmenu {color: #AAAAAA; background-color:#333333; width: 400px; height: auto; min-height: 340px; position: absolute; z-index: 0}
					#leftmenu a:link { color: #CCCCCC; }
					#leftmenu a:hover { color: #CC3333; }
					#leftmenu a:visited { color: #CCCCCC; }
					#leftmenu a:active { color: #000000; }

					#rightmenu {color: #CCCCCC; background-color:#555555; width: 200px ; height: auto; min-height: 340px; right: 10px; position: absolute; z-index: 1}
					#rightmenu a:link { color: #CCCCCC; }
					#rightmenu a:hover { color: #CC3333; }
					#rightmenu a:visited { color: #CCCCCC; }
					#rightmenu a:active { color: #000000; }

				</style>
				<script language='javascript' type='text/javascript'>
				[js_byjax]
				</script>
			</head>
			<body scroll=yes>
				<div id=\"header\">
					pAI OS
				</div>
				<div id=\"content\">
					<div id=\"leftmenu\">[left_part]</div>
					<div id=\"rightmenu\">[right_part]</div>
				</div>
			</body>
			</html>"} //"
	usr << browse(dat, "window=pai;size=640x480;border=0;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
	onclose(usr, "pai")
	temp = null
	return



/mob/living/silicon/pai/Topic(href, href_list)
	..()
	var/soft = href_list["software"]
	var/sub = href_list["sub"]

	if(soft)
		if (soft == "refresh") //irritating but handles refresh functionality innately this way
			soft = src.screen
		else
			src.screen = soft
	if(sub)
		src.subscreen = text2num(sub)

	for (var/S in src.pai_software)
		var/datum/pai/software/SW = S

		if (soft == SW.sid) //if we've got a matching href tag, refer it to the software datum's use event
			SW.action_use(src, href_list)

	//LEGACY COMMANDS FROM OLD SOFTWARE SYSTEM, NEW SOFTWARE IS HANDLED AUTOMATICALLY IN /datum/pai/software
	switch(soft)
		// Purchasing new software
		if("buy")
			if(src.subscreen == 1)
				var/datum/pai/software/T = available_software[href_list["buy"]]

				if(istype(T, /datum/pai/software))
					var/cost = T.ram
					if(src.ram >= cost)
						src.ram -= cost
						src.pai_software.Add(T)
						T.action_installed(src) //throw installed event to allow huds to be attached, etc
					else
						src.temp = "Insufficient RAM available."
{'fraction_non_alphanumeric': 0.14512832159890984, 'fraction_numerical': 0.024982966159436747, 'mean_word_length': 2.6942114093959733, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '524474', 'n_tokens_mistral': 4114, 'n_tokens_neox': 3025, 'n_words': 814}