working on command blocks
This commit is contained in:
parent
685d9642dc
commit
8cceafb10c
10 changed files with 112 additions and 26 deletions
26
Commands/command_block.gd
Normal file
26
Commands/command_block.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#@tool
|
||||
extends RigidBody3D
|
||||
class_name Command_Block
|
||||
|
||||
@export var command_name : String
|
||||
@export var command_sprite : Texture2D:
|
||||
set(new_texture):
|
||||
if command_sprite != null:
|
||||
command_sprite.changed.disconnect(on_texture_changed)
|
||||
command_sprite = new_texture
|
||||
command_sprite.changed.connect(on_texture_changed)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$MeshInstance3D.material_override.albedo_texture = command_sprite
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func on_texture_changed():
|
||||
print("meow")
|
||||
$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate()
|
||||
$MeshInstance3D.material_override.albedo_texture = command_sprite
|
||||
22
Commands/command_block.tscn
Normal file
22
Commands/command_block.tscn
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dqvq4ybcpws87"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://2i80f5wutvco" path="res://Assets/Materials/baseCommand.tres" id="1_ksvsv"]
|
||||
[ext_resource type="Script" path="res://Commands/command_block.gd" id="1_ra6j6"]
|
||||
[ext_resource type="Script" path="res://Commands/tool.gd" id="3_lrl7m"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_572kf"]
|
||||
size = Vector3(0.5, 0.5, 0.5)
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_mmdx7"]
|
||||
points = PackedVector3Array(0.25, 0.25, 0.25, 0.25, 0.25, -0.25, -0.25, 0.25, 0.25, 0.25, -0.25, 0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25)
|
||||
|
||||
[node name="BaseCommand" type="RigidBody3D"]
|
||||
script = ExtResource("1_ra6j6")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
material_override = ExtResource("1_ksvsv")
|
||||
mesh = SubResource("BoxMesh_572kf")
|
||||
script = ExtResource("3_lrl7m")
|
||||
|
||||
[node name="CollisionShape3D3" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("ConvexPolygonShape3D_mmdx7")
|
||||
12
Commands/tool.gd
Normal file
12
Commands/tool.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#@tool
|
||||
extends Node
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue