{"size": 2030, "ext": "js", "max_stars_repo_path": "DomainContent/Zombies/gasMainButton.js", "max_stars_repo_name": "ArcadeFever/vircadia-content", "max_stars_repo_stars_event_min_datetime": "2017-11-17T08:42:43.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-26T04:43:32.000Z", "max_issues_repo_path": "DomainContent/Zombies/gasMainButton.js", "max_issues_repo_name": "ArcadeFever/vircadia-content", "max_issues_repo_issues_event_min_datetime": "2017-08-24T19:18:41.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-23T04:26:35.000Z", "max_forks_repo_path": "DomainContent/Zombies/gasMainButton.js", "max_forks_repo_name": "ArcadeFever/vircadia-content", "max_forks_repo_forks_event_min_datetime": "2017-08-24T18:14:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-16T00:41:39.000Z"}
{"max_stars_count": 19, "max_issues_count": 220, "max_forks_count": 94, "avg_line_length": 28.1944444444, "max_line_length": 90, "alphanum_fraction": 0.518226601}
//
// gasMainButton.js
// 
// Created by Rebecca Stankus on 03/07/2018
// Copyright High Fidelity 2018
//
// Licensed under the Apache 2.0 License
// See accompanying license file or http://apache.org/
//

(function(){
    var FIRE_BY_GAS_MAIN_1 = "{358ac501-b964-4502-a0d6-2be2be3691cd}";
    var FIRE_BY_GAS_MAIN_2 = "{21c65586-06c0-429b-9dc3-2a13d7e92a10}";
    var FIRE_BY_GENERATOR = "{84d98c70-fe1c-4624-a8ba-d0e9171a1e46}";
    var FIRE_BY_CAFE = "{88aec9a6-97cc-4828-9983-493ab81f9131}";
    var MAX_YAW = 0.9;
    var ANGULAR_VELOCITY = {
        x: 0,
        y: 0.75,
        z: 0
    };

    var _this;

    var Button = function() {
        _this = this;
    };

    Button.prototype = {
        preload: function(entityID) {
            _this.entityID = entityID;
            _this.reset();
        },
        reset: function() {
            Entities.editEntity(_this.entityID, {
                rotation: Quat.fromPitchYawRollDegrees(0,0,0)
            });
        },
        mousePressOnEntity: function(entityID, mouseEvent) {
            Entities.editEntity(_this.entityID, {
                angularVelocity: ANGULAR_VELOCITY
            });
            var yaw = Entities.getEntityProperties(_this.entityID, 'rotation').rotation.y;
            if (yaw > MAX_YAW) {
                Entities.editEntity(FIRE_BY_GAS_MAIN_1, {
                    visible: false,
                    collisionless: true
                });

                Entities.editEntity(FIRE_BY_GAS_MAIN_2, {
                    visible: false,
                    collisionless: true
                });

                Entities.editEntity(FIRE_BY_GENERATOR, {
                    visible: false,
                    collisionless: true,
                    locked: false
                });

                Entities.editEntity(FIRE_BY_CAFE, {
                    visible: false,
                    collisionless: true,
                    locked: true
                });
            }
        }
    };
    
    return new Button();
});
