extends Node2D

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

onready var sprite = $Sprite
onready var weird = $Weird
onready var to_basement = $ToBasement

func _ready():
	if global.game_vars.has("shovel_used"):
		used_shovel()

func _on_Weird_item_used(item_id) -> void:
	var inv = global.inventory
	if item_id == inv.Items.shovel:
		if inv.remove_item(item_id):
			var anim: AnimationPlayer = global.player.animation_player
			anim.play("GrabFloor")
			global.play_sound("shovel_dig")
			used_shovel()
			global.game_vars["shovel_used"] = true

func used_shovel() -> void:
	sprite.frame = 1
	weird.hide()
	to_basement.show()

func _on_Door_used():
	if !global.game_vars.has("rec_cartridge_used"):
		global.change_music("main")
