Example #1
0
        public static void BottomPrint(GameConnection client, string message, string time, string lines)
        {
            if (lines == "" || lines.AsInt() > 3 || lines.AsInt() < 1)
                lines = "1";

            t3d.console.commandToClient(client, "bottomPrint", new[] {message, time, lines});
        }
Example #2
0
        public static void sendMsgClientKilled_Impact(string msgtype, GameConnection client, GameConnection sourceclient, string damloc)
        {
            if (client.isObject())

                message.MessageAll(msgtype, "%1 fell to his death!", client["playerName"]);
            // console.GetVarString(string.Format("{0}.playerName", client)));
        }
Example #3
0
 public static void Ban(GameConnection client)
 {
     message.MessageAll("MsgAdminForce", omni.console.ColorEncode(@"\c2The Admin has banned %1."), client["playerName"]);
     if (!client.isAIControlled())
         omni.console.Call_Classname("BanList", "add", new[] {client["guid"], client.getAddress(), omni.sGlobal["$Pref::Server::BanTime"]});
     client.delete("You have been banned from this server");
 }
Example #4
0
        public static void serverCmdTogglePathCamera(GameConnection client, bool val)
        {
            string control = val ? client["PathCamera"] : client["camera"];

            client.setControlObject(control);

            syncEditorGui();
        }
Example #5
0
 public static void sendMsgClientKilled_TurretDamage(string msgtype, GameConnection client, GameConnection sourceclient, string damloc)
 {
     if (sourceclient == 0)
         message.MessageAll(msgtype, "%1 was shot down by a turret!", client["playerName"] + ");");
     else if (sourceclient == client)
         message.MessageAll(msgtype, "%1 kill by his own turret!", client["playerName"] + ");");
     else
         message.MessageAll(msgtype, "%1 was killed by a turret of %2!", client["playerName"] + ");", sourceclient["playerName"]);
 }
 public static void sendMsgClientKilled_MineDamage(string msgType, GameConnection client, GameConnection sourceClient, string damLoc)
 {
     // Customized kill message for deaths caused by proximity mines
     if (sourceClient == 0)
         message.MessageAll(msgType, "%1 was blown up!", client["playerName"]);
     else if (sourceClient == client)
         message.MessageAll(msgType, "%1 stepped on his own mine!", client["playerName"]);
     else
         message.MessageAll(msgType, "%1 was blown up by %2!", client["playerName"], sourceClient["playerName"]);
 }
Example #7
0
        public static void sendMsgClientKilled_Default(string msgtype, GameConnection client, GameConnection sourceclient, string damloc)
        {
            if (!client.isObject())
                return;
            if (sourceclient == client)
                sendMsgClientKilled_Suicide(msgtype, client, sourceclient, damloc);

            else if (omni.console.GetVarString(sourceclient["team"]) != string.Empty && sourceclient["team"] != client["team"])
                message.MessageAll(msgtype, "%1 killed by %2 - friendly fire!", client["playerName"], sourceclient["playerName"]);
            else
                message.MessageAll(msgtype, "%1 gets nailed by %2!", client["playerName"], sourceclient.isObject() ? sourceclient["playerName"] : "a Bot!");
        }
Example #8
0
        public static void enableOculusVRDisplay(GameConnection gameConnection, bool trueStereoRendering)
        {
            if (!omni.Util.isFunction("isOculusVRDeviceActive"))
                return;
            omni.Util._call("setOVRHMDAsGameConnectionDisplayDevice", gameConnection);
            ((GameConnection) "PlayGui")["renderStyle"] = "stereo side by side";

            if (trueStereoRendering)
                ((PostEffect) "OVRBarrelDistortionPostFX")["isEnabled"] = "true";
            else
                ((PostEffect) "OVRBarrelDistortionMonoPostFX")["isEnabled"] = "true";

            // Reset all sensors
            omni.Util._call("ovrResetAllSensors");
        }
        public static void serverCmdcarUnmountObj(GameConnection client, Player obj)
        {
            obj.unmount();
            obj.setControlObject(obj);

            TransformF ejectpos = obj.getTransform();
            ejectpos += new TransformF(0, 0, 5);
            obj.setTransform(ejectpos);

            Vehicle mvehicle = obj["mVehicle"];

            Point3F ejectvel = mvehicle.getVelocity();
            ejectvel += new Point3F(0, 0, 10);

            ejectvel = ejectvel.vectorScale(((SimDataBlock) (obj.getDataBlock()))["mass"].AsFloat());

            obj.applyImpulse(ejectpos.GetPosition(), ejectvel);
        }
Example #10
0
 public virtual int GetScore(GameConnection client)
 {
     return(client["score"].AsInt());
 }
Example #11
0
        public static void serverCmdToggleCamera(GameConnection client)
        {
            string control;
            if (client.getControlObject() == client["player"])
                {
                ((Extendable.Camera) client["camera"]).setVelocity(new Point3F("0 0 0"));
                control = client["camera"];
                }
            else
                {
                ((Player) client["player"]).setVelocity(new Point3F("0 0 0"));
                control = client["player"];
                }
            client.setControlObject(control);

            syncEditorGui();
        }
Example #12
0
        public static void ServerCmdtoggleBrakeLights(GameConnection client)
        {
            Player player = client["player"];
            //Remember to pay attention to what type of object your looking at.
            WheeledVehicle vehicle = player.getControlObject().AsString();
            if (vehicle.getClassName() != "WheeledVehicle")
                return;

            if (vehicle["rightBrakeLight.isEnabled"].AsBool())
                {
                ((PointLight) vehicle["rightBrakeLight"]).setLightEnabled(false);
                ((PointLight) vehicle["leftBrakeLight"]).setLightEnabled(false);
                }
            else
                {
                ((PointLight) vehicle["rightBrakeLight"]).setLightEnabled(true);
                ((PointLight) vehicle["leftBrakeLight"]).setLightEnabled(true);
                }
        }
Example #13
0
 public static void GameConnectionspamReset(GameConnection thisobj)
 {
     thisobj["isSpamming"] = false.AsString();
 }
Example #14
0
        public override int onThrow(ShapeBase player, int amount)
        {
            if (amount == 0)
            {
                amount = 1;
            }

            if (this["maxInventory"] != string.Empty)
            {
                if (amount > this["maxInventory"].AsInt())
                {
                    amount = this["maxInventory"].AsInt();
                }
            }

            if (amount == 0)
            {
                return(0);
            }

            player.decInventory(this, amount);
            TransformF rot = new TransformF(player.getEulerRotation());

            ObjectCreator tc_obj = new ObjectCreator("AITurretShape", string.Empty);

            tc_obj["datablock"]      = this.getName();
            tc_obj["rotation"]       = "0 0 1 " + rot.mPositionZ;
            tc_obj["count"]          = "1";
            tc_obj["sourceObject"]   = player;
            tc_obj["client"]         = player["client"];
            tc_obj["isAiControlled"] = true;

            AITurretShape obj = tc_obj.Create();

            ((SimSet)"MissionGroup").pushToBack(obj);

            //todo change to csharp
            obj.addToIgnoreList(player);


            GameConnection client = player["client"];

            if (client.isObject())
            {
                if (client["ownedTurrets"] == string.Empty)
                {
                    client["ownedTurrets"] = new ObjectCreator("SimSet", string.Empty).Create().AsString();
                }

                SimSet SimSet_id    = client["ownedTurrets"];
                int    countofitems = SimSet_id.getCount();
                for (uint i = 0; i < countofitems; i++)
                {
                    AITurretShape turret = SimSet_id.getObject(i);
                    turret.addToIgnoreList(obj);
                    obj.addToIgnoreList(turret);
                }
                SimSet_id.pushToBack(obj);
            }

            return(obj);
        }
Example #15
0
        public static void ChatMessageAll(GameConnection sender, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "")
        {
            if ((msgString.Trim().Length == 0) || SpamAlert(sender))
                return;
            foreach (GameConnection obj in tst.ClientGroup)
                {
                if (sender["team"].AsInt() != 0)
                    ChatMessageClient(obj, sender, sender["voiceTag"], sender["voicePitch"], msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);

                else
                    {
                    if (obj["team"] == sender["team"])
                        ChatMessageClient(obj, sender, sender["voiceTag"], sender["voicePitch"], msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
                    }
                }
        }
Example #16
0
 public static void MessageTeamExcept(GameConnection client, string msgType, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "", string a11 = "", string a12 = "", string a13 = "")
 {
     string team = client["team"];
     foreach (GameConnection clientid in tst.ClientGroup.Where(clientid => client["team"] == team && (clientid != client)))
         MessageClient(clientid, msgType, msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
 }
Example #17
0
 public static void serverCmdMissionStartPhase2CacheAck(GameConnection client)
 {
     _missionLoadBase.serverCmdMissionStartPhase2CacheAck(client);
 }
Example #18
0
 public static void serverCmdMissionStartPhase3Ack(GameConnection client, string seq)
 {
     _missionLoadBase.serverCmdMissionStartPhase3Ack(client, seq);
 }
Example #19
0
        public override void onCollision(ShapeBase obj, SceneObject col, Point3F vec, float len)
        {
            Player player = obj.getId();

            if (player.getState() == "Dead")
            {
                return;
            }
            // Try and pickup all items
            if (col.getClassName() == "Item")
            {
                player.pickup(col.ID, 1);
                return;
            }

            if (col.GetType() != typeof(WheeledVehicle))
            {
                return;
            }

            WheeledVehicle vcol = (WheeledVehicle)col;

            //AI are not allowed to drive they are lousey drivers....
            GameConnection client = player["client"];

            if (!client.isObject())
            {
                return;
            }
            //Mount Vehicle.
            if ((console.getTypeMask(col) & (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) != (UInt32)SceneObjectTypesAsUint.GameBaseObjectType)
            {
                return;
            }
            VehicleData db = vcol.getDataBlock();

            if (!(((db.getClassName() == "WheeledVehicleData") || player["mountVehicle"].AsBool() || player.getState() == "Move" || col["mountable"].AsBool())))
            {
                return;
            }
            // Only mount drivers for now.

            // For this specific example, only one person can fit
            // into a vehicle
            int mount = vcol.getMountNodeObject(0);

            if (mount > 0)
            {
                try
                {
                    Player p = mount;
                    return;
                }
                catch (Exception err)
                {
                    //Water particle emitters seem to take up the seat when the vehicle is in water.
                    vcol.unmountObject(mount.AsString());
                    vcol.mountObject(player, 0, new TransformF());
                    ((GameConnection)player["client"]).setFirstPerson(false);
                    console.commandToClient(client, "PushVehicleMap");
                }
            }
            else
            {
                vcol.mountObject(player, 0, new TransformF());
                ((GameConnection)player["client"]).setFirstPerson(false);
                console.commandToClient(client, "PushVehicleMap");
            }
            //if (mount > 0)
            //return;
            // For this specific FPS Example, always mount the player to node 0

            player["mVehicle"] = col;
        }
Example #20
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();
            }
        }
 public virtual string onConnectRequest(GameConnection client, string netAddress, string name)
 {
     console.print(string.Format("Connect request from:{0}", netAddress));
     return(iGlobal["$Server::PlayerCount"] >= iGlobal["$Pref::Server::MaxPlayers"] ? "CR_SERVERFULL" : "");
 }
Example #22
0
        public static void serverCmdsetPlayerControl(GameConnection client)
        {
            Player player = client["player"];

            client.setControlObject(player);
        }
 public static void sendMsgClientKilled_Telefrag(string msgType, GameConnection client,
                                                 GameConnection sourceClient, string damLoc)
 {
     CustomObjects.Utilities.message.MessageAll(msgType, "%1 was telefragged by %2!", client["playerName"],
                                                sourceClient["playerName"]);
 }
Example #24
0
 public static void ChatMessageClient(GameConnection client, GameConnection sender, string voiceTag, string voicePitch, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "")
 {
     if (tst.console.isObject(client))
         {
         if (!client["muted[" + sender + "]"].AsBool())
             tst.console.commandToClient(client, "ChatMessage", new string[] {sender, voiceTag, voicePitch, tst.console.addTaggedString(msgString), a1, a2, a3, a4, a5, a6, a7, a8, a9, a10});
         }
 }
 public virtual void onDeath(GameBase sourceobject, GameConnection sourceclient, string damagetype, string damloc)
 {
 }
Example #26
0
        public static void ChatMessageTeam(GameConnection sender, string team, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "")
        {
            if ((msgString.Trim().Length == 0) || SpamAlert(sender))
                return;

            foreach (GameConnection obj in tst.ClientGroup.Where(obj => ((GameConnection) obj)["team"] == sender["team"]))
                ChatMessageClient(obj, sender, tst.console.GetVarString(string.Format("{0}.voiceTag", sender)), tst.console.GetVarString(string.Format("{0}.voicePitch", sender)), msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
        }
        public void checkWinner(GameConnection client)
        {
            for (int i = 0; i < 4; i++)
                {
                if (!client["touchedPlatform[" + i + "]"].AsBool())
                    return; // Skipped a platform, no winner message for you!
                }
            // Get the total time it took them
            double totalTime = Util.getSimTime() - client["miniStartTime"].AsDouble();
            string timeStr = timeToText(totalTime);

            // See if they beat the best time
            if (sGlobal["$Pref::Server::miniWalkableBest"] == "")
                dGlobal["$Pref::Server::miniWalkableBest"] = totalTime;
            else if (totalTime < dGlobal["$Pref::Server::miniWalkableBest"])
                {
                dGlobal["$Pref::Server::miniWalkableBest"] = totalTime;
                timeStr += "\nA new best time!";
                }

            message.MessageClient(client, "MsgItemPickup", "\\c1Congratulations! You reached the platform in %1", timeStr);
            message.MessageAllExcept(client, "-1", "MsgItemPickup", "\\c1%1 reached the platform in %2", client["PlayerName"], timeStr);

            // Reset so they can play again
            client["miniStartTime"] = "";
        }
Example #28
0
        public static void MessageClient(GameConnection client, string msgtype, string msgstring, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "", string a11 = "", string a12 = "", string a13 = "")
        {
            string function = tst.console.addTaggedString("ServerMessage");

            string tmsgtype = "";
            if (msgtype.Length > 0)
                tmsgtype = (byte) msgtype[0] == (byte) 1 ? msgtype : tst.console.addTaggedString(msgtype);
            string tmsgstring = "";
            if (msgstring.Length > 0)
                tmsgstring = (byte) msgstring[0] == (byte) 1 ? msgstring : tst.console.addTaggedString(msgstring);
            if (tst.console.isObject(client))
                tst.console.commandToClient(client, function, new[] {tmsgtype, tmsgstring, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13});
        }
Example #29
0
 public virtual int GetDeaths(GameConnection client)
 {
     return(client["deaths"].AsInt());
 }
Example #30
0
 public static void GameConnectSpamMessageTimeOut(GameConnection thisobj)
 {
     if (thisobj["spamMessageCount"].AsInt() > 0)
         thisobj["spamMessageCount"] = (thisobj["spamMessageCount"].AsInt() - 1).AsString();
 }
Example #31
0
 public virtual int GetKills(GameConnection client)
 {
     return(client["kills"].AsInt());
 }
Example #32
0
        public static bool SpamAlert(GameConnection client)
        {
            if (!tst.bGlobal["$Pref::Server::FloodProtectionEnabled"])
                return false;

            if (!client["isSpamming"].AsBool() && client["spamMessageCount"].AsInt() >= SPAM_MESSAGE_THRESHOLD)
                {
                tst.console.error("Client " + client + " is spamming, message count = " + client["spamMessageCount"]);
                client["spamProtectStart"] = tst.console.getSimTime().AsString();
                client["isSpamming"] = true.AsString();
                using (BackgroundWorker bwr_SPAM_PENALTY_PERIOD = new BackgroundWorker())
                    {
                    bwr_SPAM_PENALTY_PERIOD.DoWork += new DoWorkEventHandler(bwr_SPAM_PENALTY_PERIOD_DoWork);
                    bwr_SPAM_PENALTY_PERIOD.RunWorkerAsync(client);
                    }
                }

            if (client["isSpamming"].AsBool())
                {
                double wait = Math.Floor((SPAM_PENALTY_PERIOD - (tst.console.getSimTime() - client["spamProtectStart"].AsDouble())/1000));
                MessageClient(client, "", SPAM_MESSAGE, wait.AsString());
                return true;
                }
            client["spamMessageCount"] = (client["spamMessageCount"].AsInt() + 1).AsString();

            using (BackgroundWorker bwrSPAM_PROTECTION_PERIOD = new BackgroundWorker())
                bwrSPAM_PROTECTION_PERIOD.DoWork += new DoWorkEventHandler(bwrSPAM_PROTECTION_PERIOD_DoWork);

            return false;
        }
 public virtual void onDeath(GameBase sourceobject, GameConnection sourceclient, string damagetype,
                             string damloc)
 {
 }
Example #34
0
 public static void serverCmdMissionStartPhase2Ack(GameConnection client, string seq, PlayerData playerDB)
 {
     _missionLoadBase.serverCmdMissionStartPhase2Ack(client, seq, playerDB);
 }
Example #35
0
 public static void serverCmdEditorCameraAutoFit(GameConnection client, float radius)
 {
     Extendable.Camera camera = client["camera"];
     camera.autoFitRadius(radius);
     client.setControlObject(camera);
     syncEditorGui();
 }
 public void clientWantsGhostAlwaysRetry(GameConnection client)
 {
     if (bGlobal["$MissionRunning"])
         client.activateGhosting();
 }
Example #37
0
        public static void serverCmdSAD(GameConnection client, string password)
        {
            if (password == string.Empty || password != omni.sGlobal["$Pref::Server::AdminPassword"])
                return;
            client["isAdmin"] = true.AsString();
            client["isSuperAdmin"] = true.AsString();

            string name = omni.console.getTaggedString(client["playerName"]);
        }
 public virtual string onConnectRequest(GameConnection client, string netAddress, string name)
 {
     console.print(string.Format("Connect request from:{0}", netAddress));
     return iGlobal["$Server::PlayerCount"] >= iGlobal["$Pref::Server::MaxPlayers"] ? "CR_SERVERFULL" : "";
 }
Example #39
0
 public static void serverCmdSADSetPassword(GameConnection client, string password)
 {
     if (client["isSuperAdmin"].AsBool())
         omni.sGlobal["$Pref::Server::AdminPassword"] = password;
 }
Example #40
0
 public static void serverCmdNetSimulateLag(GameConnection client, int msDelay, float packetLossPercent)
 {
     if (client["isAdmin"].AsBool())
         client.setSimulatedNetParams((packetLossPercent/100.0f), msDelay);
 }
Example #41
0
 public static void sendMsgClientKilled_TurretDamage(string msgtype, GameConnection client, GameConnection sourceclient, string damloc)
 {
     if (sourceclient == 0)
     {
         message.MessageAll(msgtype, "%1 was shot down by a turret!", client["playerName"] + ");");
     }
     else if (sourceclient == client)
     {
         message.MessageAll(msgtype, "%1 kill by his own turret!", client["playerName"] + ");");
     }
     else
     {
         message.MessageAll(msgtype, "%1 was killed by a turret of %2!", client["playerName"] + ");", sourceclient["playerName"]);
     }
 }