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