-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes #20: ensure vanilla_entities are loaded on "Write Entities" file regeneration #21
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,7 +692,12 @@ def _write_entities_module(self): | |
|
||
msb = self.get_selected_msb() | ||
try: | ||
msb.write_entities_module(module_path, area_id=game_map.area_id, block_id=game_map.block_id) | ||
msb.write_entities_module( | ||
module_path, | ||
area_id=game_map.area_id, | ||
block_id=game_map.block_id, | ||
include_vanilla_entities=self._project.include_vanila_entities | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The MSB class doesn't have access to the project configuration, which is why this boolean needs to be passed in. Luckily, editors have access to the project via the |
||
) | ||
except Exception as ex: | ||
self.CustomDialog( | ||
"Write Failed", f"An error occurred while writing '{{project}}/events/{module_path.name}':\n{ex}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,18 +193,11 @@ def offer_entities_export(self, with_window: ProjectWindow = None): | |
game_map = self.maps.GET_MAP(map_name) | ||
|
||
if write_vanilla_entities_result == 0: | ||
try: | ||
vanilla_module = PACKAGE_PATH( | ||
f"darksouls1ptde/events/vanilla_entities/{game_map.emevd_file_stem}_entities.py" | ||
).read_text() | ||
except FileNotFoundError: | ||
vanilla_module = "" | ||
else: | ||
vanilla_module = "" | ||
self.include_vanila_entities = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now the only logic needed here is setting the project configuration value. Notably, this boolean can't be changed after project initialization (besides manually editing the config json, which will break a lot of things anyway), but I think this limitation really stems from that once an entity has replaced a hard-coded ID within a map script, there isn't a way to reverse this/update the entity without rolling back the script to use the ID again. Until that behavior changes, I think it's appropriate for this to be a one-time set. |
||
|
||
msb.write_entities_module( | ||
self.project_root / f"entities/{game_map.emevd_file_stem}_entities.py", | ||
append_to_module=vanilla_module, | ||
include_vanilla_entities=self.include_vanila_entities | ||
) | ||
return True | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was previously only here, so this didn't happen when running the function from here.