Fixed switch override
if/else tab error stupid
This commit is contained in:
@@ -380,10 +380,9 @@ script = ExtResource("13_v1s63")
|
|||||||
shape = SubResource("SphereShape3D_vyys8")
|
shape = SubResource("SphereShape3D_vyys8")
|
||||||
|
|
||||||
[node name="switch3" parent="Door1" groups=["interact", "switch_override"] instance=ExtResource("10_lktr8")]
|
[node name="switch3" parent="Door1" groups=["interact", "switch_override"] instance=ExtResource("10_lktr8")]
|
||||||
transform = Transform3D(1.655, 0, 0, 0, 1.655, 0, 0, 0, 1.655, 4.27439, 2.00195, -23.9803)
|
transform = Transform3D(1.655, 0, 0, 0, 1.655, 0, 0, 0, 1.655, 4.55934, 1.62823, -22.3877)
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
script = ExtResource("15_0sc55")
|
script = ExtResource("15_0sc55")
|
||||||
toggle_enabled = true
|
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="Door1/switch3" groups=["interact", "switch"]]
|
[node name="StaticBody3D" type="StaticBody3D" parent="Door1/switch3" groups=["interact", "switch"]]
|
||||||
collision_layer = 3
|
collision_layer = 3
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ func _ready() -> void:
|
|||||||
else:
|
else:
|
||||||
switches.append(i)
|
switches.append(i)
|
||||||
|
|
||||||
|
print("switches " + str(switches))
|
||||||
|
print("override switches " + str(switch_override))
|
||||||
|
|
||||||
func _on_switch_changed() -> void:
|
func _on_switch_changed() -> void:
|
||||||
|
|
||||||
var switches_needed = switches.size()
|
var switches_needed = switches.size()
|
||||||
@@ -27,17 +30,22 @@ func _on_switch_changed() -> void:
|
|||||||
switches_on += 1
|
switches_on += 1
|
||||||
|
|
||||||
#First check override switch and open or close door
|
#First check override switch and open or close door
|
||||||
if switch_override.switched_on:
|
if switch_override != null:
|
||||||
if door.door_open == false:
|
print("null check passed")
|
||||||
door.open()
|
if switch_override.switched_on:
|
||||||
else:
|
print("switched on")
|
||||||
if door.door_open == true:
|
if door.door_open == false:
|
||||||
door.close()
|
door.open()
|
||||||
|
else:
|
||||||
|
if door.door_open == true:
|
||||||
|
door.close()
|
||||||
|
|
||||||
#Otherwise follow standard switches
|
#Otherwise follow standard switches
|
||||||
elif switches_on >= switches_needed:
|
elif switches_on == switches_needed:
|
||||||
if door.door_open == false:
|
print("switch check run with " + str(switches_on) + "switches on")
|
||||||
door.open()
|
if door.door_open == false:
|
||||||
else:
|
door.open()
|
||||||
if door.door_open == true:
|
else:
|
||||||
door.close()
|
print("switch check run with " + str(switches_on) + "switches on")
|
||||||
|
if door.door_open == true:
|
||||||
|
door.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user