revo-jailbreak/objects/environment/switches/switch.gd

19 lines
531 B
GDScript

tool
extends Node2D
export (String) var target_group = ""
func activate():
for object in get_tree().get_nodes_in_group(target_group):
object.switch_action()
func _process(delta):
# redraw lines every frame to account for things changing
if Engine.editor_hint and Engine.get_frames_drawn() % 10 == 0:
update()
func _draw():
if Engine.editor_hint:
for node in get_tree().get_nodes_in_group(target_group):
if node is Node2D:
draw_line(Vector2.ZERO, to_local(node.global_position), Color(0.2, 1.0, 0.0, 0.5), 1.5)