<commit_before>import React from 'react';

const Barrel = (props) => {
  const position = props.position || '0 0 0';
  const rotation = props.rotation || '0 0 0';
  const barrelLength = props.barrelLength || 5;
  // TODO: Make better turret angle interpolator
  return (
    <a-entity class='turret' position={position} rotation={rotation}>
      <a-cylinder height={barrelLength} radius='0.2' material={props.material}
      position={`0 0 ${-barrelLength / 2}`} rotation='90 0 0' />
      <a-cylinder height='0.3' radius='0.25' material={props.material}
      position={`0 0 ${-barrelLength}`}
      rotation='90 0 0' />
    </a-entity>
  )
};

module.exports = Barrel;
<commit_msg>Make Barrel component take advantage of dynamic event-listener<commit_after>import React from 'react';

const Barrel = (props) => {
  const position = props.position || '0 0 0';
  const rotation = props.rotation || '0 0 0';
  const barrelLength = props.barrelLength || 6;
  // TODO: Make better turret angle interpolator
  if(props.fireEvent) {
    const fireEventArray = props.fireEvent.replace(' ', '').split(';');
    const event = fireEventArray.filter(params => params.slice(0,3) === 'on:')[0];
    return (
      <a-entity class='barrel' position={position} rotation={rotation}>
        <a-cylinder height={barrelLength} radius='0.2' material={props.material}
        position={`0 0 ${-barrelLength / 2}`} rotation='90 0 0' />
        <a-cylinder height='0.3' radius='0.25' material={props.material}
        position={`0 0 ${-barrelLength}`}
        rotation='90 0 0' 
        spawner={`mixin: projectile; ${event}`}
        event-listener={props.fireEvent}/>

        {props.children}

      </a-entity>
    )
  } else {
    return (
      <a-entity class='barrel' position={position} rotation={rotation}>
        <a-cylinder height={barrelLength} radius='0.2' material={props.material}
        position={`0 0 ${-barrelLength / 2}`} rotation='90 0 0' />
        <a-cylinder height='0.3' radius='0.25' material={props.material}
        position={`0 0 ${-barrelLength}`}
        rotation='90 0 0' />

        {props.children}

      </a-entity>
    )
  }
};

module.exports = Barrel;

{'fraction_non_alphanumeric': 0.1679705476300046, 'fraction_numerical': 0.0354348826507133, 'mean_word_length': 3.2131782945736433, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 18, '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': '1985483', 'n_tokens_mistral': 743, 'n_tokens_neox': 702, 'n_words': 167}