Skip to content

Commit

Permalink
Add parameter for oil refineries near water
Browse files Browse the repository at this point in the history
  • Loading branch information
2TallTyler committed Jul 16, 2020
1 parent 618c092 commit 20b8d1f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ July 16, 2020
- Fix: Remove industry limit when using funding "Many random industries" in Scenario Editor (fixes #3)
- Fix: Secondary industries can be funded when "Generate primary only" parameter is enabled (fixes #4)
- Fix: Oil Refinery no longer needs to be near water when funding "Many random industries" in Scenario Editor

### 1.0.2
July 16, 2020

- Add: Parameter to require oil refineries to generate near water
Binary file modified improved_town_industries.grf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/custom_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION :1.0.1
VERSION :1.0.2
TITLE :Improved Town Industries
8 changes: 8 additions & 0 deletions src/header.nml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ param 4 {
def_value: 0;
type: bool;
}}

param 5 {
param_refinery_water {
name: string(STR_PARAM_NAME_REFINERY_WATER);
desc: string(STR_PARAM_DESC_REFINERY_WATER);
def_value: 0;
type: bool;
}}
}

/*
Expand Down
5 changes: 4 additions & 1 deletion src/lang/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ STR_PARAM_NAME_PRIMARY_ONLY :Generate Primary Industries Only
STR_PARAM_DESC_PRIMARY_ONLY :Disable automatic generation of {SILVER}Factories{BLACK}, {SILVER}Steel Mills{BLACK}, {SILVER}Power Plants{BLACK}, {SILVER}Paper Mills{BLACK}, and {SILVER}Oil Refineries{BLACK}. Does not affect funded industries.

STR_PARAM_NAME_FOOD_FACTORY :Food Destination
STR_PARAM_DESC_FOOD_FACTORY :Where Food from Farms is delivered.{}{}{SILVER}Directly to towns {ORANGE}requires a house set which accepts Food{BLACK}, such as Improved Town Layouts.
STR_PARAM_DESC_FOOD_FACTORY :Where Food from {SILVER}Farms {BLACK}is delivered.{}{}{SILVER}Directly to towns {ORANGE}requires a house set which accepts Food{BLACK}, such as Improved Town Layouts.

STR_PARAM_FOOD_FACTORY_HOUSES :Directly to towns (requires house set which accepts Food)
STR_PARAM_FOOD_FACTORY_FACTORY :Processed to Goods at Factory
Expand All @@ -33,6 +33,9 @@ STR_PARAM_DESC_MINE_CLUSTER :{SILVER}Coal Mines,{BLACK}, {SILVER}Iron Mines{B
STR_PARAM_NAME_ELEVATION_CHECKS :Industry elevation requirements
STR_PARAM_DESC_ELEVATION_CHECKS :Enable elevation checks: {SILVER}Coal Mines{BLACK} must be elevation 4 or higher, {SILVER}Farm{BLACK} and {SILVER}Oil Wells{BLACK} must be elevation 2 or less.

STR_PARAM_NAME_REFINERY_WATER :Oil Refinery only builds near water
STR_PARAM_DESC_REFINERY_WATER :Require {SILVER}Oil Refinery {BLACK}to build near water (ocean or river). Does not affect funded industries.

STR_FUND_AVAILABLE_1800 :{BLACK}Introduced: {YELLOW}1800
STR_FUND_AVAILABLE_1856 :{BLACK}Introduced: {YELLOW}1856
STR_FUND_AVAILABLE_1882 :{BLACK}Introduced: {YELLOW}1882
Expand Down
10 changes: 9 additions & 1 deletion src/merged/improved_town_industries.nml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ param 4 {
def_value: 0;
type: bool;
}}

param 5 {
param_refinery_water {
name: string(STR_PARAM_NAME_REFINERY_WATER);
desc: string(STR_PARAM_DESC_REFINERY_WATER);
def_value: 0;
type: bool;
}}
}

/*
Expand Down Expand Up @@ -2628,7 +2636,7 @@ tilelayout industry_layout_oil_refinery_1 {


// Oil refinery must be within 15 tiles of water
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_water, water_distance > 15 && game_mode != GAMEMODE_EDITOR) {1: CB_RESULT_LOCATION_DISALLOW; CB_RESULT_LOCATION_ALLOW;}
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_water, water_distance > 15 && param_refinery_water == 1 && game_mode != GAMEMODE_EDITOR) {1: CB_RESULT_LOCATION_DISALLOW; CB_RESULT_LOCATION_ALLOW;}

/* Don't allow the same industry within 100 tiles - secondary industries only */
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_competitor, industry_distance(industry_oil_refinery, -1) > 100 ) {1: switch_oil_refinery_distance_water; CB_RESULT_LOCATION_DISALLOW;}
Expand Down
2 changes: 1 addition & 1 deletion src/oil_refinery.nml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ tilelayout industry_layout_oil_refinery_1 {


// Oil refinery must be within 15 tiles of water
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_water, water_distance > 15 && game_mode != GAMEMODE_EDITOR) {1: CB_RESULT_LOCATION_DISALLOW; CB_RESULT_LOCATION_ALLOW;}
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_water, water_distance > 15 && param_refinery_water == 1 && game_mode != GAMEMODE_EDITOR) {1: CB_RESULT_LOCATION_DISALLOW; CB_RESULT_LOCATION_ALLOW;}

/* Don't allow the same industry within 100 tiles - secondary industries only */
switch (FEAT_INDUSTRIES, SELF, switch_oil_refinery_distance_competitor, industry_distance(industry_oil_refinery, -1) > 100 ) {1: switch_oil_refinery_distance_water; CB_RESULT_LOCATION_DISALLOW;}
Expand Down

0 comments on commit 20b8d1f

Please sign in to comment.