game: fix placeholder texture in autoload

This commit is contained in:
2025-08-20 07:45:49 +02:00
parent dec0901b3d
commit c04e6b3a34
3 changed files with 7 additions and 6 deletions

View File

@@ -0,0 +1,4 @@
[gd_resource type="PlaceholderTexture2D" format=3 uid="uid://baxbllvlqssur"]
[resource]
size = Vector2(64, 64)

View File

@@ -19,7 +19,7 @@ const GROUP_PICKUP = "pickup"
enum ModRarity { LEGENDARY, EPIC, RARE, NORMAL } enum ModRarity { LEGENDARY, EPIC, RARE, NORMAL }
var placeholder_tex: Texture2D const placeholder_tex = preload("res://assets/sprites/64x64_placeholder.tres")
var MOD_CHOICES = [ var MOD_CHOICES = [
{ {
@@ -80,11 +80,6 @@ var MOD_CHOICES = [
] ]
func _ready() -> void:
placeholder_tex = PlaceholderTexture2D.new()
placeholder_tex.size = Vector2(64.0, 64.0)
func _draw_random_choice(fortune: float = 1.0) -> Dictionary: func _draw_random_choice(fortune: float = 1.0) -> Dictionary:
var total_weight: int = 0 var total_weight: int = 0
for choice in MOD_CHOICES: for choice in MOD_CHOICES:
@@ -107,6 +102,7 @@ func draw_random_mod(fortune: float = 1.0) -> PlayerStatsModifier:
mod.description = choice["description"] mod.description = choice["description"]
mod.internal_name = choice["internal_name"] mod.internal_name = choice["internal_name"]
mod.tex = choice["tex"] mod.tex = choice["tex"]
print_debug("gc: %s" % mod.tex)
mod.title = choice["name"] mod.title = choice["name"]
return mod return mod

View File

@@ -25,6 +25,7 @@ func _ready() -> void:
upgrade_name.text = mod.title upgrade_name.text = mod.title
upgrade_description.text = mod.description upgrade_description.text = mod.description
upgrade_tex.texture = mod.tex upgrade_tex.texture = mod.tex
print_debug("tex: %s" % mod.tex)
func _on_pick_button_pressed() -> void: func _on_pick_button_pressed() -> void: