<commit_before>
package luxe;

import luxe.components.Components;

class ParticleSystem extends Entity {

    public var active : Bool = true;
    public var emitters : Map<String, ParticleEmitter>;

    public function init( ) {
        if(emitters == null) new Map<String, ParticleEmitter>();
    } //init

    public function add_emitter(_template:Dynamic) {

        if(emitters == null) emitters = new Map<String, ParticleEmitter>();

        var _name : String = '';
        
        if(_template.name != null) {
            _name = _template.name;
        } //_template.name != null
            
        if(_name.length == 0) {
            _name = Luxe.utils.uniqueid();
        } //_name.lengths

            //create the emitter instance
        var _emitter = add(ParticleEmitter, _name, { system:this, template:_template });
        // var _emitter = new ParticleEmitter(_name, this, _template);
                //store the reference of the emitter
            emitters.set(_name, _emitter);

    } //add

    public function emit(duration:Float = -1) {
        active = true;
        for(emitter in emitters) {
            emitter.emit(duration);<commit_msg>Particles; fixing bug where init_with wasn't used for emitter components<commit_after>
package luxe;

import luxe.components.Components;

class ParticleSystem extends Entity {

    public var active : Bool = true;
    public var emitters : Map<String, ParticleEmitter>;

    public function init( ) {
        if(emitters == null) new Map<String, ParticleEmitter>();
    } //init

    public function add_emitter(_template:Dynamic) {

        if(emitters == null) emitters = new Map<String, ParticleEmitter>();

        var _name : String = '';
        
        if(_template.name != null) {
            _name = _template.name;
        } //_template.name != null
            
        if(_name.length == 0) {
            _name = Luxe.utils.uniqueid();
        } //_name.lengths

            //create the emitter instance
        var _emitter = add(ParticleEmitter, _name, { init_with : { system:this, template:_template } } );
        // var _emitter = new ParticleEmitter(_name, this, _template);
                //store the reference of the emitter
            emitters.set(_name, _emitter);

    } //add

    public function emit(duration:Float = -1) {
        active = true;
        for(emitter in emitters) {
            emitter.emit(duration);
{'fraction_non_alphanumeric': 0.10885761589403974, 'fraction_numerical': 0.0016556291390728477, 'mean_word_length': 2.218375499334221, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1729524', 'n_tokens_mistral': 688, 'n_tokens_neox': 657, 'n_words': 181}