extends StaticBody

var ammo_pickup = preload("res://objects/pickups/Item_pickup.tscn")
var health_pickup = preload("res://objects/pickups/Item_pickup.tscn")
var crabhead = preload("res://objects/enemies/crabhead/Crabhead.tscn")

var particles = preload("res://objects/particles/Cube_Particles.tscn")


enum CONTAINS {
	NOTHING,
	AMMO,
	HEALTH,
	CRABHEAD
}

export(CONTAINS) var contents = CONTAINS.NOTHING


func take_damage(amount,type = 0, source = null):
	var new_contents = null
	if contents == CONTAINS.AMMO:
		new_contents = ammo_pickup.instance()
	elif contents == CONTAINS.HEALTH:
		new_contents = health_pickup.instance()
	elif contents == CONTAINS.CRABHEAD:
		new_contents = crabhead.instance()
		
	if new_contents != null:
		new_contents.translation = translation
		get_parent().add_child(new_contents)
		
	var new_particles = particles.instance()
	new_particles.translation = translation
	get_parent().add_child(new_particles)
	
	queue_free()
