public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockshape <data> [color]"); // TODO: Color as separate command! return; } byte dat = (byte)Utilities.StringToInt(entry.InputArguments[0]); byte col = 0; if (entry.InputArguments.Count > 1) { col = (byte)Utilities.StringToInt(entry.InputArguments[1]); } Location eye = entry.Player.GetEyePosition(); CollisionResult cr = entry.Player.TheRegion.Collision.RayTrace(eye, eye + entry.Player.ForwardVector() * 5, entry.Player.IgnoreThis); if (cr.Hit && cr.HitEnt == null) { Location block = cr.Position - cr.Normal * 0.01; Material mat = entry.Player.TheRegion.GetBlockMaterial(block); if (mat != Material.AIR) { entry.Player.TheRegion.SetBlockMaterial(block, mat, dat, col); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set."); return; } } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Failed to set: couldn't hit a block!"); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 2) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockflood <material> <max radius>"); return; } Material chosenMat = MaterialHelpers.FromNameOrNumber(entry.InputArguments[0]); double maxRad = Utilities.StringToFloat(entry.InputArguments[1]); if (maxRad > 50) // TODO: Config! { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Maximum radius is 50!"); return; } Location start = entry.Player.GetPosition().GetBlockLocation() + new Location(0, 0, 1); HashSet <Location> locs = new HashSet <Location>(); FloodFrom(entry.Player.TheRegion, start, start, maxRad, locs); Location[] tlocs = locs.ToArray(); BlockInternal[] bis = new BlockInternal[tlocs.Length]; for (int i = 0; i < bis.Length; i++) { bis[i] = new BlockInternal((ushort)chosenMat, 0, 0, (byte)BlockFlags.EDITED); } entry.Player.TheRegion.MassBlockEdit(tlocs, bis, false); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count <= 0) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/remote <commands>"); return; } CommandQueue queue = CommandScript.SeparateCommands("command_line", entry.AllArguments(), entry.Player.TheServer.Commands.CommandSystem, false).ToQueue(entry.Player.TheServer.Commands.CommandSystem); queue.SetVariable("player", new PlayerTag(entry.Player)); queue.Outputsystem = (message, messageType) => { string bcolor = "^r^7"; switch (messageType) { case MessageType.INFO: case MessageType.GOOD: bcolor = "^r^2"; break; case MessageType.BAD: bcolor = "^r^3"; break; } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, entry.Player.TheServer.Commands.CommandSystem.TagSystem.ParseTagsFromText(message, bcolor, queue.CommandStack.Peek().Variables, DebugMode.FULL, (o) => { /* DO NOTHING */ }, true)); }; queue.Execute(); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockshape <data> [color]"); // TODO: Color as separate command! return; } byte dat = (byte)Utilities.StringToInt(entry.InputArguments[0]); byte col = 0; if (entry.InputArguments.Count > 1) { col = (byte)Utilities.StringToInt(entry.InputArguments[1]); } Location eye = entry.Player.GetEyePosition(); CollisionResult cr = entry.Player.TheRegion.Collision.RayTrace(eye, eye + entry.Player.ForwardVector() * 5, entry.Player.IgnoreThis); if (cr.Hit && cr.HitEnt == null) { Location block = cr.Position - cr.Normal * 0.01; Material mat = entry.Player.TheRegion.GetBlockMaterial(block); if (mat != Material.AIR) { entry.Player.TheRegion.SetBlockMaterial(block, mat, dat, col); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set."); return; } } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE,"Failed to set: couldn't hit a block!"); }
public override void Execute(PlayerCommandEntry entry) { ItemStack stack = entry.Player.Items.GetItemForSlot(entry.Player.Items.cItem); // Don't throw bound items... if (stack.IsBound) { if (stack.Info.Name == "open_hand") // TODO: Better handling of special cases -> Info.Throw() ? { if (entry.Player.GrabJoint != null) { BEPUutilities.Vector3 launchvec = (entry.Player.ItemDir * 100).ToBVector(); // TODO: Strength limits PhysicsEntity pe = entry.Player.GrabJoint.Ent2; entry.Player.TheRegion.DestroyJoint(entry.Player.GrabJoint); entry.Player.GrabJoint = null; pe.Body.ApplyLinearImpulse(ref launchvec); pe.Body.ActivityInformation.Activate(); return; } } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Can't throw this."); // TODO: Language, entry.output, etc. return; } // Ensure no spam... if (entry.Player.LastThrowTime > entry.Player.TheRegion.GlobalTickTime - 3) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Thrown too rapidly!"); return; } entry.Player.LastThrowTime = entry.Player.TheRegion.GlobalTickTime; // Actually throw it now... ItemStack item = stack.Duplicate(); item.Count = 1; PhysicsEntity ie = entry.Player.TheRegion.ItemToEntity(item); // TODO: Animate player Location fvel = entry.Player.ItemDir; ie.SetPosition(entry.Player.ItemSource() + fvel * 2); ie.SetOrientation(entry.Player.GetOrientation()); ie.SetVelocity(fvel * 15); entry.Player.TheRegion.SpawnEntity(ie); if (stack.Count > 1) { stack.Count -= 1; entry.Player.Network.SendPacket(new SetItemPacketOut(entry.Player.Items.cItem - 1, stack)); } else { entry.Player.Items.RemoveItem(entry.Player.Items.cItem); } }
public override void Execute(PlayerCommandEntry entry) { int it = entry.Player.Items.cItem; if (entry.InputArguments.Count > 0) { it = Utilities.StringToInt(entry.InputArguments[0]); } ItemStack stack = entry.Player.Items.GetItemForSlot(it); if (stack.IsBound) { if (stack.Info == entry.Player.TheServer.ItemInfos.GetInfoFor("open_hand") && // TODO: Better handling of special cases entry.Player.GrabJoint != null) { entry.Player.TheRegion.DestroyJoint(entry.Player.GrabJoint); entry.Player.GrabJoint = null; return; } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Can't drop this."); // TODO: Language, entry.output, etc. return; } // Ensure no spam... if (entry.Player.LastThrowTime > entry.Player.TheRegion.GlobalTickTime - 3) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Dropping too rapidly!"); return; } entry.Player.LastThrowTime = entry.Player.TheRegion.GlobalTickTime; // Actually drop it now... ItemStack item = stack.Duplicate(); item.Count = 1; PhysicsEntity ie = entry.Player.TheRegion.ItemToEntity(item); // TODO: Animate player Location fvel = entry.Player.ForwardVector(); ie.SetPosition(entry.Player.GetEyePosition() + fvel); ie.SetOrientation(entry.Player.GetOrientation()); ie.SetVelocity(fvel); entry.Player.TheRegion.SpawnEntity(ie); if (stack.Count > 1) { stack.Count -= 1; entry.Player.Network.SendPacket(new SetItemPacketOut(entry.Player.Items.cItem - 1, stack)); } else { entry.Player.Items.RemoveItem(entry.Player.Items.cItem); } }
public override void Execute(PlayerCommandEntry entry) { ItemStack item = entry.Player.Items.GetItemForSlot(entry.Player.Items.cItem); if (item.Info is BaseGunItem) { ((BaseGunItem)item.Info).Reload(entry.Player, item); } else if (item.Info is BowItem) { entry.Player.ItemStartClickTime = -2; } else { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "You can't reload that."); // TODO: Language, etc. } }
// TODO: EFficiency needed so much! public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockship <convex/perfect> [scale]"); return; } BGETraceMode tm = BGETraceMode.CONVEX; if (entry.InputArguments[0].ToLowerFast() == "perfect") { tm = BGETraceMode.PERFECT; } double maxRad = 20; // TODO: Config! Location start = (entry.Player.GetPosition() + new Location(0, 0, -0.1)).GetBlockLocation(); List <KeyValuePair <Location, BlockInternal> > blocks = new List <KeyValuePair <Location, BlockInternal> >(); AABB extent = new AABB() { Min = start, Max = start }; if (!FloodFrom(entry.Player.TheRegion, start, blocks, maxRad, extent) || blocks.Count == 0) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Invalid flood-search!"); return; } Location size = extent.Max - extent.Min; int xwidth = (int)size.X + 1; int ywidth = (int)size.Y + 1; int zwidth = (int)size.Z + 1; int xsub = (int)extent.Min.X; int ysub = (int)extent.Min.Y; int zsub = (int)extent.Min.Z; BlockInternal[] blocksin = new BlockInternal[xwidth * ywidth * zwidth]; foreach (KeyValuePair <Location, BlockInternal> block in blocks) { entry.Player.TheRegion.SetBlockMaterial(block.Key, Material.AIR, 0, 0, 1, 0, true, true); blocksin[(int)(block.Key.Z - zsub) * ywidth * xwidth + (int)(block.Key.Y - ysub) * xwidth + (int)(block.Key.X - xsub)] = block.Value; } BlockGroupEntity bge = new BlockGroupEntity(extent.Min, tm, entry.Player.TheRegion, blocksin, xwidth, ywidth, zwidth) { scale = entry.InputArguments.Count < 2 ? Location.One : Location.FromString(entry.InputArguments[1]) }; entry.Player.TheRegion.SpawnEntity(bge); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^r^1/say ^5<message>"); // TODO: ShowUsage return; } string message = entry.AllArguments(); if (entry.Player.TheServer.CVars.t_blockcolors.ValueB) { message = message.Replace("^", "^^n"); } DateTime Now = DateTime.Now; // TODO: Retrieve time of server current tick, as opposed to actual current time. // TODO: Better format (customizable!) entry.Player.TheServer.ChatMessage("^r^7[^d^5" + Utilities.Pad(Now.Hour.ToString(), '0', 2, true) + "^7:^5" + Utilities.Pad(Now.Minute.ToString(), '0', 2, true) + "^7:^5" + Utilities.Pad(Now.Second.ToString(), '0', 2, true) + "^r^7] <^d" + entry.Player.Name + "^r^7>:^2^d " + message, "^r^2^d"); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 2) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockflood <material> <max radius>"); return; } Material chosenMat = MaterialHelpers.FromNameOrNumber(entry.InputArguments[0]); double maxRad = Utilities.StringToFloat(entry.InputArguments[1]); if (maxRad > 50) // TODO: Config! { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Maximum radius is 50!"); return; } Location start = entry.Player.GetPosition().GetBlockLocation() + new Location(0, 0, 1); FloodFrom(entry.Player.TheRegion, start, start, chosenMat, maxRad); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 2) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockflood <material> <max radius>"); return; } Material chosenMat = MaterialHelpers.FromNameOrNumber(entry.InputArguments[0]); double maxRad = Utilities.StringToFloat(entry.InputArguments[1]); if (maxRad > 100) // TODO: Configurable. { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Maximum radius is 100!"); return; } Location start = entry.Player.GetPosition().GetBlockLocation() + new Location(0, 0, 1); HashSet <Vector3i> locs = new HashSet <Vector3i>(); FloodFrom(entry.Player.TheRegion, start.ToVec3i(), maxRad, locs); entry.Player.TheRegion.MassBlockEdit(locs, new BlockInternal((ushort)chosenMat, 0, 0, (byte)BlockFlags.EDITED), resDelay: 0.1); }
public override void Execute(PlayerCommandEntry entry) { ItemStack stack = entry.Player.Items.GetItemForSlot(entry.Player.Items.cItem); if (stack.IsBound) { if (stack.Info.Name == "open_hand") // TODO: Better handling of special cases -> Info.Throw() ? { if (entry.Player.GrabJoint != null) { BEPUutilities.Vector3 launchvec = (entry.Player.ForwardVector() * 100).ToBVector(); // TODO: Strength limits PhysicsEntity pe = entry.Player.GrabJoint.Ent2; entry.Player.TheRegion.DestroyJoint(entry.Player.GrabJoint); entry.Player.GrabJoint = null; pe.Body.ApplyLinearImpulse(ref launchvec); pe.Body.ActivityInformation.Activate(); return; } } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Can't throw this."); // TODO: Language, entry.output, etc. return; } ItemStack item = stack.Duplicate(); item.Count = 1; PhysicsEntity ie = entry.Player.TheRegion.ItemToEntity(item); // TODO: Animate player Location fvel = entry.Player.ForwardVector(); ie.SetPosition(entry.Player.GetEyePosition() + fvel * 2); ie.SetOrientation(entry.Player.GetOrientation()); ie.SetVelocity(fvel * 15); entry.Player.TheRegion.SpawnEntity(ie); if (stack.Count > 1) { stack.Count -= 1; entry.Player.Network.SendPacket(new SetItemPacketOut(entry.Player.Items.cItem - 1, stack)); } else { entry.Player.Items.RemoveItem(entry.Player.Items.cItem); } }
public override void Execute(PlayerCommandEntry entry) { int it = entry.Player.Items.cItem; if (entry.InputArguments.Count > 0) { it = Utilities.StringToInt(entry.InputArguments[0]); } ItemStack stack = entry.Player.Items.GetItemForSlot(it); if (stack.IsBound) { if (stack.Info == entry.Player.TheServer.ItemInfos.GetInfoFor("open_hand") // TODO: Better handling of special cases && entry.Player.GrabJoint != null) { entry.Player.TheRegion.DestroyJoint(entry.Player.GrabJoint); entry.Player.GrabJoint = null; return; } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^1Can't drop this."); // TODO: Language, entry.output, etc. return; } ItemStack item = stack.Duplicate(); item.Count = 1; PhysicsEntity ie = entry.Player.TheRegion.ItemToEntity(item); // TODO: Animate player Location fvel = entry.Player.ForwardVector(); ie.SetPosition(entry.Player.GetEyePosition() + fvel); ie.SetOrientation(entry.Player.GetOrientation()); ie.SetVelocity(fvel); entry.Player.TheRegion.SpawnEntity(ie); if (stack.Count > 1) { stack.Count -= 1; entry.Player.Network.SendPacket(new SetItemPacketOut(entry.Player.Items.cItem - 1, stack)); } else { entry.Player.Items.RemoveItem(entry.Player.Items.cItem); } }
// TODO: Clientside? public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^r^1/stance <stance>"); // TODO: ShowUsage return; } string stance = entry.InputArguments[0].ToLowerFast(); // TOOD: Implement! if (stance == "stand") { entry.Player.DesiredStance = Stance.Standing; } else if (stance == "crouch") { entry.Player.DesiredStance = Stance.Crouching; } else { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "^r^1Unknown stance input."); // TODO: Languaging } }
// TODO: EFficiency needed so much! public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count < 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockship <convex/perfect> [scale]"); return; } BGETraceMode tm = BGETraceMode.CONVEX; if (entry.InputArguments[0].ToLowerFast() == "perfect") { tm = BGETraceMode.PERFECT; } double maxRad = 20; // TODO: Config! Location start = (entry.Player.GetPosition() + new Location(0, 0, -0.1)).GetBlockLocation(); List<KeyValuePair<Location, BlockInternal>> blocks = new List<KeyValuePair<Location, BlockInternal>>(); AABB extent = new AABB() { Min = start, Max = start }; if (!FloodFrom(entry.Player.TheRegion, start, blocks, maxRad, extent) || blocks.Count == 0) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Invalid flood-search!"); return; } Location size = extent.Max - extent.Min; int xwidth = (int)size.X + 1; int ywidth = (int)size.Y + 1; int zwidth = (int)size.Z + 1; int xsub = (int)extent.Min.X; int ysub = (int)extent.Min.Y; int zsub = (int)extent.Min.Z; BlockInternal[] blocksin = new BlockInternal[xwidth * ywidth * zwidth]; foreach (KeyValuePair<Location, BlockInternal> block in blocks) { entry.Player.TheRegion.SetBlockMaterial(block.Key, Material.AIR, 0, 0, 1, 0, true, true, true); blocksin[(int)(block.Key.Z - zsub) * ywidth * xwidth + (int)(block.Key.Y - ysub) * xwidth + (int)(block.Key.X - xsub)] = block.Value; } BlockGroupEntity bge = new BlockGroupEntity(extent.Min, tm, entry.Player.TheRegion, blocksin, xwidth, ywidth, zwidth); bge.scale = entry.InputArguments.Count < 2 ? Location.One : Location.FromString(entry.InputArguments[1]); entry.Player.TheRegion.SpawnEntity(bge); }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count <= 0) { ShowUsage(entry); return; } string arg0 = entry.InputArguments[0]; if (arg0 == "spawnCar" && entry.InputArguments.Count > 1) { CarEntity ve = new CarEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "spawnHeli" && entry.InputArguments.Count > 1) { HelicopterEntity ve = new HelicopterEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "spawnPlane" && entry.InputArguments.Count > 1) { PlaneEntity ve = new PlaneEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "heloTilt" && entry.InputArguments.Count > 1) { if (entry.Player.CurrentSeat != null && entry.Player.CurrentSeat.SeatHolder is HelicopterEntity) { ((HelicopterEntity)entry.Player.CurrentSeat.SeatHolder).TiltMod = Utilities.StringToFloat(entry.InputArguments[1]); } } else if (arg0 == "shortRange") { entry.Player.ViewRadiusInChunks = 3; entry.Player.ViewRadExtra2 = 0; entry.Player.ViewRadExtra2Height = 0; entry.Player.ViewRadExtra5 = 0; entry.Player.ViewRadExtra5Height = 0; } else if (arg0 == "fly") { if (entry.Player.IsFlying) { entry.Player.Unfly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Unflying!"); } else { entry.Player.Fly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Flying!"); } } else if (arg0 == "playerDebug") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "YOU: " + entry.Player.Name + ", tractionForce: " + entry.Player.CBody.TractionForce + ", mass: " + entry.Player.CBody.Body.Mass + ", radius: " + entry.Player.CBody.BodyRadius + ", hasSupport: " + entry.Player.CBody.SupportFinder.HasSupport + ", hasTraction: " + entry.Player.CBody.SupportFinder.HasTraction + ", isAFK: " + entry.Player.IsAFK + ", timeAFK: " + entry.Player.TimeAFK); } else if (arg0 == "playBall") { // TODO: Item for this? ModelEntity me = new ModelEntity("sphere", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector()); me.mode = ModelCollisionMode.SPHERE; me.SetVelocity(entry.Player.ForwardVector()); me.SetBounciness(0.95f); entry.Player.TheRegion.SpawnEntity(me); } else if (arg0 == "playDisc") { // TODO: Item for this? ModelEntity me = new ModelEntity("flyingdisc", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector() * 1.5f); // TODO: 1.5 -> 'reach' value? me.mode = ModelCollisionMode.AABB; me.SetVelocity(entry.Player.ForwardVector() * 25f); // TODO: 25 -> 'strength' value? me.SetAngularVelocity(new Location(0, 0, 10)); entry.Player.TheRegion.SpawnEntity(me); entry.Player.TheRegion.AddJoint(new JointFlyingDisc(me)); } else if (arg0 == "secureMovement") { entry.Player.SecureMovement = !entry.Player.SecureMovement; entry.Player.SendLanguageData(TextChannel.COMMAND_RESPONSE, "voxalia", "commands.player.devel.secure_movement", entry.Player.Network.GetLanguageData("voxalia", "common." + (entry.Player.SecureMovement ? "true" : "false"))); if (entry.Player.SecureMovement) { entry.Player.Flags &= ~YourStatusFlags.INSECURE_MOVEMENT; } else { entry.Player.Flags |= YourStatusFlags.INSECURE_MOVEMENT; } entry.Player.SendStatus(); } else if (arg0 == "chunkDebug") { Biome biome; Location posBlock = entry.Player.GetPosition().GetBlockLocation(); double h = entry.Player.TheRegion.Generator.GetHeight(entry.Player.TheRegion.TheWorld.Seed, entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3, entry.Player.TheRegion.TheWorld.Seed4, entry.Player.TheRegion.TheWorld.Seed5, (double)posBlock.X, (double)posBlock.Y, (double)posBlock.Z, out biome); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal_NoLoad((entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation()); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Mat: " + bi.Material + ", data: " + ((int)bi.BlockData) + ", locDat: " + ((int)bi.BlockLocalData) + ", Damage: " + bi.Damage + ", Paint: " + bi.BlockPaint + ", xp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXP() + ", xm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXM() + ", yp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYP() + ", ym: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYM() + ", zp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesTOP() + ", zm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesBOTTOM()); double temp = entry.Player.TheRegion.BiomeGen.GetTemperature(entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3, (double)posBlock.X, (double)posBlock.Y); double down = entry.Player.TheRegion.BiomeGen.GetDownfallRate(entry.Player.TheRegion.TheWorld.Seed3, entry.Player.TheRegion.TheWorld.Seed4, (double)posBlock.X, (double)posBlock.Y); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Height: " + h + ", temperature: " + temp + ", downfallrate: " + down + ", biome yield: " + biome.GetName()); } else if (arg0 == "structureSelect" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structureselector", arg1, entry.Player.TheServer, 1, "items/admin/structure_selector", "Structure Selector", "Selects and creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_selector", false, 0)); } else if (arg0 == "structureCreate" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurecreate", arg1, entry.Player.TheServer, 1, "items/admin/structure_create", "Structure Creator", "Creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_create", false, 0)); } else if (arg0 == "musicBlock" && entry.InputArguments.Count > 3) { int arg1 = Utilities.StringToInt(entry.InputArguments[1]); double arg2 = Utilities.StringToFloat(entry.InputArguments[2]); double arg3 = Utilities.StringToFloat(entry.InputArguments[3]); entry.Player.Items.GiveItem(new ItemStack("customblock", entry.Player.TheServer, 1, "items/custom_blocks/music_block", "Music Block", "Plays music!", System.Drawing.Color.White, "items/custom_blocks/music_block", false, 0, new KeyValuePair<string, TemplateObject>("music_type", new IntegerTag(arg1)), new KeyValuePair<string, TemplateObject>("music_volume", new NumberTag(arg2)), new KeyValuePair<string, TemplateObject>("music_pitch", new NumberTag(arg3))) { Datum = new BlockInternal((ushort)Material.DEBUG, 0, 0, 0).GetItemDatum() }); } else if (arg0 == "structurePaste" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurepaste", arg1, entry.Player.TheServer, 1, "items/admin/structure_paste", "Structor Paster", "Pastes a ;" + arg1 + "; structure!", System.Drawing.Color.White, "items/admin/structure_paste", false, 0)); } else if (arg0 == "testPerm" && entry.InputArguments.Count > 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Testing " + entry.InputArguments[1] + ": " + entry.Player.HasPermission(entry.InputArguments[1])); } else if (arg0 == "spawnTree" && entry.InputArguments.Count > 1) { entry.Player.TheRegion.SpawnTree(entry.InputArguments[1].ToLowerFast(), entry.Player.GetPosition(), null); } else if (arg0 == "spawnTarget") { TargetEntity te = new TargetEntity(entry.Player.TheRegion); te.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); te.TheRegion.SpawnEntity(te); } else if (arg0 == "spawnSlime" && entry.InputArguments.Count > 2) { SlimeEntity se = new SlimeEntity(entry.Player.TheRegion, Utilities.StringToFloat(entry.InputArguments[2])); se.mod_color = ColorTag.For(entry.InputArguments[1]).Internal; se.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); se.TheRegion.SpawnEntity(se); } else if (arg0 == "timePathfind" && entry.InputArguments.Count > 1) { double dist = Utilities.StringToDouble(entry.InputArguments[1]); entry.Player.TheServer.Schedule.StartASyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List<Location> locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), entry.Player.GetPosition() + new Location(dist, 0, 0), dist * 2, 1.5f, true); sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "findPath") { Location eye = entry.Player.GetEyePosition(); Location forw = entry.Player.ForwardVector(); Location goal; RayCastResult rcr; if (entry.Player.TheRegion.SpecialCaseRayTrace(eye, forw, 150, MaterialSolidity.FULLSOLID, entry.Player.IgnorePlayers, out rcr)) { goal = new Location(rcr.HitData.Location); } else { goal = eye + forw * 50; } entry.Player.TheServer.Schedule.StartASyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List<Location> locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), goal, 75, 1.5f, true); sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "gameMode" && entry.InputArguments.Count > 1) { GameMode mode; if (Enum.TryParse(entry.InputArguments[1].ToUpperInvariant(), out mode)) { entry.Player.Mode = mode; } } else if (arg0 == "teleport" && entry.InputArguments.Count > 1) { entry.Player.Teleport(Location.FromString(entry.InputArguments[1])); } else if (arg0 == "loadPos") { entry.Player.UpdateLoadPos = !entry.Player.UpdateLoadPos; entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Now: " + (entry.Player.UpdateLoadPos ? "true" : "false")); } else if (arg0 == "tickRate") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Intended tick rate: " + entry.Player.TheServer.CVars.g_fps.ValueI + ", actual tick rate (last second): " + entry.Player.TheServer.TPS); } else if (arg0 == "paintBrush" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/paintbrush"); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "paintBomb" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("weapons/grenades/paintbomb", 10); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "sledgeHammer" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/sledgehammer"); int bsd = BlockShapeRegistry.GetBSDFor(entry.InputArguments[1]); its.Datum = bsd; entry.Player.Items.GiveItem(its); } else if (arg0 == "blockDamage" && entry.InputArguments.Count > 1) { BlockDamage damage; if (Enum.TryParse(entry.InputArguments[1], out damage)) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bi.Damage = damage; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); } else { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/devel <subcommand> [ values ... ]"); } } else if (arg0 == "blockShare" && entry.InputArguments.Count > 1) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bool temp = entry.InputArguments[1].ToLowerFast() == "true"; bi.BlockShareTex = temp; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Block " + posBlock + " which is a " + bi.Material + " set ShareTex mode to " + temp + " yields " + bi.BlockShareTex); } else if (arg0 == "webPass" && entry.InputArguments.Count > 1) { entry.Player.PlayerConfig.Set("web.passcode", Utilities.HashQuick(entry.Player.Name.ToLowerFast(), entry.InputArguments[1])); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set."); } else if (arg0 == "chunkTimes") { foreach (Tuple<string, double> time in entry.Player.TheRegion.Generator.GetTimings()) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> " + time.Item1 + ": " + time.Item2); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_General); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/A]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_A); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/B]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_B); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/C]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_C); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/D]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_D); if (entry.InputArguments.Count > 1 && entry.InputArguments[1] == "clear") { entry.Player.TheRegion.Generator.ClearTimings(); entry.Player.TheRegion.TheServer.BlockImages.Timings_General = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_A = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_B = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_C = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_D = 0; } } else { ShowUsage(entry); return; } }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count <= 0) { ShowUsage(entry); return; } string arg0 = entry.InputArguments[0]; if (arg0 == "spawnCar" && entry.InputArguments.Count > 1) { CarEntity ve = new CarEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "spawnHeli" && entry.InputArguments.Count > 1) { HelicopterEntity ve = new HelicopterEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } /*else if (arg0 == "spawnPlane" && entry.InputArguments.Count > 1) * { * PlaneEntity ve = new PlaneEntity(entry.InputArguments[1], entry.Player.TheRegion); * ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); * entry.Player.TheRegion.SpawnEntity(ve); * }*/ else if (arg0 == "spawnVehicle" && entry.InputArguments.Count > 1) { VehicleEntity ve = VehicleEntity.CreateVehicleFor(entry.Player.TheRegion, entry.InputArguments[1]); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 7); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "heloTilt" && entry.InputArguments.Count > 1) { if (entry.Player.CurrentSeat != null && entry.Player.CurrentSeat.SeatHolder is HelicopterEntity) { ((HelicopterEntity)entry.Player.CurrentSeat.SeatHolder).TiltMod = Utilities.StringToFloat(entry.InputArguments[1]); } } else if (arg0 == "shortRange") { entry.Player.ViewRadiusInChunks = 3; entry.Player.ViewRadExtra2 = 0; entry.Player.ViewRadExtra2Height = 0; entry.Player.ViewRadExtra5 = 0; entry.Player.ViewRadExtra5Height = 0; } else if (arg0 == "countEnts") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Ents: " + entry.Player.TheRegion.Entities.Count); } else if (arg0 == "varInt" && entry.InputArguments.Count > 1) { long l = Utilities.StringToLong(entry.InputArguments[1]); DataStream ds = new DataStream(); DataWriter dw = new DataWriter(ds); dw.WriteVarInt(l); byte[] b = ds.ToArray(); DataStream dOut = new DataStream(b); DataReader dr = new DataReader(dOut); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Read back " + dr.ReadVarInt() + " from " + string.Join(":::", b)); } else if (arg0 == "autoThrow") { ItemStack stack = entry.Player.Items.GetItemForSlot(entry.Player.Items.cItem); ItemStack item = stack.Duplicate(); item.Count = 1; PhysicsEntity ie = entry.Player.TheRegion.ItemToEntity(item); Location fvel = entry.Player.ItemDir; ie.SetPosition(entry.Player.ItemSource() + fvel * 2); ie.SetOrientation(entry.Player.GetOrientation()); ie.SetVelocity(fvel * 15); entry.Player.TheRegion.SpawnEntity(ie); } else if (arg0 == "fly") { if (entry.Player.IsFlying) { entry.Player.Unfly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Unflying!"); } else { entry.Player.Fly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Flying!"); } } else if (arg0 == "suicide") { entry.Player.Damageable().SetHealth(0); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "You have killed yourself!"); } else if (arg0 == "playerDebug") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "YOU: " + entry.Player.Name + ", tractionForce: " + entry.Player.CBody.TractionForce + ", mass: " + entry.Player.CBody.Body.Mass + ", radius: " + entry.Player.CBody.BodyRadius + ", hasSupport: " + entry.Player.CBody.SupportFinder.HasSupport + ", hasTraction: " + entry.Player.CBody.SupportFinder.HasTraction + ", isAFK: " + entry.Player.IsAFK + ", timeAFK: " + entry.Player.TimeAFK); } else if (arg0 == "playBall") { // TODO: Item for this? ModelEntity me = new ModelEntity("sphere", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector()); me.mode = ModelCollisionMode.SPHERE; me.SetVelocity(entry.Player.ForwardVector()); me.SetBounciness(0.95f); entry.Player.TheRegion.SpawnEntity(me); } else if (arg0 == "playDisc") { // TODO: Item for this? ModelEntity me = new ModelEntity("flyingdisc", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector() * 1.5f); // TODO: 1.5 -> 'reach' value? me.mode = ModelCollisionMode.AABB; me.SetVelocity(entry.Player.ForwardVector() * 25f); // TODO: 25 -> 'strength' value? me.SetAngularVelocity(new Location(0, 0, 10)); entry.Player.TheRegion.SpawnEntity(me); entry.Player.TheRegion.AddJoint(new JointFlyingDisc(me)); } else if (arg0 == "secureMovement") { entry.Player.SecureMovement = !entry.Player.SecureMovement; entry.Player.SendLanguageData(TextChannel.COMMAND_RESPONSE, "voxalia", "commands.player.devel.secure_movement", entry.Player.Network.GetLanguageData("core", "common." + (entry.Player.SecureMovement ? "true" : "false"))); if (entry.Player.SecureMovement) { entry.Player.Flags &= ~YourStatusFlags.INSECURE_MOVEMENT; } else { entry.Player.Flags |= YourStatusFlags.INSECURE_MOVEMENT; } entry.Player.SendStatus(); } else if (arg0 == "structureSelect" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structureselector", arg1, entry.Player.TheServer, 1, "items/admin/structure_selector", "Structure Selector", "Selects and creates a '" + arg1 + "' structure!", Color4F.White, "items/admin/structure_selector", false, 0)); } else if (arg0 == "structureCreate" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurecreate", arg1, entry.Player.TheServer, 1, "items/admin/structure_create", "Structure Creator", "Creates a '" + arg1 + "' structure!", Color4F.White, "items/admin/structure_create", false, 0)); } else if (arg0 == "musicBlock" && entry.InputArguments.Count > 3) { int arg1 = Utilities.StringToInt(entry.InputArguments[1]); double arg2 = Utilities.StringToFloat(entry.InputArguments[2]); double arg3 = Utilities.StringToFloat(entry.InputArguments[3]); entry.Player.Items.GiveItem(new ItemStack("customblock", entry.Player.TheServer, 1, "items/custom_blocks/music_block", "Music Block", "Plays music!", Color4F.White, "items/custom_blocks/music_block", false, 0, new KeyValuePair <string, TemplateObject>("music_type", new IntegerTag(arg1)), new KeyValuePair <string, TemplateObject>("music_volume", new NumberTag(arg2)), new KeyValuePair <string, TemplateObject>("music_pitch", new NumberTag(arg3))) { Datum = new BlockInternal((ushort)Material.DEBUG, 0, 0, 0).GetItemDatum() }); } else if (arg0 == "structurePaste" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurepaste", arg1, entry.Player.TheServer, 1, "items/admin/structure_paste", "Structor Paster", "Pastes a ;" + arg1 + "; structure!", Color4F.White, "items/admin/structure_paste", false, 0)); } else if (arg0 == "testPerm" && entry.InputArguments.Count > 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Testing " + entry.InputArguments[1] + ": " + entry.Player.HasPermissionByPathString(entry.InputArguments[1])); } else if (arg0 == "spawnTree" && entry.InputArguments.Count > 1) { entry.Player.TheRegion.SpawnTree(entry.InputArguments[1].ToLowerFast(), entry.Player.GetPosition(), null); } else if (arg0 == "spawnTarget") { TargetEntity te = new TargetEntity(entry.Player.TheRegion); te.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); te.TheRegion.SpawnEntity(te); } else if (arg0 == "spawnSlime" && entry.InputArguments.Count > 2) { SlimeEntity se = new SlimeEntity(entry.Player.TheRegion, Utilities.StringToFloat(entry.InputArguments[2])) { //mod_color = ColorTag.For(entry.InputArguments[1]).Internal }; se.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); se.TheRegion.SpawnEntity(se); } else if (arg0 == "timePathfind" && entry.InputArguments.Count > 1) { double dist = Utilities.StringToDouble(entry.InputArguments[1]); entry.Player.TheServer.Schedule.StartAsyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List <Location> locs = entry.Player.TheRegion.FindPathAsyncDouble(entry.Player.GetPosition(), entry.Player.GetPosition() + new Location(dist, 0, 0), dist * 2, 1.5f); sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "findPath") { Location eye = entry.Player.GetEyePosition(); Location forw = entry.Player.ForwardVector(); Location goal; if (entry.Player.TheRegion.SpecialCaseRayTrace(eye, forw, 150, MaterialSolidity.FULLSOLID, entry.Player.IgnorePlayers, out RayCastResult rcr)) { goal = new Location(rcr.HitData.Location); } else { goal = eye + forw * 50; } entry.Player.TheServer.Schedule.StartAsyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List <Location> locs; try { locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), goal, 75, 1.5f); } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output("pathfinding", ex); locs = null; } sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "massiveSet" && entry.InputArguments.Count > 1) { BlockInternal bi = new BlockInternal((ushort)(Utilities.UtilRandom.Next(10) > 5 ? Material.DIRT : Material.STONE), 0, 0, (byte)BlockFlags.EDITED); int pre_count = entry.Player.TheRegion.LoadedChunks.Count; Stopwatch sw = new Stopwatch(); sw.Start(); Location radius = Location.FromString(entry.InputArguments[1]); Location minimum = entry.Player.GetPosition() - radius; Location maximum = entry.Player.GetPosition() + new Location(radius.X, radius.Y, 0); Vector3i min_i = minimum.ToVec3i(); Vector3i max_i = maximum.ToVec3i(); Vector3i c_min = entry.Player.TheRegion.ChunkLocFor(min_i); Vector3i c_max = entry.Player.TheRegion.ChunkLocFor(max_i); Vector3i chunk_scale = c_max - c_min + new Vector3i(1, 1, 1); Chunk[] chunks = new Chunk[chunk_scale.X * chunk_scale.Y * chunk_scale.Z]; for (int x = c_min.X; x <= c_max.X; x++) { for (int y = c_min.Y; y <= c_max.Y; y++) { for (int z = c_min.Z; z <= c_max.Z; z++) { Vector3i cloc = new Vector3i(x, y, z); Chunk ch = entry.Player.TheRegion.LoadChunk(cloc); ch.LateCheckValid(); Vector3i cur = cloc - c_min; chunks[cur.Z * chunk_scale.Y * chunk_scale.X + cur.Y * chunk_scale.X + cur.X] = ch; } } } for (int x = min_i.X; x < max_i.X; x++) { for (int y = min_i.Y; y < max_i.Y; y++) { for (int z = min_i.Z; z < max_i.Z; z++) { Vector3i cloc = entry.Player.TheRegion.ChunkLocFor(new Vector3i(x, y, z)); Vector3i cur = cloc - c_min; chunks[cur.Z * chunk_scale.Y * chunk_scale.X + cur.Y * chunk_scale.X + cur.X].SetBlockAt_NoCheck (x - cloc.X * Chunk.CHUNK_SIZE, y - cloc.Y * Chunk.CHUNK_SIZE, z - cloc.Z * Chunk.CHUNK_SIZE, bi); } } } sw.Stop(); int post_count = entry.Player.TheRegion.LoadedChunks.Count; entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took: " + (sw.ElapsedTicks / (double)Stopwatch.Frequency) + " seconds... chunk load count: " + (post_count - pre_count)); for (int i = 0; i < chunks.Length; i++) { chunks[i].ChunkDetect(); entry.Player.TheRegion.PushNewChunkDetailsToUpperArea(chunks[i]); entry.Player.TheRegion.ChunkUpdateForAll(chunks[i]); } } else if (arg0 == "gameMode" && entry.InputArguments.Count > 1) { if (Enum.TryParse(entry.InputArguments[1].ToUpperInvariant(), out GameMode mode)) { entry.Player.Mode = mode; } } else if (arg0 == "teleport" && entry.InputArguments.Count > 1) { entry.Player.Teleport(Location.FromString(entry.InputArguments[1])); } else if (arg0 == "loadPos") { entry.Player.UpdateLoadPos = !entry.Player.UpdateLoadPos; entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Now: " + (entry.Player.UpdateLoadPos ? "true" : "false")); } else if (arg0 == "tickRate") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Intended tick rate: " + entry.Player.TheServer.Settings.FPS + ", actual tick rate (last second): " + entry.Player.TheServer.TPS); foreach (World w in entry.Player.TheServer.LoadedWorlds) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> " + w.Name + ": actual tick rate (last second): " + w.TPS); } } else if (arg0 == "paintBrush" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/paintbrush"); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "paintBomb" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("weapons/grenades/paintbomb", 10); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "sledgeHammer" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/sledgehammer"); int bsd = BlockShapeRegistry.GetBSDFor(entry.InputArguments[1]); its.Datum = bsd; entry.Player.Items.GiveItem(its); } else if (arg0 == "blockDamage" && entry.InputArguments.Count > 1) { if (Enum.TryParse(entry.InputArguments[1], out BlockDamage damage)) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bi.Damage = damage; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); } else { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/devel <subcommand> [ values ... ]"); } } else if (arg0 == "blockShare" && entry.InputArguments.Count > 1) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bool temp = entry.InputArguments[1].ToLowerFast() == "true"; bi.BlockShareTex = temp; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Block " + posBlock + " which is a " + bi.Material + " set ShareTex mode to " + temp + " yields " + bi.BlockShareTex); } else if (arg0 == "webPass" && entry.InputArguments.Count > 1) { entry.Player.PlayerConfig.Set("web.passcode", Utilities.HashQuick(entry.Player.Name.ToLowerFast(), entry.InputArguments[1])); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set."); } else if (arg0 == "myProperties") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Property count: " + entry.Player.PropertyCount); foreach (Property p in entry.Player.GetAllProperties()) { Dictionary <string, string> strs = new Dictionary <string, string>(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Property[" + p.GetPropertyName() + "]: "); foreach (KeyValuePair <string, string> strentry in p.GetDebuggable()) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, " " + strentry.Key + ": " + strentry.Value); } } } else if (arg0 == "spawnMessage" && entry.InputArguments.Count > 1) { string mes = entry.InputArguments[1].Replace("\\n", "\n"); HoverMessageEntity hme = new HoverMessageEntity(entry.Player.TheRegion, mes) { Position = entry.Player.GetEyePosition() }; entry.Player.TheRegion.SpawnEntity(hme); } else if (arg0 == "chunkTimes") { foreach (Tuple <string, double> time in entry.Player.TheRegion.Generator.GetTimings()) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> " + time.Item1 + ": " + time.Item2); } #if TIMINGS entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_General); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/A]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_A); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/B]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_B); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/C]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_C); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/D]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_D); if (entry.InputArguments.Count > 1 && entry.InputArguments[1] == "clear") { entry.Player.TheRegion.Generator.ClearTimings(); entry.Player.TheRegion.TheServer.BlockImages.Timings_General = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_A = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_B = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_C = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_D = 0; } #endif } else if (arg0 == "fireWork" && entry.InputArguments.Count > 1) { ParticleEffectPacketOut pepo; Location pos = entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 10; switch (entry.InputArguments[1]) { case "rainbow_huge": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 15, pos, new Location(-1, -1, -1), new Location(-1, -1, -1), 150); break; case "red_big": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 10, pos, new Location(1, 0, 0), new Location(1, 0, 0), 100); break; case "green_medium": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 7.5, pos, new Location(0.25, 1, 0.25), new Location(0.25, 1, 1), 100); break; case "blue_small": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 5, pos, new Location(0, 0, 1), new Location(0, 0, -1), 50); break; default: ShowUsage(entry); return; } entry.Player.Network.SendPacket(pepo); } else if (arg0 == "summonMountain") { System.Drawing.Image img = System.Drawing.Image.FromFile("mountain.png"); System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img); Location min = entry.Player.GetPosition(); for (int x = 0; x < bmp.Width; x++) { int xxer = x; Action a = () => { HashSet <Vector3i> loads = new HashSet <Vector3i>(); List <Location> locs = new List <Location>(2048); for (int y = 0; y < bmp.Height; y++) { int col = bmp.GetPixel(xxer, y).R * 3; for (int z = -30; z < col; z++) { for (int tx = 0; tx < 3; tx++) { for (int ty = 0; ty < 3; ty++) { Location loc = min + new Location(xxer * 3 + tx, y * 3 + ty, z); locs.Add(loc); } } } for (int z = -30; z < col + 120; z += 10) { Location loc = min + new Location(xxer * 3, y * 3, z); Vector3i cloc = entry.Player.TheRegion.ChunkLocFor(loc); if (!loads.Contains(cloc)) { loads.Add(cloc); entry.Player.TheRegion.LoadChunk(cloc); } } } Location[] loca = locs.ToArray(); BlockInternal[] bia = new BlockInternal[loca.Length]; for (int fx = 0; fx < bia.Length; fx++) { bia[fx] = new BlockInternal((ushort)Material.STONE, 0, 0, 0); } entry.Player.TheRegion.MassBlockEdit(loca, bia); }; entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(a, x * 0.1); } entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { bmp.Dispose(); img.Dispose(); }, bmp.Width * 0.05 + 1); } else { ShowUsage(entry); return; } }
public override void Execute(PlayerCommandEntry entry) { if (entry.InputArguments.Count <= 0) { ShowUsage(entry); return; } string arg0 = entry.InputArguments[0]; if (arg0 == "spawnCar" && entry.InputArguments.Count > 1) { CarEntity ve = new CarEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "spawnHeli" && entry.InputArguments.Count > 1) { HelicopterEntity ve = new HelicopterEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "spawnPlane" && entry.InputArguments.Count > 1) { PlaneEntity ve = new PlaneEntity(entry.InputArguments[1], entry.Player.TheRegion); ve.SetPosition(entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 5); entry.Player.TheRegion.SpawnEntity(ve); } else if (arg0 == "heloTilt" && entry.InputArguments.Count > 1) { if (entry.Player.CurrentSeat != null && entry.Player.CurrentSeat.SeatHolder is HelicopterEntity) { ((HelicopterEntity)entry.Player.CurrentSeat.SeatHolder).TiltMod = Utilities.StringToFloat(entry.InputArguments[1]); } } else if (arg0 == "shortRange") { entry.Player.ViewRadiusInChunks = 3; entry.Player.ViewRadExtra2 = 0; entry.Player.ViewRadExtra2Height = 0; entry.Player.ViewRadExtra5 = 0; entry.Player.ViewRadExtra5Height = 0; } else if (arg0 == "countEnts") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Ents: " + entry.Player.TheRegion.Entities.Count); } else if (arg0 == "fly") { if (entry.Player.IsFlying) { entry.Player.Unfly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Unflying!"); } else { entry.Player.Fly(); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Flying!"); } } else if (arg0 == "playerDebug") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "YOU: " + entry.Player.Name + ", tractionForce: " + entry.Player.CBody.TractionForce + ", mass: " + entry.Player.CBody.Body.Mass + ", radius: " + entry.Player.CBody.BodyRadius + ", hasSupport: " + entry.Player.CBody.SupportFinder.HasSupport + ", hasTraction: " + entry.Player.CBody.SupportFinder.HasTraction + ", isAFK: " + entry.Player.IsAFK + ", timeAFK: " + entry.Player.TimeAFK); } else if (arg0 == "playBall") { // TODO: Item for this? ModelEntity me = new ModelEntity("sphere", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector()); me.mode = ModelCollisionMode.SPHERE; me.SetVelocity(entry.Player.ForwardVector()); me.SetBounciness(0.95f); entry.Player.TheRegion.SpawnEntity(me); } else if (arg0 == "playDisc") { // TODO: Item for this? ModelEntity me = new ModelEntity("flyingdisc", entry.Player.TheRegion); me.SetMass(5); me.SetPosition(entry.Player.GetCenter() + entry.Player.ForwardVector() * 1.5f); // TODO: 1.5 -> 'reach' value? me.mode = ModelCollisionMode.AABB; me.SetVelocity(entry.Player.ForwardVector() * 25f); // TODO: 25 -> 'strength' value? me.SetAngularVelocity(new Location(0, 0, 10)); entry.Player.TheRegion.SpawnEntity(me); entry.Player.TheRegion.AddJoint(new JointFlyingDisc(me)); } else if (arg0 == "secureMovement") { entry.Player.SecureMovement = !entry.Player.SecureMovement; entry.Player.SendLanguageData(TextChannel.COMMAND_RESPONSE, "voxalia", "commands.player.devel.secure_movement", entry.Player.Network.GetLanguageData("voxalia", "common." + (entry.Player.SecureMovement ? "true" : "false"))); if (entry.Player.SecureMovement) { entry.Player.Flags &= ~YourStatusFlags.INSECURE_MOVEMENT; } else { entry.Player.Flags |= YourStatusFlags.INSECURE_MOVEMENT; } entry.Player.SendStatus(); } else if (arg0 == "chunkDebug") { Location posBlock = entry.Player.GetPosition().GetBlockLocation(); double h = entry.Player.TheRegion.Generator.GetHeight(entry.Player.TheRegion.TheWorld.Seed, entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3, entry.Player.TheRegion.TheWorld.Seed4, entry.Player.TheRegion.TheWorld.Seed5, (double)posBlock.X, (double)posBlock.Y, (double)posBlock.Z, out Biome biome); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal_NoLoad((entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation()); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Mat: " + bi.Material + ", data: " + ((int)bi.BlockData) + ", locDat: " + ((int)bi.BlockLocalData) + ", Damage: " + bi.Damage + ", Paint: " + bi.BlockPaint + ", xp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXP() + ", xm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesXM() + ", yp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYP() + ", ym: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesYM() + ", zp: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesTOP() + ", zm: " + BlockShapeRegistry.BSD[bi.BlockData].OccupiesBOTTOM()); double temp = entry.Player.TheRegion.Generator.GetBiomeGen().GetTemperature(entry.Player.TheRegion.TheWorld.Seed2, entry.Player.TheRegion.TheWorld.Seed3, (double)posBlock.X, (double)posBlock.Y); double down = entry.Player.TheRegion.Generator.GetBiomeGen().GetDownfallRate(entry.Player.TheRegion.TheWorld.Seed3, entry.Player.TheRegion.TheWorld.Seed4, (double)posBlock.X, (double)posBlock.Y); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Height: " + h + ", temperature: " + temp + ", downfallrate: " + down + ", biome yield: " + biome.GetName()); BlockUpperArea.TopBlock top = entry.Player.TheRegion.GetHighestBlock(posBlock); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Material: " + top.BasicMat + ", height: " + top.Height); } else if (arg0 == "structureSelect" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structureselector", arg1, entry.Player.TheServer, 1, "items/admin/structure_selector", "Structure Selector", "Selects and creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_selector", false, 0)); } else if (arg0 == "structureCreate" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurecreate", arg1, entry.Player.TheServer, 1, "items/admin/structure_create", "Structure Creator", "Creates a '" + arg1 + "' structure!", System.Drawing.Color.White, "items/admin/structure_create", false, 0)); } else if (arg0 == "musicBlock" && entry.InputArguments.Count > 3) { int arg1 = Utilities.StringToInt(entry.InputArguments[1]); double arg2 = Utilities.StringToFloat(entry.InputArguments[2]); double arg3 = Utilities.StringToFloat(entry.InputArguments[3]); entry.Player.Items.GiveItem(new ItemStack("customblock", entry.Player.TheServer, 1, "items/custom_blocks/music_block", "Music Block", "Plays music!", System.Drawing.Color.White, "items/custom_blocks/music_block", false, 0, new KeyValuePair <string, TemplateObject>("music_type", new IntegerTag(arg1)), new KeyValuePair <string, TemplateObject>("music_volume", new NumberTag(arg2)), new KeyValuePair <string, TemplateObject>("music_pitch", new NumberTag(arg3))) { Datum = new BlockInternal((ushort)Material.DEBUG, 0, 0, 0).GetItemDatum() }); } else if (arg0 == "structurePaste" && entry.InputArguments.Count > 1) { string arg1 = entry.InputArguments[1]; entry.Player.Items.GiveItem(new ItemStack("structurepaste", arg1, entry.Player.TheServer, 1, "items/admin/structure_paste", "Structor Paster", "Pastes a ;" + arg1 + "; structure!", System.Drawing.Color.White, "items/admin/structure_paste", false, 0)); } else if (arg0 == "testPerm" && entry.InputArguments.Count > 1) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Testing " + entry.InputArguments[1] + ": " + entry.Player.HasPermission(entry.InputArguments[1])); } else if (arg0 == "spawnTree" && entry.InputArguments.Count > 1) { entry.Player.TheRegion.SpawnTree(entry.InputArguments[1].ToLowerFast(), entry.Player.GetPosition(), null); } else if (arg0 == "spawnTarget") { TargetEntity te = new TargetEntity(entry.Player.TheRegion); te.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); te.TheRegion.SpawnEntity(te); } else if (arg0 == "spawnSlime" && entry.InputArguments.Count > 2) { SlimeEntity se = new SlimeEntity(entry.Player.TheRegion, Utilities.StringToFloat(entry.InputArguments[2])) { mod_color = ColorTag.For(entry.InputArguments[1]).Internal }; se.SetPosition(entry.Player.GetPosition() + entry.Player.ForwardVector() * 5); se.TheRegion.SpawnEntity(se); } else if (arg0 == "timePathfind" && entry.InputArguments.Count > 1) { double dist = Utilities.StringToDouble(entry.InputArguments[1]); entry.Player.TheServer.Schedule.StartAsyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List <Location> locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), entry.Player.GetPosition() + new Location(dist, 0, 0), dist * 2, 1.5f); sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "findPath") { Location eye = entry.Player.GetEyePosition(); Location forw = entry.Player.ForwardVector(); Location goal; if (entry.Player.TheRegion.SpecialCaseRayTrace(eye, forw, 150, MaterialSolidity.FULLSOLID, entry.Player.IgnorePlayers, out RayCastResult rcr)) { goal = new Location(rcr.HitData.Location); } else { goal = eye + forw * 50; } entry.Player.TheServer.Schedule.StartAsyncTask(() => { Stopwatch sw = new Stopwatch(); sw.Start(); List <Location> locs; try { locs = entry.Player.TheRegion.FindPath(entry.Player.GetPosition(), goal, 75, 1.5f); } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output("pathfinding", ex); locs = null; } sw.Stop(); entry.Player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() => { if (locs != null) { entry.Player.Network.SendPacket(new PathPacketOut(locs)); } entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Took " + sw.ElapsedMilliseconds + "ms, passed: " + (locs != null)); }); }); } else if (arg0 == "gameMode" && entry.InputArguments.Count > 1) { if (Enum.TryParse(entry.InputArguments[1].ToUpperInvariant(), out GameMode mode)) { entry.Player.Mode = mode; } } else if (arg0 == "teleport" && entry.InputArguments.Count > 1) { entry.Player.Teleport(Location.FromString(entry.InputArguments[1])); } else if (arg0 == "loadPos") { entry.Player.UpdateLoadPos = !entry.Player.UpdateLoadPos; entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Now: " + (entry.Player.UpdateLoadPos ? "true" : "false")); } else if (arg0 == "tickRate") { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Intended tick rate: " + entry.Player.TheServer.CVars.g_fps.ValueI + ", actual tick rate (last second): " + entry.Player.TheServer.TPS); } else if (arg0 == "paintBrush" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/paintbrush"); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "paintBomb" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("weapons/grenades/paintbomb", 10); byte col = Colors.ForName(entry.InputArguments[1]); its.Datum = col; its.DrawColor = Colors.ForByte(col); entry.Player.Items.GiveItem(its); } else if (arg0 == "sledgeHammer" && entry.InputArguments.Count > 1) { ItemStack its = entry.Player.TheServer.Items.GetItem("tools/sledgehammer"); int bsd = BlockShapeRegistry.GetBSDFor(entry.InputArguments[1]); its.Datum = bsd; entry.Player.Items.GiveItem(its); } else if (arg0 == "blockDamage" && entry.InputArguments.Count > 1) { if (Enum.TryParse(entry.InputArguments[1], out BlockDamage damage)) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bi.Damage = damage; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); } else { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/devel <subcommand> [ values ... ]"); } } else if (arg0 == "blockShare" && entry.InputArguments.Count > 1) { Location posBlock = (entry.Player.GetPosition() + new Location(0, 0, -0.05f)).GetBlockLocation(); BlockInternal bi = entry.Player.TheRegion.GetBlockInternal(posBlock); bool temp = entry.InputArguments[1].ToLowerFast() == "true"; bi.BlockShareTex = temp; entry.Player.TheRegion.SetBlockMaterial(posBlock, bi); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Block " + posBlock + " which is a " + bi.Material + " set ShareTex mode to " + temp + " yields " + bi.BlockShareTex); } else if (arg0 == "webPass" && entry.InputArguments.Count > 1) { entry.Player.PlayerConfig.Set("web.passcode", Utilities.HashQuick(entry.Player.Name.ToLowerFast(), entry.InputArguments[1])); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Set."); } else if (arg0 == "spawnMessage" && entry.InputArguments.Count > 1) { string mes = entry.InputArguments[1].Replace("\\n", "\n"); HoverMessageEntity hme = new HoverMessageEntity(entry.Player.TheRegion, mes) { Position = entry.Player.GetEyePosition() }; entry.Player.TheRegion.SpawnEntity(hme); } else if (arg0 == "chunkTimes") { foreach (Tuple <string, double> time in entry.Player.TheRegion.Generator.GetTimings()) { entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> " + time.Item1 + ": " + time.Item2); } #if TIMINGS entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_General); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/A]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_A); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/B]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_B); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/C]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_C); entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "--> [Image/D]: " + entry.Player.TheRegion.TheServer.BlockImages.Timings_D); if (entry.InputArguments.Count > 1 && entry.InputArguments[1] == "clear") { entry.Player.TheRegion.Generator.ClearTimings(); entry.Player.TheRegion.TheServer.BlockImages.Timings_General = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_A = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_B = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_C = 0; entry.Player.TheRegion.TheServer.BlockImages.Timings_D = 0; } #endif } else if (arg0 == "fireWork" && entry.InputArguments.Count > 1) { ParticleEffectPacketOut pepo; Location pos = entry.Player.GetEyePosition() + entry.Player.ForwardVector() * 10; switch (entry.InputArguments[1]) { case "rainbow_huge": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 15, pos, new Location(-1, -1, -1), new Location(-1, -1, -1), 150); break; case "red_big": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 10, pos, new Location(1, 0, 0), new Location(1, 0, 0), 100); break; case "green_medium": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 7.5, pos, new Location(0.25, 1, 0.25), new Location(0.25, 1, 1), 100); break; case "blue_small": pepo = new ParticleEffectPacketOut(ParticleEffectNetType.FIREWORK, 5, pos, new Location(0, 0, 1), new Location(0, 0, -1), 50); break; default: ShowUsage(entry); return; } entry.Player.Network.SendPacket(pepo); } else { ShowUsage(entry); return; } }