doors are now assigned via door script
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
extends Node
|
||||
|
||||
@export var door : Node
|
||||
|
||||
var switches = []
|
||||
var doors = []
|
||||
var switch_override : Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -17,6 +16,8 @@ func _ready() -> void:
|
||||
switch_override = i
|
||||
else:
|
||||
switches.append(i)
|
||||
if i.is_in_group("door"):
|
||||
doors.append(i)
|
||||
|
||||
#print("switches " + str(switches))
|
||||
#print("override switches " + str(switch_override))
|
||||
@@ -34,27 +35,32 @@ func _on_switch_changed() -> void:
|
||||
print("null check passed")
|
||||
if switch_override.switched_on:
|
||||
print("switched on")
|
||||
if door.door_open == false:
|
||||
door.open()
|
||||
else:
|
||||
if door.door_open == true:
|
||||
door.close()
|
||||
for i in doors:
|
||||
if i.door_open == false:
|
||||
i.open()
|
||||
else:
|
||||
if i.door_open == false:
|
||||
i.open()
|
||||
#Otherwise follow standard switches
|
||||
elif switches_on == switches_needed:
|
||||
print("switch check run with " + str(switches_on) + "switches on")
|
||||
if door.door_open == false:
|
||||
door.open()
|
||||
for i in doors:
|
||||
if i.door_open == false:
|
||||
i.open()
|
||||
else:
|
||||
print("switch check run with " + str(switches_on) + "switches on")
|
||||
if door.door_open == true:
|
||||
door.close()
|
||||
for i in doors:
|
||||
if i.door_open == true:
|
||||
i.close()
|
||||
|
||||
#Otherwise follow standard switches
|
||||
elif switches_on == switches_needed:
|
||||
print("switch check run with " + str(switches_on) + "switches on")
|
||||
if door.door_open == false:
|
||||
door.open()
|
||||
for i in doors:
|
||||
if i.door_open == false:
|
||||
i.open()
|
||||
else:
|
||||
print("switch check run with " + str(switches_on) + "switches on")
|
||||
if door.door_open == true:
|
||||
door.close()
|
||||
for i in doors:
|
||||
if i.door_open == true:
|
||||
i.close()
|
||||
|
||||
Reference in New Issue
Block a user