Example #1
0
        public virtual void spawnCamera(string spawnPoint)
        {
            Camera camera = this["camera"];

            //string camera = console.GetVarString(thisobj + ".camera");

            // Set the control object to the default camera
            if (!camera.isObject())
            {
                camera         = Util.spawnObject(sGlobal["$Game::DefaultCameraClass"], sGlobal["$Game::DefaultCameraDataBlock"]);
                this["camera"] = camera;
            }

            // If we have a camera then set up some properties
            if (!camera.isObject())
            {
                return;
            }

            ((SimSet)"MissionCleanup").pushToBack(camera);

            camera.scopeToClient(this);

            this.setControlObject(camera);

            if (spawnPoint == string.Empty)
            {
                return;
            }

            // Attempt to treat %spawnPoint as an object

            if (Util.getWordCount(spawnPoint) == 1 && console.isObject(spawnPoint))
            {
                camera.setTransform(((SpawnSphere)spawnPoint).getTransform());
            }
            else
            {
                camera.setTransform(new TransformF(spawnPoint));
            }
        }
Example #2
0
        public virtual void onDeath(GameBase sourceobject, GameConnection sourceclient, string damagetype, string damloc)
        {
            if (this.isObject())
            {
                if (this["ownedTurrets"] == string.Empty)
                {
                    this["ownedTurrets"] = new ObjectCreator("SimSet").Create().AsString();
                }

                SimSet simSet = this["ownedTurrets"];

                for (uint i = 0; i < simSet.getCount(); i++)
                {
                    ((SimObject)simSet.getObject(i)).schedule("10", "delete");
                }
            }

            // clear the weaponHUD
            this.refreshWeaponHud(0, string.Empty, string.Empty, string.Empty, 0);

            Player player = this["player"];

            // Clear out the name on the corpse
            player.setShapeName(string.Empty);

            // Update the numerical Health HUD

            //PlayerUpdateHealth(player);

            // Switch the client over to the death cam and unhook the player object.
            Camera camera = this["camera"];

            if (camera.isObject() && player.isObject())
            {
                camera.setMode("Corpse", player, string.Empty, string.Empty);
                //camera.call("setMode", "Corpse", player, string.Empty, string.Empty);
                this.setControlObject(camera);
            }
            else
            {
                console.print("------------>Failed to Switch the client over to the death cam.");
            }

            this["player"] = "0";

            // Display damage appropriate kill message
            string sendMsgFunction = "sendMsgClientKilled_" + damagetype;

            //if (!console.isFunction(sendMsgFunction))
            //    {
            //    sendMsgFunction = "sendMsgClientKilled_Default";
            //    }

            console.Call(sendMsgFunction, new string[] { "MsgClientKilled", this, sourceclient, damloc });
            // Dole out points and check for win
            if ((damagetype == "Suicide") || (sourceclient == this))
            {
                IncDeaths(this, "1", "1");
                IncScore(this, "-1", "0");
            }
            else
            {
                IncDeaths(this, "1", "0");
                IncScore(sourceclient, "1", "1");
                IncKills(sourceclient, "1", "0");
            }

            if (iGlobal["$Game::EndGameScore"] > 0 && sourceclient["kills"].AsInt() >= iGlobal["$Game::EndGameScore"])
            {
                missionLoad.cycleGame();
            }
        }