
@BaseScript(EntityTypeScript)


@BaseScript(EntityTypeScript)
/**
 * 
 */
package scripts.types

import groovy.transform.BaseScript
import studio.junk.jam.coloritum.EntityTypeScript
import studio.junk.jam.coloritum.GameState
import studio.junk.jam.coloritum.entities.components.Animated
import studio.junk.jam.coloritum.entities.components.Collision
import studio.junk.jam.coloritum.entities.components.Lights
import studio.junk.jam.coloritum.entities.components.PigmentComponent
import studio.junk.jam.coloritum.entities.components.Placable
import studio.junk.jam.coloritum.entities.components.Source
import studio.junk.jam.coloritum.entities.components.TilePosition
import studio.junk.jam.coloritum.screen.InGame
import box2dLight.Light
import box2dLight.PointLight

/**
 * Needs arguments:
 * Vector2 agrs[0]: position
 * int args[1]    : emision period
 * Pigment args[2]: pigment
 * 
 * @author cryptjar
 *
 */

entity {
	addStatic this.args[0], 0.5f
	add new TilePosition(this.args[0])
	add new Source(this.args[1])
	add new PigmentComponent(this.args[2])
	Light[] ls = new Light[1];
	ls[0] = new PointLight(InGame.rayLightsHandler, GameState.RAYS_NUM, this.args[2].color.cpy().mul(1,1,1,0.8f), 3f, this.args[0].x, this.args[0].y)
	ls[0].attachToBody(Collision.mapper.get(ent).body, 0, 0)
	add new Lights(ls)
	
	add new Animated(this.getAnim("source"));
	add new Placable()
}
