protected override void ClientGenerateMap(long seed, BoundsUshort worldBounds, byte startHeight) { EditorStaticObjectsRemovalHelper.ClientDelete(worldBounds); var map = GenerateIslandMap(seed, worldBounds.Size); this.ClientApplyMap(worldBounds.Offset, map, startHeight); }
private static void DeleteObjectsUnderMouseCursor() { var worldObjectsToDelete = Api.Client.World.GetTile( Input.MousePointedTilePosition) .StaticObjects; if (worldObjectsToDelete.Count > 0) { EditorStaticObjectsRemovalHelper.ClientDelete( worldObjectsToDelete.ToList()); } }
public void ClientDeleteSelectedZoneObjects(IProtoZone zone) { var clientZoneProvider = ClientZoneProvider.Get(zone); var worldService = Api.Client.World; var zoneQuadTree = clientZoneProvider.GetQuadTree(); var zoneBounds = zoneQuadTree.Bounds; var worldBoundsToDeleteObjects = worldService.GetStaticObjectsAtBounds(zoneBounds) .Where(o => zoneQuadTree.IsPositionFilled(o.TilePosition)) .ToList(); EditorStaticObjectsRemovalHelper.ClientDelete(worldBoundsToDeleteObjects); this.CallServer(_ => _.ServerRemote_DeleteZoneMobs(zone)); }
public void ClientDeleteSelectedZoneObjects(IProtoZone zone) { var clientZoneProvider = ClientZoneProvider.Get(zone); var worldService = Api.Client.World; var zoneQuadTree = clientZoneProvider.GetQuadTree(); var zoneBounds = zoneQuadTree.Bounds; // TODO: it would be great if we can make that it will delete the map objects // that were spawned only by spawn scripts and not by hand/during loading the map from the map file. // Unfortunately, it's not possible to determine. var worldBoundsToDeleteObjects = worldService.GetStaticObjectsAtBounds(zoneBounds) .Where(o => zoneQuadTree.IsPositionFilled(o.TilePosition)) .ToList(); EditorStaticObjectsRemovalHelper.ClientDelete(worldBoundsToDeleteObjects); this.CallServer(_ => _.ServerRemote_DeleteZoneMobs(zone)); }
public EditorActiveToolObjectBrush( IProtoStaticWorldObject protoStaticObject, [NotNull] Action <List <Vector2Ushort> > onSelected, Action onDispose = null) { this.protoStaticObject = protoStaticObject; this.onSelected = onSelected; this.onDispose = onDispose; this.sceneObject = Api.Client.Scene.CreateSceneObject("ActiveEditorToolBrush", Vector2D.Zero); this.sceneObject.AddComponent <ClientComponentObjectPlacementHelper>() .Setup( protoStaticObject, isCancelable: false, isRepeatCallbackIfHeld: true, isDrawConstructionGrid: false, isBlockingInput: false, validateCanPlaceCallback: this.ValidateCanBuild, placeSelectedCallback: this.PlaceSelectedHandler); this.inputContext = ClientInputContext .Start("Editor delete object") .HandleButtonDown( GameButton.ActionInteract, () => { var worldObjectsToDelete = Api.Client.World.GetTile( Api.Client.Input.MousePointedTilePosition) .StaticObjects; if (worldObjectsToDelete.Count > 0) { EditorStaticObjectsRemovalHelper.ClientDelete( worldObjectsToDelete.ToList()); } }); }
private static void ClientDeleteCallback(IReadOnlyCollection <IStaticWorldObject> worldObjectsToDelete) { EditorStaticObjectsRemovalHelper.ClientDelete(worldObjectsToDelete); }