<commit_before>function Tank(offset, y_rotation) {
    var body = new TankBody(offset, y_rotation);
    var turret = new TankTurret(offset, y_rotation);

    adaptToTerrain = function() {
        var terrain_info = terrain.getMapHeightAndSlope(body.offset.x, body.offset.z);

        body.offset.y = terrain_info.y;
        turret.offset = body.offset;

        body.rotation.x = turret.rotation.x = terrain_info.slope.rotation_around_x;
        body.rotation.z = turret.rotation.z = terrain_info.slope.rotation_around_z;
    };
    adaptToTerrain(); // initial setup

    this.getOffset = function() {
        return body.offset;
    };

    this.getBodyYRotation = function() {
        return body.rotation.y;
    };

    this.getTurretYRotation = function() {
        return turret.rotation.y;
    };

    this.moveOnXAxis = function(units) {
        body.moveOnXAxis(units);
        setTurretOffset();
    };

    this.moveOnZAxis = function(units) {
        body.moveOnZAxis(units);
        adaptToTerrain();
    };

    this.placeOnTerrain = function() {
        adaptToTerrain();
    };

    this.rotateBodyOnYAxis = function(units) {
        body.rotateOnYAxis(units);
    };

    this.rotateTurretOnYAxis = function(units) {
        turret.rotateOnYAxis(units);
    };

    this.setPositionAndRotation = function(pos, y_rot) {
        body.offset = pos;
        body.rotation.y = y_rot;
        setTurretOffset();
    };

    this.update = function() {
        body.update();
        turret.update();
    };

    this.draw = function() {
        body.draw();
        turret.draw();
    };
}
<commit_msg>Resolve some scoping issues so multiple tanks are all able to stick to the landscape.<commit_after>function Tank(offset, y_rotation) {
    var body = new TankBody(offset, y_rotation);
    var turret = new TankTurret(offset, y_rotation);

    this.adaptToTerrain = function() {
        var terrain_info = terrain.getMapHeightAndSlope(body.offset.x, body.offset.z);

        body.offset.y = terrain_info.y;
        turret.offset = body.offset;

        body.rotation.x = turret.rotation.x = terrain_info.slope.rotation_around_x;
        body.rotation.z = turret.rotation.z = terrain_info.slope.rotation_around_z;
    };
    this.adaptToTerrain(); // initial setup

    this.getOffset = function() {
        return body.offset;
    };

    this.getBodyYRotation = function() {
        return body.rotation.y;
    };

    this.getBodyRotation = function() {
        return body.rotation;
    };

    this.getTurretYRotation = function() {
        return turret.rotation.y;
    };

    this.moveOnXAxis = function(units) {
        body.moveOnXAxis(units);
        this.adaptToTerrain();
    };

    this.moveOnZAxis = function(units) {
        body.moveOnZAxis(units);
        this.adaptToTerrain();
    };

    this.placeOnTerrain = function() {
        this.adaptToTerrain();
    };

    this.rotateBodyOnYAxis = function(units) {
        body.rotateOnYAxis(units);
    };

    this.rotateTurretOnYAxis = function(units) {
        turret.rotateOnYAxis(units);
    };

    this.setPositionAndRotation = function(pos, y_rot) {
        body.offset = pos;
        body.rotation.y = y_rot;
    };

    this.update = function() {
        body.update();
        turret.update();
    };

    this.draw = function() {
        body.draw();
        turret.draw();
    };
}

{'fraction_non_alphanumeric': 0.12399881340848413, 'fraction_numerical': 0.0, 'mean_word_length': 2.4060606060606062, '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': '2190261', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1054, 'n_words': 171}