SoF S4: prevent resource spawn on strange locations; fixes #5278

This commit is contained in:
Lukas Jox 2020-11-13 00:12:05 +01:00 committed by Pentarctagon
parent 9f6cca84c4
commit a8f057d5be

View file

@ -391,117 +391,6 @@
variable=resource_return_locations
[/store_locations]
# Here we need to randomize the coal and gold locations by
# hand, because the map generator can otherwise sometimes place
# them inside cavewall.
# The first coal pile is somewhere near where side 2 starts
[store_locations]
[filter]
side=2
canrecruit=yes
[/filter]
radius=5
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
variable=possible_coal_1_locations
[/store_locations]
{RANDOM 1..$possible_coal_1_locations.length}
{VARIABLE_OP random sub 1}
{VARIABLE coal_1.x $possible_coal_1_locations[$random].x}
{VARIABLE coal_1.y $possible_coal_1_locations[$random].y}
# The second coal pile is somewhere near where side 4 starts
[store_locations]
[filter]
side=4
canrecruit=yes
[/filter]
radius=5
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
variable=possible_coal_2_locations
[/store_locations]
{RANDOM 1..$possible_coal_2_locations.length}
{VARIABLE_OP random sub 1}
{VARIABLE coal_2.x $possible_coal_2_locations[$random].x}
{VARIABLE coal_2.y $possible_coal_2_locations[$random].y}
# And the gold pile is 8-12 hexes away from where side 3 starts
[store_locations]
[and]
[filter]
side=3
canrecruit=yes
[/filter]
radius=12
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
[/and]
[not]
[filter]
side=3
canrecruit=yes
[/filter]
radius=8
# Not sure if this is really needed
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
[/not]
variable=possible_gold_locations
[/store_locations]
{RANDOM 1..$possible_gold_locations.length}
{VARIABLE_OP random sub 1}
{VARIABLE gold_1.x $possible_gold_locations[$random].x}
{VARIABLE gold_1.y $possible_gold_locations[$random].y}
[item]
image=items/gold.png
x,y=$gold_1.x,$gold_1.y
[/item]
[item]
image=items/coal.png
x,y=$coal_1.x,$coal_1.y
[/item]
[item]
image=items/coal.png
x,y=$coal_2.x,$coal_2.y
[/item]
{VARIABLE coalin 0}
{VARIABLE goldin 0}
{CLEAR_VARIABLE possible_coal_1_locations}
{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)
@ -564,6 +453,141 @@
[/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.
# The first coal pile is somewhere near where side 2 starts
[store_locations]
[filter]
side=2
canrecruit=yes
[/filter]
radius=5
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
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}
{VARIABLE coal_1.x $possible_coal_1_locations[$random].x}
{VARIABLE coal_1.y $possible_coal_1_locations[$random].y}
# The second coal pile is somewhere near where side 4 starts
[store_locations]
[filter]
side=4
canrecruit=yes
[/filter]
radius=5
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
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}
{VARIABLE coal_2.x $possible_coal_2_locations[$random].x}
{VARIABLE coal_2.y $possible_coal_2_locations[$random].y}
# And the gold pile is 8-12 hexes away from where side 3 starts
[store_locations]
[and]
[filter]
side=3
canrecruit=yes
[/filter]
radius=12
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
[/and]
[not]
[filter]
side=3
canrecruit=yes
[/filter]
radius=8
# Not sure if this is really needed
[filter_radius]
terrain=!,Xu,Qxu,*^V*
[/filter_radius]
[/not]
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}
{VARIABLE gold_1.x $possible_gold_locations[$random].x}
{VARIABLE gold_1.y $possible_gold_locations[$random].y}
[item]
image=items/gold.png
x,y=$gold_1.x,$gold_1.y
[/item]
[item]
image=items/coal.png
x,y=$coal_1.x,$coal_1.y
[/item]
[item]
image=items/coal.png
x,y=$coal_2.x,$coal_2.y
[/item]
{VARIABLE coalin 0}
{VARIABLE goldin 0}
{CLEAR_VARIABLE possible_coal_1_locations}
{CLEAR_VARIABLE possible_coal_2_locations}
{CLEAR_VARIABLE possible_gold_locations}
# one cart near the player, another cart randomly further out
# can probably be better optimized
[store_locations]