added machine item slots so ican start building gameplay
This commit is contained in:
21
GameShit/PlayerController/ControllerSystem/Highlight.gd
Normal file
21
GameShit/PlayerController/ControllerSystem/Highlight.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends RayCast3D
|
||||
|
||||
# Keep track of what we were just looking at
|
||||
var current_target: Object = null
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if is_colliding():
|
||||
var collider = get_collider()
|
||||
if current_target != collider:
|
||||
_clear_current_highlight()
|
||||
current_target = collider
|
||||
if current_target.has_method("startHighlight"):
|
||||
current_target.startHighlight()
|
||||
else:
|
||||
_clear_current_highlight()
|
||||
|
||||
func _clear_current_highlight() -> void:
|
||||
if current_target != null:
|
||||
if current_target.has_method("stopHighlight"):
|
||||
current_target.stopHighlight()
|
||||
current_target = null
|
||||
@@ -0,0 +1 @@
|
||||
uid://peb1cm1x2b2u
|
||||
@@ -56,7 +56,7 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
if is_left:
|
||||
if event.pressed:
|
||||
spawnObjectByID(MainGame.selectedBlockID, get_collision_point(), rot)
|
||||
spawnObjectByID(MainGame.selectedBlockID, get_collision_point() + Vector3(0, 0.5, 0), rot)
|
||||
if MainGame.currentHeldItemID == "base:hammer":
|
||||
var is_left = event.button_index == MOUSE_BUTTON_LEFT
|
||||
if is_left:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cjdago36f5tk1" path="res://GameShit/PlayerController/Hotbar/HotbarSlot.tscn" id="7_eb4xd"]
|
||||
[ext_resource type="Resource" uid="uid://ng8hm4a1u2ya" path="res://GameShit/PlayerController/Hotbar/MainBar.res" id="8_jteqg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bliihydr5ja7g" path="res://GameShit/PlayerController/ChatSystem/ChatBox.tscn" id="8_x05u2"]
|
||||
[ext_resource type="Script" uid="uid://peb1cm1x2b2u" path="res://GameShit/PlayerController/ControllerSystem/Highlight.gd" id="9_dt52j"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_3mwrl"]
|
||||
|
||||
@@ -95,6 +96,12 @@ grow_horizontal = 1
|
||||
pivot_offset = Vector2(0, 120)
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HighlightRaycast" type="RayCast3D" parent="Camera3D" unique_id=1504301830]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, -0.51586515)
|
||||
target_position = Vector3(0, -4, 0)
|
||||
script = ExtResource("9_dt52j")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=639269486]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 1, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_3mwrl")
|
||||
|
||||
Reference in New Issue
Block a user