local ImpactEffectSystem = inherited("ImpactEffectSystem", SystemMap)

function ImpactEffectSystem:new()
	local ms = instance(self)
	return ms
end

function ImpactEffectSystem:wants(ent)
	return ent.aspects.impact_effect
end

function ImpactEffectSystem:ent_added(ent)
end

function ImpactEffectSystem:ent_removed(ent)
end

function ImpactEffectSystem:step(dt)
	local world = self.world
	for ent, _ in pairs(self.ents) do
		if ent.any_impact then
			local effect = ent.effect
			local target = ent.impact_target
			if effect and target then
				effect:apply_to(target, ent, ent.effect_power)
			end
			world:remove_ent(ent)
		end	
	end
end

return ImpactEffectSystem