module JackalHelperDummyRefill

using ..Ahorn, Maple

@mapdef Entity "JackalHelper/DummyRefill" DummyRefill(
	x::Integer,
	y::Integer,

	twoDash::Bool=false,
	respawn::Number=2.5
)

const placements = Ahorn.PlacementDict(
	"Dummy Refill (Jackal Helper)" => Ahorn.EntityPlacement(
		DummyRefill
	),

	"Dummy Refill (Two Dashes) (Jackal Helper)" => Ahorn.EntityPlacement(
		DummyRefill,
		"point",
		Dict{String, Any}(
			"twoDash" => true
		)
	)
)

spriteOneDash = "objects/refill/idle00"
spriteTwoDash = "objects/refillTwo/idle00"

function getSprite(entity::DummyRefill)
	twoDash = get(entity.data, "twoDash", false)

	return twoDash ? spriteTwoDash : spriteOneDash
end

function Ahorn.selection(entity::DummyRefill)
	x, y = Ahorn.position(entity)
	sprite = getSprite(entity)

	return Ahorn.getSpriteRectangle(sprite, x, y)
end

function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::DummyRefill, room::Maple.Room)
	sprite = getSprite(entity)
	Ahorn.drawSprite(ctx, sprite, 0, 0)
end

end