diff --git a/assets/scene_props/fence_fortified.tscn b/assets/scene_props/fence_fortified.tscn new file mode 100644 index 0000000..8a55776 --- /dev/null +++ b/assets/scene_props/fence_fortified.tscn @@ -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) diff --git a/objects/player.gd b/objects/player.gd index 0cec1c8..46280c8 100644 --- a/objects/player.gd +++ b/objects/player.gd @@ -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() diff --git a/scenes/game.tscn b/scenes/game.tscn index 5b66c39..e3a6662 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -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"] diff --git a/systems/BuildSystem.gd b/systems/BuildSystem.gd new file mode 100644 index 0000000..b3e5ab1 --- /dev/null +++ b/systems/BuildSystem.gd @@ -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))