Skip to content

Commit

Permalink
Update version to 0.4.5 and enhance inventory slot references in play…
Browse files Browse the repository at this point in the history
…er scene
  • Loading branch information
sebashtioon committed Nov 20, 2024
1 parent ef64dcf commit 06b9927
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Scenes and Scripts/Scenes/Main Menu/MainMenu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true

[node name="Version" type="Label" parent="Camera3D/MainLayer"]
[node name="Version_LBL" type="Label" parent="Camera3D/MainLayer"]
modulate = Color(1, 1, 1, 0.259)
anchors_preset = 1
anchor_left = 1.0
Expand All @@ -384,7 +384,7 @@ offset_bottom = 39.0
grow_horizontal = 0
theme = ExtResource("4_grlcg")
theme_override_font_sizes/font_size = 26
text = "v0.4.0"
text = "v0.4.5"

[node name="FadeOut" type="ColorRect" parent="Camera3D/MainLayer"]
anchors_preset = 15
Expand Down
16 changes: 16 additions & 0 deletions Scenes and Scripts/Scenes/Player/Inventory/InventorySlot_SCRIPT.gd
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extends StaticBody2D

@export var is_touching_draggable = false
@export var populated = false
@export var reserved_for_populating = false

func _ready():
modulate = Color(1, 1, 1, 0.05)
Expand All @@ -74,6 +75,21 @@ func set_populated(populatedValue : bool):
print("{LOCAL} [InventorySlot_SCRIPT.gd] Empty, Slot: " + str(name))
populated = false

func is_reserved_for_populating():
if reserved_for_populating:
return true
else:
return false

func set_reserved_for_populating(value : bool):
if value:
reserved_for_populating = true
print("{LOCAL} [InventorySlot_SCRIPT.gd] Reserved for populating, Slot: " + str(name))
else:
print("{LOCAL} [InventorySlot_SCRIPT.gd] Cleared reservation for populating, Slot: " + str(name))
reserved_for_populating = false


func _on_draggable_detector_area_entered(area: Area2D) -> void:
if area.is_in_group("draggable"):
if $AlreadyPopulatedChecker.time_left > 0.0:
Expand Down
11 changes: 10 additions & 1 deletion Scenes and Scripts/Scenes/Player/Player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ size = Vector2(1101.5, 236)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_47l1q"]
size = Vector2(417.75, 819)

[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("head", "camera", "Inventory_Item_Ref_Label", "Is_Raycast_Colliding_Label", "Is_Inside_Settings_Label", "Is_Moving_Label", "Is_Walking_Label", "Is_Sprinting_Label", "Is_Crouching_Label", "Showing_Interaction_Notification_Label", "Current_Time_Label", "Current_FPS_Label", "Player_Position_Label", "Player_VelocityY_Label", "Player_VelocityY_Accurate_Label", "Is_On_Floor_Label", "Inputs_Currently_Pressing_Label") groups=["PlayerBody"]]
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("head", "camera", "Slot1_Ref", "Slot2_Ref", "Slot3_Ref", "Slot4_Ref", "Slot5_Ref", "Slot6_Ref", "Slot7_Ref", "Slot8_Ref", "Slot9_Ref", "Inventory_Item_Ref_Label", "Is_Raycast_Colliding_Label", "Is_Inside_Settings_Label", "Is_Moving_Label", "Is_Walking_Label", "Is_Sprinting_Label", "Is_Crouching_Label", "Showing_Interaction_Notification_Label", "Current_Time_Label", "Current_FPS_Label", "Player_Position_Label", "Player_VelocityY_Label", "Player_VelocityY_Accurate_Label", "Is_On_Floor_Label", "Inputs_Currently_Pressing_Label") groups=["PlayerBody"]]
collision_mask = 3
script = ExtResource("1_5mhs1")
Fade_In = true
Expand All @@ -97,6 +97,15 @@ CROUCH_SPEED = 2.0
CROUCH_INTERPOLATION = 8.0
head = NodePath("Head")
camera = NodePath("Head/Camera3D")
Slot1_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot1")
Slot2_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot2")
Slot3_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot3")
Slot4_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot4")
Slot5_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot5")
Slot6_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot6")
Slot7_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot7")
Slot8_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot8")
Slot9_Ref = NodePath("Head/Camera3D/InventoryLayer/Slot9")
Inventory_Item_Ref_Label = NodePath("Head/Camera3D/DebugLayer/item_ref_LBL")
Is_Raycast_Colliding_Label = NodePath("Head/Camera3D/DebugLayer/is_raycast_colliding")
Is_Inside_Settings_Label = NodePath("Head/Camera3D/DebugLayer/is_inside_settings")
Expand Down
44 changes: 28 additions & 16 deletions Scenes and Scripts/Scenes/Player/Player_SCRIPT.gd
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ var is_crouching = false
@export var head : Node3D # Reference to the head of the player scene. (used for mouse movement and looking around)
@export var camera : Camera3D # Reference to the camera of the player (used for mouse movement and looking around)

@export_subgroup("Inventory")
@export var Slot1_Ref : StaticBody2D
@export var Slot2_Ref : StaticBody2D
@export var Slot3_Ref : StaticBody2D
@export var Slot4_Ref : StaticBody2D
@export var Slot5_Ref : StaticBody2D
@export var Slot6_Ref : StaticBody2D
@export var Slot7_Ref : StaticBody2D
@export var Slot8_Ref : StaticBody2D
@export var Slot9_Ref : StaticBody2D

@export_subgroup("Debug")
@export var Inventory_Item_Ref_Label : Label
@export var Is_Raycast_Colliding_Label : Label
Expand Down Expand Up @@ -554,41 +565,42 @@ func _on_boundary_area_exited(area):
func _on_pickup_object_detector_area_entered(area: Area3D) -> void:
if area.is_in_group("pickup_player_detector"):
var slots = [
$Head/Camera3D/InventoryLayer/Slot1,
$Head/Camera3D/InventoryLayer/Slot2,
$Head/Camera3D/InventoryLayer/Slot3,
$Head/Camera3D/InventoryLayer/Slot4,
$Head/Camera3D/InventoryLayer/Slot5,
$Head/Camera3D/InventoryLayer/Slot6,
$Head/Camera3D/InventoryLayer/Slot7,
$Head/Camera3D/InventoryLayer/Slot8,
$Head/Camera3D/InventoryLayer/Slot9
Slot1_Ref,
Slot2_Ref,
Slot3_Ref,
Slot4_Ref,
Slot5_Ref,
Slot6_Ref,
Slot7_Ref,
Slot8_Ref,
Slot9_Ref,
]

var free_slot = null


# Get the free slot
for i in range(slots.size()):
if not slots[i].is_populated():
free_slot = slots[i]
break



if free_slot != null:
# Use the free_slot variable as needed
print("{LOCAL} [Player_SCRIPT.gd] Free slot found: " + free_slot.name)


print("{LOCAL} [Player_SCRIPT.gd] Free slot found: " + free_slot.name)

var PickupObject = area.get_parent()
var PickupItemType = PickupObject.get_ITEM_TYPE()
var PlayerPos = $PickupAttractionPos.global_position

print("{LOCAL} [Player_SCRIPT.gd] Collided with pickup player detector! Item: " + PickupItemType)

var tween = get_tree().create_tween().set_parallel()

var tween = get_tree().create_tween()
tween.tween_property(PickupObject, "position", PlayerPos, 0.2).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE)

await get_tree().create_timer(0.2).timeout
tween.stop()
tween.kill()
delete_pickup_object(PickupObject)
InventoryManager.spawn_inventory_dropable(free_slot.position, PickupItemType, free_slot)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ grow_vertical = 2
theme = ExtResource("2_og75x")
theme_override_font_sizes/font_size = 35
text = "This is a pre-release version of Expland!
You are currently playing v0.4.0."
You are currently playing v0.4.5."
horizontal_alignment = 1
vertical_alignment = 1

Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ config_version=5
config/name="Expland"
config/description="Expland
"
config/version="0.4.0"
config/version="0.4.5"
config/tags=PackedStringArray("3d", "noeco", "official")
run/main_scene="res://Scenes and Scripts/Scenes/Main Menu/MainMenu.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
Expand Down

0 comments on commit 06b9927

Please sign in to comment.