extends Node2D

onready var global: Node = get_node("/root/Global")

onready var wall = $Wall

func _ready():
	if global.game_vars.has("cartridge_grabbed"):
		grabbed_cartridge()

func _on_LinkButton_pressed() -> void:
	if wall.frame == 0:
		if global.inventory.add_item(global.inventory.Items.cartridge):
			global.game_vars["cartridge_grabbed"] = true
			global.play_sound("cartridge_grab")
			grabbed_cartridge()

func grabbed_cartridge() -> void:
	wall.frame = 1
