public virtual void LoadOut(Player player) { player.clearWeaponCycle(); player.setInventory("Ryder", 1); player.setInventory("RyderClip", player.maxInventory("RyderClip")); player.setInventory("RyderAmmo", player.maxInventory("RyderAmmo")); player.addToWeaponCycle("Ryder"); player.setInventory("Lurker", 1); player.setInventory("LurkerClip", player.maxInventory("LurkerClip")); player.setInventory("LurkerAmmo", player.maxInventory("LurkerAmmo")); player.addToWeaponCycle("Lurker"); player.setInventory("LurkerGrenadeLauncher", 1); player.setInventory("LurkerGrenadeAmmo", player.maxInventory("LurkerGrenadeAmmo")); player.addToWeaponCycle("LurkerGrenadeLauncher"); player.setInventory("ProxMine", player.maxInventory("ProxMine")); player.addToWeaponCycle("ProxMine"); player.setInventory("DeployableTurret", player.maxInventory("DeployableTurret")); player.addToWeaponCycle("DeployableTurret"); SimDataBlock playerdatablock = player.getDataBlock(); string junk = playerdatablock["mainWeapon.image"]; player.mountImage(junk == string.Empty ? "LurkerWeaponImage" : junk, 0, true, string.Empty); //ShapeBase.mountImage(player, junk == "" ? junk : "LurkerWeaponImage", 0, true, ""); }
public virtual bool verifyObject(GameBase gobj, SceneObject entrance, SceneObject exit) { ShapeBase obj = gobj._ID; // Bail out early if we couldn't find an exit for this teleporter. if (!exit.isObject()) { console.error(string.Format("Cound not find an exit for {0}", console.GetVarString(entrance + ".name"))); return(false); } if (!obj.isMemberOfClass("Player")) { return(false); } // If the entrance is once sided, make sure the object // approached it from it's front. if (entrance["oneSided"].AsBool()) { TransformF forwardvector = new TransformF(entrance.getForwardVector()); Point3F velocity = obj.getVelocity(); float dotProduct = TransformF.vectorDot(forwardvector, velocity); if (dotProduct > 0) { return(false); } // If we are coming directly from another teleporter and it happens // to be bidirectional, We need to avoid ending sending objects through // an infinite loop. if (obj["isTeleporting"].AsBool()) { return(false); } // We only want to teleport players // So bail out early if we have found any // other object. if (entrance["timeOfLastTeleport"].AsInt() > 0 && entrance["teleporterCooldown"].AsInt() > 0) { int currentTime = console.getSimTime(); int timedifference = currentTime - entrance["timeOfLastTeleport"].AsInt(); SimDataBlock db = console.getDatablock(entrance); if (timedifference <= db["teleporterCooldown"].AsInt()) { return(false); } } } return(true); }
public virtual SceneObject respawnTurret(SimDataBlock datablock, string classname, TransformF transform, string isstatic, string respawn) { ObjectCreator tch = new ObjectCreator(classname); tch["datablock"] = datablock; tch["static"] = isstatic; tch["respawn"] = respawn; SceneObject turret = tch.Create(); turret.setTransform(transform); ((SimGroup) "MissionGroup").add(turret); return turret; }
public virtual SceneObject respawnTurret(SimDataBlock datablock, string classname, TransformF transform, string isstatic, string respawn) { ObjectCreator tch = new ObjectCreator(classname); tch["datablock"] = datablock; tch["static"] = isstatic; tch["respawn"] = respawn; SceneObject turret = tch.Create(); turret.setTransform(transform); ((SimGroup)"MissionGroup").add(turret); return(turret); }
public static void clientCmdPlayTeleportEffect(Point3F position, SimDataBlock effectDataBlock) { if (!effectDataBlock.isObject()) return; ObjectCreator tch = new ObjectCreator("Explosion"); tch["position"] = position.AsString(); tch["datablock"] = effectDataBlock; tch.Create(); }
public virtual bool SpawnPlayer(string spawnpoint, bool nocontrol) { Player player = this["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 = sGlobal["$Game::DefaultPlayerClass"]; string spawndatablock = sGlobal["$Game::DefaultPlayerDataBlock"]; SimObject 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 = Util.spawnObject(spawnclass, spawndatablock, "", spawnproperties, spawnScript, typeof(Player).FullName); //player.TickCounterNotifyServer = true; //player.TickCounterAdd("TestCheck", 100); //player.TickNotifyBefore = true; //player.TickNotifyClient = true; //player.TickNotifyServer = true; //player.TickNotifyBefore = true; // If we have an object do some initial setup if (console.isObject(player)) { // Pick a location within the spawn sphere. player.setTransform(PointInSpawnSphere(player, (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() != "") { WinterLeaf.Demo.Full.Models.User.GameCode.Client.Gui.messageBox.MessageBoxOK("Spawn Player Failed", "Unable to create a player with class " + spawnclass + " and datablock " + spawndatablock + ".\n\nStarting as an Observer instead.", ""); } else { WinterLeaf.Demo.Full.Models.User.GameCode.Client.Gui.messageBox.MessageBoxOK("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(sGlobal["$Game::DefaultPlayerClass"], sGlobal["$Game::DefaultPlayerDataBlock"], string.Empty, string.Empty, string.Empty); 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)) { this["spawnCamera"] = spawnpoint; return(false); } ((SimSet)"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"] = this; // If the player's client has some owned turrets, make sure we let them // know that we're a friend too. if (this["ownedTurrets"].AsInt() >= 1) { SimSet turrets = this["ownedTurrets"]; for (uint i = 0; i < turrets.getCount(); i++) { ((AITurretShape)turrets.getObject(i)).addToIgnoreList(player); } } player.setShapeName(this["playerName"]); SimDataBlock playerdata = player.getDataBlock(); player.setEnergyLevel(playerdata["maxEnergy"].AsFloat()); if (this["skin"] != string.Empty) { string availableSkins = playerdata["availableSkins"]; foreach (GameConnection other in ClientGroup.Where(other => other != this)) { 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); this["skin"] = availskin[r]; } } player.setSkinName(this["skin"]); this["player"] = player; console.error("--->Player ID is " + player); SimObject control = null; if (console.GetVarString("$startWorldEditor") == "1") { control = this["camera"]; Camera c = this["camera"]; c.setMode("Fly"); console.Call("EditorGui", "syncCameraGui"); } else { control = player; } if (!nocontrol) { this.setControlObject(control); } int team = new Random().Next(1, 2); player.AddObjectTo_MobSearchGroup(team); message.MessageClient(this, "System", "Your on Team " + team); console.error(DateTime.Now + " --- PLAYER JOIN::Name '" + Util.StripMLControlChars(player.getShapeName()) + "'::ID '" + player + "'"); return(true); }