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,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