Page 1 of 3

Szurke NML Questions???

Posted: 28 Aug 2014 11:00
by Szurke
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.

Re: Szurke NML Questions???

Posted: 28 Aug 2014 11:15
by PikkaBird
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.

Re: Szurke NML Questions???

Posted: 28 Aug 2014 11:22
by Szurke
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.

Re: Szurke NML Questions???

Posted: 28 Aug 2014 12:05
by Alberth
FIRS has ground-aware industries, source code can be found ath the devzone repository (http://dev.openttdcoop.org/projects/firs)

Re: Szurke NML Questions???

Posted: 28 Aug 2014 14:14
by PikkaBird
Industry tile layouts are definitely the most mind-melting thing you can do in NewGRF. :lol:

Re: Szurke NML Questions???

Posted: 28 Aug 2014 15:29
by Eddi
... until we get state machines :)

Re: Szurke NML Questions???

Posted: 31 Aug 2014 14:18
by Szurke
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.

Re: Szurke NML Questions???

Posted: 31 Aug 2014 16:52
by PikkaBird
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.

Re: Szurke NML Questions???

Posted: 31 Aug 2014 17:14
by Szurke
I wanna make like your project:
http://users.tt-forums.net/pikka/wiki/i ... rick_Chain

Anyway build on a slpoe.

Re: Szurke NML Questions???

Posted: 31 Aug 2014 17:27
by PikkaBird
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...

Re: Szurke NML Questions???

Posted: 31 Aug 2014 17:43
by andythenorth
This is the nml that makes for forest that is slope aware and snow aware.

Code: Select all

/*
 * 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;
 }
}

Re: Szurke NML Questions???

Posted: 02 Sep 2014 15:11
by Szurke
Thank you all!

Thet was the exapmle solution to us problem :

Code: Select all

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; }

Re: Szurke NML Questions???

Posted: 02 Sep 2014 15:23
by Szurke
Next question:

How must use random to a industry grafik?

Re: Szurke NML Questions???

Posted: 04 Sep 2014 06:28
by PikkaBird
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.

Re: Szurke NML Questions???

Posted: 08 Nov 2014 20:50
by Szurke
Hi evryone!

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

My code:

Code: Select all

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?

Re: Szurke NML Questions???

Posted: 08 Nov 2014 22:25
by TadeuszD
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: Select all

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.

Re: Szurke NML Questions???

Posted: 08 Nov 2014 22:44
by Szurke
Then write this:

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

Re: Szurke NML Questions???

Posted: 08 Nov 2014 23:00
by Transportman
What is the output from

Code: Select all

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.

Re: Szurke NML Questions???

Posted: 09 Nov 2014 00:27
by Szurke
0.2.5.r2135:6f38df710194
Library versions encountered:
PIL: 1.1.7
PLY: 3.4

Re: Szurke NML Questions???

Posted: 09 Nov 2014 01:53
by Digitalfox
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