Browse Source

Adding glass block

pull/9/head
Ryan Reed 1 month ago
parent
commit
044f0760fe
10 changed files with 120 additions and 4 deletions
  1. +10
    -0
      assets/materials/glass.tres
  2. BIN
      assets/textures/glass-block.png
  3. +35
    -0
      assets/textures/glass-block.png.import
  4. BIN
      assets/textures/glass.png
  5. +34
    -0
      assets/textures/glass.png.import
  6. +1
    -0
      autoloads/db_items.gd
  7. +14
    -0
      resources/blocks/006_glass.tres
  8. +1
    -1
      scenes/ui/quick_slots.gd
  9. +24
    -2
      scenes/ui/quick_slots.tscn
  10. +1
    -1
      scenes/world/world.gd

+ 10
- 0
assets/materials/glass.tres View File

@ -0,0 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://b2w5ybx51vuwf"]
[ext_resource type="Texture2D" uid="uid://dbgq50hfo3qyi" path="res://assets/textures/glass-block.png" id="1_wmskm"]
[resource]
transparency = 1
albedo_texture = ExtResource("1_wmskm")
metallic_specular = 0.0
roughness = 0.0
texture_filter = 0

BIN
assets/textures/glass-block.png View File

Before After
Width: 48  |  Height: 32  |  Size: 385 B

+ 35
- 0
assets/textures/glass-block.png.import View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dbgq50hfo3qyi"
path.s3tc="res://.godot/imported/glass-block.png-044c3715bdfecbc3ecf8d63721050d0b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/glass-block.png"
dest_files=["res://.godot/imported/glass-block.png-044c3715bdfecbc3ecf8d63721050d0b.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
assets/textures/glass.png View File

Before After
Width: 16  |  Height: 16  |  Size: 281 B

+ 34
- 0
assets/textures/glass.png.import View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpllegyqnfnrh"
path="res://.godot/imported/glass.png-bc5a76edb61031570869d2267fdb76fd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/glass.png"
dest_files=["res://.godot/imported/glass.png-bc5a76edb61031570869d2267fdb76fd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

+ 1
- 0
autoloads/db_items.gd View File

@ -7,4 +7,5 @@ extends Node
"003": preload("res://resources/blocks/003_wood.tres"), "003": preload("res://resources/blocks/003_wood.tres"),
"004": preload("res://resources/blocks/004_leaves.tres"), "004": preload("res://resources/blocks/004_leaves.tres"),
"005": preload("res://resources/blocks/005_grass.tres"), "005": preload("res://resources/blocks/005_grass.tres"),
"006": preload("res://resources/blocks/006_glass.tres"),
} }

+ 14
- 0
resources/blocks/006_glass.tres View File

@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="BlockResource" load_steps=3 format=3 uid="uid://bfrbhymu4iqu8"]
[ext_resource type="Material" uid="uid://b2w5ybx51vuwf" path="res://assets/materials/glass.tres" id="1_6luft"]
[ext_resource type="Script" uid="uid://dwrmy4mx0mw18" path="res://resources/block_resource.gd" id="2_jygkk"]
[resource]
script = ExtResource("2_jygkk")
material_texture = ExtResource("1_6luft")
id = "006"
name = "Glass"
amount = 0
description = "Glass block"
item_texture = "uid://cpllegyqnfnrh"
metadata/_custom_type_script = "uid://dwrmy4mx0mw18"

+ 1
- 1
scenes/ui/quick_slots.gd View File

@ -6,7 +6,7 @@ extends Node
@onready var slots_container: GridContainer = $GridContainer @onready var slots_container: GridContainer = $GridContainer
var _items: Array[String] = ["001", "005", "002", "003", "004"]
var _items: Array[String] = ["001", "005", "002", "003", "004", "006"]
var _previous_selected_item: int = 0 var _previous_selected_item: int = 0
var _selected_item: int = 0 : var _selected_item: int = 0 :
set(new_item_index): set(new_item_index):


+ 24
- 2
scenes/ui/quick_slots.tscn View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://cbiygbgpfk220"]
[gd_scene load_steps=9 format=3 uid="uid://cbiygbgpfk220"]
[ext_resource type="Script" uid="uid://bcq6vexsmyeol" path="res://scenes/ui/quick_slots.gd" id="1_cqw2g"] [ext_resource type="Script" uid="uid://bcq6vexsmyeol" path="res://scenes/ui/quick_slots.gd" id="1_cqw2g"]
[ext_resource type="Texture2D" uid="uid://li36txj7oweq" path="res://assets/textures/dirt.png" id="2_kotkb"] [ext_resource type="Texture2D" uid="uid://li36txj7oweq" path="res://assets/textures/dirt.png" id="2_kotkb"]
@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://bgo4mb3atmbot" path="res://assets/textures/grass.png" id="3_yyyxx"] [ext_resource type="Texture2D" uid="uid://bgo4mb3atmbot" path="res://assets/textures/grass.png" id="3_yyyxx"]
[ext_resource type="Texture2D" uid="uid://0mw651622h01" path="res://assets/textures/wood.png" id="4_yyyxx"] [ext_resource type="Texture2D" uid="uid://0mw651622h01" path="res://assets/textures/wood.png" id="4_yyyxx"]
[ext_resource type="Texture2D" uid="uid://goygbpyqhych" path="res://assets/textures/leaves.png" id="5_ps55n"] [ext_resource type="Texture2D" uid="uid://goygbpyqhych" path="res://assets/textures/leaves.png" id="5_ps55n"]
[ext_resource type="Texture2D" uid="uid://cpllegyqnfnrh" path="res://assets/textures/glass.png" id="8_bup65"]
[node name="QuickSlots" type="MarginContainer"] [node name="QuickSlots" type="MarginContainer"]
anchors_preset = 7 anchors_preset = 7
@ -30,7 +31,7 @@ highlight_theme = ExtResource("2_ps55n")
layout_mode = 2 layout_mode = 2
theme_override_constants/h_separation = 8 theme_override_constants/h_separation = 8
theme_override_constants/v_separation = 8 theme_override_constants/v_separation = 8
columns = 5
columns = 10
[node name="Slot0" type="Panel" parent="GridContainer"] [node name="Slot0" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
@ -136,3 +137,24 @@ theme_override_constants/margin_bottom = 4
texture_filter = 1 texture_filter = 1
layout_mode = 2 layout_mode = 2
texture = ExtResource("5_ps55n") texture = ExtResource("5_ps55n")
[node name="Slot6" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot6"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot6/MarginContainer"]
texture_filter = 1
layout_mode = 2
texture = ExtResource("8_bup65")

+ 1
- 1
scenes/world/world.gd View File

@ -38,7 +38,7 @@ func _create_dropped_block(id: String, block_position: Vector3) -> void:
block.initialize(id, block_position) block.initialize(id, block_position)
func _create_test_blocks() -> void: func _create_test_blocks() -> void:
var test_blocks: Array = ["001", "002", "003", "004", "005"]
var test_blocks: Array = ["001", "002", "003", "004", "005", "006"]
for index: int in range(1, test_blocks.size() + 1): for index: int in range(1, test_blocks.size() + 1):
_create_block("00" + str(index), Vector3(index, 1, -3)) _create_block("00" + str(index), Vector3(index, 1, -3))
_create_block("00" + str(index), Vector3(index, 2, -4)) _create_block("00" + str(index), Vector3(index, 2, -4))


Loading…
Cancel
Save