Example #1
0
        protected override void PrepareProtoStatusEffect()
        {
            base.PrepareProtoStatusEffect();

            if (Api.IsClient)
            {
                return;
            }

            // cache the server zone prototype
            this.serverZone = this.ServerZoneProto;

            // cache the tile offsets
            // but select only every third tile (will help to reduce the load without damaging accuracy too much)
            this.serverTileOffsetsCircle = ShapeTileOffsetsHelper
                                           .GenerateOffsetsCircle(EnvironmentalRadiationLookupAreaDiameter)
                                           .ToArray();

            this.serverTileOffsetsCircle = ShapeTileOffsetsHelper.SelectOffsetsWithRate(
                this.serverTileOffsetsCircle,
                rate: 3);

            // setup timer (tick every frame)
            TriggerEveryFrame.ServerRegister(
                callback: this.ServerGlobalUpdate,
                name: "System." + this.ShortId);
        }
Example #2
0
        protected override void PrepareProtoStatusEffect()
        {
            base.PrepareProtoStatusEffect();

            // cache the tile offsets
            // but select only every third tile (will help to reduce the load without damaging accuracy too much)
            this.serverTileOffsetsCircle = ShapeTileOffsetsHelper
                                           .GenerateOffsetsCircle(EnvironmentalTileHeatLookupAreaDiameter)
                                           .ToArray();

            this.serverTileOffsetsCircle = ShapeTileOffsetsHelper.SelectOffsetsWithRate(
                this.serverTileOffsetsCircle,
                rate: 3);

            this.serverProtoTileLava    = Api.GetProtoEntity <TileLava>();
            this.serverProtoTileVolcano = Api.GetProtoEntity <TileVolcanic>();
        }
Example #3
0
        public static IEnumerable <Vector2Int> GenerateOffsets(EditorBrushShape brush, int brushSize, bool isForPreview)
        {
            switch (brush)
            {
            case EditorBrushShape.Circle:
                return(ShapeTileOffsetsHelper.GenerateOffsetsCircle(brushSize));

            case EditorBrushShape.Square:
                return(ShapeTileOffsetsHelper.GenerateOffsetsSquare(brushSize));

                /*case EditorBrushShape.Spray:
                 *  return isForPreview
                 *             ? ShapeTileOffsetsHelper.GenerateOffsetsSquare(brushSize)
                 *             : ShapeTileOffsetsHelper.GenerateOffsetsSpray(brushSize);*/
            }

            throw new ArgumentOutOfRangeException(nameof(brush), "Unknown brush shape");
        }
        protected override void PrepareProtoStatusEffect()
        {
            base.PrepareProtoStatusEffect();

            if (Api.IsClient)
            {
                return;
            }

            this.serverFrameOffset = (byte)this.Id.GetHashCode();

            // cache the server zone prototype
            this.serverZone = this.ServerZoneProto;

            // cache the tile offsets
            this.serverTileOffsetsCircle = ShapeTileOffsetsHelper
                                           .GenerateOffsetsCircle(EnvironmentalRadiationLookupAreaDiameter)
                                           .ToArray();

            // setup timer (tick every frame)
            TriggerEveryFrame.ServerRegister(
                callback: this.ServerGlobalUpdate,
                name: "System." + this.ShortId);
        }