public static bool DoDrawOp(DrawOp op, Brush brush, Player p, Vec3U16[] marks) { op.Origin = marks[0]; op.Min = marks[0]; op.Max = marks[0]; for (int i = 1; i < marks.Length; i++) { op.Min = Vec3U16.Min(op.Min, marks[i]); op.Max = Vec3U16.Max(op.Max, marks[i]); } op.Level = p.level; if (!op.Level.DrawingAllowed) { Player.SendMessage(p, "Drawing commands are turned off on this map."); return(false); } long affected = 0; if (!op.CanDraw(marks, p, out affected)) { return(false); } if (brush != null && affected != -1) { const string format = "{0}({1}): affecting up to {2} blocks"; Player.SendMessage(p, String.Format(format, op.Name, brush.Name, affected)); } else if (affected != -1) { const string format = "{0}: affecting up to {1} blocks"; Player.SendMessage(p, String.Format(format, op.Name, affected)); } AppendDrawOp(p, op, brush, marks, affected); return(true); }
public static bool Do(DrawOp op, Brush brush, Player p, Vec3S32[] marks, bool checkLimit = true) { Level lvl = p.level; op.Setup(p, lvl, marks); if (lvl != null && !lvl.Config.Drawing && !op.AlwaysUsable) { p.Message("Drawing commands are turned off on this map."); return(false); } if (lvl != null && CannotBuildIn(p, lvl)) { return(false); } long affected = op.BlocksAffected(lvl, marks); if (op.AffectedByTransform) { p.Transform.GetBlocksAffected(ref affected); } if (checkLimit && !op.CanDraw(marks, p, affected)) { return(false); } if (brush != null && affected != -1) { const string format = "{0}({1}): affecting up to {2} blocks"; if (!p.Ignores.DrawOutput) { p.Message(format, op.Name, brush.Name, affected); } } else if (affected != -1) { const string format = "{0}: affecting up to {1} blocks"; if (!p.Ignores.DrawOutput) { p.Message(format, op.Name, affected); } } DoQueuedDrawOp(p, op, brush, marks); return(true); }
public static bool Do(DrawOp op, Brush brush, Player p, Vec3S32[] marks, bool checkLimit = true) { Level lvl = Setup(op, p, marks); if (lvl != null && !lvl.Config.DrawingAllowed) { Player.Message(p, "Drawing commands are turned off on this map."); return(false); } if (lvl != null && !lvl.BuildAccess.CheckDetailed(p)) { Player.Message(p, "Hence you cannot use draw commands on this map."); return(false); } long affected = op.BlocksAffected(lvl, marks); if (p != null && op.AffectedByTransform) { p.Transform.GetBlocksAffected(ref affected); } if (checkLimit && !op.CanDraw(marks, p, affected)) { return(false); } if (brush != null && affected != -1) { const string format = "{0}({1}): affecting up to {2} blocks"; if (p == null || !p.Ignores.DrawOutput) { Player.Message(p, format, op.Name, brush.Name, affected); } } else if (affected != -1) { const string format = "{0}: affecting up to {1} blocks"; if (p == null || !p.Ignores.DrawOutput) { Player.Message(p, format, op.Name, affected); } } DoQueuedDrawOp(p, op, brush, marks); return(true); }
public static bool DoDrawOp(DrawOp op, Brush brush, Player p, Vec3S32[] marks, bool checkLimit = true) { op.SetMarks(marks); op.Level = p == null ? null : p.level; op.Player = p; if (op.Level != null && !op.Level.DrawingAllowed) { Player.Message(p, "Drawing commands are turned off on this map."); return(false); } if (op.Level != null && op.Level.BuildAccess.Check(p) == LevelAccess.Blacklisted) { Player.Message(p, "You are blacklisted from building in this map, " + "hence you cannot draw in this map"); return(false); } long affected = op.BlocksAffected(op.Level, marks); if (p != null && op.AffectedByTransform) { p.Transform.GetBlocksAffected(ref affected); } if (checkLimit && !op.CanDraw(marks, p, affected)) { return(false); } if (brush != null && affected != -1) { const string format = "{0}({1}): affecting up to {2} blocks"; Player.Message(p, format, op.Name, brush.Name, affected); } else if (affected != -1) { const string format = "{0}: affecting up to {1} blocks"; Player.Message(p, format, op.Name, affected); } AppendDrawOp(p, op, brush, marks, affected); return(true); }