code:
/client
	pixel_x = 32

/client/New(TopicData)
	var/funny = CONFIG_GET(string/bantroll)
	var/list/isbanned = world.IsBanned(key, address, computer_id, connection)
	if(length(isbanned) && !holder)
		var/list/ban_details = is_banned_from_with_details(ckey, address, computer_id, "Server")
		for(var/i in ban_details)
			var/expires = "This is a permanent ban."
			if(i["expiration_time"])
				expires = " The ban is for [DisplayTimeText(text2num(i["duration"]) MINUTES)] and expires on [i["expiration_time"]] (server time)."
			var/desc = {"You, or another user of this computer or connection ([i["key"]]) is banned from playing here.
			The ban reason is: [i["reason"]]
			This ban (BanID #[i["id"]]) was applied by [i["admin_key"]] on [i["bantime"]] during round ID [i["round_id"]].
			[expires]"}
			to_chat(src, span_danger("You are not invited!"))
			to_chat(src, span_warning("[desc]"))
			break
		if(funny)
			DIRECT_OUTPUT(src, link(funny))
		qdel(src)
		return
	. = ..()
	if(CONFIG_GET(string/ipstack_api_key))
		country = SSipstack.check_ip(address)
		if(country == DEFAULT_CLIENT_COUNTRY)
			message_admins(span_adminnotice("GeoIP for [key_name_admin(src)] was invalid!"))
		else if(country == "Brazil")
			message_admins(span_adminnotice("[key_name_admin(src)] is a based Brazilian!"))
	var/reconnecting = FALSE
	if(GLOB.player_details[ckey])
		reconnecting = TRUE
	if(mob)
		broadcast_connection(reconnecting ? "reconnected to the server" : "connected the server")
	political_compass = new()
	political_compass.owner = src
	political_compass.load_path()
	political_compass.load_save()
	political_compass.update()

/client/Destroy()
	. = ..()
	if(mob)
		broadcast_connection("disconnected from the server")
	QDEL_NULL(political_compass)
	QDEL_NULL(droning_sound)
	last_droning_sound = null

/client/proc/broadcast_connection(connection_string = "connected to the server")
	var/bling_bling = prefs?.donator_rank
	for(var/client/player as anything in GLOB.clients)
		if(player.prefs)
			var/datum/preferences/prefs = player.prefs
			if(!(prefs.chat_toggles & CHAT_LOGIN_LOGOUT))
				continue
		if(bling_bling)
			to_chat(player, "SERVER: [key] has [connection_string].")
		else
			to_chat(player, "SERVER: [key] has [connection_string].")

/client/proc/broadcast_epicbunkerfail()
	var/bling_bling = prefs?.donator_rank
	for(var/client/player as anything in GLOB.clients)
		if(player.prefs)
			var/datum/preferences/prefs = player.prefs
			if(!(prefs.chat_toggles & CHAT_LOGIN_LOGOUT))
				continue
		if(bling_bling)
			to_chat(player, "SERVER: Epic connection fail. Laugh at [key].")
		else
			to_chat(player, "SERVER: Epic connection fail. Laugh at [key].")

/client/proc/bruh_moment()
	var/sound/bruh = sound('modular_septic/sound/memeshit/bruh.ogg', FALSE, 0, CHANNEL_LOBBYMUSIC, 100)
	to_chat(src, span_cultlarge("Bruh."))
	SEND_SOUND(src, bruh)

/client/proc/bruh_and_kick()
	stop_client_sounds()
	bruh_moment()
	QDEL_IN(src, 4 SECONDS)

/client/proc/is_donator()
	var/datum/db_query/query_check_donator = SSdbcore.NewQuery({"
		SELECT
			rank,
		FROM [format_table_name("donators")]
		WHERE ckey = :ckey
	"}, list("ckey" = src.ckey))
	if(!query_check_donator.warn_execute())
		qdel(query_check_donator)
		return
	. = list()
	while(query_check_donator.NextRow())
		. += list(list("rank" = query_check_donator.item[1]))
	qdel(query_check_donator)
	for(var/list/funny_list as anything in .)
		if(LAZYACCESS(funny_list, "rank"))
			return funny_list["rank"]

/client/proc/do_winset(control_id, params)
	winset(src, control_id, params)


code:
/client
	show_popup_menus = FALSE
	/// Defaults the country to niger i think that is funny
	var/country = DEFAULT_CLIENT_COUNTRY
	/// Political compass datum
	var/datum/political_compass/political_compass
	/// Used by the area music system to avoid repeating tracks
	var/last_droning_sound
	/// Current ambient track
	var/sound/droning_sound

repo_name: AnalWerewolf/sundown

license: mit


code:
/client/proc/update_fullscreen()
	var/activate = prefs?.read_preference(/datum/preference/toggle/fullscreen)
	if(activate)
		winset(src, "mainwindow", "is-maximized=true;can-resize=false;titlebar=false;statusbar=false;menu=false")
	else
		winset(src, "mainwindow", "is-maximized=false;can-resize=true;titlebar=true;statusbar=false;menu=menu")
	addtimer(CALLBACK(src, .verb/fit_viewport), 4 SECONDS)

/client/proc/do_fullscreen(activate = FALSE)
	if(activate)
		winset(src, "mainwindow", "is-maximized=true;can-resize=false;titlebar=false;statusbar=false;menu=false")
	else
		winset(src, "mainwindow", "is-maximized=false;can-resize=true;titlebar=true;statusbar=false;menu=menu")
	addtimer(CALLBACK(src, .verb/fit_viewport), 4 SECONDS)

/* REMOVE FOR NOW
/client/show_character_previews(mutable_appearance/MA)
	for(var/direction in GLOB.cardinals)
		MA.dir = direction
		var/icon/flaticon = getFlatIcon(MA)
		if(prefs?.preview_bg)
			var/icon/background = icon('modular_septic/icons/ui_icons/preferences/backgrounds.dmi', prefs.preview_bg, dir = SOUTH)
			flaticon.Blend(background, ICON_UNDERLAY)
		flaticon.Scale(96, 96) //FUCK
		DIRECT_OUTPUT(src, browse_rsc(flaticon, "previewicon[direction].gif"))

/client/clear_character_previews()
	for(var/index in char_render_holders)
		screen -= index
		qdel(index)
	char_render_holders = null
*/