<commit_before>package com.bitdecay.game.system;

import com.bitdecay.game.component.BreakableObjectComponent;
import com.bitdecay.game.component.PhysicsComponent;
import com.bitdecay.game.component.SizeComponent;
import com.bitdecay.game.component.StaticImageComponent;
import com.bitdecay.game.gameobject.MyGameObject;
import com.bitdecay.game.room.AbstractRoom;
import com.bitdecay.game.system.abstracted.AbstractForEachUpdatableSystem;

/**
 * Created by Monday on 4/22/2017.
 */
public class BreakableObjectSystem extends AbstractForEachUpdatableSystem {


    public BreakableObjectSystem(AbstractRoom room) {
        super(room);
    }

    @Override
    protected boolean validateGob(MyGameObject gob) {
        return gob.hasComponents(
                BreakableObjectComponent.class,
                StaticImageComponent.class,
                PhysicsComponent.class,
                SizeComponent.class
        );
    }

    @Override
    protected void forEach(float delta, MyGameObject gob) {
        gob.forEachComponentDo(BreakableObjectComponent.class, breaker -> {
            gob.forEachComponentDo(StaticImageComponent.class, image -> {
                gob.forEachComponentDo(PhysicsComponent.class, phys -> {
                    gob.forEachComponentDo(SizeComponent.class, size -> {
                        if (phys.body.getLinearVelocity().len() > breaker.breakVelocity) {
                            image.setImage(breaker.image);
                            size.set(breaker.breakWidth, breaker.breakHeight);
                        }
                    });
                });
            });
        });
    }
}<commit_msg>leave a todo, come back later<commit_after>package com.bitdecay.game.system;

import com.badlogic.gdx.math.Vector2;
import com.bitdecay.game.component.BreakableObjectComponent;
import com.bitdecay.game.component.PhysicsComponent;
import com.bitdecay.game.component.SizeComponent;
import com.bitdecay.game.component.StaticImageComponent;
import com.bitdecay.game.gameobject.MyGameObject;
import com.bitdecay.game.room.AbstractRoom;
import com.bitdecay.game.system.abstracted.AbstractForEachUpdatableSystem;

/**
 * Created by Monday on 4/22/2017.
 */
public class BreakableObjectSystem extends AbstractForEachUpdatableSystem {


    public BreakableObjectSystem(AbstractRoom room) {
        super(room);
    }

    @Override
    protected boolean validateGob(MyGameObject gob) {
        return gob.hasComponents(
                BreakableObjectComponent.class,
                StaticImageComponent.class,
                PhysicsComponent.class,
                SizeComponent.class
        );
    }

    @Override
    protected void forEach(float delta, MyGameObject gob) {
        gob.forEachComponentDo(BreakableObjectComponent.class, breaker -> {
            gob.forEachComponentDo(StaticImageComponent.class, image -> {
                gob.forEachComponentDo(PhysicsComponent.class, phys -> {
                    gob.forEachComponentDo(SizeComponent.class, size -> {
                        Vector2 linearVelocity = phys.body.getLinearVelocity();
                        if (linearVelocity.len() > breaker.breakVelocity) {
                            image.setImage(breaker.image);
                            size.set(breaker.breakWidth, breaker.breakHeight);
                            // TODO figure out how to get these to feel 'good'
//                            phys.body.setTransform(phys.body.getPosition(), linearVelocity.angle());
                        }
                    });
                });
            });
        });
    }
}
{'fraction_non_alphanumeric': 0.08974715198666296, 'fraction_numerical': 0.004445679355376493, 'mean_word_length': 2.2490974729241877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1115592', 'n_tokens_mistral': 960, 'n_tokens_neox': 920, 'n_words': 146}