Is it possible to add the station to the Oil Rig in MML?

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
temporal8
Route Supervisor
Route Supervisor
Posts: 429
Joined: 17 May 2019 14:15

Is it possible to add the station to the Oil Rig in MML?

Post by temporal8 »

As you surely know, my industries newgrf, Real Industries does not have a functional Oil Rig, does not include the hidden station for oil boats and no possibility for helicopters to land.

I would like to add the station for the boats, is it possible to do it in nml?
Real Projects 32bpp releases:

Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Brickblock1
Engineer
Engineer
Posts: 117
Joined: 04 Apr 2022 12:44
Location: The openttd discord server

Re: Is it possible to add the station to the Oil Rig in MML?

Post by Brickblock1 »

I am fairly sure it is possible but I don't know how. Looking at firs code it seams to have the flags IND_FLAG_BUILT_ON_WATER and IND_FLAG_AI_CREATES_AIR_AND_SHIP_ROUTES so maybe you have too have those set.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Is it possible to add the station to the Oil Rig in MML?

Post by jfs »

Yes, it's the above mentioned flags, plus the industry tile layout needs to contain a special tile that is the station tile itself. I can't find the specific tile ID right now, but you need to add it to the tile layout by numeric ID.
temporal8
Route Supervisor
Route Supervisor
Posts: 429
Joined: 17 May 2019 14:15

Re: Is it possible to add the station to the Oil Rig in MML?

Post by temporal8 »

jfs wrote: 17 Apr 2023 07:16 Yes, it's the above mentioned flags, plus the industry tile layout needs to contain a special tile that is the station tile itself. I can't find the specific tile ID right now, but you need to add it to the tile layout by numeric ID.
I found this but i not understand at all. https://newgrf-specs.tt-wiki.net/wiki/I ... faultProps

This its the source code from Real Industries Oil Rig:

Code: Select all

/**************************************
oilrig
***************************************/
        spriteset(oilrig_spriteset_ground_0, "gfx/groundtiles.png") {
                    tmpl_ground_tile(360, 10)
            }

            spriteset(oilrig_spriteset_ground_overlay_0, "gfx/groundtiles.png") {
                    tmpl_ground_tile(360, 10)
            }

            spriteset(oilrig_spriteset_1_0) {
                        [96, 0, 64, 254, -31, -223, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_1_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [257, 36, 257, 217, -126, -284, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_2_0) {
                        [128, 0, 64, 270, -31, -239, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_2_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [515, 63, 128, 446, 4, -322, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_3_0) {
                        [160, 0, 64, 286, -31, -255, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_3_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [643, 127, 129, 446, 4, -322, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_4_0) {
                        [192, 0, 64, 302, -31, -271, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_4_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [130, 63, 128, 446, -125, -322, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_5_0) {
                        [64, 0, 64, 270, -31, -239, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_5_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [258, 254, 257, 192, -125, -195, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_6_0) {
                        [96, 0, 64, 286, -31, -255, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_6_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [515, 509, 129, 128, 3, -4, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_7_0) {
                        [128, 0, 64, 302, -31, -271, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_7_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [0, 127, 130, 446, -127, -321, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_8_0) {
                        [160, 0, 64, 318, -31, -287, ANIM | NOCROP, "gfx/oilrig.png"] 
            }
            alternative_sprites(oilrig_spriteset_8_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [130, 509, 128, 130, -125, -4, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            spriteset(oilrig_spriteset_9_0) {
                        [32, 0, 64, 286, -31, -255, ANIM | NOCROP, "gfx/oilrig.png"]
            }
            alternative_sprites(oilrig_spriteset_9_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, ""){
                        [258, 446, 257, 254, -125, -131, ANIM | NOCROP, "gfx/oilrig_32.png"]
            }

            
    spritelayout oilrig_spritelayout_1 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
           recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }
        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional

            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_1_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_1_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_1_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_1_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_2 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }

        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional

            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_2_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_2_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_2_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_2_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_3 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }

        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_3_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_3_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_3_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_3_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
     }

    spritelayout oilrig_spritelayout_4 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }

        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        // construction stages - optional

            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_4_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_4_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_4_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)

                building {
                    sprite: oilrig_spriteset_4_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_5 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }

        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_5_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_5_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_5_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_5_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_6 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }
        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_6_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_6_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_6_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
               building {
                    sprite: oilrig_spriteset_6_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_7 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }
        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_7_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_7_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_7_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)

                building {
                    sprite: oilrig_spriteset_7_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_8 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }
        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_8_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_8_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_8_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_8_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    spritelayout oilrig_spritelayout_9 {
        // generic ground (terrain aware / climate aware)
        ground {
            sprite: GROUNDSPRITE_WATER ;
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
        }
        // industry-specific ground (snow aware)
        // normal
        childsprite {
            sprite: oilrig_spriteset_ground_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }
        childsprite {
            sprite: oilrig_spriteset_ground_overlay_0(0* animation_frame);
            recolour_mode: RECOLOUR_REMAP;
            palette: PALETTE_USE_DEFAULT;
            hide_sprite: (terrain_type == TILETYPE_SNOW); always_draw: 1;
        }

        // construction stages - optional
            // construction states (no snow awareness)
            building {
                sprite: oilrig_spriteset_9_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 0);
            }
            building {
                sprite: oilrig_spriteset_9_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 1);
            }
            building {
                sprite: oilrig_spriteset_9_0(0* animation_frame);
                recolour_mode: RECOLOUR_REMAP;
                palette: PALETTE_USE_DEFAULT;
                xoffset: 0;
                yoffset: 0;
                zoffset: 0;
                xextent: 16;
                yextent: 16;
                zextent: 16;
                always_draw: 0;
                hide_sprite: (construction_state != 2);
            }

        // buildings (snow aware)
                building {
                    sprite: oilrig_spriteset_9_0(0* animation_frame);
                    recolour_mode: RECOLOUR_REMAP;
                    palette: PALETTE_USE_DEFAULT;
                    xoffset: 0;
                    yoffset: 0;
                    zoffset: 0;
                    xextent: 16;
                    yextent: 16;
                    zextent: 16;
                    always_draw: 0;
                    hide_sprite: (construction_state != 3) || (terrain_type == TILETYPE_SNOW) ;
                }
    }

    switch(FEAT_INDUSTRYTILES, SELF, oilrig_industry_layout_1_graphics_switch, relative_pos) {
            relative_coord(0, 0): oilrig_spritelayout_1;
            relative_coord(0, 1): oilrig_spritelayout_2;
            relative_coord(0, 2): oilrig_spritelayout_3;
            relative_coord(1, 0): oilrig_spritelayout_4;
            relative_coord(1, 1): oilrig_spritelayout_5;
            relative_coord(1, 2): oilrig_spritelayout_6;
            relative_coord(2, 0): oilrig_spritelayout_7;
            relative_coord(2, 1): oilrig_spritelayout_8;
            relative_coord(2, 2): oilrig_spritelayout_9;

        oilrig_spritelayout_2; // a default is needed, but should never be reached, layout definitions are explicit
    }

switch(FEAT_INDUSTRYTILES, PARENT, oilrig_industry_graphics_switch_layouts, layout_num) {

     1: oilrig_industry_layout_1_graphics_switch;

 oilrig_industry_layout_1_graphics_switch; // default
}

switch(FEAT_INDUSTRYTILES, SELF, oilrig_industry_construction_state_graphics_switch, construction_state) {
 0..2: spritelayout_default_construction_states;
 oilrig_industry_graphics_switch_layouts; // default
}

switch(FEAT_INDUSTRYTILES, PARENT, oilrig_industry_master_graphics_switch, STORE_TEMP(random_bits, 0)) {
 oilrig_industry_construction_state_graphics_switch; // default
}

switch (FEAT_INDUSTRYTILES, SELF, oilrig_tile_fence_station, [ STORE_TEMP( LOAD_TEMP(9) * (nearby_tile_class(-1, 0) != TILE_CLASS_STATION), 9), STORE_TEMP( LOAD_TEMP(10) * (nearby_tile_class( 0, -1) != TILE_CLASS_STATION), 10), STORE_TEMP( LOAD_TEMP(11) * (nearby_tile_class( 0, 1) != TILE_CLASS_STATION), 11), STORE_TEMP( LOAD_TEMP(12) * (nearby_tile_class( 1, 0) != TILE_CLASS_STATION), 12), ]) { oilrig_industry_master_graphics_switch; }
switch (FEAT_INDUSTRYTILES, SELF, oilrig_tile_fence_industry, [ STORE_TEMP( LOAD_TEMP(9) * !nearby_tile_is_same_industry(-1, 0), 9), STORE_TEMP( LOAD_TEMP(10) * !nearby_tile_is_same_industry( 0, -1), 10), STORE_TEMP( LOAD_TEMP(11) * !nearby_tile_is_same_industry( 0, 1), 11), STORE_TEMP( LOAD_TEMP(12) * !nearby_tile_is_same_industry( 1, 0), 12), ]) { oilrig_tile_fence_station; }
switch (FEAT_INDUSTRYTILES, SELF, oilrig_tile_fences, [ STORE_TEMP( 0, 1), STORE_TEMP( 0, 2), STORE_TEMP( 0, 3), STORE_TEMP( 0, 4), STORE_TEMP( 1, 9), STORE_TEMP( 1, 10), STORE_TEMP( 1, 11), STORE_TEMP( 1, 12), STORE_TEMP( 0, 5), STORE_TEMP( 0, 6), STORE_TEMP( 0, 7), STORE_TEMP( 0, 8), ]) { oilrig_tile_fence_industry; }

/* *************************************************
 * Definition of the industry tile and its callbacks
 * *************************************************/
switch (FEAT_INDUSTRYTILES, SELF, oilrig_nearby_industry, (nearby_tile_class( 1, 1) == TILE_CLASS_INDUSTRY) | (nearby_tile_class( 1, 0) == TILE_CLASS_INDUSTRY) | (nearby_tile_class( 1, -1) == TILE_CLASS_INDUSTRY) | (nearby_tile_class( 0, -1) == TILE_CLASS_INDUSTRY) | (nearby_tile_class(-1, -1) == TILE_CLASS_INDUSTRY) | (nearby_tile_class(-1, 0) == TILE_CLASS_INDUSTRY) | (nearby_tile_class(-1, 1) == TILE_CLASS_INDUSTRY) | (nearby_tile_class( 0, 1) == TILE_CLASS_INDUSTRY)) { 1: return CB_RESULT_LOCATION_DISALLOW; return CB_RESULT_LOCATION_ALLOW; }
switch (FEAT_INDUSTRYTILES, PARENT, oilrig_player_check, ( (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_FUND) || (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_PROSPECT) ) ) { 1: return CB_RESULT_LOCATION_ALLOW; oilrig_nearby_industry; }
switch (FEAT_INDUSTRYTILES, SELF, oilrig_location_check, nearby_tile_slope(0,0) == SLOPE_FLAT) { 1: oilrig_player_check; return CB_RESULT_LOCATION_DISALLOW; }

item(FEAT_INDUSTRYTILES, oilrig_tile, 113) {
 property {
  substitute: 0;
  special_flags: bitmask(IND_FLAG_BUILT_ON_WATER,INDTILE_FLAG_ACCEPT_ALL);
  animation_triggers: bitmask(ANIM_TRIGGER_INDTILE_CONSTRUCTION_STATE);
 }
 graphics {
  tile_check: oilrig_location_check;
  oilrig_tile_fences;
 }
}

/* *************************************************
 * Definition of the industry layouts
 * *************************************************/
    tilelayout oilrig_industry_layout_1_tilelayout {
            0, 0: oilrig_tile;
            0, 1: oilrig_tile;
            0, 2: oilrig_tile;
            1, 0: oilrig_tile;
            1, 1: oilrig_tile;
            1, 2: oilrig_tile;
            2, 0: oilrig_tile;
            2, 1: oilrig_tile;
            2, 2: oilrig_tile;
    }

/* *************************************************
 * Definition of the industry
 * *************************************************/
/* THIS SECTION TELLS THE INDUSTRY TO PRODUCE CARGOS DEPENDING ON TOWN SIZE */

switch (FEAT_INDUSTRIES, SELF, oilrig_oilrig, industry_distance(oilrig)) { 0 .. 60: return CB_RESULT_LOCATION_DISALLOW; return CB_RESULT_LOCATION_ALLOW; }
switch (FEAT_INDUSTRIES, SELF, oilrig_check_location, ( (extra_callback_info2 == IND_CREATION_FUND) || (extra_callback_info2 == IND_CREATION_PROSPECT) ) ) { 1: return CB_RESULT_LOCATION_ALLOW; oilrig_oilrig; }

        item(FEAT_INDUSTRIES, oilrig, 113) {
            property {
                substitute: 5;
                override: 5;
                life_type: IND_LIFE_TYPE_PROCESSING;
                closure_msg: TTD_STR_NEWS_INDUSTRY_CLOSURE_SUPPLY_PROBLEMS;
                prod_increase_msg: TTD_STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL;
                prod_decrease_msg: TTD_STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL;
                new_ind_msg: TTD_STR_NEWS_INDUSTRY_CONSTRUCTION;
                min_cargo_distr: 5;
                map_colour: 151;
                spec_flags: bitmask(IND_FLAG_LONG_CARGO_TYPE_LISTS, IND_FLAG_BUILT_ON_WATER, IND_FLAG_AI_CREATES_AIR_AND_SHIP_ROUTES,INDTILE_FLAG_ACCEPT_ALL);
                layouts:
[
    oilrig_industry_layout_1_tilelayout,
];
                conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this
                name: string(STR_IND_oilrig);
                nearby_station_name: string(STR_STATION, string(STR_TOWN), string(STR_STATION_OIL_RIG));
                prob_random: 12;
                prob_in_game: 4;
                prospect_chance: 0.75;
                fund_cost_multiplier: 1;
                remove_cost_multiplier: 0;
		cargo_types:[produce_cargo("PASS",4),produce_cargo("OIL_",12)];
            }
        }

item(FEAT_INDUSTRIES, oilrig, 113) {
 graphics {
 		extra_text_industry: return string(STR_EXTRA_oilrig);
		location_check: oilrig_check_location;
 }
}

/***************************
 END oilrig
****************************/
Real Projects 32bpp releases:

Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Is it possible to add the station to the Oil Rig in MML?

Post by jfs »

On the IndustryDefaultProps page you linked, it kind of is and is not hinted what the special tile ID is.

You need to put industry tile id 0x18 (decimal 24) in your industry tile layout to generate the station part of the industry. This tile renders as plain water with nothing on top, but it also generates the docking and helipad zones for vehicles to stop at.


The Real Industries Oil Rig seems like a bad example to work from, it's extremely complex and will most likely also have a high performance impact on the game.
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 495
Joined: 11 Aug 2019 18:15
Contact:

Re: Is it possible to add the station to the Oil Rig in MML?

Post by 2TallTyler »

If you're looking for a minimalist example, I made a Trade Center NewGRF that only exists to provide this neutral station, so players can trade cargos between companies. The industry itself does nothing.

https://github.com/2TallTyler/trade_center
temporal8
Route Supervisor
Route Supervisor
Posts: 429
Joined: 17 May 2019 14:15

Re: Is it possible to add the station to the Oil Rig in MML?

Post by temporal8 »

Thank you very much, I will investigate it! :bow:
Real Projects 32bpp releases:

Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Is it possible to add the station to the Oil Rig in MML?

Post by jfs »

I found the code for my rather dormant project, that includes a water industry.

Code: Select all

tilelayout candyrig_layout1 {
    0, 0: 0xFF; 1, 0: 0xFF;           2, 0: 0xFF;           3, 0: 0xFF;
    0, 1: 0xFF; 1, 1: 0x18;           2, 1: 0xFF;           3, 1: 0xFF;
    0, 2: 0xFF; 1, 2: 0x18;           2, 2: candyrig_tile1; 3, 2: 0xFF;
    0, 3: 0xFF; 1, 3: candyrig_tile3; 2, 3: candyrig_tile2; 3, 3: 0xFF;
    0, 4: 0xFF; 1, 4: 0xFF;           2, 4: 0xFF;           3, 4: 0xFF;
}
Here the 0xFF tiles in the layout are the "water check" tiles, the 0x18 are the station tiles, and the remaining are custom industry tiles defined earlier in the file.

For the industry itself, you need two spec_flags: IND_FLAG_BUILT_ON_WATER, IND_FLAG_AI_CREATES_AIR_AND_SHIP_ROUTES

Code: Select all

item(FEAT_INDUSTRIES, candyrig) {
    property {
        substitute: INDUSTRYTYPE_PLASTIC_FOUNTAIN;
        name: string(STR_CANDYRIG_NAME);
        nearby_station_name: string(STR_CANDYRIG_STATION);
        layouts: [candyrig_layout1];
        spec_flags: bitmask(IND_FLAG_BUILT_ON_WATER, IND_FLAG_AI_CREATES_AIR_AND_SHIP_ROUTES);
        life_type: IND_LIFE_TYPE_EXTRACTIVE;
        cargo_types: [
            accept_cargo("SWTR"),
            produce_cargo("SUGR", 15)
        ];
    }
    graphics {
        extra_text_industry: string(STR_CANDYRIG_FLAVOUR);
        produce_256_ticks: candyrig_prod_cb;
    }
}
If your industry has those two parts (0x18 tiles in the layout, and those flags) then it should generate the neutral station with dock and heliport.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: Is it possible to add the station to the Oil Rig in MML?

Post by Quast65 »

One thing I can remember from making OTIS, is that I noticed that (when testing, so renewing the GRF in a running game) sometimes the station did not appear immediately at the placement of the industry and it takes a couple of ticks.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Is it possible to add the station to the Oil Rig in MML?

Post by Andrew350 »

jfs wrote: 18 May 2023 08:16 For the industry itself, you need two spec_flags: IND_FLAG_BUILT_ON_WATER, IND_FLAG_AI_CREATES_AIR_AND_SHIP_ROUTES
Fun fact: It's actually possible to create a land-based industry with these special tiles by leaving off the IND_FLAG_BUILT_ON_WATER flag. The special tiles themselves will still spawn a water tile underneath them, but those can be covered up by the structure in front of them to give the correct illusion. You can even put multiple helipads on the same industry, although they will obviously be considered separate stations which may cause some issues with production mechanics. The only downside is that the map generator seems unable to place these industries automatically, so they can only be funded manually. Also this may be completely a bug and is almost certainly not intended behavior, but it's fun nonetheless :lol:
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 495
Joined: 11 Aug 2019 18:15
Contact:

Re: Is it possible to add the station to the Oil Rig in MML?

Post by 2TallTyler »

Quast65 wrote: 18 May 2023 08:34 One thing I can remember from making OTIS, is that I noticed that (when testing, so renewing the GRF in a running game) sometimes the station did not appear immediately at the placement of the industry and it takes a couple of ticks.
Yes, this is because it does not appear until the industry has finished construction. Easy to forget if (like me) you don’t include construction sprites. ;)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest