initial commit

This commit is contained in:
Brazly
2026-01-13 03:47:51 +00:00
commit b58b59eb96
43 changed files with 3202 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
extends CenterContainer
@export var dotRadius: float = 1
@export var dotColor: Color = Color.WHITE
var current_radius: float
var is_highlighted: bool = false
var tween: Tween
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
queue_redraw()
pass # Replace with function body.
# This function is called by the Camera script
func set_highlight(active: bool) -> void:
is_highlighted = active
_animate_radius()
queue_redraw()
func _animate_radius():
# Kill any existing tween so they don't fight each other
if tween and tween.is_running():
tween.kill()
tween = create_tween()
# Determine target based on state
var target = dotRadius * 3 if is_highlighted else dotRadius
# Transition from current_radius to target over 0.3 seconds
tween.tween_property(self, "current_radius", target, 0.1)\
.set_trans(Tween.TRANS_SINE)\
.set_ease(Tween.EASE_OUT)
func _draw():
draw_circle(Vector2(0,0),current_radius,dotColor)

View File

@@ -0,0 +1 @@
uid://chb1dyhl7cyg1

View File

@@ -0,0 +1,13 @@
extends Node
@onready var colorRect = $ColorRect
@onready var animationPlayer = $AnimationPlayer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
colorRect.visible = true
animationPlayer.play("fade_in")
await get_tree().create_timer(5.0).timeout
queue_free()
pass # Replace with function body.

View File

@@ -0,0 +1 @@
uid://cs6mhxw52ldo1

View File

@@ -0,0 +1,15 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
pass # Replace with function body.
func _on_new_game_button_pressed() -> void:
get_tree().change_scene_to_file("res://Scenes/Levels/office.tscn")
print("changed")
pass # Replace with function body.

View File

@@ -0,0 +1 @@
uid://2sxp2yxkv5k2

View File

@@ -0,0 +1,39 @@
extends Control
var paused = false
var showMouse = false
func _ready() -> void:
self.visible = paused
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("Pause"):
print("paused")
_pause_and_unpause()
func _pause_and_unpause():
paused = !paused
showMouse = !showMouse
get_tree().paused = paused
self.visible = paused
$MarginContainer/VBoxContainer/CameraSensitivityLabel/HSlider.value = GlobalSettings.cameraSensitivity
if showMouse:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _on_resume_game_button_pressed() -> void:
_pause_and_unpause()
func _on_quit_game_button_pressed() -> void:
get_tree().quit()
func _on_h_slider_value_changed(value: float) -> void:
GlobalSettings.cameraSensitivity = value
print(GlobalSettings.cameraSensitivity)
pass # Replace with function body.

View File

@@ -0,0 +1 @@
uid://cnw8764a6hljr

View File

@@ -0,0 +1,168 @@
extends Node
class_name TerminalControls
@onready var historyContainer = $MarginContainer/ScrollContainer/VBoxContainer
@onready var caret = $MarginContainer/ScrollContainer/VBoxContainer/Label/Caret
@onready var blink_timer = $MarginContainer/ScrollContainer/VBoxContainer/Label/CaretTimer
@export var terminalLine: Label
var command: String
var directory: String = "~/"
var fileSystem: Dictionary = {
"documents": {
"special": {
"notes.txt": "test",
"secrets": {
"password.txt": 123
}
}
},
"bin": {
"sh": "binary data",
}
}
func _ready() -> void:
terminalLine.text = "user@work "+ directory + " "
UpdateCaretPos()
blink_timer.start()
# --- Caret Blinking Logic ---
func _on_caret_timer_timeout() -> void:
caret.visible = !caret.visible
func reset_blink() -> void:
caret.visible = true
blink_timer.start() # Resets the countdown
# --- Input Handling ---
func InputChar(input) -> void:
if input == null:
return
command = input
terminalLine.text += command
UpdateCaretPos()
reset_blink()
func InputDelChar() -> void:
if terminalLine.text.length() > ("user@work " + directory).length() + 1:
terminalLine.text = terminalLine.text.left(-1)
UpdateCaretPos()
reset_blink()
func EnterCommand() -> void:
var fullText = terminalLine.text
var userInput = fullText.trim_prefix("user@work " + directory).strip_edges()
if historyContainer.get_child_count() <22:
CreateHistoryEntry(fullText)
var parts = userInput.split(" ")
match parts[0]:
"ls":
var currentDirData
if parts.size() > 1:
currentDirData = GetDirAtPath(directory + parts[1])
else:
currentDirData = GetDirAtPath(directory)
if currentDirData is Dictionary:
var list = ""
for key in currentDirData.keys():
list += key + " "
CreateHistoryEntry(list)
else:
CreateHistoryEntry("error: Directory not found")
"cd":
if parts.size() > 1:
var targetPath = parts[1]
var newDir = ResolvePath(directory, targetPath)
if GetDirAtPath(newDir) != null:
directory = newDir
else:
CreateHistoryEntry("cd: no such directory: " + targetPath)
else:
directory = "~/"
"cat":
if parts.size() > 1:
RetrieveData(parts[1])
else:
CreateHistoryEntry("usage: cat [filename]")
"clear":
for child in historyContainer.get_children():
if child != terminalLine:
child.queue_free()
"":
pass
_:
CreateHistoryEntry("Command not found: " + userInput)
terminalLine.text = "user@work "+ directory + " "
# Handle UI scrolling correctly
var scrollBox = historyContainer.get_parent() as ScrollContainer
historyContainer.force_update_transform()
await get_tree().process_frame
scrollBox.scroll_vertical = int(scrollBox.get_v_scroll_bar().max_value)
UpdateCaretPos()
# --- History and FileSystem Helpers ---
func CreateHistoryEntry(content: String) -> void:
var label = Label.new()
label.text = content
label.label_settings = LabelSettings.new()
label.label_settings.font_size = 42
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
label.custom_minimum_size = Vector2(1400, 0)
if terminalLine.text.length() > 200:
for child in historyContainer.get_children():
if child != terminalLine:
child.queue_free()
historyContainer.add_child(label)
historyContainer.move_child(label, historyContainer.get_child_count() - 2)
# Limit history to 15 entries + 1 active line
if historyContainer.get_child_count() > 22:
historyContainer.get_child(0).queue_free()
func ResolvePath(current: String, target: String) -> String:
if target.begins_with("~/"):
return target if target.ends_with("/") else target + "/"
if target == "..":
if current == "~/": return "~/"
var parts = current.trim_suffix("/").rsplit("/", true, 1)
return parts[0] + "/"
var joined = current + target
return joined if joined.ends_with("/") else joined + "/"
func GetDirAtPath(path: String):
if path == "~/": return fileSystem
var cleanPath = path.trim_prefix("~/").trim_suffix("/")
var folders = cleanPath.split("/")
var current = fileSystem
for folder in folders:
if current is Dictionary and current.has(folder) and current[folder] is Dictionary:
current = current[folder]
else:
return null
return current if current is Dictionary else null
func RetrieveData(filename: String):
var currentData = GetDirAtPath(directory)
if currentData == null:
CreateHistoryEntry("Error: Current directory invalid.")
return
if currentData.has(filename):
var content = currentData[filename]
if content is Dictionary:
CreateHistoryEntry("cat: " + filename + ": is a directory")
else:
CreateHistoryEntry(str(content))
else:
CreateHistoryEntry("cat: " + filename + ": no such file")
func UpdateCaretPos():
var last_char_index = terminalLine.text.length() - 1
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
caret.position.x = char_rect.end.x + 1
caret.position.y = char_rect.position.y

View File

@@ -0,0 +1 @@
uid://ckagscjkf3iiu