Compare commits
3 Commits
9d25524b3b
...
f555eceffc
Author | SHA1 | Date |
---|---|---|
Martin Felis | f555eceffc | |
Martin Felis | 69713fb7d1 | |
Martin Felis | 723b1e0394 |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cx3x4l20q17xh"
|
||||
path="res://.godot/imported/fence_fortified.png-1ae65c603e478020bc26d4e987d66517.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/resources/fence_fortified.png"
|
||||
dest_files=["res://.godot/imported/fence_fortified.png-1ae65c603e478020bc26d4e987d66517.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -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)
|
|
@ -0,0 +1,12 @@
|
|||
[gd_resource type="Resource" script_class="Item" load_steps=4 format=3 uid="uid://c714vj3s6cnqg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cx3x4l20q17xh" path="res://assets/resources/fence_fortified.png" id="1_hyv8l"]
|
||||
[ext_resource type="Script" path="res://model/item.gd" id="1_u43c0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dv60qx8nqw3vg" path="res://assets/resources/fence_fortified.tscn" id="2_8ttdv"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_u43c0")
|
||||
name = ""
|
||||
scene = ExtResource("2_8ttdv")
|
||||
icon = ExtResource("1_hyv8l")
|
||||
max_stack_size = 64
|
|
@ -10,3 +10,4 @@ script = ExtResource("1_pmsv1")
|
|||
name = "Pickaxe"
|
||||
scene = ExtResource("1_hcgy2")
|
||||
icon = ExtResource("1_n8kbr")
|
||||
max_stack_size = 1
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[gd_resource type="Resource" script_class="Recipe" load_steps=5 format=3 uid="uid://dtlb5wp5shlm3"]
|
||||
|
||||
[ext_resource type="Script" path="res://model/recipe.gd" id="1_h0rj4"]
|
||||
[ext_resource type="Resource" uid="uid://bn5j38jbwlj1f" path="res://data/items/stick.tres" id="1_i6g7d"]
|
||||
[ext_resource type="Resource" uid="uid://dmjr6pmb17l2y" path="res://data/items/woodplanks.tres" id="2_d54b6"]
|
||||
[ext_resource type="Resource" uid="uid://c714vj3s6cnqg" path="res://data/items/fence_fortified.tres" id="3_bsd6g"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_h0rj4")
|
||||
name = "Fence Fortified"
|
||||
ingredients = Array[Resource("res://model/item.gd")]([ExtResource("1_i6g7d"), ExtResource("1_i6g7d"), ExtResource("2_d54b6")])
|
||||
results = Array[Resource("res://model/item.gd")]([ExtResource("3_bsd6g")])
|
|
@ -1,12 +1,13 @@
|
|||
class_name Player
|
||||
extends CharacterBody3D
|
||||
|
||||
const SPEED = 4.0
|
||||
const SPEED = 3.0
|
||||
const JUMP_VELOCITY = 2.5
|
||||
|
||||
@onready var geometry:Node3D = %Geometry
|
||||
@onready var actionable_detector = %ActionableDetector
|
||||
@onready var animation_tree:AnimationTree = $Geometry/Rogue/AnimationTree
|
||||
@onready var build_location:Node3D = %BuildLocation
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
|
@ -64,6 +65,9 @@ func on_item_picked_up(item:Item):
|
|||
inventory.add_item(item)
|
||||
|
||||
|
||||
func get_actionable_global_transform() -> Vector3:
|
||||
return build_location.global_position
|
||||
|
||||
func _unhandled_input(_event: InputEvent) -> void:
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
var actionables = actionable_detector.get_overlapping_areas()
|
||||
|
|
|
@ -45,7 +45,11 @@ collision_mask = 16
|
|||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/ActionableDetector"]
|
||||
shape = SubResource("SphereShape3D_wrkyq")
|
||||
|
||||
[node name="BuildLocation" type="Node3D" parent="Geometry"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(2.5, 0, 0, 0, 2.5, 0, 0, 0, 2.5, 0, 0, 2.4682)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.460138, 0.887848, 0, -0.887848, 0.460138, 0, 2.91421, 1.186)
|
||||
transform = Transform3D(1, 0, 0, 0, 0.639707, 0.768619, 0, -0.768619, 0.639707, 0, 2.23862, 1.4653)
|
||||
current = true
|
||||
|
|
|
@ -314,7 +314,6 @@ size_flags_vertical = 3
|
|||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
columns = 3
|
||||
rows = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="GameUI/InventoryDialog/Panel/PanelContainer/CraftingUI/HBoxContainer/CraftIngredients"]
|
||||
layout_mode = 2
|
||||
|
@ -384,7 +383,6 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
rows = 3
|
||||
|
||||
[node name="GameMenuUI" type="PanelContainer" parent="GameUI"]
|
||||
unique_name_in_owner = true
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://cqie4cy0uy1t0"]
|
||||
[gd_scene load_steps=9 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="Resource" uid="uid://c714vj3s6cnqg" path="res://data/items/fence_fortified.tres" id="5_ii2f8"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmagdl5pi6jdj" path="res://world/level.tscn" id="6_svjo8"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_y65pc"]
|
||||
|
@ -31,3 +33,15 @@ 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")
|
||||
build_item = ExtResource("5_ii2f8")
|
||||
|
||||
[node name="BuildPreview" type="Node3D" parent="BuildSystem"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="BuiltStructures" type="Node" parent="BuildSystem"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[editable path="Player"]
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
class_name BuildSystem
|
||||
extends Node
|
||||
|
||||
@onready var build_preview = %BuildPreview
|
||||
@onready var player = %Player
|
||||
@onready var built_structures = %BuiltStructures
|
||||
|
||||
@export var build_item:Item = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func update_build_preview_item() -> void:
|
||||
for child in build_preview.get_children():
|
||||
if build_item == null or child.scene_file_path != build_item.scene.resource_path:
|
||||
child.get_parent().remove_child(child)
|
||||
child.queue_free()
|
||||
|
||||
if build_preview.get_child_count() == 0 and build_item != null:
|
||||
build_preview.add_child(build_item.scene.instantiate())
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(_delta):
|
||||
update_build_preview_item()
|
||||
|
||||
var build_location:Vector3 = player.get_actionable_global_transform()
|
||||
build_location = Vector3(roundf(build_location.x * 2), build_location.y, roundf(build_location.z * 2)) * 0.5
|
||||
build_preview.global_position = build_location
|
||||
|
||||
if build_item != null and Input.is_action_just_pressed("interaction"):
|
||||
var new_structure:Node3D = build_item.scene.instantiate()
|
||||
new_structure.transform = build_preview.transform
|
||||
built_structures.add_child(new_structure)
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue