public IAction Fix(Problem problem) { return new ReplaceObjects(problem.Objects, problem.Objects.Select(x => { var c = x.Clone(); c.ID = problem.Map.IDGenerator.GetNextObjectID(); return c; })); }
public IAction Fix(Problem problem) { return new Create(problem.Map.WorldSpawn.ID, new Entity(problem.Map.IDGenerator.GetNextObjectID()) { EntityData = new EntityData { Name = "info_player_start" }, ClassName = "info_player_start", Colour = Colour.GetDefaultEntityColour(), Origin = Coordinate.Zero }); }
public IAction Fix(Problem problem) { var edit = new EditEntityData(); foreach (var mo in problem.Objects) { var ed = mo.GetEntityData().Clone(); var prop = ed.Properties.FirstOrDefault(x => x.Key.ToLowerInvariant() == "target"); if (prop != null) { ed.Properties.Remove(prop); edit.AddEntity(mo, ed); } } return edit; }
public IAction Fix(Problem problem) { return new EditFace(problem.Faces, (d, x) => { var ignored = "{#!~+-0123456789".ToCharArray(); var def = d.TextureCollection.GetAllItems() .OrderBy(i => new string(i.Name.Where(c => !ignored.Contains(c)).ToArray()) + "Z") .FirstOrDefault(); if (def != null) { x.Texture.Name = def.Name; x.Texture.Texture = def.GetTexture(); x.CalculateTextureCoordinates(); } }, true); }
public IAction Fix(Problem problem) { var edit = new EditEntityData(); foreach (var mo in problem.Objects.OfType<Entity>().Where(x => x.GameData != null)) { var ed = mo.GetEntityData().Clone(); foreach (var prop in mo.EntityData.Properties) { if (!mo.GameData.Properties.Any(x => String.Equals(x.Name, prop.Key, StringComparison.InvariantCultureIgnoreCase))) { ed.Properties.Remove(prop); } } edit.AddEntity(mo, ed); } return edit; }
public IAction Fix(Problem problem) { var edit = new EditEntityData(); foreach (var mo in problem.Objects) { var ed = mo.GetEntityData().Clone(); var dupes = from p in ed.Properties group p by p.Key.ToLowerInvariant() into g where g.Count() > 1 select g; foreach (var prop in dupes.SelectMany(dupe => dupe.Skip(1))) { ed.Properties.Remove(prop); } edit.AddEntity(mo, ed); } return edit; }
public IAction Fix(Problem problem) { return new Delete(problem.Objects.Select(x => x.ID)); }
public IAction Fix(Problem problem) { return new EditFace(problem.Faces, (d, x) => x.ID = d.Map.IDGenerator.GetNextFaceID(), true); }
public IAction Fix(Problem problem) { return new Reparent(problem.Objects[0].Parent.ID, problem.Objects[0].GetChildren().SelectMany(x => x.Find(y => y is Entity))); }
public IAction Fix(Problem problem) { return new Edit(problem.Objects, (d, x) => x.ID = d.Map.IDGenerator.GetNextObjectID()); }
public IAction Fix(Problem problem) { return new EditFace(problem.Faces, (d,x) => x.AlignTextureToFace(), false); }
public IAction Fix(Problem problem) { return new Reparent(problem.Objects[0].Parent.ID, problem.Objects[0].GetChildren()); }
public IAction Fix(Problem problem) { return(new Reparent(problem.Objects[0].Parent.ID, problem.Objects[0].GetChildren())); }
public IAction Fix(Problem problem) { return(new EditFace(problem.Faces, (d, x) => x.AlignTextureToFace(), false)); }
public IAction Fix(Problem problem) { return(new Delete(problem.Objects.Select(x => x.ID))); }