Browse Source

Minor formatting update

pull/1/head
Ryan Reed 1 month ago
parent
commit
6919c1af96
2 changed files with 10 additions and 10 deletions
  1. +0
    -2
      data_structure/block.gd
  2. +10
    -8
      scenes/blocks/block.gd

+ 0
- 2
data_structure/block.gd View File

@ -2,8 +2,6 @@ class_name BlockResource
extends ItemResource
# TODO: Replace with "missing texture" resource
## East material is also the default material if not provided
@export var material_east: StandardMaterial3D = null
@export var material_west: StandardMaterial3D = null


+ 10
- 8
scenes/blocks/block.gd View File

@ -30,10 +30,18 @@ func release() -> void:
func set_id(block_id: String) -> void:
id = block_id
_get_resource_data()
_load_resource_data()
_apply_materials()
## Apply a specific material to a MeshInstance3D
## If material is null, the EastFace material will be used
func _apply_material(face: MeshInstance3D, material: StandardMaterial3D) -> void:
if material == null:
material = resource.material_east # Default to East face (first)
face.set_surface_override_material(0, material)
func _apply_materials() -> void:
if east_face == null: return
@ -45,13 +53,7 @@ func _apply_materials() -> void:
_apply_material(top_face, resource.material_top)
_apply_material(bottom_face, resource.material_bottom)
func _apply_material(face: MeshInstance3D, material: StandardMaterial3D) -> void:
if material == null:
material = resource.material_east # Default to East face (first)
face.set_surface_override_material(0, material)
func _get_resource_data() -> void:
func _load_resource_data() -> void:
if not id:
printerr("Block ID was expected but was not received")
return


Loading…
Cancel
Save