- /*
- * This file is aimed to provide an example on how to code a basic industry in NML.
- * To keep the code readable, not every property or variable is documented in
- * detail, refer to the object-specific reference in the documentation.
- *
- * This version shows only how to modify a built-in industry.
- *
- * Apart from this file, you will also need the following
- * - Language files, to be placed in the 'lang' folder.
- * Currently english.lng is supplied.
- */
- /**********************************************
- * Header, containing some general stuff:
- **********************************************/
- /*
- * First, define a grf block. This defines some basic properties of the grf,
- * which are required for the grf to be valid and loadable.
- */
- grf {
- /* This grf is part of NML, therefore "NML" is chosen as the first three
- * characters of the GRFID. It is the third real grf defined as part of
- * NML, therefore the last character is set to 2. Successive grfs will
- * have 3, 4, etc. there, to make sure each example grf has a unique GRFID.
- */
- grfid : "NML\04";
- name : string(STR_GRF_NAME);
- desc : string(STR_GRF_DESCRIPTION);
- version : 0; // must be numeric
- min_compatible_version : 0;
- }
- /* this example assumes we're just matching to the default temperate cargos, this wouldn't be the usual case
- cargotable {
- PASS, COAL, MAIL, OIL_, LVST, WOOD, GRAI, WOOD, IORE, STEL, VALU
- }
- /*
- * This example extends the cargos accepted and produce by the default temperate factory.
- */
- item(FEAT_INDUSTRIES, factory) {
- property {
- substitute: INDUSTRYTYPE_TEMPERATE_FACTORY;
- override: INDUSTRYTYPE_TEMPERATE_FACTORY;
- accept_cargo_types: [cargotype("COAL"), cargotype("OIL_"),
- cargotype("LVST"), cargotype("WOOD"),
- cargotype("IORE"), cargotype("GRAI")]; // prop 25 (tested working)
- prod_cargo_types: [cargotype("MAIL"), cargotype("GOOD"),
- cargotype("STEL"), cargotype("VALU")]; // prop 26 (tested working)
- input_multiplier: [ // prop 28 (tested working)
- [1 , 1, 1, 1 ], // 1st input cargo produces one of each output
- [1 , 1, 0, 0 ], // 2nd input cargo produces only first two outputs
- [0 , 0, 4, 0 ], // 3rd input cargo produces third output four times the input amount
- [0.5, 0, 0, 0.5] // 4th input cargo produces each of first and fourth output cargo in half the input amount (2 in => 1 of first and 1 of fourth out)
- ];
- }
- }
- item(FEAT_INDUSTRYTILES, factory_tile_1) {
- property {
- substitute: 39;
- override: 39;
- special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
- }
- }
- item(FEAT_INDUSTRYTILES, factory_tile_2) {
- property {
- substitute: 40;
- override: 40;
- special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
- }
- }
- item(FEAT_INDUSTRYTILES, factory_tile_3) {
- property {
- substitute: 41;
- override: 41;
- special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
- }
- }
- item(FEAT_INDUSTRYTILES, factory_tile_4) {
- property {
- substitute: 42;
- override: 42;
- special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
- }
- }
- /*
- * This example causes the default farm to produce livestock, grain, and wood.
- */
- item(FEAT_INDUSTRIES, farm) {
- property {
- substitute: INDUSTRYTYPE_TEMPERATE_ARCTIC_FARM;
- override: INDUSTRYTYPE_TEMPERATE_ARCTIC_FARM;
- prod_cargo_types: [4, 6, 7];
- prod_multiplier: [8, 12, 4]; // prop 27 (tested working)
- }
- }