Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Jul 21, 2018 11:46 am

All times are UTC




Post new topic  Reply to topic  [ 55 posts ]  Go to page 1 2 3 Next
Author Message
 Post subject: Szurke NML Questions???
PostPosted: Thu Aug 28, 2014 11:00 am 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
Hi all!

We have a problem WITH!!!!! NML. We wanna an industry build on a non flat titles, but we cant fund tath how can it be.

Well, we wanna like in ECS the tourist-centres.


Top
   
PostPosted: Thu Aug 28, 2014 11:15 am 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5295
Location: The Moon
I have split your question off into your own thread. Welcome. :)

You might want to look at the industry tile property land_shape_flags and the callback tile_check. I'm not familiar with the ECS tourist center, but the callbacks foundations and autoslope may also be useful for making your industry appear correctly.

_________________
Pikkarail.com blog | Patreon
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API


Top
   
PostPosted: Thu Aug 28, 2014 11:22 am 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
PikkaBird wrote:
I have split your question off into your own thread. Welcome. :)

You might want to look at the industry tile property land_shape_flags and the callback tile_check. I'm not familiar with the ECS tourist center, but the callbacks foundations and autoslope may also be useful for making your industry appear correctly.



Thank you! Thik you, if i found enything els usefull, then i make a questions here?

You know, i read so many about teth them, but i don't know by my self how can do it. The better is thet, if somebady can write to me a btw. code.


Top
   
PostPosted: Thu Aug 28, 2014 12:05 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4643
Location: home
FIRS has ground-aware industries, source code can be found ath the devzone repository (http://dev.openttdcoop.org/projects/firs)

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Thu Aug 28, 2014 2:14 pm 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5295
Location: The Moon
Industry tile layouts are definitely the most mind-melting thing you can do in NewGRF. :lol:

_________________
Pikkarail.com blog | Patreon
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API


Top
   
PostPosted: Thu Aug 28, 2014 3:29 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7043
... until we get state machines :)

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Sun Aug 31, 2014 2:18 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
I programing in NML an Industry GRF.
I wanna an Industry on an non flat title build. Tath can i how make?

Yes i find to on wiki alls about tath, but it not clear for me.

Where and what form need i use the nearby_tile_slope?

I can under the my picture (industry title) that title what i want, but it don't builting to like this ground.


Top
   
PostPosted: Sun Aug 31, 2014 4:52 pm 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5295
Location: The Moon
Szurke wrote:
I can under the my picture (industry title) that title what i want, but it don't builting to like this ground.


What are you doing, what is happening, and what do you expect to happen?
I'm afraid your English is not so good. :) If you can post screenshots, that may make things easier for us to understand.

_________________
Pikkarail.com blog | Patreon
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API


Top
   
PostPosted: Sun Aug 31, 2014 5:14 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
I wanna make like your project:
http://users.tt-forums.net/pikka/wiki/i ... rick_Chain

Anyway build on a slpoe.


Top
   
PostPosted: Sun Aug 31, 2014 5:27 pm 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5295
Location: The Moon
Use the land_shape_flags tile property to control what slopes the industry can be built on. Use the nearby_tile_slope variable to decide which sprite to display if you allow your tiles to be built on a variety of slopes.

If you don't understand the basic principles of properties and variables in NewGRF, industry layouts is probably not the best place to start...

_________________
Pikkarail.com blog | Patreon
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API


Top
   
PostPosted: Sun Aug 31, 2014 5:43 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4676
Location: Lost in Music
This is the nml that makes for forest that is slope aware and snow aware.

Code:
/*
 * This file is part of FIRS industry set.
 * FIRS industry set is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * FIRS industry set is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRS industry set. If not, see <http://www.gnu.org/licenses/>.
 */



/* **************
 * tile_trees
 * *************/




spritelayout forest_tree_tile_layout { ground { sprite: GROUNDSPRITE_NORMAL + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; } childsprite { sprite: GROUNDSPRITE_DESERT + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_TROPIC) || (climate == CLIMATE_TROPIC) && (nearby_tile_terrain_type(0, 0) != TILETYPE_DESERT); } childsprite { sprite: 4512 + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_TROPIC) || (climate == CLIMATE_TROPIC) && (nearby_tile_terrain_type(0, 0) == TILETYPE_DESERT) || (climate == CLIMATE_TROPIC) && (nearby_tile_terrain_type(0, 0) == TILETYPE_NORMAL) && ((nearby_tile_terrain_type( 1, 0) != TILETYPE_DESERT) && (nearby_tile_terrain_type(-1, 0) != TILETYPE_DESERT) && (nearby_tile_terrain_type( 0, 1) != TILETYPE_DESERT) && (nearby_tile_terrain_type( 0,-1) != TILETYPE_DESERT)); } childsprite { sprite: GROUNDSPRITE_SNOW + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_ARCTIC) || (climate == CLIMATE_ARCTIC) && (nearby_tile_height(0, 0) < (snowline_height + 2)); } childsprite { sprite: 4531 + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_ARCTIC) || (climate == CLIMATE_ARCTIC) && ((nearby_tile_height(0, 0) < (snowline_height + 1)) || (nearby_tile_height(0, 0) >= (snowline_height + 2))); } childsprite { sprite: 4512 + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_ARCTIC) || (climate == CLIMATE_ARCTIC) && ((nearby_tile_height(0, 0) < (snowline_height + 0)) || (nearby_tile_height(0, 0) >= (snowline_height + 1))); } childsprite { sprite: 4493 + slope_to_sprite_offset(nearby_tile_slope(0, 0)); recolour_mode: RECOLOUR_REMAP; palette: PALETTE_USE_DEFAULT; always_draw: 1; hide_sprite: (climate != CLIMATE_ARCTIC) || (climate == CLIMATE_ARCTIC) && ((nearby_tile_height(0, 0) < (snowline_height - 1)) || (nearby_tile_height(0, 0) >= (snowline_height + 0))); }
 building {
  sprite: 1586;
  xoffset: 2;
  yoffset: 2;
  xextent: 13;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TEMPERATE;
 }
 building {
  sprite: 1593;
  xoffset: 8;
  yoffset: 2;
  xextent: 7;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TEMPERATE;
 }
 building {
  sprite: 1593;
  yoffset: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TEMPERATE;
 }
 building {
  sprite: 1586;
  xoffset: 8;
  yoffset: 7;
  xextent: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TEMPERATE;
 }

 building {
  sprite: 1817;
  xoffset: 2;
  yoffset: 2;
  xextent: 13;
  yextent: 13;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) < snowline_height;
 }
 building {
  sprite: 1775;
  xoffset: 8;
  yoffset: 2;
  xextent: 7;
  yextent: 13;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) < snowline_height;
 }
 building {
  sprite: 1817;
  yoffset: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) < snowline_height;
 }
 building {
  sprite: 1775;
  xoffset: 8;
  yoffset: 7;
  xextent: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) < snowline_height;
 }

 building {
  sprite: 1760;
  xoffset: 2;
  yoffset: 2;
  xextent: 13;
  yextent: 13;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) >= snowline_height;
 }
 building {
  sprite: 1719;
  xoffset: 8;
  yoffset: 2;
  xextent: 7;
  yextent: 13;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) >= snowline_height;
 }
 building {
  sprite: 1760;
  yoffset: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) >= snowline_height;
 }
 building {
  sprite: 1719;
  xoffset: 8;
  yoffset: 7;
  xextent: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_ARCTIC || nearby_tile_height(0, 0) >= snowline_height;
 }

 building {
  sprite: 1915;
  xoffset: 2;
  yoffset: 2;
  xextent: 13;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TROPICAL || nearby_tile_terrain_type(0, 0) != TILETYPE_DESERT;
 }
 building {
  sprite: 1923;
  xoffset: 8;
  yoffset: 2;
  xextent: 7;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TROPICAL || nearby_tile_terrain_type(0, 0) != TILETYPE_DESERT;
 }
 building {
  sprite: 1923;
  yoffset: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TROPICAL || nearby_tile_terrain_type(0, 0) != TILETYPE_DESERT;
 }
 building {
  sprite: 1915;
  xoffset: 8;
  yoffset: 7;
  xextent: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TROPICAL || nearby_tile_terrain_type(0, 0) != TILETYPE_DESERT;
 }

 building {
  sprite: 1845;
  xoffset: 2;
  yoffset: 2;
  xextent: 13;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TROPICAL || (climate == CLIMATE_TROPICAL && nearby_tile_terrain_type(0, 0) == TILETYPE_DESERT);
 }
 building {
  sprite: 1866;
  xoffset: 8;
  yoffset: 2;
  xextent: 7;
  yextent: 13;
  hide_sprite: climate != CLIMATE_TROPICAL || (climate == CLIMATE_TROPICAL && nearby_tile_terrain_type(0, 0) == TILETYPE_DESERT);
 }
 building {
  sprite: 1845;
  yoffset: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TROPICAL || (climate == CLIMATE_TROPICAL && nearby_tile_terrain_type(0, 0) == TILETYPE_DESERT);
 }
 building {
  sprite: 1866;
  xoffset: 8;
  yoffset: 7;
  xextent: 7;
  yextent: 8;
  hide_sprite: climate != CLIMATE_TROPICAL || (climate == CLIMATE_TROPICAL && nearby_tile_terrain_type(0, 0) == TILETYPE_DESERT);
 }
}

/* **************
 * tile_equipment
 * *************/

spriteset(spriteset_crane, "src/graphics/industries/forest_1.png") { tmpl_building_sprite(10, 10, 78, -45) }
spriteset(spriteset_bulldozer, "src/graphics/industries/forest_1.png") { tmpl_building_sprite(80, 10, 78, -45) }
spriteset(spriteset_tracks_snowtile, "src/graphics/industries/forest_1.png") { tmpl_building_sprite(220, 10, 78, -45) }

spritelayout forest_tile_equipment_nonsnow_spritelayout {
 ground {
  sprite: 2022;
 }
 building {
  sprite: spriteset_crane;
  recolour_mode: RECOLOUR_REMAP;
  palette: 0;
  xextent: 7;
  yextent: 7;
  zextent: 7;
  always_draw: 1;
 }
 building {
  sprite: spriteset_bulldozer;
  recolour_mode: RECOLOUR_REMAP;
  palette: 0;
  xextent: 7;
  yextent: 7;
  zextent: 7;
  always_draw: 1;
 }
}

spritelayout forest_tile_equipment_snow_spritelayout {
 ground {
  sprite: spriteset_tracks_snowtile;
  recolour_mode: RECOLOUR_REMAP;
  palette: 0;
 }
 building {
  sprite: spriteset_crane;
  recolour_mode: RECOLOUR_REMAP;
  palette: 0;
  xextent: 7;
  yextent: 7;
  zextent: 7;
  always_draw: 1;
 }
 building {
  sprite: spriteset_bulldozer;
  recolour_mode: RECOLOUR_REMAP;
  palette: 0;
  xextent: 7;
  yextent: 7;
  zextent: 7;
  always_draw: 1;
 }
}

switch(FEAT_INDUSTRYTILES, SELF, forest_tile_equipment_height_check, UCMP(nearby_tile_height(0, 0) - 0, snowline_height - 0)) { 0..1: forest_tile_equipment_nonsnow_spritelayout; forest_tile_equipment_snow_spritelayout; }

switch(FEAT_INDUSTRYTILES, SELF, forest_tile_equipment_spritelayout, climate) {
 CLIMATE_ARCTIC: forest_tile_equipment_height_check;
 forest_tile_equipment_nonsnow_spritelayout;
}

/* ****************************************************
 * Definition of the industry tiles and their callbacks
 * ***************************************************/

switch(FEAT_INDUSTRYTILES, SELF, forest_tile_trees_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, forest_tile_trees_player_check, ( (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_FUND) || (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_PROSPECT) ) ) { 1: return CB_RESULT_LOCATION_ALLOW; forest_tile_trees_nearby_industry; }
switch(FEAT_INDUSTRYTILES, SELF, forest_tile_trees_water_check, nearby_tile_is_water(0, 0)) { 1: string(STR_ERR_LOCATION_NOT_ON_WATER); forest_tile_trees_player_check; }
switch(FEAT_INDUSTRYTILES, SELF, forest_tile_trees_location_check, (nearby_tile_terrain_type( 1, -1) == TILETYPE_DESERT) && (nearby_tile_terrain_type( 1, 0) == TILETYPE_DESERT) && (nearby_tile_terrain_type( 1, 1) == TILETYPE_DESERT) && (nearby_tile_terrain_type( 0, -1) == TILETYPE_DESERT) && (nearby_tile_terrain_type( 0, 0) == TILETYPE_DESERT) && (nearby_tile_terrain_type( 0, 1) == TILETYPE_DESERT) && (nearby_tile_terrain_type(-1, -1) == TILETYPE_DESERT) && (nearby_tile_terrain_type(-1, 0) == TILETYPE_DESERT) && (nearby_tile_terrain_type(-1, 1) == TILETYPE_DESERT) ) { 1: return string(STR_ERR_LOCATION_NOT_IN_DESERT); forest_tile_trees_water_check; }

item(FEAT_INDUSTRYTILES, tile_trees, 205) {
 property {
  substitute: 0;
  accepted_cargos: [[FMSP, 8]];
  land_shape_flags: 0;
 }
 graphics {
  foundations: return CB_RESULT_NO_FOUNDATIONS;
  autoslope: return CB_RESULT_NO_AUTOSLOPE;
  tile_check: forest_tile_trees_location_check;
  forest_tree_tile_layout;
 }
}


switch(FEAT_INDUSTRYTILES, SELF, forest_tile_equipment_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, forest_tile_equipment_player_check, ( (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_FUND) || (((extra_callback_info2 & 0xFF00) >> 8) == IND_CREATION_PROSPECT) ) ) { 1: return CB_RESULT_LOCATION_ALLOW; forest_tile_equipment_nearby_industry; }
switch(FEAT_INDUSTRYTILES, SELF, forest_tile_equipment_location_check, nearby_tile_is_water(0, 0)) { 1: CB_RESULT_LOCATION_DISALLOW; forest_tile_equipment_player_check; }

item(FEAT_INDUSTRYTILES, tile_equipment, 206) {
 property {
  substitute: 0;
  accepted_cargos: [[FMSP, 8]];
  land_shape_flags: 0;
 }
 graphics {
  tile_check: forest_tile_equipment_location_check;
  forest_tile_equipment_spritelayout;
 }
}

/* *************************************************
 * Definition of the industry layouts
 * *************************************************/

tilelayout tilelayout_forest_1 {
 0, 0: tile_trees;
 0, 1: tile_trees;
 0, 2: tile_trees;
 1, 0: tile_trees;
 1, 1: tile_trees;
 1, 2: tile_trees;
 2, 1: tile_trees;
 2, 2: tile_equipment;
}

tilelayout tilelayout_forest_2 {
 0, 0: tile_trees;
 0, 1: tile_trees;
 0, 2: tile_trees;
 1, 0: tile_trees;
 1, 1: tile_trees;
 1, 2: tile_trees;
 3, 0: tile_trees;
 3, 1: tile_trees;
 3, 2: tile_equipment;
 4, 0: tile_trees;
 4, 1: tile_trees;
 4, 2: tile_trees;
}

tilelayout tilelayout_forest_3 {
 0, 1: tile_trees;
 0, 2: tile_trees;
 0, 3: tile_trees;
 1, 0: tile_trees;
 1, 1: tile_trees;
 1, 2: tile_trees;
 1, 3: tile_trees;
 1, 4: tile_trees;
 2, 0: tile_trees;
 2, 1: tile_trees;
 2, 2: tile_trees;
 2, 3: tile_trees;
 3, 0: tile_trees;
 3, 1: tile_trees;
 3, 2: tile_equipment;
 4, 0: tile_trees;
 4, 1: tile_trees;
 5, 0: tile_trees;
 5, 1: tile_trees;
 5, 2: tile_trees;
}

/* *************************************************
 * Definition of the industry
 * *************************************************/

switch (FEAT_INDUSTRIES, SELF, forest_forest, industry_count(forest) * 3 / 4 / industry_clusters != 0 && ( industry_distance(forest) < 15 || industry_distance(forest) > 80) ) { 1: return CB_RESULT_LOCATION_DISALLOW; return CB_RESULT_LOCATION_ALLOW; }
switch (FEAT_INDUSTRIES, SELF, forest_sawmill, industry_distance(sawmill)) { 0 .. 16: return CB_RESULT_LOCATION_DISALLOW; forest_forest; }
switch (FEAT_INDUSTRIES, SELF, forest_paper_mill, industry_distance(paper_mill)) { 0 .. 16: return CB_RESULT_LOCATION_DISALLOW; forest_sawmill; }
switch (FEAT_INDUSTRIES, SELF, forest_check_location, ( (extra_callback_info2 == IND_CREATION_FUND) || (extra_callback_info2 == IND_CREATION_PROSPECT) ) ) { 1: return CB_RESULT_LOCATION_ALLOW; forest_paper_mill; }

switch(FEAT_INDUSTRIES, SELF, forest_colour, colour) { 0: return 0; 1: return 1; 2: return 2; 3: return 13; 4: return 2; 5: return 5; 6: return 1; 7: return 1; 8: return 0; 9: return 14; 10: return 10; 11: return 11; 12: return 13; 13: return 13; 14: return 14; 15: return 14; return 0; }

/*
 * This file is part of FIRS industry set.
 * FIRS industry set is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * FIRS industry set is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRS industry set. If not, see <http://www.gnu.org/licenses/>.
 */

/* Template to handle defining supply requirements, and display of extra text for primary industries
 *
 * No debug texts. Show extra text about influence of supplies
 *
 */

/* used by production template */



/* extra text */
switch(FEAT_INDUSTRIES, SELF, forest_extra_text, LOAD_PERM(3)) {
 3: return string(STR_PRIMARY_PRODUCTION_4X, 56);
 1: return string(STR_PRIMARY_PRODUCTION_2X, 14, 56);
 return string(STR_PRIMARY_PRODUCTION_1X, 14, 56);
}


# 1 "generated/pnml/../../src/templates/produce_primary.pnml" 1
/*
 * This file is part of FIRS industry set.
 * FIRS industry set is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * FIRS industry set is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRS industry set. If not, see <http://www.gnu.org/licenses/>.
 */

/* Primary production which is boosted by supplies */

produce(forest_production, 9999, 9999, 9999, 0, 0, 0);

switch(FEAT_INDUSTRIES, SELF, forest_produce, STORE_PERM(waiting_cargo_1 + waiting_cargo_2 + waiting_cargo_3 + LOAD_PERM(0), 0)) {
 forest_production;
}

produce(forest_production_256, 0, 0, 0, LOAD_TEMP(9) * production_rate_1, LOAD_TEMP(9) * production_rate_2, 0);

switch(FEAT_INDUSTRIES, SELF, forest_produce_256_ticks,
  [STORE_TEMP(
   LOAD_PERM(0) +
   LOAD_PERM(1) +
   LOAD_PERM(2),
  8),
  STORE_TEMP((LOAD_TEMP(8) >= 56) ? 3 : ((LOAD_TEMP(8) >= 14) ? 1 : 0), 9),
  STORE_PERM(LOAD_TEMP(9), 3)
  ]) {
 forest_production_256;
}
# 368 "generated/pnml/forest.pnml" 2
# 1 "generated/pnml/../../src/templates/check_primary_production_level.pnml" 1
/*
 * This file is part of FIRS industry set.
 * FIRS industry set is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * FIRS industry set is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRS industry set. If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * This template is for use with primary industries which support supply usage
 *
 * Used permanent storage: var_num_supplies_delivered
 *
 * Usage in the industry's pnml:
 * monthly callback: THIS_ID(check_production_level)
 *
 */

/* =================================== */
/* Production change evaluated monthly */
/* =================================== */

switch(FEAT_INDUSTRIES, SELF, forest_monthly_update, [
 STORE_PERM(LOAD_PERM(1), 2),
 STORE_PERM(LOAD_PERM(0), 1),
 STORE_PERM(0, 0)
]) {
 return CB_RESULT_IND_PROD_NO_CHANGE;
}
# 369 "generated/pnml/forest.pnml" 2


# 1 "generated/pnml/../../src/templates/check_availability.pnml" 1
/*
 * This file is part of FIRS industry set.
 * FIRS industry set is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * FIRS industry set is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRS industry set. If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * Template which checks availability of an industry for building
 * - Allow in THIS_MIN_YEAR ... THIS_MAX_YEAR
 * - Always allow in SE
 * - Never allow when NewGRF parameter forbids building
 * - Always allow otherwise
 *
 * Optionally an industry may define in its pnml file
 * THIS_MIN_YEAR      first availability year
 * THIS_MAX_YEAR      last availability year
 */
# 29 "generated/pnml/../../src/templates/check_availability.pnml"
/* Check for restriction via parameter */
switch(FEAT_INDUSTRIES, SELF, forest_check_availability_param, restrict_open_during_gameplay) {
 1..255: return CB_RESULT_IND_NO_CONSTRUCTION; // disallow when restrictions in place
 return CB_RESULT_IND_PROBABILITY_FROM_PROPERTY; // we may build
}

/* Allow always during map gen */
switch (FEAT_INDUSTRIES, SELF, forest_check_map_gen, extra_callback_info2 == IND_CREATION_GENERATION) {
 1: return CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;
 forest_check_availability_param;
}
/* Allow always in the scenario editor */
switch (FEAT_INDUSTRIES, SELF, forest_available_game_mode, game_mode == GAMEMODE_GAME) {
 1: forest_check_map_gen;
 return CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;
}

/* Allow only within the availability years */
switch (FEAT_INDUSTRIES, SELF, forest_check_availability, current_date) {
 date(0,1,1) .. date(5000000,12,31): forest_available_game_mode;
 return CB_RESULT_IND_NO_CONSTRUCTION;
}
# 372 "generated/pnml/forest.pnml" 2


    if (economy==0) {

        item(FEAT_INDUSTRIES, forest, 11) {
            property {

                substitute: INDUSTRYTYPE_FOREST;

                life_type: IND_LIFE_TYPE_ORGANIC;
                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;

                map_colour: 81;
                spec_flags: 0;
                layouts: [tilelayout_forest_1, tilelayout_forest_2, tilelayout_forest_3];
                conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this

                name: TTD_STR_INDUSTRY_NAME_FOREST;

                prod_multiplier: [19];



                prob_random: 8;
                prob_in_game: 3;
                prospect_chance: 0.75;
                fund_cost_multiplier: 95;


                accept_cargo_types: [FMSP];
                prod_cargo_types: [WOOD];
            }
        }

    }


    if (economy==1) {

    }


    if (economy==2) {

        item(FEAT_INDUSTRIES, forest, 11) {
            property {

                substitute: INDUSTRYTYPE_FOREST;

                life_type: IND_LIFE_TYPE_ORGANIC;
                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;

                map_colour: 81;
                spec_flags: 0;
                layouts: [tilelayout_forest_1, tilelayout_forest_2, tilelayout_forest_3];
                conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this

                name: TTD_STR_INDUSTRY_NAME_FOREST;

                prod_multiplier: [19];



                prob_random: 8;
                prob_in_game: 3;
                prospect_chance: 0.75;
                fund_cost_multiplier: 95;


                accept_cargo_types: [FMSP];
                prod_cargo_types: [WOOD];
            }
        }

    }


    if (economy==3) {

    }


    if (economy==4) {

        item(FEAT_INDUSTRIES, forest, 11) {
            property {

                substitute: INDUSTRYTYPE_FOREST;

                life_type: IND_LIFE_TYPE_ORGANIC;
                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;

                map_colour: 81;
                spec_flags: 0;
                layouts: [tilelayout_forest_1, tilelayout_forest_2, tilelayout_forest_3];
                conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this

                name: TTD_STR_INDUSTRY_NAME_FOREST;

                prod_multiplier: [19];



                prob_random: 8;
                prob_in_game: 3;
                prospect_chance: 0.75;
                fund_cost_multiplier: 95;


                accept_cargo_types: [FMSP];
                prod_cargo_types: [WOOD];
            }
        }

    }



item(FEAT_INDUSTRIES, forest, 11) {
 graphics {
  produce_cargo_arrival: forest_produce;
  construction_probability:forest_check_availability;
  location_check: forest_check_location;
  produce_256_ticks: forest_produce_256_ticks;
  monthly_prod_change: forest_monthly_update;
        random_prod_change: return CB_RESULT_IND_PROD_NO_CHANGE;
  build_prod_change: randomise_primary_production_on_build;
  extra_text_fund: return string(STR_FUND_FOREST);
  extra_text_industry: forest_extra_text;
  colour: forest_colour;
 }
}

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (Released) | CHIPS Has Improved Players' Stations (Finished)
Iron Horse (trains, released) | Termite (tracks for Iron Horse, released) | Busy Bee (game script, released)

Road Hog (road vehicles, released)


Top
   
PostPosted: Tue Sep 02, 2014 3:11 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
Thank you all!

Thet was the exapmle solution to us problem :

Code:
switch(FEAT_INDUSTRYTILES, SELF, szolo_alja,
   (nearby_tile_slope (0,0) != SLOPE_FLAT  ) &&
   (nearby_tile_height (0,0) < nearby_tile_height (0,-2) ))
   { 1: return CB_RESULT_LOCATION_ALLOW; return CB_RESULT_LOCATION_DISALLOW; }


Top
   
PostPosted: Tue Sep 02, 2014 3:23 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
Next question:

How must use random to a industry grafik?


Top
   
PostPosted: Thu Sep 04, 2014 6:28 am 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5295
Location: The Moon
Use a random switch, or a "random" switch which isn't random but is based on, eg, the location of the industry, or use multiple industry layouts.

_________________
Pikkarail.com blog | Patreon
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API


Top
   
PostPosted: Sat Nov 08, 2014 8:50 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
Hi evryone!

I have one more question! I wana made a zoom level 2.

My code:
Code:
10: spriteset(spriteset_busz, "src/Mercedes_C21.png") {
11:     //left_x, upper_y, width, height, offset_x, offset_y
12:     [ 13,   92,      8,      27,      -4,      -8 ]
13:    [ 26,   92,      30,      24,      -22,   -8 ]
14:    [ 62,   92,      33,      13,      -10,   -7 ]
15:    [ 101,   92,      30,      24,      -18,   -15 ]
16:    [ 137,   92,      8,      27,      -4,      -8 ]
17:    [ 150,   92,      30,      24,      -13,   -14 ]
18:    [ 186,   92,      33,      13,      -9,      -6 ]
19:    [ 225,   92,      30,      24,      -8,      -9 ]
20: }
21: alternative_sprites(spriteset_busz, ZOOM_LEVEL_IN_2X, BIT_DEPTH_8BPP) {
22:     //left_x, upper_y, width, height, offset_x, offset_y
23:    [ 13,      127,      16,      54,      0,      0, "src/Mercedes_C21.png"]
24:     [ 39,      127,      60,      48,      0,      0, "src/Mercedes_C21.png"]
25:     [ 111,      127,      66,      26,      0,      0, "src/Mercedes_C21.png"]
26:     [ 189,      127,      60,      48,      0,      0, "src/Mercedes_C21.png"]
27:     [ 261,      127,      16,      54,      0,      0, "src/Mercedes_C21.png"]
28:     [ 287,      127,      60,      48,      0,      0, "src/Mercedes_C21.png"]
29:     [ 359,      127,      66,      54,      0,      0, "src/Mercedes_C21.png"]
30:     [ 437,      127,      60,      48,      0,      0, "src/Mercedes_C21.png"]
31: }


And i become an error: nmlc: "input", line 21: Unrecognized identifier 'BIT_DEPTH_8BPP' encountered

What is the problem?


Top
   
PostPosted: Sat Nov 08, 2014 10:25 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 325
Location: PL
Szurke wrote:
And i become an error: nmlc: "input", line 21: Unrecognized identifier 'BIT_DEPTH_8BPP' encountered
What is the problem?

Please try this:
Code:
21: alternative_sprites(spriteset_busz, ZOOM_LEVEL_IN_2X, BIT_DEPTH_8BPP, "src/Mercedes_C21.png") {
22:     //left_x, upper_y, width, height, offset_x, offset_y
23:    [ 13,      127,      16,      54,      0,      0 ]

It works in my set.

_________________
Image


Top
   
PostPosted: Sat Nov 08, 2014 10:44 pm 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
Then write this:

nmlc: "input", line 21: alternative_sprite-block requeres 2 or 3 parameters, encountered 4.


Top
   
PostPosted: Sat Nov 08, 2014 11:00 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2640
What is the output from
Code:
nmlc --version

Maybe you have a version that does not work with alternative sprites as described in the specs as it was changed between 0.2 and 0.3.

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML


Top
   
PostPosted: Sun Nov 09, 2014 12:27 am 
Offline
Engineer
Engineer

Joined: Thu Aug 28, 2014 10:56 am
Posts: 20
0.2.5.r2135:6f38df710194
Library versions encountered:
PIL: 1.1.7
PLY: 3.4


Top
   
PostPosted: Sun Nov 09, 2014 1:53 am 
Offline
Chief Executive
Chief Executive
User avatar

Joined: Thu Oct 28, 2004 4:42 am
Posts: 702
Location: Catch the Fox if you can... 10 years and counting!
Szurke wrote:
0.2.5.r2135:6f38df710194
Library versions encountered:
PIL: 1.1.7
PLY: 3.4


Why don't you try to use a more recent version?

http://bundles.openttdcoop.org/nml/releases/?C=M&O=D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 55 posts ]  Go to page 1 2 3 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.