initial shit

This commit is contained in:
2026-06-04 16:53:41 -05:00
parent f019615187
commit d3779cff20
828 changed files with 512567 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ItemData" format=3 uid="uid://cnu2f5ec7qb48"]
[ext_resource type="Script" uid="uid://cjb16s8q73wkx" path="res://GameShit/PlayerController/Hotbar/ItemData.gd" id="1_udtmv"]
[resource]
script = ExtResource("1_udtmv")
Name = "air"
ID = "base:air"
description = "air"
metadata/_custom_type_script = "uid://cjb16s8q73wkx"

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="ItemData" format=3 uid="uid://bw6nhoeremely"]
[ext_resource type="Script" uid="uid://cjb16s8q73wkx" path="res://GameShit/PlayerController/Hotbar/ItemData.gd" id="1_sp53r"]
[ext_resource type="Texture2D" uid="uid://bywcem8skp767" path="res://Assets/textures/hammer.png" id="2_hsm3r"]
[resource]
script = ExtResource("1_sp53r")
Name = "Hammer"
ID = "base:hammer"
description = "A hammer to destroy blocks"
texture = ExtResource("2_hsm3r")
metadata/_custom_type_script = "uid://cjb16s8q73wkx"

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="ItemData" format=3 uid="uid://cwv45kgf8soiw"]
[ext_resource type="Script" uid="uid://cjb16s8q73wkx" path="res://GameShit/PlayerController/Hotbar/ItemData.gd" id="1_e0ofu"]
[ext_resource type="Texture2D" uid="uid://c0ypn10bhavvb" path="res://Assets/textures/interact.png" id="2_121r2"]
[resource]
script = ExtResource("1_e0ofu")
Name = "Interact"
ID = "base:interact"
description = "a blank item for holding a slot for interacting"
texture = ExtResource("2_121r2")
metadata/_custom_type_script = "uid://cjb16s8q73wkx"

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="ItemData" format=3 uid="uid://c6sayeu6ky2ye"]
[ext_resource type="Script" uid="uid://cjb16s8q73wkx" path="res://GameShit/PlayerController/Hotbar/ItemData.gd" id="1_ifkot"]
[ext_resource type="Texture2D" uid="uid://d0aqp2i4stybu" path="res://Assets/textures/Stone.png" id="2_e2kbk"]
[resource]
script = ExtResource("1_ifkot")
Name = "Test Machine"
ID = "base:testMachine"
description = "its uhh, its a test machine"
texture = ExtResource("2_e2kbk")
metadata/_custom_type_script = "uid://cjb16s8q73wkx"

View File

@@ -0,0 +1,31 @@
extends Node3D
## define all of the game variables, ill replace this with a settings file later
## ignore duplicate keys, idrc atp
## this game is jus a mess of spaghetti anyhow
var selectedBlockID : String = "base:testMachine"
var selectedSlot = 0
var currentHeldItemID : String = "base:air"
var canPlaceBlock : bool = false
var username = "Xtimhedi"
var loadedLanguage = "en-US"
var isInputLocked = false
signal hideChatbox
func getIfIDExists(ID:String) -> bool:
var segments = ID.split(":")
return ResourceLoader.exists("res://WorldObjects/{namespace}/{id}.tscn".format({"namespace": segments[0], "id": segments[1]}))
func _process(delta: float) -> void:
if currentHeldItemID != "base:air" and getIfIDExists(currentHeldItemID):
canPlaceBlock = true
selectedBlockID = currentHeldItemID
else:
canPlaceBlock = false
selectedBlockID = "base:air"

View File

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

View File

@@ -0,0 +1,56 @@
shader_type spatial;
// Texture Inputs
uniform sampler2D flat_albedo : source_color, filter_linear_mipmap_anisotropic; // e.g., Grass
uniform sampler2D flat_normal : hint_normal, filter_linear_mipmap_anisotropic;
uniform sampler2D steep_albedo : source_color, filter_linear_mipmap_anisotropic; // e.g., Cliff/Rock
uniform sampler2D steep_normal : hint_normal, filter_linear_mipmap_anisotropic;
// Shader Control Knobs
uniform float texture_scale = 0.05;
uniform float slope_threshold : hint_range(0.0, 1.0) = 0.7;
uniform float slope_blend : hint_range(0.01, 0.5) = 0.1;
// Triplanar helper function to prevent stretching on procedural cliffs
vec4 triplanar_sample(sampler2D tex, vec3 world_pos, vec3 normal) {
vec3 blending = abs(normal);
blending = normalize(max(blending, 0.00001)); // Avoid division by zero
blending /= (blending.x + blending.y + blending.z);
vec4 x_tex = texture(tex, world_pos.zy * texture_scale);
vec4 y_tex = texture(tex, world_pos.xz * texture_scale);
vec4 z_tex = texture(tex, world_pos.xy * texture_scale);
return x_tex * blending.x + y_tex * blending.y + z_tex * blending.z;
}
varying vec3 world_position;
varying vec3 world_normal;
void vertex() {
// Grab real-world coordinates from Terrainy's procedural vertices
world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
world_normal = MODEL_NORMAL_MATRIX * NORMAL;
}
void fragment() {
// Normalize vectors for accurate angle calculations
vec3 normal = normalize(world_normal);
// Sample textures using triplanar projection mapping
vec4 grass_c = triplanar_sample(flat_albedo, world_position, normal);
vec4 grass_n = triplanar_sample(flat_normal, world_position, normal);
vec4 rock_c = triplanar_sample(steep_albedo, world_position, normal);
vec4 rock_n = triplanar_sample(steep_normal, world_position, normal);
// Calculate slope: dot product against the world UP vector (0, 1, 0)
float slope = dot(normal, vec3(0.0, 1.0, 0.0));
// Create a smooth mask transitioning between flat areas and cliffs
float weight = smoothstep(slope_threshold - slope_blend, slope_threshold + slope_blend, slope);
// Blend the textures together based on the procedural terrain angles
ALBEDO = mix(rock_c.rgb, grass_c.rgb, weight);
NORMAL_MAP = mix(rock_n.rgb, grass_n.rgb, weight);
ROUGHNESS = 0.8; // Uniform roughness default
}

View File

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

Binary file not shown.

View File

@@ -0,0 +1,66 @@
extends Control
## This entire script is just for handling the ChatBox UI
## if you are here looking for command handlers
## they are in GameShit/ChatSystem/commands
## if you are looking for chat var storage
## they are in GameShit/ChatSystem/ChatBox.gd
var Commands : Dictionary = {
"give": CommandHandler.registerCommand("base:giveItem").new(),
"say": CommandHandler.registerCommand("base:say").new()
}
var language = LanguageManager.loadLanguage()
func _parseMessage():
var messageContents : String = %Input.text
if messageContents.begins_with("/"):
var command = messageContents.right(-1)
runCommand(command)
%Input.text = ""
MainGame.hideChatbox.emit()
else:
sendMessage(messageContents)
%Input.text = ""
MainGame.hideChatbox.emit()
func sendMessage(message):
%TextDisplay.newline()
%TextDisplay.add_text("{a}: {b}".format({"a": MainGame.username, "b": message}))
func sendMessageAs(user, message):
%TextDisplay.newline()
%TextDisplay.add_text("{a}: {b}".format({"a": user, "b": message}))
func sendSystemErrorMessage(error:Dictionary):
%TextDisplay.newline()
%TextDisplay.add_text("Error: {Error} {Details}".format({"Error": language[error["type"]], "Details": error["caller"]}))
func _ready() -> void:
## here imma add callbacks to signals for chatbox
CommandBus.sendChatMessage.connect(sendMessage)
CommandBus.sendChatMessageAs.connect(sendMessageAs)
CommandBus.castError.connect(sendSystemErrorMessage)
func runCommand(message: String):
var regex = RegEx.new()
regex.compile("(\"[^\"]*\"|'[^']*'|\\S+)")
var matches = regex.search_all(message)
var commandArgs = []
for m in matches:
var arg = m.get_string()
if (arg.begins_with("\"") and arg.ends_with("\"")) or (arg.begins_with("'") and arg.ends_with("'")):
arg = arg.substr(1, arg.length() - 2)
commandArgs.append(arg)
if commandArgs.size() > 0:
var command_name = commandArgs[0]
if Commands.has(command_name):
Commands[command_name].runCommand(commandArgs.slice(1))
else:
CommandBus.castError.emit({"type": "base.command.commandNotFoundError", "caller": command_name})
func _on_input_text_submitted(new_text: String) -> void:
_parseMessage()

View File

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

View File

@@ -0,0 +1,73 @@
[gd_scene format=3 uid="uid://bliihydr5ja7g"]
[ext_resource type="Script" uid="uid://bv7jebheo3yyf" path="res://GameShit/PlayerController/ChatSystem/ChatBox.gd" id="1_u837s"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bq26o"]
bg_color = Color(0.043137256, 0.043137256, 0.043137256, 0.6509804)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u837s"]
bg_color = Color(0.14767182, 0.14767182, 0.14767176, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_aksbt"]
bg_color = Color(0.24840015, 0.24840021, 0.24840006, 1)
[node name="ChatBox" type="Control" unique_id=756491211]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_u837s")
[node name="Panel" type="Panel" parent="." unique_id=1311922339]
layout_mode = 0
offset_right = 384.0
offset_bottom = 264.0
[node name="Panel2" type="Panel" parent="Panel" unique_id=1474934579]
layout_mode = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 376.0
offset_bottom = 256.0
[node name="TextDisplay" type="RichTextLabel" parent="Panel/Panel2" unique_id=575967085]
unique_name_in_owner = true
layout_mode = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 360.0
offset_bottom = 200.0
theme_override_font_sizes/normal_font_size = 10
theme_override_font_sizes/bold_font_size = 10
theme_override_font_sizes/bold_italics_font_size = 10
theme_override_font_sizes/italics_font_size = 10
theme_override_font_sizes/mono_font_size = 10
theme_override_styles/normal = SubResource("StyleBoxFlat_bq26o")
theme_override_styles/focus = SubResource("StyleBoxFlat_u837s")
bbcode_enabled = true
[node name="Input" type="LineEdit" parent="Panel/Panel2" unique_id=484855696]
unique_name_in_owner = true
layout_mode = 0
offset_left = 8.0
offset_top = 208.0
offset_right = 304.0
offset_bottom = 239.0
theme_override_styles/normal = SubResource("StyleBoxFlat_aksbt")
theme_override_styles/read_only = SubResource("StyleBoxFlat_aksbt")
theme_override_styles/focus = SubResource("StyleBoxFlat_aksbt")
placeholder_text = "Type a message or command!"
[node name="Send" type="Button" parent="Panel/Panel2" unique_id=1540729483]
unique_name_in_owner = true
layout_mode = 0
offset_left = 312.0
offset_top = 208.0
offset_right = 360.0
offset_bottom = 240.0
text = "Send"
[connection signal="text_submitted" from="Panel/Panel2/Input" to="." method="_on_input_text_submitted"]
[connection signal="pressed" from="Panel/Panel2/Send" to="." method="_parseMessage"]

View File

@@ -0,0 +1,10 @@
extends Node
## all command variables are stuck in here, idk why i did this but its like 5am and im done with this shit atp
var lastMessage = ""
func registerCommand(CommandID:String):
var parts = CommandID.split(":")
return load("res://GameShit/PlayerController/ChatSystem/commands/{namespace}/{id}.gd".format({"namespace": parts[0], "id": parts[1]}))

View File

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

View File

@@ -0,0 +1,5 @@
extends Node
func runCommand(args:Array):
print("test")
InventoryBus.givePlayerItem.emit(args[0])

View File

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

View File

@@ -0,0 +1,4 @@
extends Node
func runCommand(args:Array):
CommandBus.sendChatMessageAs.emit(args[0], args[1])

View File

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

View File

@@ -0,0 +1,42 @@
extends Camera3D
@export var sensitivity: float = 0.002
@export var smooth_speed: float = 15.0
var target_yaw: float = 0.0
var target_pitch: float = 0.0
func _ready() -> void:
target_yaw = rotation.y
target_pitch = rotation.x
# Capture the mouse immediately so you don't need to click to look around
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(event: InputEvent) -> void:
# Allows you to hit 'Escape' to free your mouse cursor if needed
if event.is_action_pressed("ui_cancel"):
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# Always looks around when the mouse moves (as long as it's captured)
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
target_yaw -= event.relative.x * sensitivity
target_pitch -= event.relative.y * sensitivity
target_pitch = clamp(target_pitch, deg_to_rad(-89), deg_to_rad(89))
# Zoom implementation (Clamped safely between 10 and 75 FOV)
if event is InputEventMouseButton:
if Input.is_key_pressed(KEY_ALT):
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
fov = clamp(fov + 5, 10, 75)
elif event.button_index == MOUSE_BUTTON_WHEEL_UP:
fov = clamp(fov - 5, 10, 75)
func _process(delta: float) -> void:
# Smooth Rotation
rotation.y = lerp_angle(rotation.y, target_yaw, smooth_speed * delta)
rotation.x = lerp(rotation.x, target_pitch, smooth_speed * delta)

View File

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

View File

@@ -0,0 +1,111 @@
extends CharacterBody3D
@export var isShiny : bool = false;
@export var geraldColor : Color = Color(0.673, 0.03, 0.35, 1.0);
@export var glowStrength : int = 2;
@export_group("Movement")
@export var speed = 5.0
@export var jump_velocity = 4.5
@export var fly_speed = 8.0 # How fast you fly up/down/around
@export var is_flying : bool = false # Toggle this in the inspector or via code
# Get the gravity from the project settings
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var PlayerMaterial : StandardMaterial3D = StandardMaterial3D.new();
func save():
Save.saveGameData("test.tres")
func loadGame():
Save.loadGameData("test.tres")
func fcm():
$Camera3D/CanvasLayer/ChatBox.visible = not $Camera3D/CanvasLayer/ChatBox.visible
if $Camera3D/CanvasLayer/ChatBox.visible:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
MainGame.isInputLocked = true
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
MainGame.isInputLocked = false
func _ready() -> void:
MainGame.hideChatbox.connect(fcm)
$Camera3D/MeshInstance3D.material_override = PlayerMaterial
if isShiny:
PlayerMaterial.emission_enabled = true;
PlayerMaterial.emission = geraldColor;
PlayerMaterial.emission_energy_multiplier = glowStrength;
PlayerMaterial.roughness = 0.05;
PlayerMaterial.metallic = 1.0;
PlayerMaterial.albedo_color = geraldColor;
$Label3D.text=MainGame.username
func _process(delta: float) -> void:
if Input.is_action_just_pressed("fly"):
is_flying = not is_flying
if !MainGame.isInputLocked:
if Input.is_action_just_pressed("save"):
save()
elif Input.is_action_just_pressed("load"):
loadGame()
if !$Camera3D/CanvasLayer/ChatBox/Panel/Panel2/Input.has_focus():
if Input.is_action_just_pressed("chat"):
$Camera3D/CanvasLayer/ChatBox.visible = not $Camera3D/CanvasLayer/ChatBox.visible
if $Camera3D/CanvasLayer/ChatBox.visible:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
MainGame.isInputLocked = true
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
MainGame.isInputLocked = false
func _physics_process(delta):
if is_flying:
handle_flight_movement(delta)
else:
if !MainGame.isInputLocked:
handle_ground_movement(delta)
move_and_slide()
func handle_ground_movement(delta):
if not is_on_floor():
velocity.y -= gravity * delta
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = jump_velocity
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var cam_basis = $Camera3D.global_transform.basis
var forward = Vector3(cam_basis.z.x, 0, cam_basis.z.z).normalized()
var right = Vector3(cam_basis.x.x, 0, cam_basis.x.z).normalized()
var direction = (forward * input_dir.y + right * input_dir.x).normalized()
if direction != Vector3.ZERO:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = 0
velocity.z = 0
func handle_flight_movement(delta):
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var cam_basis = $Camera3D.global_transform.basis
var forward = Vector3(cam_basis.z.x, 0, cam_basis.z.z).normalized()
var right = Vector3(cam_basis.x.x, 0, cam_basis.x.z).normalized()
var direction = (forward * input_dir.y + right * input_dir.x).normalized()
if direction != Vector3.ZERO:
velocity.x = direction.x * fly_speed
velocity.z = direction.z * fly_speed
else:
velocity.x = 0
velocity.z = 0
var fly_up = Input.is_physical_key_pressed(KEY_SPACE)
var fly_down = Input.is_physical_key_pressed(KEY_C)
var fly_dir = 0
if fly_up:
fly_dir += 1
if fly_down:
fly_dir -= 1
velocity.y = fly_dir * fly_speed

View File

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

View File

@@ -0,0 +1,84 @@
extends RayCast3D
var current_target: Node = null
var curTarget: Node = null
@export var mode = 0;
var rot : int = 0
func _process(delta: float) -> void:
if Input.is_key_pressed(KEY_E):
rot += 2
if Input.is_key_pressed(KEY_Q):
rot -= 2
if Input.is_key_pressed(KEY_1):
mode = 0
elif Input.is_key_pressed(KEY_2):
mode = 1
elif Input.is_key_pressed(KEY_3):
mode = 2
func spawnObjectByID(ObjectID:String, position:Vector3, rotation:int):
var segments = ObjectID.split(":")
var objectScene = load("res://WorldObjects/{namespace}/{id}.tscn".format({"namespace": segments[0], "id": segments[1]}))
var object = objectScene.instantiate()
object.global_position = position
object.rotation_degrees = Vector3(0, rotation, 0)
get_tree().current_scene.get_node("objects").add_child(object)
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if not MainGame.canPlaceBlock:
var is_left = event.button_index == MOUSE_BUTTON_LEFT
var is_right = event.button_index == MOUSE_BUTTON_RIGHT
if is_left or is_right:
if event.pressed:
if is_colliding():
var collider = get_collider()
var target = _find_interactable_node(collider)
if target:
current_target = target
if current_target.has_method("_interact_press"):
# If it's a right click, pass true for the alt interaction
current_target._interact_press(is_right)
else:
# Handle releasing the click
if current_target and current_target.has_method("_interact_release"):
current_target._interact_release()
current_target = null
elif MainGame.canPlaceBlock:
var is_left = event.button_index == MOUSE_BUTTON_LEFT
if is_left:
if event.pressed:
spawnObjectByID(MainGame.selectedBlockID, get_collision_point(), rot)
if MainGame.currentHeldItemID == "base:hammer":
var is_left = event.button_index == MOUSE_BUTTON_LEFT
if is_left:
if event.pressed:
var collider = get_collider()
var target = _findBreakableNode(collider)
if target:
curTarget = target
if curTarget.has_method("_destroy"):
curTarget._destroy()
func _find_interactable_node(node: Node) -> Node:
while node != null:
if node.has_method("_interact_press"):
return node
node = node.get_parent()
return null
func _findBreakableNode(node: Node) -> Node:
while node != null:
if node.has_method("_destroy"):
return node
node = node.get_parent()
return null

View File

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

View File

@@ -0,0 +1,104 @@
[gd_scene format=3 uid="uid://h6pvjvocpe1y"]
[ext_resource type="Script" uid="uid://bcx7cyoq31cw6" path="res://GameShit/PlayerController/ControllerSystem/CameraDrag.gd" id="1_2be4l"]
[ext_resource type="Script" uid="uid://b7x6n68hgibrl" path="res://GameShit/PlayerController/ControllerSystem/Gerald.gd" id="1_3mwrl"]
[ext_resource type="Texture2D" uid="uid://djghgojdnndiq" path="res://GameShit/PlayerController/ControllerSystem/crosshair.png" id="3_1hgir"]
[ext_resource type="Script" uid="uid://d2r0ovdfa5y18" path="res://GameShit/PlayerController/ControllerSystem/Interact.gd" id="3_y00gc"]
[ext_resource type="Script" uid="uid://csqbc3n5gn47h" path="res://GameShit/PlayerController/Hotbar/HotBar.gd" id="6_y6phc"]
[ext_resource type="PackedScene" uid="uid://cjdago36f5tk1" path="res://GameShit/PlayerController/Hotbar/HotbarSlot.tscn" id="7_eb4xd"]
[ext_resource type="Resource" uid="uid://ng8hm4a1u2ya" path="res://GameShit/PlayerController/Hotbar/MainBar.res" id="8_jteqg"]
[ext_resource type="PackedScene" uid="uid://bliihydr5ja7g" path="res://GameShit/PlayerController/ChatSystem/ChatBox.tscn" id="8_x05u2"]
[sub_resource type="SphereMesh" id="SphereMesh_3mwrl"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3mwrl"]
[node name="PlayerController" type="CharacterBody3D" unique_id=1597560541 groups=["saveable"]]
script = ExtResource("1_3mwrl")
glowStrength = 140000
[node name="Camera3D" type="Camera3D" parent="." unique_id=866350707]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.496, 0)
current = true
script = ExtResource("1_2be4l")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Camera3D" unique_id=1586810034]
mesh = SubResource("SphereMesh_3mwrl")
[node name="RayCast3D" type="RayCast3D" parent="Camera3D" unique_id=725234463]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, -0.51586515)
target_position = Vector3(0, -4, 0)
script = ExtResource("3_y00gc")
[node name="CanvasLayer" type="CanvasLayer" parent="Camera3D" unique_id=1005709652]
[node name="TextureRect" type="TextureRect" parent="Camera3D/CanvasLayer" unique_id=1252526888]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.400024
offset_top = -9.740021
offset_right = 10.400024
offset_bottom = 9.740021
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.5, 0.5)
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("3_1hgir")
metadata/_edit_use_anchors_ = true
[node name="HotBar" type="Control" parent="Camera3D/CanvasLayer" unique_id=1228004643 node_paths=PackedStringArray("HotbarContainer")]
layout_mode = 3
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
script = ExtResource("6_y6phc")
slotScene = ExtResource("7_eb4xd")
HotbarContainer = NodePath("HBoxContainer")
hotbar = ExtResource("8_jteqg")
metadata/_edit_use_anchors_ = true
[node name="HBoxContainer" type="HBoxContainer" parent="Camera3D/CanvasLayer/HotBar" unique_id=569216010]
custom_minimum_size = Vector2(40, 40)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -196.0
offset_top = -40.0
offset_right = 196.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/separation = 50
alignment = 1
metadata/_edit_use_anchors_ = true
[node name="ChatBox" parent="Camera3D/CanvasLayer" unique_id=756491211 instance=ExtResource("8_x05u2")]
visible = false
anchors_preset = 4
anchor_top = 0.5
anchor_right = 0.0
anchor_bottom = 0.5
grow_horizontal = 1
pivot_offset = Vector2(0, 120)
metadata/_edit_use_anchors_ = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=639269486]
transform = Transform3D(0.5, 0, 0, 0, 1, 0, 0, 0, 0.5, 0, 0, 0)
shape = SubResource("CapsuleShape3D_3mwrl")
[node name="Label3D" type="Label3D" parent="." unique_id=2066773761]
transform = Transform3D(-0.9999846, 0, 0.0055676177, 0, 1, 0, -0.0055676177, 0, -0.9999846, 0, 1.6802876, 0)
text = "USERNAME"

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

View File

@@ -0,0 +1,42 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djghgojdnndiq"
path.s3tc="res://.godot/imported/crosshair.png-6671a2781fe821ac2264c60589cc7d1e.s3tc.ctex"
path.etc2="res://.godot/imported/crosshair.png-6671a2781fe821ac2264c60589cc7d1e.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://GameShit/PlayerController/ControllerSystem/crosshair.png"
dest_files=["res://.godot/imported/crosshair.png-6671a2781fe821ac2264c60589cc7d1e.s3tc.ctex", "res://.godot/imported/crosshair.png-6671a2781fe821ac2264c60589cc7d1e.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@@ -0,0 +1,83 @@
extends Control
@export var slotScene : PackedScene
@export var HotbarContainer : HBoxContainer
@export var hotbar : HotbarResource
func updateHotbar(hotbar: HotbarResource):
for child in HotbarContainer.get_children():
child.queue_free()
for index in hotbar.slots.size():
var item = hotbar.slots[index]
var slotInstance = slotScene.instantiate()
HotbarContainer.add_child(slotInstance)
if item:
var is_selected = (MainGame.selectedSlot == index)
if is_selected:
MainGame.currentHeldItemID = item.ID
slotInstance.setItem(item, is_selected)
func givePlayerItem(ID:String, ):
var segments = ID.split(":")
for index in hotbar.slots.size():
var item = hotbar.slots[index]
if item.ID == "base:air":
hotbar.slots[index] = load("res://GameShit/ItemHandlers/{namespace}/{id}.tres".format({"namespace": segments[0], "id": segments[1]}))
updateHotbar(hotbar)
return
else:
print("there will be a UIThrowException call eventually but im too lazy to implement it rn")
print("UI.Command.give.InventoryFullException")
func _ready() -> void:
## connect the InventoryBus signal for the shit
InventoryBus.givePlayerItem.connect(givePlayerItem)
## throw in some default slots
if hotbar.slots.is_empty():
hotbar.slots.clear()
for i in range(0,12):
hotbar.slots.append(load("res://GameShit/ItemHandlers/base/air.tres"))
## give the player the default tools
givePlayerItem("base:hammer")
givePlayerItem("base:interact")
updateHotbar(hotbar)
func _process(delta: float) -> void:
if Input.is_key_pressed(KEY_1):
MainGame.selectedSlot = 0
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_2):
MainGame.selectedSlot = 1
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_3):
MainGame.selectedSlot = 2
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_4):
MainGame.selectedSlot = 3
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_5):
MainGame.selectedSlot = 4
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_6):
MainGame.selectedSlot = 5
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_7):
MainGame.selectedSlot = 6
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_8):
MainGame.selectedSlot = 7
updateHotbar(hotbar)
elif Input.is_key_pressed(KEY_9):
MainGame.selectedSlot = 8
updateHotbar(hotbar)

View File

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

View File

@@ -0,0 +1,7 @@
extends Resource
class_name HotbarResource
@export var slots: Array[ItemData] = []
func add_item(item: ItemData):
slots.append(item)

View File

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

View File

@@ -0,0 +1,29 @@
[gd_scene format=3 uid="uid://cjdago36f5tk1"]
[ext_resource type="Script" uid="uid://c0tnorcgu7dev" path="res://GameShit/PlayerController/Hotbar/hotbar_slot.gd" id="1_hqux7"]
[node name="HotbarSlot" type="Control" unique_id=395686084]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_hqux7")
[node name="Button" type="Button" parent="." unique_id=342233194]
layout_mode = 0
offset_left = -24.0
offset_top = -24.0
offset_right = 24.0
offset_bottom = 24.0
[node name="TextureRect" type="TextureRect" parent="." unique_id=1767675987]
layout_mode = 0
offset_left = -16.0
offset_top = -16.0
offset_right = 16.0
offset_bottom = 16.0
mouse_filter = 2
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]

View File

@@ -0,0 +1,7 @@
extends Resource
class_name ItemData
@export var Name : String = ""
@export var ID : String = "base:null"
@export var description: String = ""
@export var texture : Texture2D

View File

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

Binary file not shown.

View File

@@ -0,0 +1,28 @@
extends Control
# Pre-create flat styles to override the engine's default skin
var active_style = StyleBoxFlat.new()
var inactive_style = StyleBoxFlat.new()
func _ready():
# Configure your exact custom colors
active_style.bg_color = Color(0.378, 0.378, 0.378, 0.988)
inactive_style.bg_color = Color(0.075, 0.075, 0.075, 0.988)
func setItem(item, isActive):
$TextureRect.texture = item.texture
if isActive:
# Force-override all basic button background states
$Button.add_theme_stylebox_override("normal", active_style)
$Button.add_theme_stylebox_override("hover", active_style)
$Button.add_theme_stylebox_override("pressed", active_style)
else:
$Button.add_theme_stylebox_override("normal", inactive_style)
$Button.add_theme_stylebox_override("hover", inactive_style)
$Button.add_theme_stylebox_override("pressed", inactive_style)
func _on_button_pressed() -> void:
pass # Replace with function body.

View File

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