Skip to content

Commit

Permalink
Small fixes and scene work.
Browse files Browse the repository at this point in the history
Cogito_Switch  / Button / Door:
- Changed methodology a key item is removed from inventory when required. (thanks to OvercastInteractive )

CogitoSnapSlot:
- Improved item snap slot example in the Laboratory scene.
  • Loading branch information
Phazorknight committed Sep 14, 2024
1 parent d30050d commit 8f6cbd4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion COGITO/CogitoObjects/cogito_button.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ func check_for_item() -> bool:
if slot_data != null and slot_data.inventory_item == required_item:
player_interaction_component.send_hint(null, required_item.name + " used.") # Sends a hint with the key item name.
if slot_data.inventory_item.discard_after_use:
inventory.remove_slot_data(slot_data)
inventory.remove_item_from_stack(slot_data)
# inventory.remove_slot_data(slot_data) (removed on 20240913, leaving line just in case there's bugs.
return true

if item_hint != "":
Expand Down
3 changes: 2 additions & 1 deletion COGITO/CogitoObjects/cogito_door.gd
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ func check_for_key(interactor):
if slot_data != null and slot_data.inventory_item == key:
interactor.send_hint(null, key.name + " used.") # Sends a hint with the key item name.
if slot_data.inventory_item.discard_after_use:
inventory.remove_slot_data(slot_data)
inventory.remove_item_from_stack(slot_data)
# inventory.remove_slot_data(slot_data) (removed on 20240913, leaving line just in case there's bugs.
unlock_door()

for nodepath in doors_to_sync_with:
Expand Down
3 changes: 2 additions & 1 deletion COGITO/CogitoObjects/cogito_switch.gd
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ func check_for_item() -> bool:
if slot_data != null and slot_data.inventory_item == required_item:
player_interaction_component.send_hint(null, required_item.name + " used.") # Sends a hint with the key item name.
if slot_data.inventory_item.discard_after_use:
inventory.remove_slot_data(slot_data)
inventory.remove_item_from_stack(slot_data)
# inventory.remove_slot_data(slot_data) (removed on 20240913, leaving line just in case there's bugs.
return true

if item_hint != "":
Expand Down
15 changes: 14 additions & 1 deletion COGITO/DemoScenes/COGITO_4_Laboratory.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=121 format=3 uid="uid://6hh7o77unixk"]
[gd_scene load_steps=122 format=3 uid="uid://6hh7o77unixk"]

[ext_resource type="Script" path="res://COGITO/SceneManagement/cogito_scene.gd" id="1_4dqq6"]
[ext_resource type="Texture2D" uid="uid://sdcljx8f5dhj" path="res://COGITO/Assets/hdris/kloofendal_48d_partly_cloudy_puresky_2k.hdr" id="1_ponqc"]
Expand Down Expand Up @@ -780,6 +780,10 @@ albedo_color = Color(0.117647, 0.117647, 0.117647, 1)
material = SubResource("StandardMaterial3D_lfkf8")
size = Vector3(0.1, 0.1, 2)

[sub_resource type="BoxMesh" id="BoxMesh_w38aj"]
material = SubResource("StandardMaterial3D_lfkf8")
size = Vector3(0.1, 0.1, 1)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xpdqy"]
resource_name = "metalLight"
albedo_color = Color(0.918013, 0.929502, 0.9647, 1)
Expand Down Expand Up @@ -3292,9 +3296,16 @@ mesh = SubResource("BoxMesh_6fdh2")
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -12.7, 1, 1.66153)
mesh = SubResource("BoxMesh_6fdh2")

[node name="CableA3" type="MeshInstance3D" parent="NavigationRegion3D/SYSTEMIC_PROPERTIES"]
transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, -9.392, 1.4, -3)
mesh = SubResource("BoxMesh_w38aj")

[node name="SnapSlotBattery" parent="NavigationRegion3D/SYSTEMIC_PROPERTIES" instance=ExtResource("47_71h2t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77805, 0.958914, -2.99995)

[node name="Lamp_ElectricWire2" parent="NavigationRegion3D/SYSTEMIC_PROPERTIES" instance=ExtResource("42_3rq3h")]
transform = Transform3D(-1.81058e-08, 1, -2.70212e-15, 6.18173e-08, 0, 1, 1, 1.81059e-08, -6.18173e-08, -9.524, 1.93194, -3)

[node name="Pickup_Battery" parent="NavigationRegion3D/SYSTEMIC_PROPERTIES" instance=ExtResource("48_y72lj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.94467, 0.180138, -3.20706)

Expand Down Expand Up @@ -3380,6 +3391,8 @@ transform = Transform3D(-1, -6.18173e-08, 6.18173e-08, 0, 0.707107, 0.707107, -8
[connection signal="body_exited" from="NavigationRegion3D/SYSTEMIC_PROPERTIES/Cathode_B" to="NavigationRegion3D/SYSTEMIC_PROPERTIES/Cathode_B" method="_on_body_exited"]
[connection signal="has_become_electric" from="NavigationRegion3D/SYSTEMIC_PROPERTIES/Cathode_B/CogitoProperties" to="NavigationRegion3D/SYSTEMIC_PROPERTIES/Lamp_ElectricWire" method="switch_on"]
[connection signal="has_lost_electricity" from="NavigationRegion3D/SYSTEMIC_PROPERTIES/Cathode_B/CogitoProperties" to="NavigationRegion3D/SYSTEMIC_PROPERTIES/Lamp_ElectricWire" method="switch_off"]
[connection signal="object_placed" from="NavigationRegion3D/SYSTEMIC_PROPERTIES/SnapSlotBattery" to="NavigationRegion3D/SYSTEMIC_PROPERTIES/Lamp_ElectricWire2" method="switch_on"]
[connection signal="object_removed" from="NavigationRegion3D/SYSTEMIC_PROPERTIES/SnapSlotBattery" to="NavigationRegion3D/SYSTEMIC_PROPERTIES/Lamp_ElectricWire2" method="switch_off"]
[connection signal="pressed" from="VendingMachine/GenericButton" to="VendingMachine/Spawnzone_VendingMachine" method="_on_generic_button_pressed"]
[connection signal="pressed" from="VendingMachine/GenericButton2" to="VendingMachine/Spawnzone_VendingMachine2" method="_on_generic_button_pressed"]
[connection signal="plate_activated" from="Cogito_Pressureplate" to="CeilingLamp" method="switch_on"]
Expand Down
4 changes: 2 additions & 2 deletions COGITO/PackedScenes/Pickups/pickup_dart.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ metallic = 1.0
height = 0.28
radius = 0.05

[sub_resource type="Resource" id="Resource_a1ixw"]
[sub_resource type="Resource" id="Resource_jnojv"]
resource_local_to_scene = true
script = ExtResource("4_qk8k6")
inventory_item = ExtResource("3_ohc35")
Expand Down Expand Up @@ -116,7 +116,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.14, 0)
shape = SubResource("CylinderShape3D_xbicr")

[node name="PickupComponent" parent="." instance=ExtResource("2_u01ym")]
slot_data = SubResource("Resource_a1ixw")
slot_data = SubResource("Resource_jnojv")

[node name="Lifespan" type="Timer" parent="."]

Expand Down

0 comments on commit 8f6cbd4

Please sign in to comment.