pedestals working
This commit is contained in:
parent
813feb9fef
commit
4a564dc3f5
6 changed files with 109 additions and 9 deletions
|
|
@ -43,6 +43,7 @@ func _physics_process(delta):
|
|||
if Input.is_action_just_pressed("interact"):
|
||||
if "name" in raycast.get_collider():
|
||||
if "command_name" in raycast.get_collider():
|
||||
# clicked a command block
|
||||
print(raycast.get_collider().command_name)
|
||||
|
||||
#hand.add_child(held_object)
|
||||
|
|
@ -52,6 +53,18 @@ func _physics_process(delta):
|
|||
held_object.position = Vector3(0,0,0)
|
||||
held_object.freeze = true
|
||||
has_object = true
|
||||
elif "placed_command" in raycast.get_collider():
|
||||
# clicked a pedestal, place on pedestal if its not already got something
|
||||
var clicked_pedestal = raycast.get_collider() as Pedestal
|
||||
print("clicked pedestal: "+ clicked_pedestal.name)
|
||||
if(has_object and not clicked_pedestal.has_command):
|
||||
print("trying to place")
|
||||
held_object.reparent(clicked_pedestal.slot)
|
||||
held_object.position = Vector3(0,0,0)
|
||||
held_object.rotation_degrees = Vector3(0,0,0)
|
||||
has_object = false
|
||||
clicked_pedestal.has_command = true
|
||||
clicked_pedestal.placed_command = held_object
|
||||
else:
|
||||
print(raycast.get_collider().name)
|
||||
object_clicked.emit(raycast.get_collider())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue