1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
/*
* This file is aimed to provide an example on how to code a Station in NML.
* To keep the code readable, not every property or variable is documented in
* detail, refer to the station-specific reference in the documentation.
*
* The NewGRF implements a conversion of CHIPS Cow pens.
*
* Apart from this file, you will also need the following
* - Graphics, found in cows_cargo.png (in the same folder)
* - Language files, to be placed in the 'lang' folder.
* Currently english.lng is supplied.
*/
/*
* 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 seventh real grf defined as part of
* NML (the first is the train example), therefore the last character is
* set to 6. Successive grfs will have 7, 8, etc. there, to make sure each
* example grf has a unique GRFID.
*/
grfid: "NML\06";
/* GRF name and description strings are defined in the lang files */
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
/* This is the first version, start numbering at 1. */
version: 1;
min_compatible_version: 1;
/* This NewGRF has no parameters. See the train example NewGRF for parameter
* usage
*/
}
/* Using parametrized sprite layouts are only valid in OpenTTD r22723 or later.
* Earlier versions will choke on those and otherwise disable the NewGRF.
*/
if (version_openttd(1,2,0,22723) > openttd_version) {
error(FATAL, REQUIRES_OPENTTD, string(STR_VERSION_22723));
}
cargotable {
LVST
}
spriteset (cow_pen_empty, "cows_cargo.png") {
[ 10, 10, 64, 65, -31, -34 ]
[ 220, 10, 64, 65, -31, -34 ]
}
spriteset (cow_pen_half, "cows_cargo.png") {
[ 80, 10, 64, 65, -31, -34 ]
[ 290, 10, 64, 65, -31, -34 ]
}
spriteset (cow_pen_full, "cows_cargo.png") {
[ 150, 10, 64, 65, -31, -34 ]
[ 360, 10, 64, 65, -31, -34 ]
}
spritelayout cow_pen_X(a) {
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(0); // first sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
}
spritelayout cow_pen_Y(a) {
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(1); // second sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
}
spritegroup cow_pen_1 {
little: [cow_pen_empty, cow_pen_half];
lots: cow_pen_full;
}
spritegroup cow_pen_2 {
little: [cow_pen_empty, cow_pen_half, cow_pen_full];
lots: cow_pen_full;
}
random_switch(FEAT_STATIONS, TILE, random_cow_pen) {
1: cow_pen_1;
1: cow_pen_2;
}
/* Define the station itself */
item(FEAT_STATIONS, cow_pen) {
property {
/* The class allows to sort stations into categories. */
class: "NML_";
/* If no other NewGRF provides this class before us, we have to name it */
classname: string(STR_NAME_STATCLASS);
/* Name of this particular station */
name: string(STR_NAME_STATION);
cargo_threshold: 160;
tile_flags: [
bitmask(STAT_TILE_NOWIRE, STAT_TILE_BLOCKED),
bitmask(STAT_TILE_NOWIRE, STAT_TILE_BLOCKED)
];
}
graphics {
sprite_layouts: [cow_pen_X(0), cow_pen_Y(0)];
select_tile_type: 0;
purchase: cow_pen_half;
LVST: random_cow_pen;
cow_pen_empty;
}
}
|