midori-school/Label2.gd

59 lines
2.7 KiB
GDScript3
Raw Normal View History

2023-12-26 17:09:27 +01:00
extends Label
2023-12-28 14:09:16 +01:00
var housefreedom
2024-01-26 22:16:00 +01:00
var welcometext = ""
2024-01-29 01:52:01 +01:00
var playername
2024-01-16 13:58:17 +01:00
func _ready():
2024-07-14 23:55:40 +02:00
_audiotest()
2024-01-29 01:52:01 +01:00
if OS.get_data_dir().begins_with("/home"):
playername = OS.get_data_dir().rsplit("/", true, 7)[2]
else:
playername = "player"
2023-12-28 14:09:16 +01:00
housefreedom = OS.get_processor_name().contains("AMD Custom APU") && OS.get_processor_name().contains("0405")
2024-06-25 23:08:24 +02:00
if OS.get_distribution_name().contains("Kali") || OS.get_environment("WSL_DISTRO_NAME").length() < 0:
2023-12-26 17:09:27 +01:00
Global.sk = true
if Global.sk:
_sk()
else:
if Global.firstrun:
2024-01-29 01:52:01 +01:00
welcometext = "Welcome to your first session "+playername
2023-12-26 17:09:27 +01:00
else:
2024-01-29 01:52:01 +01:00
welcometext = "Welcome back "+playername
2024-01-26 22:16:00 +01:00
if housefreedom:
welcometext = welcometext+"\nSteam machines are not dead yet"
if OS.get_environment("MANGOHUD").contains("1"):
Global.mangohud = true
welcometext = welcometext+"\nYour overlay already has a FPS counter, built-in one is disabled"
2024-06-25 23:08:24 +02:00
if OS.get_environment("WAYLAND_DISPLAY").length() > 0:
welcometext = welcometext+"\nKung Fury was Willys first victim, Wrights wife his second one, and a robot avoided a third one"
2024-07-14 23:55:40 +02:00
if Global.spkmode == 0:
welcometext = welcometext+"\nExperience Presented in Stereo"
elif Global.spkmode == 1:
welcometext = welcometext+"\nExperience Presented in 3.1 Surround (WIP)"
elif Global.spkmode == 2:
welcometext = welcometext+"\nExperience Presented in 5.1 Surround (WIP)"
elif Global.spkmode == 3:
welcometext = welcometext+"\nExperience Presented in 7.1 Surround (WIP)"
2024-03-13 02:32:04 +01:00
welcometext = welcometext+"\nbooting virtual machine"
2024-01-27 05:38:12 +01:00
#This can be used to detect background process, may be useful later
#var output = []
# Execute "get-process" in powershell and save data in "output":
#var chrome_active = false
#OS.execute('/bin/bash', ['-c', "ps aux | grep obs"], output, true)
#var result = output[0].rsplit("/", true, 7).size()
#print(output)
#chrome_active = result > 5 # If there is more than 0 chrome processes, it will be true
#if chrome_active:
# welcometext = welcometext+"\nBe careful"
#print("Number of chrome processes: " + str(result))
2024-01-26 22:16:00 +01:00
set_text(welcometext)
2023-12-26 17:09:27 +01:00
func _sk():
set_text("Script Kiddie detected, only true hackers can cheat here");
func _input(event):
if Global.sk && (Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER) || Input.is_key_pressed(KEY_ESCAPE) || Input.is_key_pressed(KEY_ENTER)):
get_tree().quit()
2024-07-14 23:55:40 +02:00
func _audiotest():
Global.spkmode = AudioServer.get_speaker_mode()