Skip to content

Commit

Permalink
SoF S4: prevent resource spawn on strange locations; fixes #5278
Browse files Browse the repository at this point in the history
  • Loading branch information
IskarJarak authored and Pentarctagon committed Nov 17, 2020
1 parent 9f6cca8 commit a8f057d
Showing 1 changed file with 86 additions and 62 deletions.
148 changes: 86 additions & 62 deletions data/campaigns/Sceptre_of_Fire/scenarios/4_Gathering_Materials.cfg
Expand Up @@ -391,6 +391,68 @@
variable=resource_return_locations
[/store_locations]

# Here we overlay a mask containing a rather random pattern of
# suitable terrains on the map, because the map generator itself
# only places the very basic terrains (floor, walls, etc)
# also, include tracks overlay in mask

[terrain_mask]
x,y=1,1
mask="{campaigns/Sceptre_of_Fire/maps/4_Gathering_Materials-random.mask}"

[rule]
old=Uu
new=Uu^Ii,Uu^Tf,Tb^Tf,Uh,Ww,Cud
[/rule]

[rule]
old=Xu
new=*^Br\
terrain=Uh^Br\
[/rule]

[rule]
old=Xu
new=*^Br|
terrain=Uh^Br|
[/rule]

[rule]
old=Xu
new=*^Br/
terrain=Uh^Br/
[/rule]

[rule]
old=Xu,Cud,Kud
use_old=yes
[/rule]

[rule]
new=*^Br\
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br\
[/rule]

[rule]
new=*^Br|
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br|
[/rule]

[rule]
new=*^Br/
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br/
[/rule]
[/terrain_mask]

# Here we need to randomize the coal and gold locations by
# hand, because the map generator can otherwise sometimes place
# them inside cavewall.
Expand All @@ -412,6 +474,14 @@
variable=possible_coal_1_locations
[/store_locations]

[store_locations]
find_in=possible_coal_1_locations
[not]
terrain=Kud,Cud,Re,*^Br*
[/not]
variable=possible_coal_1_locations
[/store_locations]

{RANDOM 1..$possible_coal_1_locations.length}
{VARIABLE_OP random sub 1}

Expand All @@ -435,6 +505,14 @@
variable=possible_coal_2_locations
[/store_locations]

[store_locations]
find_in=possible_coal_2_locations
[not]
terrain=Kud,Cud,Re,*^Br*
[/not]
variable=possible_coal_2_locations
[/store_locations]

{RANDOM 1..$possible_coal_2_locations.length}
{VARIABLE_OP random sub 1}

Expand Down Expand Up @@ -474,6 +552,14 @@
variable=possible_gold_locations
[/store_locations]

[store_locations]
find_in=possible_gold_locations
[not]
terrain=Kud,Cud,Re,*^Br*
[/not]
variable=possible_gold_locations
[/store_locations]

{RANDOM 1..$possible_gold_locations.length}
{VARIABLE_OP random sub 1}

Expand Down Expand Up @@ -502,68 +588,6 @@
{CLEAR_VARIABLE possible_coal_2_locations}
{CLEAR_VARIABLE possible_gold_locations}

# Here we overlay a mask containing a rather random pattern of
# suitable terrains on the map, because the map generator itself
# only places the very basic terrains (floor, walls, etc)
# also, include tracks overlay in mask

[terrain_mask]
x,y=1,1
mask="{campaigns/Sceptre_of_Fire/maps/4_Gathering_Materials-random.mask}"

[rule]
old=Uu
new=Uu^Ii,Uu^Tf,Tb^Tf,Uh,Ww,Cud
[/rule]

[rule]
old=Xu
new=*^Br\
terrain=Uh^Br\
[/rule]

[rule]
old=Xu
new=*^Br|
terrain=Uh^Br|
[/rule]

[rule]
old=Xu
new=*^Br/
terrain=Uh^Br/
[/rule]

[rule]
old=Xu,Cud,Kud
use_old=yes
[/rule]

[rule]
new=*^Br\
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br\
[/rule]

[rule]
new=*^Br|
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br|
[/rule]

[rule]
new=*^Br/
use_old=no
layer=both
replace_if_failed=yes
terrain=Uu^Br/
[/rule]
[/terrain_mask]

# one cart near the player, another cart randomly further out
# can probably be better optimized
[store_locations]
Expand Down

0 comments on commit a8f057d

Please sign in to comment.