Skip to content

Commit a60ea6f

Browse files
authored
USU - Dynamic subfarm infrastructure (#51)
1 parent 319c7fb commit a60ea6f

File tree

4 files changed

+90
-5
lines changed

4 files changed

+90
-5
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on_game_started = {
2+
on_actions = {
3+
mog_usu_subfarm_infrastructure_init
4+
}
5+
}
6+
7+
mog_usu_subfarm_infrastructure_init = {
8+
effect = {
9+
every_state = {
10+
mog_usu_subfarm_infrastructure_update = yes
11+
}
12+
}
13+
}
14+
15+
on_monthly_pulse_state = {
16+
on_actions = {
17+
mog_usu_subfarm_infrastructure_monthly_pulse
18+
}
19+
}
20+
21+
mog_usu_subfarm_infrastructure_monthly_pulse = {
22+
effect = {
23+
mog_usu_subfarm_infrastructure_update = yes
24+
}
25+
}
26+
27+
on_building_built = {
28+
on_actions = {
29+
mog_usu_subfarm_infrastructure_building_expanded
30+
}
31+
}
32+
33+
on_building_expanded = {
34+
on_actions = {
35+
mog_usu_subfarm_infrastructure_building_expanded
36+
}
37+
}
38+
39+
mog_usu_subfarm_infrastructure_building_expanded = {
40+
effect = {
41+
if = {
42+
limit = {
43+
# Everything that uses arable land
44+
is_building_group = bg_agriculture
45+
is_building_group = bg_ranching
46+
is_building_group = bg_plantations
47+
}
48+
state = {
49+
mog_usu_subfarm_infrastructure_update = yes
50+
}
51+
}
52+
}
53+
}

Urban Synergy Unleashed/common/production_methods/yMoG_USU_road_carts_subsistence.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ default_building_subsistence_farms = {
3131
state_modifiers = {
3232
workforce_scaled = {
3333
state_birth_rate_mult = -0.0045 # For some reason this one gets modifiers but the other doesn't, and the goal is to cancel out when fully employed.
34-
state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
34+
#state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
3535
}
3636
level_scaled = {
3737
state_birth_rate_mult = 0.005
@@ -62,7 +62,7 @@ default_building_subsistence_orchards = {
6262
state_modifiers = {
6363
workforce_scaled = {
6464
state_birth_rate_mult = -0.0045
65-
state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
65+
#state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
6666
}
6767
level_scaled = {
6868
state_birth_rate_mult = 0.005
@@ -93,7 +93,7 @@ default_building_subsistence_pastures = {
9393
state_modifiers = {
9494
workforce_scaled = {
9595
state_birth_rate_mult = -0.0045
96-
state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
96+
#state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
9797
}
9898
level_scaled = {
9999
state_birth_rate_mult = 0.005
@@ -124,7 +124,7 @@ default_building_subsistence_fishing_villages = {
124124
state_modifiers = {
125125
workforce_scaled = {
126126
state_birth_rate_mult = -0.0045
127-
state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
127+
#state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
128128
}
129129
level_scaled = {
130130
state_birth_rate_mult = 0.005
@@ -154,7 +154,7 @@ default_building_subsistence_rice_paddies = {
154154
state_modifiers = {
155155
workforce_scaled = {
156156
state_birth_rate_mult = -0.0045
157-
state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
157+
#state_infrastructure_from_population_max_add = -1 # The existence of easily usable land allows people to use it trivially (infra from pop max), but actually having people using the land uses that up.
158158
}
159159
level_scaled = {
160160
state_birth_rate_mult = 0.005
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# state scope
2+
mog_usu_subfarm_infrastructure_update = {
3+
if = {
4+
limit = {
5+
has_modifier = mog_subfarm_modifiers_occupancy_scaled
6+
}
7+
remove_modifier = mog_subfarm_modifiers_occupancy_scaled
8+
}
9+
every_scope_building = {
10+
limit = {
11+
is_subsistence_building = yes
12+
}
13+
set_local_variable = {
14+
name = occupied_levels
15+
value = {
16+
value = occupancy
17+
multiply = level
18+
}
19+
}
20+
PREV = {
21+
add_modifier = {
22+
name = mog_subfarm_modifiers_occupancy_scaled
23+
multiplier = local_var:occupied_levels
24+
}
25+
}
26+
}
27+
}

Urban Synergy Unleashed/common/static_modifiers/MoG_USU_static_modifiers.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ mog_construction_max_level_adjustment = {
2020
state_building_construction_sector_max_level_add = 1
2121
}
2222

23+
mog_subfarm_modifiers_occupancy_scaled = {
24+
icon = gfx/interface/icons/state_status_icons/state_infrastructure.dds
25+
state_infrastructure_from_population_max_add = -1
26+
}
27+
2328
## STATIC MODIFIERS
2429
mog_mapi = {
2530
icon = gfx/interface/icons/timed_modifier_icons/modifier_documents_positive.dds

0 commit comments

Comments
 (0)