示例#1
0
        public string PickCameraSpawnPoint(string spawnGroups)
        {
            coSimObject spawnpoint = null;

            String[] lspawngroups = spawnGroups.Split(' ');

            foreach (coSimSet group in lspawngroups)
            {
                if (!group.isObject())
                {
                    continue;
                }
                spawnpoint = group.getRandom();
                if (spawnpoint.isObject())
                {
                    return(spawnpoint);
                }
            }
            coSpawnSphere DefaultCameraSpawnSphere = "DefaultCameraSpawnSphere";

            if (!DefaultCameraSpawnSphere.isObject())
            {
                Torque_Class_Helper spawn = new Torque_Class_Helper("SpawnSphere", "DefaultCameraSpawnSphere");
                spawn.Props.Add("dataBlock", "SpawnSphereMarker");
                spawn.PropsAddString("spawnClass", Game__DefaultCameraClass);
                spawn.PropsAddString("spawnDatablock", Game__DefaultCameraDataBlock);
                coSpawnSphere spawnobj = spawn.Create();

                ((coSimSet)"MissionCleanup").pushToBack(spawnobj);
            }

            return(DefaultCameraSpawnSphere);
        }
        public void GrenadeLauncherImageOnMount(coSimObject thisobj, coSimObject obj, string slot, string nameSpaceDepth)
        {
            // Make it ready
            obj["detonadeEnabled"] = true.AsString();
            int nsd = (nameSpaceDepth.AsInt() + 1);

            console.ParentExecute(thisobj, "onMount", nsd, new string[] { thisobj, obj, slot });
        }
        public string StaticShapeDataCreate(coSimDataBlock data)
        {
            Torque_Class_Helper tch = new Torque_Class_Helper("StaticShape");

            tch.Props.Add("dataBlock", data);
            coSimObject obj = tch.Create();

            return(obj);
        }
示例#4
0
        public void movedown(int val)
        {
            coSimObject obj = ((coGameConnection)"ServerConnection").getControlObject();

            if (obj.isInNamespaceHierarchy("Camera"))
            {
                iGlobal["$mvDownAction"] = val * movementSpeed;
            }
            //console.SetVar("$mvDownAction", val.AsInt() * movementSpeed);
        }
示例#5
0
        public void AudioStateExclusiveonActivate(coSimObject thisobj)
        {
            console.ParentExecute(thisobj.ID, "onActivate", 1, new[] { thisobj.ID });
            coSimSet group = thisobj["parentGroup"];

            for (uint i = 0; i < group.getCount(); i++)
            {
                coSFXState obj = group.getObject(i);
                if (obj != thisobj && obj.isMemberOfClass("SFXState") && obj.isActive())
                {
                    obj.deactivate();
                }
            }
        }
示例#6
0
        public void GuiCanvascheckCursor(coGuiCanvas thisobj)
        {
            for (uint i = 0; i < thisobj.getCount(); i++)
            {
                coSimObject control = thisobj.getObject(i);

                if ((control["noCursor"] != "") && (control["noCursor"].AsBool()))
                {
                    continue;
                }
                showCursor();
                return;
            }
            hideCursor();
        }
示例#7
0
        public bool ShapeBaseShapeBaseThrow(coShapeBase thisobj, coItemData data, int amount = 1)
        {
            bool functionresult = false;

            if (ShapeBaseShapeBaseGetInventory(thisobj, data) > 0)
            {
                coSimObject objectid = data.call("onThrow", thisobj, amount.AsString());
                {
                    if (objectid != 0)
                    {
                        thisobj.call("throwObject", objectid);
                        AudioServerPlay3D("ThrowSnd", thisobj.getTransform());
                        functionresult = true;
                    }
                }
            }
            return(functionresult);
        }
示例#8
0
        public void ServerCmdThrow(coGameConnection client, string data)
        {
            coPlayer player = client["player"];

            if (!player.isObject() || (player.getState() == "Dead") || !Game_Running)
            {
                return;
            }

            coSimObject mountedimage = player.getMountedImage(iGlobal["$WeaponSlot"]);

            switch (data)
            {
            case "Weapon":
            {
                if (mountedimage != "0")
                {
                    coItemData item = mountedimage["item"];
                    ShapeBaseShapeBaseThrow(player, item);
                }
            }
            break;

            case "Ammo":
            {
                if (mountedimage != "0")
                {
                    coSimObject item = mountedimage;
                    if (item["ammo"] != "")
                    {
                        ShapeBaseShapeBaseThrow(player, item["ammo"]);
                    }
                }
            }
            break;

            default:
                if (ShapeBaseShapeBaseHasInventory(player, data.getName()))
                {
                    ShapeBaseShapeBaseThrow(player, data);
                }
                break;
            }
        }
        public void DemoPlayerOnDisabled(coPlayerData datablock, coAIPlayer npc, string state)
        {
            Util._cancelAll(npc);
            coScriptObject aimanager = null;

            aimanager = npc["aiManager"];
            if (!aimanager.isObject())
            {
                console.error("Bad aiManager");
                return;
            }
            npc.setImageTarget(0, false);



            coSimObject item = ((coSimObject)npc.getMountedImage(WeaponSlot))["item"];

            if (item.isObject())
            {
                //string item = console.GetVarString(ShapeBase.getMountedImage(npc, WeaponSlot).AsString() + ".item");
                if (r.Next(1, 100) > 80)
                {
                    int amount = ShapeBaseShapeBaseGetInventory(npc, item["image.ammo"]);

                    if (amount.AsBool())
                    {
                        ShapeBaseShapeBaseThrow(npc, item["image.clip"], 1);
                    }
                }
            }

            ShapeBaseTossPatch(npc);
            PlayerPlayDeathCry(npc);
            PlayerPlayDeathAnimation(npc);
            int ctov = 2000;

            spawnAI(aimanager);

            npc.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true");
            npc.schedule(ctov.AsString(), "deleteme");
            aiscreated--;
        }
示例#10
0
        public void sfxPause(coSimSet channels, coSimSet pauseSet)
        {
            if (!console.isObject(pauseSet))
            {
                pauseSet = sGlobal["SFXPausedSet"];
            }

            coSimSet SFXSourceSet = sGlobal["SFXSourceSet"];

            for (uint i = 0; i < SFXSourceSet.getCount(); i++)
            {
                coSimObject source  = SFXSourceSet.getObject(i);
                string      channel = sfxGroupToOldChannel(source.getGroup());

                //console.Call(source, "getGroup"));
                throw new Exception("The find word function doesn't exists... wtf?");
                //if (channel != "" && console.Call("findWord", new string[] { channels, channel }).AsInt() == -1)
                //    continue;
                ////SFXSource.pause(source, -1);
                //pauseSet.pushToBack(source);
            }
        }
示例#11
0
        public bool SpawnPlayer(coGameConnection client, string spawnpoint, bool nocontrol)
        {
            coPlayer player = client["player"];


            if (player.isObject())
            {
                console.error("Attempting to create a player for a client that already has one!");
                return(false);
            }

            if ((spawnpoint.Split(' ').GetUpperBound(0) == 0) && (spawnpoint.isObject()))
            {
                // Attempt to treat %spawnPoint as an object
                string spawnclass     = Game__DefaultPlayerClass;
                string spawndatablock = Game__DefaultPlayerDataBlock;

                coSimObject ospawnpoint = spawnpoint;


                // Overrides by the %spawnPoint
                if (ospawnpoint["spawnClass"] != "")
                {
                    spawnclass     = ospawnpoint["spawnClass"];
                    spawndatablock = ospawnpoint["spawnDataBlock"];
                }

                else if (ospawnpoint["spawnDatablock"] != "")
                {
                    // This may seem redundant given the above but it allows
                    // the SpawnSphere to override the datablock without
                    // overriding the default player class
                    spawndatablock = ospawnpoint["spawnDatablock"];
                }
                string spawnproperties = ospawnpoint["spawnProperties"];
                string spawnScript     = ospawnpoint["spawnScript"];

                // Spawn with the engine's Sim::spawnObject() function
                player = console.SpawnObject(spawnclass, spawndatablock, "", spawnproperties, spawnScript);
                // If we have an object do some initial setup
                if (console.isObject(player))
                {
                    // Pick a location within the spawn sphere.
                    player.setTransform(PointInSpawnSphere(player, ((coSpawnSphere)spawnpoint)));
                }
                else
                {
                    // If we weren't able to create the player object then warn the user
                    // When the player clicks OK in one of these message boxes, we will fall through
                    // to the "if (!isObject(%player))" check below.
                    if (console.GetVarString(spawndatablock).Trim() != "")
                    {
                        console.Call("MessageBoxOK", new[] { "Spawn Player Failed", "Unable to create a player with class " + spawnclass + " and datablock " + spawndatablock + ".\n\nStarting as an Observer instead.", "" });
                    }
                    else
                    {
                        console.Call("MessageBoxOK", new[] { "Spawn Player Failed", "Unable to create a player with class " + spawnclass + ".\n\nStarting as an Observer instead.", "" });
                    }
                }
            }
            else
            {
                // Create a default player
                player = console.SpawnObject(Game__DefaultPlayerClass, Game__DefaultPlayerDataBlock, "", "", "");

                if (player.isMemberOfClass("Player"))
                {
                    //if (SimObject.SimObject_isMemberOfClass(player, "Player"))
                    console.warn("Trying to spawn a class that does not derive from player!!!!!");
                }
                // Treat %spawnPoint as a transform
                player.setTransform(new TransformF(spawnpoint));
            }

            // Update the default camera to start with the player
            if (!console.isObject(player))
            {
                client["spawnCamera"] = spawnpoint;
                return(false);
            }

            ((coSimSet)"MissionCleanup").pushToBack(player);
            // Update the default camera to start with the player


            // Store the client object on the player object for
            // future reference
            player["client"] = client;

            // If the player's client has some owned turrets, make sure we let them
            // know that we're a friend too.

            if (client["ownedTurrets"].AsInt() >= 1)
            {
                coSimSet turrets = client["ownedTurrets"];
                for (uint i = 0; i < turrets.getCount(); i++)
                {
                    ((coTurretShape)turrets.getObject(i)).call("addToIgnoreList", player);
                }
            }

            player.setShapeName(client["playerName"]);

            player.setEnergyLevel(((coPlayerData)player.getDataBlock())["maxEnergy"].AsFloat());

            if (client["skin"] != "")
            {
                string availableSkins = ((coPlayerData)player.getDataBlock())["availableSkins"];
                foreach (coGameConnection other in ClientGroup.Where(other => other != client))
                {
                    availableSkins = availableSkins.Replace(console.GetVarString(other + ".skin"), " ");

                    availableSkins = availableSkins.Replace("  ", " ");
                }
                List <string> availskin = availableSkins.Split('\t').ToList();
                if (availskin.Count > 0)
                {
                    int r = new Random().Next(0, availskin.Count - 1);
                    client["skin"] = availskin[r];
                }
            }

            player.setSkinName(client["skin"]);
            client["player"] = player;

            coSimObject control = null;

            if (console.GetVarString("$startWorldEditor") == "1")
            {
                control = client["camera"];
                console.Call("EditorGui", "syncCameraGui");
            }
            else
            {
                control = player;
            }

            if (!nocontrol)
            {
                client.setControlObject(control);
            }

            int team = new Random().Next(1, 2);

            AddObjectTo_MobSearchGroup(player, team);

            MessageClient(client, "System", "Your on Team " + team);

            console.error(DateTime.Now + " --- PLAYER JOIN::Name '" + Util.StripMLControlChars(player.getShapeName()) + "'::ID '" + player + "'");
            return(true);
        }
示例#12
0
 public void ppOptionsHDRBloomBlurMeanonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::gaussMean"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#13
0
 public void ppOptionsHDRBrightnessAdaptRateonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::adaptRate"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#14
0
 public void ppOptionsHDRMinLuminanceonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::minLuminace"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#15
0
 public void ppOptionsSSAOFarTolerancePoweronMouseDragged(coSimObject thisobj)
 {
     sGlobal["$SSAOPostFx::lNormalPow"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#16
0
 public void ppOptionsSSAONearToleranceNormalonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$SSAOPostFx::sNormalTol"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
 public void ppOptionsHDRBrightnessAdaptRateonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::adaptRate"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsHDRWhiteCutoffonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::whiteCutoff"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsHDRMinLuminanceonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::minLuminace"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsHDRToneMappingAmountonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::enableToneMapping"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsSSAOFarTolerancePoweronMouseDragged(coSimObject thisobj)
     {
     sGlobal["$SSAOPostFx::lNormalPow"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsSSAOFarDepthMaxonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$SSAOPostFx::lDepthMax"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
 public void ppOptionsSSAONearToleranceNormalonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$SSAOPostFx::sNormalTol"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
示例#24
0
 public void ppOptionsSSAONearStrengthonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$SSAOPostFx::sStrength"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
 public void ppOptionsHDRBloomBlurBrightPassThresholdonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::brightPassThreshold"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
示例#26
0
 public void ppOptionsSSAOFarDepthMaxonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$SSAOPostFx::lDepthMax"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
 public void ppOptionsHDRBloomBlurMeanonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$HDRPostFX::gaussMean"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
示例#28
0
 public void ppOptionsHDRToneMappingAmountonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::enableToneMapping"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#29
0
        public void WeaponOnUser(coScriptObject data, coPlayer obj)
        {
            if (obj.getMountedImage(WeaponSlot) == data["image"].AsInt())
            {
                return;
            }

            AudioServerPlay3D("WeaponUseSound", obj.getTransform());


            obj.mountImage(data["image"], WeaponSlot, true, "");

            if (obj["client"].AsBool())
            {
                if (data["description"] != "")
                {
                    MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", data["description"]);
                }
                else
                {
                    MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected"));
                }
            }

            if (obj.isInNamespaceHierarchy("Player"))
            {
                return;
            }

            obj.allowAllPoses();
            coSimObject image = data["image"];

            if (image["jumpingDisallowed"].AsBool())
            {
                obj.allowJumping(false);
            }

            if (image["jetJumpingDisallowed"].AsBool())
            {
                obj.allowJetJumping(false);
            }

            if (image["sprintDisallowed"].AsBool())
            {
                obj.allowSprinting(false);
            }

            if (image["crouchDisallowed"].AsBool())
            {
                obj.allowCrouching(false);
            }

            if (image["proneDisallowed"].AsBool())
            {
                obj.allowProne(false);
            }

            if (image["swimmingDisallowed"].AsBool())
            {
                obj.allowSwimming(false);
            }
        }
示例#30
0
 public void ppOptionsHDRWhiteCutoffonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::whiteCutoff"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
 public void ppOptionsSSAOBlurDepthonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$SSAOPostFx::blurDepthTol"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }
示例#32
0
 public void ppOptionsHDRBloomBlurBrightPassThresholdonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$HDRPostFX::brightPassThreshold"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
 public void AudioStateExclusiveonActivate(coSimObject thisobj)
     {
     console.ParentExecute(thisobj.ID, "onActivate", 1, new[] {thisobj.ID});
     coSimSet group = thisobj["parentGroup"];
     for (uint i = 0; i < group.getCount(); i++)
         {
         coSFXState obj = group.getObject(i);
         if (obj != thisobj && obj.isMemberOfClass("SFXState") && obj.isActive())
             obj.deactivate();
         }
     }
示例#34
0
 public void LightRayPostFXpreProcess(coSimObject thisobj)
     {
     thisobj["targetScale"] = sGlobal["$LightRayPostFX::resolutionScale"] + " " + sGlobal["$LightRayPostFX::resolutionScale"];
     }
        public void TeleporterTriggerOnEnterTrigger(coSimDataBlock thisobj, coSceneObject entrance, coPlayer obj)
        {
            //if (!console.isMemberOfClass(obj, "Player"))
            //    return;

            if (obj["isTeleporting"].AsBool())
            {
                return;
            }
            // Get the location of our target position
            coTrigger exit = entrance["exit"];

            bool valid = TeleporterTriggerVerifyObject(thisobj, obj, entrance, exit);

            if (!valid)
            {
                return;
            }

            TeleporterTriggerTeleFrag(thisobj, obj, exit);
            // Create our entrance effects on all clients.



            coSimObject entranceeffect = entrance["entranceEffect"];

            if (entranceeffect.isObject())
            {
                foreach (coGameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { entrance["position"], entranceeffect.getId().AsString() });
                    }
                }
            }


            TeleporterTriggerTeleportPlayer(thisobj, obj, exit);
            // Create our exit effects on all clients.

            coSimObject exitEffect = entrance["exitEffect"];

            if (exitEffect.isObject())
            {
                foreach (coGameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { entrance["position"], exitEffect.getId().AsString() });
                    }
                }
            }

            // Record what time we last teleported so we can determine if enough
            // time has elapsed to teleport again
            int tolt = console.getSimTime();

            entrance["timeOfLastTeleport"] = tolt.AsString();

            // If this is a bidirectional teleporter, log it's exit too.
            if (exit["exit"] == entrance["name"])
            {
                exit["timeOfLastTeleport"] = tolt.AsString();
            }


            // Tell the client to play the 2D sound for the player that teleported.
            if (((coSimObject)thisobj["teleportSound"]).isObject() && ((coGameConnection)obj["client"]).isObject())
            {
                ((coGameConnection)obj["client"]).play2D(thisobj["teleportSound"]);
                //GameConnection.play2D(obj, thisobj["teleportSound"]);
            }
        }
 public void GrenadeLauncherImageOnMount(coSimObject thisobj, coSimObject obj, string slot, string nameSpaceDepth)
     {
     // Make it ready
     obj["detonadeEnabled"] = true.AsString();
     int nsd = (nameSpaceDepth.AsInt() + 1);
     console.ParentExecute(thisobj, "onMount", nsd, new string[] { thisobj, obj, slot });
     }
示例#37
0
 public void ppOptionsSSAOBlurDepthonMouseDragged(coSimObject thisobj)
 {
     sGlobal["$SSAOPostFx::blurDepthTol"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
 }
示例#38
0
 public void LightRayPostFXpreProcess(coSimObject thisobj)
 {
     thisobj["targetScale"] = sGlobal["$LightRayPostFX::resolutionScale"] + " " + sGlobal["$LightRayPostFX::resolutionScale"];
 }
 public void ppOptionsSSAONearStrengthonMouseDragged(coSimObject thisobj)
     {
     sGlobal["$SSAOPostFx::sStrength"] = thisobj["value"];
     thisobj["toolTip"] = "Value : " + thisobj["value"];
     }