Finished basic needs
This commit is contained in:
@@ -15,6 +15,8 @@ func _ready() -> void:
|
||||
child.set_item(null)
|
||||
child.inventory = self
|
||||
|
||||
GlobalSignals.on_give_player_item.connect(on_give_player_item)
|
||||
|
||||
for item in starter_items:
|
||||
add_item(item)
|
||||
|
||||
|
||||
@@ -55,4 +55,16 @@ func _on_pressed():
|
||||
remove_item()
|
||||
|
||||
func drop_item():
|
||||
pass
|
||||
if item == null:
|
||||
return
|
||||
|
||||
var world_item = item.world_item_scene.instantiate()
|
||||
add_child(world_item)
|
||||
world_item.position = inventory.get_parent().position + Vector3(0, 1.5, 0) - inventory.get_parent().basis.z
|
||||
remove_item()
|
||||
|
||||
|
||||
func _on_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
drop_item()
|
||||
|
||||
@@ -46,6 +46,7 @@ label_settings = SubResource("LabelSettings_0eju6")
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 2
|
||||
|
||||
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
|
||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
||||
|
||||
13
Items/ItemData/Goo.tres
Normal file
13
Items/ItemData/Goo.tres
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="Resource" script_class="Item" load_steps=4 format=3 uid="uid://bn62yixvjt8qa"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dkvupub4psbja" path="res://Items/Icons/Goo.png" id="1_8it1k"]
|
||||
[ext_resource type="Script" uid="uid://c077ak2rge5iv" path="res://Item.gd" id="2_65xks"]
|
||||
[ext_resource type="PackedScene" uid="uid://cm0qgjsn7atr6" path="res://World Items/WorldItem_Goo.tscn" id="3_q6rrq"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_65xks")
|
||||
display_name = "Goo"
|
||||
icon = ExtResource("1_8it1k")
|
||||
max_stack_size = 12
|
||||
world_item_scene = ExtResource("3_q6rrq")
|
||||
metadata/_custom_type_script = "uid://c077ak2rge5iv"
|
||||
@@ -1,11 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://bn62yixvjt8qa"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c077ak2rge5iv" path="res://Item.gd" id="1_fokvi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkvupub4psbja" path="res://Items/Icons/Goo.png" id="1_rxo6g"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_fokvi")
|
||||
display_name = "Goo"
|
||||
icon = ExtResource("1_rxo6g")
|
||||
max_stack_size = 12
|
||||
metadata/_custom_type_script = "uid://c077ak2rge5iv"
|
||||
@@ -5,9 +5,9 @@
|
||||
[ext_resource type="Script" uid="uid://bgp8sred771bp" path="res://Inventory/Inventory.gd" id="3_0eju6"]
|
||||
[ext_resource type="Script" uid="uid://c077ak2rge5iv" path="res://Item.gd" id="4_ererc"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7i5cai8ud4lr" path="res://Inventory/inventory_slot.tscn" id="4_sydjo"]
|
||||
[ext_resource type="Resource" uid="uid://bn62yixvjt8qa" path="res://Items/ItemData/itemGoo_resource.tres" id="5_iq2nx"]
|
||||
[ext_resource type="Resource" uid="uid://ce3p2y2gmsvhm" path="res://Items/ItemData/itemIron_resource.tres" id="6_kcr7a"]
|
||||
[ext_resource type="Resource" uid="uid://cfq2hlp4dfjsa" path="res://Items/ItemData/itemWood_resource.tres" id="7_inybr"]
|
||||
[ext_resource type="Resource" uid="uid://bn62yixvjt8qa" path="res://Items/ItemData/Goo.tres" id="5_iq2nx"]
|
||||
[ext_resource type="Resource" uid="uid://ce3p2y2gmsvhm" path="res://Items/ItemData/Iron.tres" id="6_kcr7a"]
|
||||
[ext_resource type="Resource" uid="uid://cfq2hlp4dfjsa" path="res://Items/ItemData/Wood.tres" id="7_inybr"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lt5te"]
|
||||
radius = 0.3
|
||||
|
||||
28
World Items/WorldItem_Goo.tscn
Normal file
28
World Items/WorldItem_Goo.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cm0qgjsn7atr6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://hd6ac5oii8rv" path="res://WorldItem.gd" id="1_ac2u7"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://bjlhco0x10xv7" path="res://Items/Models/Goo.obj" id="2_ke25d"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1bvp3"]
|
||||
albedo_color = Color(1, 0.481483, 0.747791, 1)
|
||||
roughness = 0.37
|
||||
rim_enabled = true
|
||||
rim = 0.31
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_h2yge"]
|
||||
points = PackedVector3Array(0.211515, 0.459467, -1.19335, 0.202778, 0.855241, -0.740826, 0.74526, 0.577405, -0.668387, 0.732668, 0.242068, -0.907523, 0.495734, -0.109329, -0.986944, -0.0498327, -0.195667, -1.01291, -0.65065, -0.206027, -0.964471, -0.277516, 0.624546, -1.02687, 0.762221, 0.756816, 0.243428, 0.520918, 0.751463, -0.511291, -0.173954, 0.747836, -0.789483, -0.577668, 0.8713, 0.16117, -0.252332, 0.861285, 0.353177, 1.03719, 0.495211, -0.00116289, 1.25511, 0.302677, -0.032364, 1.40056, -0.0349052, 0.172953, 1.14692, -0.504412, -0.00334477, 0.861415, -0.357292, -0.42816, 0.527342, -0.399943, -0.660751, -0.394956, -0.524615, -0.90556, -0.847239, -0.690212, -0.415942, -1.22474, -0.374041, -0.219353, -1.00194, 0.0395183, -0.477253, -0.518306, 0.307167, -0.938943, -0.9747, 0.663916, -0.0397825, 1.03282, 0.584312, 0.482782, 0.35234, 0.781508, 0.415143, -0.683029, 0.591046, 0.524893, -0.0171964, 0.581722, 0.728027, 0.3251, 0.488304, 0.896034, 1.1721, 0.2564, 0.525111, 0.976028, -0.480065, 0.722136, 0.796656, -0.839231, 0.21419, 0.425065, -0.726819, -0.250117, -0.506998, -0.756001, -0.618858, -1.02815, -0.628566, -0.04611, -0.467167, -0.892761, -0.0271275, -0.864713, -0.53204, 0.418634, -1.09856, -0.0682317, 0.330486, -1.22474, 0.280056, 0.156806, 0.600067, 0.23965, 1.03568, -0.794044, 0.325643, 0.575513, -0.484127, 0.114287, 0.79523, 0.0259761, -0.000542641, 0.99291, 0.861672, -0.0349052, 0.91458, 0.262654, -0.401842, 0.867887, 0.308139, -0.647215, 0.755083, -0.0886366, -0.870486, 0.33114, 0.417612, -0.866514, 0.0108376, -0.0876087, -0.864269, -0.231353, -0.309639, -0.344341, 0.885997, 0.0336854, -0.134712, 0.970873)
|
||||
|
||||
[node name="WorldItem_Goo" type="RigidBody3D"]
|
||||
script = ExtResource("1_ac2u7")
|
||||
item_name = "Goo"
|
||||
interact_prompt = "Pickup Goo"
|
||||
|
||||
[node name="Goo" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0)
|
||||
mesh = ExtResource("2_ke25d")
|
||||
skeleton = NodePath("../..")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_1bvp3")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0)
|
||||
shape = SubResource("ConvexPolygonShape3D_h2yge")
|
||||
@@ -5,3 +5,4 @@ extends InteractableObject
|
||||
func _interact ():
|
||||
var item = load("res://Items/ItemData/" + item_name + ".tres")
|
||||
GlobalSignals.on_give_player_item.emit(item, 1 )
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user