// License: GPLv2 // Author: Zuu + forsch123 grf { grfid : "ZUU0"; name : string(STR_GRF_NAME); desc : string(STR_GRF_DESCRIPTION); version: 2; min_compatible_version: 1; } /* Behaviour: * Industry is constructed with 'storage 0' set to 512, which means 100%. * GS sets 'storage 0' via command. * Actual production modifier is: (1 + storage0/256) / 3 * storage0 = 0 -> 33% * storage0 = 256 -> 66% * storage0 = 512 -> 100% * storage0 = 1024 -> 166% * Special value: * Adding 0x10000 to storage0 announces closure and closes the industry next month. */ produce (primary_produce, 0, 0, 0, production_rate_1 * (LOAD_PERM(0) & 0xFFFF) / 256, production_rate_2 * (LOAD_PERM(0) & 0xFFFF) / 256, ); produce (secondary_produce, 0, 0, 0, waiting_cargo_1 * (1 + (LOAD_PERM(0) & 0xFFFF)) / 256 / 3, waiting_cargo_2 * (1 + (LOAD_PERM(0) & 0xFFFF)) / 256 / 3, ); switch (FEAT_INDUSTRIES, SELF, monthly_check, [ LOAD_PERM(0) >> 16 ]) { 1: return CB_RESULT_IND_PROD_CLOSE; 0: return CB_RESULT_IND_PROD_NO_CHANGE; } switch (FEAT_INDUSTRIES, SELF, switch_prod_change, [ STORE_PERM(extra_callback_info1, 0), extra_callback_info1 ]) { return CB_RESULT_IND_PROD_NO_CHANGE; } switch (FEAT_INDUSTRIES, SELF, init_industry, [ STORE_PERM(512, 0), extra_callback_info1 ]) { return 16; } // Create items for all default primary industries FOR_EACH_BEGIN (INDUSTRY in [INDUSTRYTYPE_COAL_MINE, INDUSTRYTYPE_FOREST, INDUSTRYTYPE_TROPICAL_FARM, INDUSTRYTYPE_COPPER_ORE_MINE, INDUSTRYTYPE_OIL_WELLS, INDUSTRYTYPE_GOLD_MINE, INDUSTRYTYPE_DIAMOND_MINE, INDUSTRYTYPE_IRON_ORE_MINE, INDUSTRYTYPE_FRUIT_PLANTATION, INDUSTRYTYPE_RUBBER_PLANTATION, INDUSTRYTYPE_WATER_WELL, INDUSTRYTYPE_CANDYFLOSS_FOREST, INDUSTRYTYPE_BATTERY_FARM, INDUSTRYTYPE_COLA_WELLS, INDUSTRYTYPE_PLASTIC_FOUNTAIN, INDUSTRYTYPE_BUBBLE_GENERATOR, INDUSTRYTYPE_TOFFE_QUARRY, INDUSTRYTYPE_SUGAR_MINE]) item (FEAT_INDUSTRIES, item_industry_INDUSTRY) { property { substitute: INDUSTRY; override: INDUSTRY; prod_multiplier: [5, 0]; } graphics { build_prod_change: init_industry; random_prod_change: switch_prod_change; monthly_prod_change: monthly_check; produce_256_ticks: primary_produce; } } FOR_EACH_END // Two cargo type producers item (FEAT_INDUSTRIES, item_industry_INDUSTRYTYPE_OIL_RIG) { property { substitute: INDUSTRYTYPE_OIL_RIG; override: INDUSTRYTYPE_OIL_RIG; prod_multiplier: [5, 1]; } graphics { build_prod_change: init_industry; random_prod_change: switch_prod_change; monthly_prod_change: monthly_check; produce_256_ticks: primary_produce; } } item (FEAT_INDUSTRIES, item_industry_INDUSTRYTYPE_TEMPERATE_ARCTIC_FARM) { property { substitute: INDUSTRYTYPE_TEMPERATE_ARCTIC_FARM; override: INDUSTRYTYPE_TEMPERATE_ARCTIC_FARM; prod_multiplier: [5, 5]; } graphics { build_prod_change: init_industry; random_prod_change: switch_prod_change; monthly_prod_change: monthly_check; produce_256_ticks: primary_produce; } } // Default secondary industries FOR_EACH_BEGIN (INDUSTRY in [INDUSTRYTYPE_SAWMILL, INDUSTRYTYPE_OIL_REFINERY, INDUSTRYTYPE_TEMPERATE_FACTORY, INDUSTRYTYPE_TROPICAL_FACTORY, INDUSTRYTYPE_PRINTING_WORKS, INDUSTRYTYPE_STEEL_MILL, INDUSTRYTYPE_FOOD_PROCESSING_PLANT, INDUSTRYTYPE_PAPER_MILL, INDUSTRYTYPE_LUMBER_MILL, INDUSTRYTYPE_SWEETS_FACTORY, INDUSTRYTYPE_TOY_FACTORY, INDUSTRYTYPE_FIZZY_DRINKS_FACTORY]) item (FEAT_INDUSTRIES, item_industry_INDUSTRY) { property { substitute: INDUSTRY; override: INDUSTRY; } graphics { random_prod_change: switch_prod_change; monthly_prod_change: monthly_check; produce_cargo_arrival: secondary_produce; } } FOR_EACH_END // Remaining default industries: FOR_EACH_BEGIN (cargo in [INDUSTRYTYPE_POWER_PLANT, INDUSTRYTYPE_TEMPERATE_BANK, INDUSTRYTYPE_TROPICAL_ARCTIC_BANK, INDUSTRYTYPE_WATER_TOWER, INDUSTRYTYPE_TOY_SHOP])