diff --git a/addons/inventory-system-demos/fps/dropped_items/campfire.tscn b/addons/inventory-system-demos/fps/dropped_items/campfire.tscn index df3b2f66..df27be9d 100644 --- a/addons/inventory-system-demos/fps/dropped_items/campfire.tscn +++ b/addons/inventory-system-demos/fps/dropped_items/campfire.tscn @@ -1,12 +1,11 @@ [gd_scene load_steps=6 format=3 uid="uid://dn6p5t574xtto"] [ext_resource type="PackedScene" uid="uid://bu50ku0vxmpwt" path="res://addons/inventory-system-demos/fps/dropped_items/dropped_item.tscn" id="1_ffr75"] -[ext_resource type="Resource" uid="uid://cricka5cb3hrg" path="res://addons/inventory-system-demos/base/items/campfire.tres" id="2_hlwm8"] +[ext_resource type="ItemDefinition" uid="uid://cricka5cb3hrg" path="res://addons/inventory-system-demos/base/items/campfire.tres" id="2_hlwm8"] [ext_resource type="PackedScene" uid="uid://bmewr3e0dn71h" path="res://addons/inventory-system-demos/assets/survival-kit-1.1/Models/GLTF format/campfire.glb" id="3_qwue6"] [sub_resource type="Item" id="Resource_82w71"] definition = ExtResource("2_hlwm8") -properties = {} [sub_resource type="BoxShape3D" id="BoxShape3D_ffk2p"] size = Vector3(0.230849, 0.262369, 0.22973) diff --git a/addons/inventory-system-demos/fps/dropped_items/dropped_item.tscn b/addons/inventory-system-demos/fps/dropped_items/dropped_item.tscn index 7d054c65..445de8d1 100644 --- a/addons/inventory-system-demos/fps/dropped_items/dropped_item.tscn +++ b/addons/inventory-system-demos/fps/dropped_items/dropped_item.tscn @@ -3,9 +3,7 @@ [ext_resource type="Script" path="res://addons/inventory-system/extras/dropped_item_3d.gd" id="1_qx0iq"] [sub_resource type="InteractAction" id="Resource_w5bs8"] -input = "interact" description = "Get Item" -code = 0 [sub_resource type="BoxShape3D" id="BoxShape3D_6n6kg"] size = Vector3(0.4, 0.4, 0.4) diff --git a/addons/inventory-system/editor/items/item_editor.tscn b/addons/inventory-system/editor/items/item_editor.tscn index 3d3381e3..475242c7 100644 --- a/addons/inventory-system/editor/items/item_editor.tscn +++ b/addons/inventory-system/editor/items/item_editor.tscn @@ -5,7 +5,7 @@ [ext_resource type="PackedScene" uid="uid://bl40ri4you0n5" path="res://addons/inventory-system/editor/items/categories_in_item.tscn" id="3_cy8bj"] [ext_resource type="PackedScene" uid="uid://c1am6gfdvbcgx" path="res://addons/inventory-system/editor/items/custom_properties.tscn" id="3_obam6"] -[sub_resource type="Image" id="Image_thk57"] +[sub_resource type="Image" id="Image_000oo"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 131, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 131, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 131, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 93, 93, 55, 255, 97, 97, 58, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0), "format": "RGBA8", @@ -15,9 +15,9 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_uoasd"] -image = SubResource("Image_thk57") +image = SubResource("Image_000oo") -[sub_resource type="Image" id="Image_dybfd"] +[sub_resource type="Image" id="Image_ew0e3"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0), "format": "RGBA8", @@ -26,8 +26,8 @@ data = { "width": 16 } -[sub_resource type="ImageTexture" id="ImageTexture_7ntid"] -image = SubResource("Image_dybfd") +[sub_resource type="ImageTexture" id="ImageTexture_a4jr3"] +image = SubResource("Image_ew0e3") [node name="ItemEditor" type="Control"] custom_minimum_size = Vector2(256, 0) @@ -92,7 +92,7 @@ custom_minimum_size = Vector2(160, 0) [node name="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/ItemIDEditor" index="2"] tooltip_text = "Edit" -icon = SubResource("ImageTexture_7ntid") +icon = SubResource("ImageTexture_a4jr3") [node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -148,7 +148,9 @@ text = "Item Weight" custom_minimum_size = Vector2(0, 32) layout_mode = 2 size_flags_horizontal = 3 +max_value = 100000.0 step = 0.001 +value = 0.1 allow_greater = true allow_lesser = true @@ -192,28 +194,28 @@ layout_mode = 2 [node name="ItemResourceFileDialog" type="FileDialog" parent="."] title = "Open a File" size = Vector2i(326, 162) -ok_button_text = "Abrir" +ok_button_text = "Open" file_mode = 0 filters = PackedStringArray("*.tres ; ItemDefinition") [node name="IconFileDialog" type="FileDialog" parent="."] title = "Open a File" size = Vector2i(326, 162) -ok_button_text = "Abrir" +ok_button_text = "Open" file_mode = 0 filters = PackedStringArray("*.png ; Texture2D") [node name="HandItemFileDialog" type="FileDialog" parent="."] title = "Open a File" size = Vector2i(326, 162) -ok_button_text = "Abrir" +ok_button_text = "Open" file_mode = 0 filters = PackedStringArray("*.tscn ; PackedScene") [node name="DroppedItemFileDialog" type="FileDialog" parent="."] title = "Open a File" size = Vector2i(326, 162) -ok_button_text = "Abrir" +ok_button_text = "Open" file_mode = 0 filters = PackedStringArray("*.tscn ; PackedScene") diff --git a/addons/inventory-system/extras/character_inventory_system.gd b/addons/inventory-system/extras/character_inventory_system.gd index deed01dd..81438740 100644 --- a/addons/inventory-system/extras/character_inventory_system.gd +++ b/addons/inventory-system/extras/character_inventory_system.gd @@ -23,6 +23,7 @@ signal dropped(node : Node) @export_group("⌨️ Inputs") ## Change mouse state based on inventory status @export var change_mouse_state : bool = true +@export var check_inputs : bool = true @export var toggle_inventory_input : String = "toggle_inventory" @export var exit_inventory_and_craft_panel_input : String = "escape" @export var toggle_craft_panel_input : String = "toggle_craft_panel" @@ -61,8 +62,9 @@ func _ready(): func _input(event : InputEvent) -> void: if Engine.is_editor_hint(): return - hot_bar_inputs(event) - inventory_inputs() + if check_inputs: + hot_bar_inputs(event) + inventory_inputs() func _physics_process(_delta : float): @@ -73,15 +75,20 @@ func _physics_process(_delta : float): interactor.try_interact() +func is_any_station_or_inventory_opened() -> bool: + return crafter.is_open_any_station() or inventory_handler.is_open_main_inventory() + + func _update_opened_inventories(_inventory : Inventory): - if inventory_handler.is_open_main_inventory(): - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - else: - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + _check_inputs() func _update_opened_stations(_craft_station : CraftStation): - if crafter.is_open_any_station(): + _check_inputs() + + +func _check_inputs(): + if is_any_station_or_inventory_opened(): Input.mouse_mode = Input.MOUSE_MODE_VISIBLE else: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED @@ -89,7 +96,7 @@ func _update_opened_stations(_craft_station : CraftStation): func inventory_inputs(): if Input.is_action_just_released(toggle_inventory_input): - if not inventory_handler.is_open_any_inventory() and not crafter.is_open_any_station(): + if not is_any_station_or_inventory_opened(): open_main_inventory() if Input.is_action_just_released(exit_inventory_and_craft_panel_input): @@ -97,7 +104,7 @@ func inventory_inputs(): close_craft_stations() if Input.is_action_just_released(toggle_craft_panel_input): - if not inventory_handler.is_open_any_inventory() and not crafter.is_open_any_station(): + if not is_any_station_or_inventory_opened(): open_main_craft_station() @@ -136,13 +143,18 @@ func transaction_to_at(slot_index : int, inventory : Inventory, amount_to_move : func pick_to_inventory(node : Node): inventory_handler.pick_to_inventory(node) + +func add_to_inventory(item : Item, amount : int): + inventory_handler.add_to_inventory(inventory_handler.get_inventory(0), item, amount) + + ## Crafter func craft(craft_station : CraftStation, recipe_index : int): craft_station.craft(recipe_index) func open_main_craft_station(): - inventory_handler.open_main_inventory() + crafter.open_main_craft_station() func close_craft_stations(): diff --git a/addons/inventory-system/multiplayer/networked_character_inventory_system.gd b/addons/inventory-system/multiplayer/networked_character_inventory_system.gd index 930dbf3a..c76e74aa 100644 --- a/addons/inventory-system/multiplayer/networked_character_inventory_system.gd +++ b/addons/inventory-system/multiplayer/networked_character_inventory_system.gd @@ -19,7 +19,7 @@ func _ready(): func _input(event : InputEvent): if Engine.is_editor_hint(): return - if is_multiplayer_authority(): + if check_inputs and is_multiplayer_authority(): hot_bar_inputs(event) inventory_inputs() @@ -82,6 +82,13 @@ func pick_to_inventory(node : Node): pick_to_inventory_rpc.rpc_id(1, node.get_path()) +func add_to_inventory(item : Item, amount : int): + if multiplayer.is_server(): + super.add_to_inventory(item, amount) + else: + add_to_inventory_rpc.rpc_id(1, item.definition.id, amount) + + func open_main_craft_station(): if multiplayer.is_server(): super.open_main_craft_station() @@ -199,6 +206,13 @@ func pick_to_inventory_rpc(node_path : NodePath): super.pick_to_inventory(get_node(node_path)) +@rpc +func add_to_inventory_rpc(item_id : int, amount : int): + var item = Item.new() + item.definition = get_item_from_id(item_id) + super.add_to_inventory(item, amount) + + @rpc func open_main_craft_station_rpc(): super.open_main_craft_station() @@ -220,7 +234,8 @@ func close_stations_rpc(): func craft_rpc(craft_station_path : NodePath, recipe_index : int): var station = get_node(craft_station_path) station.craft(recipe_index) - + + @rpc func hotbar_change_selection_rpc(index : int): hotbar.change_selection(index) @@ -243,5 +258,5 @@ func _physics_process(_delta : float): return if not can_interact: return - if is_multiplayer_authority(): + if multiplayer.multiplayer_peer != null and is_multiplayer_authority(): interactor.try_interact() diff --git a/addons/inventory-system/plugin.cfg b/addons/inventory-system/plugin.cfg index 33c9ba2c..473cd150 100644 --- a/addons/inventory-system/plugin.cfg +++ b/addons/inventory-system/plugin.cfg @@ -3,5 +3,5 @@ name="Inventory System" description="Inventory System for Godot 4 Networked" author="Expresso Bits" -version="1.0.3" +version="1.0.5" script="inventory-system.gd"