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);
        }
Example #2
0
        private static void DeleteObjectsUnderMouseCursor()
        {
            var worldObjectsToDelete = Api.Client.World.GetTile(
                Input.MousePointedTilePosition)
                                       .StaticObjects;

            if (worldObjectsToDelete.Count > 0)
            {
                EditorStaticObjectsRemovalHelper.ClientDelete(
                    worldObjectsToDelete.ToList());
            }
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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());
                }
            });
        }
Example #6
0
 private static void ClientDeleteCallback(IReadOnlyCollection <IStaticWorldObject> worldObjectsToDelete)
 {
     EditorStaticObjectsRemovalHelper.ClientDelete(worldObjectsToDelete);
 }