<commit_before>package com.spaceproject.systems;


import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IteratingSystem;
import com.spaceproject.components.HyperDriveComponent;
import com.spaceproject.components.PhysicsComponent;
import com.spaceproject.components.TransformComponent;
import com.spaceproject.utility.Mappers;
import com.spaceproject.utility.MyMath;

public class HyperDriveSystem extends IteratingSystem {
    
    public HyperDriveSystem() {
        super(Family.all(TransformComponent.class, HyperDriveComponent.class).get());
    }
    
    @Override
    protected void processEntity(Entity entity, float deltaTime) {
        HyperDriveComponent hyperDrive = Mappers.hyper.get(entity);
        
        toggleHyperDrive(entity, hyperDrive);
        
        if (hyperDrive.isActive) {
            TransformComponent transform = Mappers.transform.get(entity);
            transform.pos.add(hyperDrive.velocity.cpy().scl(deltaTime));
        }
    }
    
    private void toggleHyperDrive(Entity entity, HyperDriveComponent hyperDrive) {
        if (hyperDrive.activate) {
            if (hyperDrive.coolDownTimer.tryEvent()) {
                PhysicsComponent physicsComp = Mappers.physics.get(entity);
                if (hyperDrive.isActive) {
                    hyperDrive.isActive = false;
                    physicsComp.body.setTransform(entity.getComponent(TransformComponent.class).pos, physicsComp.body.getAngle());
                    physicsComp.body.setActive(true);
                    physicsComp.body.setLinearVelocity(MyMath.vector(physicsComp.body.getAngle(), 20));
                } else {
                    hyperDrive.isActive = true;
                    hyperDrive.velocity.set(MyMath.vector(physicsComp.body.getAngle(), hyperDrive.speed));
                    physicsComp.body.setActive(false);
                }
            }
        }
    }
    
}<commit_msg>Update HyperDriveSystem.java<commit_after>package com.spaceproject.systems;


import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IteratingSystem;
import com.spaceproject.components.HyperDriveComponent;
import com.spaceproject.components.PhysicsComponent;
import com.spaceproject.components.TransformComponent;
import com.spaceproject.utility.Mappers;
import com.spaceproject.utility.MyMath;

public class HyperDriveSystem extends IteratingSystem {
    
    public HyperDriveSystem() {
        super(Family.all(TransformComponent.class, HyperDriveComponent.class).get());
    }
    
    @Override
    protected void processEntity(Entity entity, float deltaTime) {
        HyperDriveComponent hyperDrive = Mappers.hyper.get(entity);
        
        toggleHyperDrive(entity, hyperDrive);
        
        if (hyperDrive.isActive) {
            TransformComponent transform = Mappers.transform.get(entity);
            transform.pos.add(hyperDrive.velocity.cpy().scl(deltaTime));
        }
    }
    
    private void toggleHyperDrive(Entity entity, HyperDriveComponent hyperDrive) {
        if (hyperDrive.activate && hyperDrive.coolDownTimer.tryEvent()) {
            PhysicsComponent physicsComp = Mappers.physics.get(entity);
            if (hyperDrive.isActive) {
                hyperDrive.isActive = false;
                physicsComp.body.setTransform(entity.getComponent(TransformComponent.class).pos, physicsComp.body.getAngle());
                physicsComp.body.setActive(true);
                physicsComp.body.setLinearVelocity(MyMath.vector(physicsComp.body.getAngle(), 20));
            } else {
                hyperDrive.isActive = true;
                hyperDrive.velocity.set(MyMath.vector(physicsComp.body.getAngle(), hyperDrive.speed));
                physicsComp.body.setActive(false);
            }
            
        }
    }
    
}
{'fraction_non_alphanumeric': 0.09598558929490479, 'fraction_numerical': 0.001029336078229542, 'mean_word_length': 2.751930501930502, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6076247', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1054, 'n_words': 146}