Initial works on building system.

main
Martin Felis 2024-09-08 22:06:34 +02:00
parent 9d25524b3b
commit 723b1e0394
4 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://dv60qx8nqw3vg"]
[ext_resource type="PackedScene" uid="uid://cg5cy35mk8nba" path="res://assets/3rdparty/kenney/survival-kit/Models/fence-fortified.glb" id="1_bm7wh"]
[node name="fence-fortified" instance=ExtResource("1_bm7wh")]
[node name="fence-fortified" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.222241)

View File

@ -64,6 +64,9 @@ func on_item_picked_up(item:Item):
inventory.add_item(item)
func get_actionable_global_transform() -> Vector3:
return actionable_detector.global_position
func _unhandled_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
var actionables = actionable_detector.get_overlapping_areas()

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://cqie4cy0uy1t0"]
[gd_scene load_steps=8 format=3 uid="uid://cqie4cy0uy1t0"]
[ext_resource type="PackedScene" uid="uid://ch0s3dxx3rpir" path="res://objects/player.tscn" id="2_rjgxk"]
[ext_resource type="Script" path="res://systems/QuestSystem.gd" id="4_8oxap"]
[ext_resource type="Script" path="res://systems/BuildSystem.gd" id="4_iqdys"]
[ext_resource type="PackedScene" uid="uid://dmagdl5pi6jdj" path="res://world/level.tscn" id="6_svjo8"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_y65pc"]
@ -31,3 +32,8 @@ unique_name_in_owner = true
[node name="QuestSystem" type="Node" parent="."]
script = ExtResource("4_8oxap")
[node name="BuildSystem" type="Node" parent="."]
script = ExtResource("4_iqdys")
[editable path="Player"]

14
systems/BuildSystem.gd Normal file
View File

@ -0,0 +1,14 @@
class_name BuildSystem
extends Node
@onready var player = %Player
# 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):
var build_location:Vector3 = player.get_actionable_global_transform()
build_location = Vector3(roundf(build_location.x), build_location.y, roundf(build_location.z))