Skip to content

Commit cc115f3

Browse files
committed
v1.8.1
* Remove partner unlocks from mods that are no longer loaded, to prevent script crash on save load. * Seeded Mod Club Station for deterministic generation. * Mod Club Station refresh doors now offset the seed consistently, so layouts can be revisited. * Remove reference to ModWorkshop from translation strings.
1 parent c98c8f0 commit cc115f3

File tree

10 files changed

+86
-76
lines changed

10 files changed

+86
-76
lines changed

mods/cat_modutils/bugfix/Party.gd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
extends "res://global/save_state/Party.gd"
22

3+
func set_snapshot(snap, version: int) -> bool:
4+
if not .set_snapshot(snap, version):
5+
return false
6+
7+
# BUGFIX: Remove unknown partner unlocks!
8+
# This prevents script errors later, if a mod partner was removed.
9+
for id in unlocked_partners:
10+
var partner = get_partner_by_id(id)
11+
if not partner:
12+
unlocked_partners.erase(id)
13+
return true
14+
315

416
func remap_partner_tapes() -> void:
517
var randomize_dog_bootleg: bool = DLC.mods_by_id.cat_modutils.setting_randomize_dog_bootleg

mods/cat_modutils/metadata.tres

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
script = ExtResource( 1 )
88
id = "cat_modutils"
99
name = "MOD_CAT_MODUTILS_NAME"
10-
version_code = 18
11-
version_string = "1.8.0"
10+
version_code = 19
11+
version_string = "1.8.1"
1212
author = "cat"
1313
save_file_format_tag = ""
1414
save_file_format_tag_version = 0

mods/cat_modutils/mod_strings.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ MODUTILS_TUTORIAL_PLATFORMD1,"Talk to Redkrab to access new locations provided b
3434
Possible destinations may include a dungeon, a town, or even an entire island."
3535
MODUTILS_TUTORIAL_PLATFORMD2,"You must install additional mods to use this feature.
3636
37-
Look for “Platform D” support on ModWorkshop."
37+
Look for mods with “Platform D” support on the Steam Workshop."
3838
MODUTILS_REDKRAB_MENU,"Speak your mind, adventuring fellows! From whence shall we begin these festivities?"
3939
MODUTILS_REDKRAB_MENU_OPTION_TRAVEL,I seek adventure!
4040
MODUTILS_REDKRAB_MENU_OPTION_MODCLUB,Mod Club Station?

mods/cat_modutils/world.gd

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var _modclub_population: Array
3838
var _modclub_destinations: Array
3939
var _magikrab_extra_behaviors: PackedScene
4040
var _magikrab_dest_modclub: PackedScene
41+
var _modclub_seed_offset: int
4142

4243

4344
func _init(modutils: ContentInfo) -> void:
@@ -59,193 +60,157 @@ func _init(modutils: ContentInfo) -> void:
5960
{
6061
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
6162
"mode": "standing",
62-
"chance": 1/3.0,
63+
"chance": 1/4.0,
6364
"flags": ["modutils_modclub_unlocked"],
6465
},
6566
{
6667
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
6768
"mode": "standing",
68-
"chance": 1/3.0,
69+
"chance": 1/4.0,
6970
"flags": ["modutils_modclub_unlocked"],
7071
},
7172
{
7273
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
7374
"mode": "standing",
74-
"chance": 1/3.0,
75+
"chance": 1/4.0,
7576
"flags": ["modutils_modclub_unlocked"],
7677
},
7778
{
7879
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
7980
"mode": "standing",
80-
"chance": 1/3.0,
81+
"chance": 1/4.0,
8182
"flags": ["modutils_modclub_unlocked"],
8283
},
8384
{
8485
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
8586
"mode": "standing",
86-
"chance": 1/3.0,
87-
"flags": ["modutils_modclub_unlocked"],
88-
},
89-
{
90-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
91-
"mode": "shop full",
92-
"chance": 1/3.0,
93-
"flags": ["modutils_modclub_unlocked"],
94-
},
95-
{
96-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
97-
"mode": "shop full",
98-
"chance": 1/3.0,
99-
"flags": ["modutils_modclub_unlocked"],
100-
},
101-
{
102-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
103-
"mode": "shop full",
104-
"chance": 1/3.0,
105-
"flags": ["modutils_modclub_unlocked"],
106-
},
107-
{
108-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
109-
"mode": "shop full",
110-
"chance": 1/3.0,
111-
"flags": ["modutils_modclub_unlocked"],
112-
},
113-
{
114-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
115-
"mode": "shop full",
116-
"chance": 1/3.0,
117-
"flags": ["modutils_modclub_unlocked"],
118-
},
119-
{
120-
"scene": "res://mods/cat_modutils/world/scenery/decorative_plants/RandomPlanter.tscn",
121-
"mode": "shop full",
122-
"chance": 1/3.0,
87+
"chance": 1/4.0,
12388
"flags": ["modutils_modclub_unlocked"],
12489
},
12590
{
12691
"scene": "res://world/objects/decorative_plants/autumn_leaf_pile/autumn_leaf_pile_1.tscn",
12792
"mode": "shop full",
128-
"chance": 1/3.0,
93+
"chance": 1/4.0,
12994
"flags": ["modutils_modclub_unlocked"],
13095
},
13196
{
13297
"scene": "res://world/objects/decorative_plants/autumn_leaf_pile/autumn_leaf_pile_1.tscn",
13398
"mode": "shop full",
134-
"chance": 1/3.0,
99+
"chance": 1/4.0,
135100
"flags": ["modutils_modclub_unlocked"],
136101
},
137102
{
138103
"scene": "res://mods/cat_modutils/world/scenery/RandomDestructible.tscn",
139104
"mode": "standing",
140-
"chance": 1/3.0,
105+
"chance": 1/6.0,
141106
"flags": ["modutils_modclub_unlocked"],
142107
},
143108
{
144109
"scene": "res://mods/cat_modutils/world/scenery/RandomDestructible.tscn",
145110
"mode": "standing",
146-
"chance": 1/3.0,
111+
"chance": 1/6.0,
147112
"flags": ["modutils_modclub_unlocked"],
148113
},
149114
{
150115
"scene": "res://mods/cat_modutils/world/scenery/RandomLiftable.tscn",
151116
"mode": "standing",
152-
"chance": 1/3.0,
117+
"chance": 1/2.0,
153118
"flags": ["modutils_modclub_unlocked"],
154119
},
155120
{
156121
"scene": "res://mods/cat_modutils/world/scenery/RandomLiftable.tscn",
157122
"mode": "standing",
158-
"chance": 1/3.0,
123+
"chance": 1/2.0,
159124
"flags": ["modutils_modclub_unlocked"],
160125
},
161126
{
162127
"scene": "res://mods/cat_modutils/world/scenery/RandomLiftable.tscn",
163128
"mode": "standing",
164-
"chance": 1/3.0,
129+
"chance": 1/2.0,
165130
"flags": ["modutils_modclub_unlocked"],
166131
},
167132
{
168133
"scene": "res://mods/cat_modutils/world/scenery/RandomLiftable.tscn",
169134
"mode": "standing",
170-
"chance": 1/3.0,
135+
"chance": 1/2.0,
171136
"flags": ["modutils_modclub_unlocked"],
172137
},
173138
{
174139
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
175140
"mode": "standing",
176-
"chance": 1/3.0,
141+
"chance": 1/5.0,
177142
"flags": ["modutils_modclub_unlocked"],
178143
},
179144
{
180145
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
181146
"mode": "standing",
182-
"chance": 1/3.0,
147+
"chance": 1/5.0,
183148
"flags": ["modutils_modclub_unlocked"],
184149
},
185150
{
186151
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
187152
"mode": "standing",
188-
"chance": 1/3.0,
153+
"chance": 1/5.0,
189154
"flags": ["modutils_modclub_unlocked"],
190155
},
191156
{
192157
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
193158
"mode": "standing",
194-
"chance": 1/3.0,
159+
"chance": 1/5.0,
195160
"flags": ["modutils_modclub_unlocked"],
196161
},
197162
{
198163
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
199164
"mode": "standing",
200-
"chance": 1/3.0,
165+
"chance": 1/5.0,
201166
"flags": ["modutils_modclub_unlocked"],
202167
},
203168
{
204169
"scene": "res://mods/cat_modutils/world/scenery/RandomFurniture.tscn",
205170
"mode": "standing",
206-
"chance": 1/3.0,
171+
"chance": 1/5.0,
207172
"flags": ["modutils_modclub_unlocked"],
208173
},
209174
{
210175
"scene": "res://world/objects/interior_props/PunchingBag.tscn",
211176
"mode": "shop full",
212-
"chance": 1/3.0,
177+
"chance": 1/8.0,
213178
"flags": ["modutils_modclub_unlocked"],
214179
},
215180
{
216181
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
217182
"mode": "shop full",
218-
"chance": 1/3.0,
183+
"chance": 1/8.0,
219184
"flags": ["modutils_modclub_unlocked"],
220185
},
221186
{
222187
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
223188
"mode": "shop full",
224-
"chance": 1/3.0,
189+
"chance": 1/8.0,
225190
"flags": ["modutils_modclub_unlocked"],
226191
},
227192
{
228193
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
229194
"mode": "shop full",
230-
"chance": 1/3.0,
195+
"chance": 1/8.0,
231196
"flags": ["modutils_modclub_unlocked"],
232197
},
233198
{
234199
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
235200
"mode": "shop full",
236-
"chance": 1/3.0,
201+
"chance": 1/8.0,
237202
"flags": ["modutils_modclub_unlocked"],
238203
},
239204
{
240205
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
241206
"mode": "shop full",
242-
"chance": 1/3.0,
207+
"chance": 1/8.0,
243208
"flags": ["modutils_modclub_unlocked"],
244209
},
245210
{
246211
"scene": "res://mods/cat_modutils/world/scenery/CoffeeTableScene.tscn",
247212
"mode": "shop full",
248-
"chance": 1/3.0,
213+
"chance": 1/8.0,
249214
"flags": ["modutils_modclub_unlocked"],
250215
},
251216
]
@@ -273,8 +238,8 @@ func _init(modutils: ContentInfo) -> void:
273238
# I highly recommend your mod do the same, for dungeons.
274239
SceneManager.PRESERVABLE_SCENE_BLACKLIST.push_back("res://mods/cat_modutils/")
275240

276-
# Add "Mod Club Station" to overworld fast travel map if discovered
277-
SaveSystem.connect("file_loaded", self, "_init_modclub_chunk_feature")
241+
# Add "Mod Club Station" to overworld fast travel map if discovered, load seed, etc.
242+
SaveSystem.connect("file_loaded", self, "_on_save_file_loaded")
278243

279244
# Add "Return to Mod Club Station" button to menu
280245
_init_modclub_return_button()
@@ -387,6 +352,12 @@ func is_modclub_populated() -> bool:
387352
return true
388353
return false
389354

355+
356+
func _on_save_file_loaded() -> void:
357+
_modclub_seed_offset = 0
358+
_init_modclub_chunk_feature()
359+
360+
390361
# Adds fast travel waypoint to an overworld chunk for Mod Club Station
391362
func _init_modclub_chunk_feature(force: bool = false) -> void:
392363
if _chunk_init:

mods/cat_modutils/world/ExternalNPCs.gd

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
extends Spatial
22

3+
onready var lib: Reference = DLC.mods_by_id.cat_modutils.world
34
onready var standing: Node = $Standing
45
onready var bench: Node = $Bench
56
onready var shops: Node = $Shops
@@ -9,10 +10,11 @@ func _ready() -> void:
910

1011

1112
func _populate() -> void:
13+
# Seed the randomizer so predictable club layouts can be replicated.
14+
seed(Random.child_seed(SaveState.random_seed ^ (SaveState.world_time.date * 12) ^ (lib._modclub_seed_offset * 3), "cat_modclub"))
15+
1216
# Get the population
13-
var lib: Reference = DLC.mods_by_id.cat_modutils.world
1417
var population: Array = lib._modclub_population.duplicate()
15-
1618
population.shuffle()
1719

1820
# Get all the spawn locations
@@ -114,6 +116,11 @@ func _populate() -> void:
114116
WarpTarget.warp(shop_spots[0], [node])
115117
shop_spots.pop_front()
116118

119+
# Once we're well-and-truly done generating, reset the random seed for gameplay.
120+
yield (Co.next_frame(), "completed")
121+
randomize()
122+
123+
117124
# Helper for creating temporary NPC nodes
118125
func _spawn_npc(scene: PackedScene, default_state_override: String = "") -> Spatial:
119126
var node: Spatial = scene.instance()
@@ -142,6 +149,7 @@ func _spawn_npc(scene: PackedScene, default_state_override: String = "") -> Spat
142149

143150
return node
144151

152+
145153
func _process_out_conditionals(node: Spatial) -> void:
146154
for child in node.get_children():
147155
if child is BaseConditionalLayer:
@@ -156,3 +164,11 @@ func _process_out_conditionals(node: Spatial) -> void:
156164
child.free()
157165
elif child is Spatial:
158166
_process_out_conditionals(child)
167+
168+
169+
func inc_seed() -> void:
170+
lib._modclub_seed_offset += 1
171+
172+
173+
func dec_seed():
174+
lib._modclub_seed_offset -= 1

mods/cat_modutils/world/Passenger2.gd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
extends Node
22

3+
34
func _ready() -> void:
45
call_deferred("update_sprite")
56

@@ -22,10 +23,10 @@ func update_sprite() -> void:
2223
var geo: Sprite3D = sprite.get_node("Sprite3D")
2324
geo.cast_shadow = GeometryInstance.SHADOW_CASTING_SETTING_OFF
2425

26+
2527
func _on_PlayerDetector_detected(_detection) -> void:
26-
yield (Co.next_frame(), "completed")
2728
owner.kill()
2829

29-
#func _on_VisibilityNotifier_screen_entered() -> void:
30-
# Co.safe_wait(owner, 2.0)
31-
# owner.kill()
30+
31+
func _on_Timer_timeout() -> void:
32+
owner.kill()

mods/cat_modutils/world/Passenger2.tscn

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ require_similar_player_scale = false
3232
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0 )
3333
shape = SubResource( 1 )
3434

35-
[connection signal="detected" from="PlayerDetector" to="Behavior" method="_on_PlayerDetector_detected" flags=6]
35+
[node name="Timer" type="Timer" parent="." index="11"]
36+
wait_time = 3.0
37+
one_shot = true
38+
39+
[connection signal="screen_entered" from="VisibilityNotifier" to="Timer" method="start"]
40+
[connection signal="screen_exited" from="VisibilityNotifier" to="Timer" method="stop"]
41+
[connection signal="detected" from="PlayerDetector" to="Behavior" method="_on_PlayerDetector_detected" flags=7]
42+
[connection signal="timeout" from="Timer" to="Behavior" method="_on_Timer_timeout" flags=6]

mods/cat_modutils/world/Station.tscn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,6 @@ direction = "down"
510510
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -17, 8, 28 )
511511
script = ExtResource( 10 )
512512
direction = "down"
513+
514+
[connection signal="arrived" from="Area2" to="ExternalNPCs" method="dec_seed"]
515+
[connection signal="arrived" from="Area3" to="ExternalNPCs" method="inc_seed"]

mods/cat_modutils/world/scenery/decorative_plants/random_sprite.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extends Sprite3D
22
## Selects a random sprite from an array of textures every time the scene is loaded.
33

44

5-
export var textures: Array
5+
export (Array, Texture) var textures: Array
66

77

88
func _ready() -> void:

0 commit comments

Comments
 (0)