Exemple #1
0
        public static void Init()
        {
            Core.Console.Profiles.Init();
            Core.Console.Console.Init();
            ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap");

            globalActionMap.bindCmd("keyboard", "tilde", "toggleConsole(true);");
        }
Exemple #2
0
        public static void initializePhysicsTools()
        {
            Omni.self.Print(" % - Initializing Physics Tools");

            if (!omni.Util.physicsPluginPresent())
            {
                omni.Util._echo("No physics plugin exists.");
                return;
            }
            ActionMap globalactionmap = "globalactionmap";

            globalactionmap.bindCmd("keyboard", "alt t", "physicsToggleSimulation();", "");
            globalactionmap.bindCmd("keyboard", "alt r", "physicsRestoreState();", "");

            ObjectCreator o = new ObjectCreator("ScriptObject", "PhysicsEditorPlugin", typeof(PhysicsEditorPlugin));

            o["editorGui"] = "EWorldEditor";
            o.Create();
        }
Exemple #3
0
        public static void onStart()
        {
            // Create objects!
            SimGroup gameGroup = new SimGroup("GameGroup");

            gameGroup.Name = "GameGroup";
            gameGroup.registerObject();

            LevelInfo levelInfo = new LevelInfo("TheLevelInfo")
            {
                CanvasClearColor = new ColorI(0, 0, 0, 0)
            };

            levelInfo.registerObject();

            GroundPlane groundPlane = new GroundPlane("TheGround")
            {
                Position = Point3F.Zero,
                Material = "BlankWhite"
            };

            groundPlane.registerObject();

            Sun sun = new Sun("TheSun")
            {
                Azimuth     = 230,
                Elevation   = 45,
                Color       = ColorF.WHITE,
                Ambient     = new ColorF(0.1f, 0.1f, 0.1f, 1),
                CastShadows = true
            };

            sun.registerObject();

            gameGroup.add(levelInfo, groundPlane, sun);

            // Allow us to exit the game...
            ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap");

            globalActionMap.bindCmd("keyboard", "escape", "quit");
        }
Exemple #4
0
        public static void initialize()
        {
            if ("moveMap".isObject())
            {
                "moveMap".delete();
            }

            ActionMap moveMap         = new ObjectCreator("ActionMap", "moveMap").Create();
            ActionMap GlobalActionMap = "GlobalActionMap";

            moveMap.bindCmd("keyboard", "escape", "", "handleEscape();");
            moveMap.bind("keyboard", "ctrl h", "hideHUDs");
            moveMap.bind("keyboard", "alt p", "doScreenShotHudless");

            moveMap.bind("keyboard", "a", "moveleft");
            moveMap.bind("keyboard", "d", "moveright");
            moveMap.bind("keyboard", "left", "moveleft");
            moveMap.bind("keyboard", "right", "moveright");

            moveMap.bind("keyboard", "w", "moveforward");
            moveMap.bind("keyboard", "s", "movebackward");
            moveMap.bind("keyboard", "up", "moveforward");
            moveMap.bind("keyboard", "down", "movebackward");

            moveMap.bind("keyboard", "e", "moveup");
            moveMap.bind("keyboard", "c", "movedown");

            moveMap.bind("keyboard", "space", "jump");
            moveMap.bind("mouse", "xaxis", "yaw");
            moveMap.bind("mouse", "yaxis", "pitch");

            moveMap.bind("gamepad", "thumbrx", "D", "-0.23 0.23", "gamepadYaw");
            moveMap.bind("gamepad", "thumbry", "D", "-0.23 0.23", "gamepadPitch");
            moveMap.bind("gamepad", "thumblx", "D", "-0.23 0.23", "gamePadMoveX");
            moveMap.bind("gamepad", "thumbly", "D", "-0.23 0.23", "gamePadMoveY");

            moveMap.bind("gamepad", "btn_a", "jump");
            moveMap.bindCmd("gamepad", "btn_back", "disconnect();", "");

            moveMap.bindCmd("gamepad", "dpadl", "toggleLightColorViz();", "");
            moveMap.bindCmd("gamepad", "dpadr", "metrics(fps);", "");
            GlobalActionMap.bind("gamepad", "dpadu", "toggleConsole");
            moveMap.bindCmd("gamepad", "dpadd", "toggleNormalsViz();", "");

            moveMap.bind("mouse", "button0", "mouseFire");

            moveMap.bind("gamepad", "triggerr", "gamepadFire");
            moveMap.bind("gamepad", "triggerl", "gamepadAltTrigger");

            if (omni.sGlobal["$Player::CurrentFOV"] == "")
            {
                omni.iGlobal["$Player::CurrentFOV"] = omni.iGlobal["$pref::Player::DefaultFOV"] / 2;
            }

            moveMap.bind("keyboard", "f", "setZoomFOV"); // f for field of view
            moveMap.bind("keyboard", "z", "toggleZoom"); // z for zoom
            moveMap.bind("mouse", "button1", "mouseButtonZoom");
            moveMap.bind("gamepad", "btn_rt", "toggleZoom");

            moveMap.bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            moveMap.bind("keyboard", "tab", "toggleFirstPerson");
            moveMap.bind("keyboard", "alt c", "toggleCamera");

            moveMap.bind("gamepad", "btn_start", "toggleCamera");
            moveMap.bind("gamepad", "btn_y", "toggleFirstPerson");

            //------------------------------------------------------------------------------
            // Item manipulation

            moveMap.bind("keyboard", "F3", "startRecordingDemo");
            moveMap.bind("keyboard", "F4", "stopRecordingDemo");

            GlobalActionMap.bind("keyboard", "ctrl o", "bringUpOptions");

            GlobalActionMap.bind("keyboard", "ctrl F3", "doProfile");

            //------------------------------------------------------------------------------
            // Misc.
            //------------------------------------------------------------------------------

            GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
            GlobalActionMap.bind("keyboard", "alt tilde", "ShowNewTools");
            GlobalActionMap.bindCmd("keyboard", "alt k", "cls();", "");
            GlobalActionMap.bindCmd("keyboard", "alt enter", "", "Canvas.attemptFullscreenToggle();");
            GlobalActionMap.bindCmd("keyboard", "F1", "", "contextHelp();");
            moveMap.bindCmd("keyboard", "n", "toggleNetGraph();", "");

            // Bind the keys to the carjack command
            moveMap.bindCmd("keyboard", "ctrl z", "carjack();", "");

            moveMap.bindCmd("gamepad", "connect", "echo(\"Pressed Xbox Button\");", ""); //Button_Xbox
        }
        public static void initialize()
        {
            if ("moveMap".isObject())
            {
                "moveMap".delete();
            }

            ActionMap moveMap         = new ObjectCreator("ActionMap", "moveMap").Create();
            ActionMap GlobalActionMap = "GlobalActionMap";

            moveMap.bindCmd("keyboard", "escape", "", "handleEscape();");
            moveMap.bind("keyboard", "F2", "showPlayerList");
            moveMap.bind("keyboard", "ctrl h", "hideHUDs");
            moveMap.bind("keyboard", "alt p", "doScreenShotHudless");

            moveMap.bind("keyboard", "a", "moveleft");
            moveMap.bind("keyboard", "d", "moveright");
            moveMap.bind("keyboard", "left", "moveleft");
            moveMap.bind("keyboard", "right", "moveright");

            moveMap.bind("keyboard", "w", "moveforward");
            moveMap.bind("keyboard", "s", "movebackward");
            moveMap.bind("keyboard", "up", "moveforward");
            moveMap.bind("keyboard", "down", "movebackward");

            moveMap.bind("keyboard", "e", "moveup");
            moveMap.bind("keyboard", "c", "movedown");

            moveMap.bind("keyboard", "space", "jump");
            moveMap.bind("mouse", "xaxis", "yaw");
            moveMap.bind("mouse", "yaxis", "pitch");

            moveMap.bind("gamepad", "thumbrx", "D", "-0.23 0.23", "gamepadYaw");
            moveMap.bind("gamepad", "thumbry", "D", "-0.23 0.23", "gamepadPitch");
            moveMap.bind("gamepad", "thumblx", "D", "-0.23 0.23", "gamePadMoveX");
            moveMap.bind("gamepad", "thumbly", "D", "-0.23 0.23", "gamePadMoveY");

            moveMap.bind("gamepad", "btn_a", "jump");
            moveMap.bindCmd("gamepad", "btn_back", "disconnect();", "");

            moveMap.bindCmd("gamepad", "dpadl", "toggleLightColorViz();", "");
            moveMap.bindCmd("gamepad", "dpadr", "metrics(fps);", "");
            //moveMap.bindCmd("gamepad", "dpadu", "toggleDepthViz();", "");
            GlobalActionMap.bind("gamepad", "dpadu", "toggleConsole");
            moveMap.bindCmd("gamepad", "dpadd", "toggleNormalsViz();", "");
            //moveMap.bindCmd("gamepad", "dpadr", "toggleLightSpecularViz();", "");

            moveMap.bind("keyboard", "lcontrol", "doCrouch");
            moveMap.bind("gamepad", "btn_b", "doCrouch");

            moveMap.bind("keyboard", "lshift", "doSprint");
            moveMap.bind("gamepad", "btn_lt", "doSprint"); //Analog_LT Click

            moveMap.bind("mouse", "button0", "mouseFire");

            moveMap.bind("gamepad", "triggerr", "gamepadFire");
            moveMap.bind("gamepad", "triggerl", "gamepadAltTrigger");

            if (omni.sGlobal["$Player::CurrentFOV"] == "")
            {
                omni.iGlobal["$Player::CurrentFOV"] = omni.iGlobal["$pref::Player::DefaultFOV"] / 2;
            }

            moveMap.bind("keyboard", "f", "setZoomFOV"); // f for field of view
            moveMap.bind("keyboard", "z", "toggleZoom"); // z for zoom
            moveMap.bind("mouse", "button1", "mouseButtonZoom");
            moveMap.bind("gamepad", "btn_rt", "toggleZoom");

            moveMap.bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            moveMap.bind("keyboard", "tab", "toggleFirstPerson");
            moveMap.bind("keyboard", "alt c", "toggleCamera");

            moveMap.bind("gamepad", "btn_start", "toggleCamera");
            moveMap.bind("gamepad", "btn_y", "toggleFirstPerson");
            moveMap.bindCmd("gamepad", "btn_x", "commandToServer('reloadWeapon');", ""); //Button_X

            // ----------------------------------------------------------------------------
            // Misc. Player stuff
            // ----------------------------------------------------------------------------

            // Gideon does not have these animations, so the player does not need access to
            // them.  Commenting instead of removing so as to retain an example for those
            // who will want to use a player model that has these animations and wishes to
            // use them.

            //moveMap.bindCmd(keyboard, "ctrl w", "commandToServer('playCel',\"wave\");", "");
            //moveMap.bindCmd(keyboard, "ctrl s", "commandToServer('playCel',\"salute\");", "");

            moveMap.bindCmd("keyboard", "ctrl k", "commandToServer('suicide');", "");

            //------------------------------------------------------------------------------
            // Item manipulation
            //------------------------------------------------------------------------------
            moveMap.bindCmd("keyboard", "1", "commandToServer('use',\"Ryder\");", "");
            moveMap.bindCmd("keyboard", "2", "commandToServer('use',\"Lurker\");", "");
            moveMap.bindCmd("keyboard", "3", "commandToServer('use',\"LurkerGrenadeLauncher\");", "");
            moveMap.bindCmd("keyboard", "4", "commandToServer('use',\"ProxMine\");", "");
            moveMap.bindCmd("keyboard", "5", "commandToServer('use',\"DeployableTurret\");", "");

            moveMap.bindCmd("keyboard", "r", "commandToServer('reloadWeapon');", "");

            moveMap.bind("keyboard", "0", "unmountWeapon");

            moveMap.bind("keyboard", "alt w", "throwWeapon");
            moveMap.bind("keyboard", "alt a", "tossAmmo");

            moveMap.bind("keyboard", "q", "nextWeapon");
            moveMap.bind("keyboard", "ctrl q", "prevWeapon");
            moveMap.bind("mouse", "zaxis", "mouseWheelWeaponCycle");

            moveMap.bind("gamepad", "btn_l", "prevWeapon");
            moveMap.bind("gamepad", "btn_r", "nextWeapon");

            moveMap.bind("keyboard", "u", "toggleMessageHud");
            //moveMap.bind(keyboard, y, teamMessageHud );
            moveMap.bind("keyboard", "pageUp", "pageMessageHudUp");
            moveMap.bind("keyboard", "pageDown", "pageMessageHudDown");
            moveMap.bind("keyboard", "p", "resizeMessageHud");

            moveMap.bind("keyboard", "F3", "startRecordingDemo");
            moveMap.bind("keyboard", "F4", "stopRecordingDemo");

            moveMap.bind("keyboard", "F8", "dropCameraAtPlayer");
            moveMap.bind("keyboard", "F7", "dropPlayerAtCamera");

            //ActionMap GlobalActionMap = "GlobalActionMap";

            GlobalActionMap.bind("keyboard", "ctrl o", "bringUpOptions");

            GlobalActionMap.bind("keyboard", "ctrl F3", "doProfile");

            //------------------------------------------------------------------------------
            // Misc.
            //------------------------------------------------------------------------------

            GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
            GlobalActionMap.bind("keyboard", "alt tilde", "ShowNewTools");
            GlobalActionMap.bindCmd("keyboard", "alt k", "cls();", "");
            GlobalActionMap.bindCmd("keyboard", "alt enter", "", "Canvas.attemptFullscreenToggle();");
            GlobalActionMap.bindCmd("keyboard", "F1", "", "contextHelp();");
            moveMap.bindCmd("keyboard", "n", "toggleNetGraph();", "");

            // Bind the keys to the carjack command
            moveMap.bindCmd("keyboard", "ctrl z", "carjack();", "");

            if ("vehicleMap".isObject())
            {
                "vehicleMap".delete();
            }

            ActionMap vehicleMap = new ObjectCreator("ActionMap", "vehicleMap").Create();

            // The key command for flipping the car
            vehicleMap.bindCmd("keyboard", "ctrl x", "commandToServer(\'flipCar\');", "");

            vehicleMap.bind("keyboard", "w", "moveforward");
            vehicleMap.bind("keyboard", "s", "movebackward");
            vehicleMap.bind("keyboard", "up", "moveforward");
            vehicleMap.bind("keyboard", "down", "movebackward");
            vehicleMap.bind("mouse", "xaxis", "yaw");
            vehicleMap.bind("mouse", "yaxis", "pitch");
            vehicleMap.bind("mouse", "button0", "mouseFire");
            vehicleMap.bind("mouse", "button1", "altTrigger");
            vehicleMap.bindCmd("keyboard", "ctrl f", "getout();", "");
            vehicleMap.bind("keyboard", "space", "brake");
            vehicleMap.bindCmd("keyboard", "l", "brakeLights();", "");
            vehicleMap.bindCmd("keyboard", "escape", "", "handleEscape();");
            vehicleMap.bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            //vehicleMap.bind(keyboard, tab, toggleFirstPerson );
            vehicleMap.bind("keyboard", "alt c", "toggleCamera");

            //Vehicle Gamepad
            vehicleMap.bind("gamepad", "triggerr", "moveforward");  //Trigger_RT
            vehicleMap.bind("gamepad", "triggerl", "movebackward"); //Trigger_RT

            //Uncomment below for right thumb, forward-backwards
            //vehicleMap.bind(gamepad, "thumbry", gamePadMoveY);                    //Analog_RT axis_Y
            vehicleMap.bind("gamepad", "thumblx", "gamepadYaw");                         //Analog_LT axis_X
            vehicleMap.bindCmd("gamepad", "btn_y", "getout();", "");                     //Button_Y
            vehicleMap.bind("gamepad", "btn_b", "brake");                                //Button_B
            vehicleMap.bind("gamepad", "btn_x", "mouseFire");                            //Button_X
            moveMap.bindCmd("gamepad", "connect", "echo(\"Pressed Xbox Button\");", ""); //Button_Xbox
        }
Exemple #6
0
        public static void initializeCore()
        {
            if (omni.bGlobal["$coreInitialized"])
            {
                return;
            }

            ActionMap GlobalActionMap = "GlobalActionMap";

            GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
            GlobalActionMap.bind("keyboard", "alt tilde", "ShowNewTools");
            GlobalActionMap.bind("keyboard", "ctrl p", "doScreenShot");
            GlobalActionMap.bindCmd("keyboard", "alt enter", "Canvas.attemptFullscreenToggle();", "");
            GlobalActionMap.bindCmd("keyboard", "alt k", "cls();", "");

            audio.initialize();
            canvas.initialize();
            GuiCanvas.initialize();
            //omni.Util.exec("core/scripts/client/cursor.cs", false, false);
            //omni.Util.exec("core/scripts/client/persistenceManagerTest.cs", false, false);

            // Content.
            omni.Util.exec("core/art/gui/profiles.cs", false, false);
            //omni.Util.exec("core/scripts/gui/cursors.cs", false, false);
            cursor.initialize();

            audioEnviroments.initialize();
            audioDescriptions.initialize();
            audioStates.initialize();
            audioAmbiences.initialize();

            // Input devices
            // omni.Util.exec("core/scripts/client/oculusVR.cs", false, false);

            omni.Util.setRandomSeed((DateTime.Now.Millisecond + 1) * (DateTime.Now.Second + 1));

            // Set up networking.
            omni.Util.setNetPort(0);

            // Initialize the canvas.
            canvas.initializeCanvas();

            // Start processing file change events.
            omni.Util.startFileChangeNotifications();

            // Core Guis.

            //omni.Util.exec("core/art/gui/console.gui", false, false);
            ConsoleDlg.initialize();

            //omni.Util.exec("core/art/gui/consoleVarDlg.gui", false, false);
            ConsoleVarDlg.initialize();
            omni.Util.exec("core/art/gui/netGraphGui.gui", false, false);

            // Gui Helper Scripts.
            //omni.Util.exec("core/scripts/gui/help.cs", false, false);

            // Random Scripts.
            //omni.Util.exec("core/scripts/client/screenshot.cs", false, false);
            screenshot.initialize();
            //omni.Util.exec("core/scripts/client/helperfuncs.cs", false, false);
            // Client scripts
            metrics.initialize();
            //omni.Util.exec("core/scripts/client/recordings.cs", false, false);
            centerPrint.initialize();
            loadCoreMaterials();
            commonMaterialData.intialize();
            shaders.initialize();
            materials.initialize();

            terrainBlock.initialize();
            water.initialize();
            scatterSky.initialize();
            clouds.initialize();

            // Initialize all core post effects.
            postFX.initialize();
            postFX.initPostEffects();

            // Initialize the post effect manager.
            postFXManager.createGui();
            ((postFXManager)"PostFXManager").settingsApplyDefaultPreset();
            ((GuiCanvas)"Canvas").setCursor("DefaultCursor");

            //Need to call this function through the console because loadKeyBindings is part of a packaged used in tools
            omni.console.Call("loadKeybindings");

            omni.bGlobal["$coreInitialized"] = true;
        }