Skip to content
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

Refactor editors #20

Merged
merged 35 commits into from
Mar 5, 2024
Merged

Refactor editors #20

merged 35 commits into from
Mar 5, 2024

Conversation

snipercup
Copy link
Collaborator

@snipercup snipercup commented Dec 13, 2023

This requires #19 to work. I will publish this PR as a draft to make sure #19 gets merged first.

This refactors the editors in the content editor to use the Gamedata autoload singleton. The primary goal is to prevent spaghetti code.

  • Sprites in general are now collected from Gamedata instead of loading them from disk
  • The editors only have access to 1 item now instead of the entire data array
  • Data is saved by Gamedata instead of the editors themselves
  • The mapeditor now uses the json_helper properly
  • JSON for mobs, tiles and maps are now saved in a more readable format. The primary goal is to have the GIT version managment system recognize what lines are edited.

The code to connect the signal in the editors to Gamedata is done by the contenteditor scene. I did consider that this might be complex for other Godot users so I added some comments to explain. Since the contenteditor has access to the data array from gamedata, it passes a refrence to that array into the signal at the moment of connection. When an editor fires the signal, Gamedata will know what array to save to disk. Godot is amazing.

When the materials are generated, set the proper uv scaling so they are correctly visualized in-game.
This fixes the situation where if two map editors are opened, only the last one receives input from the scroll wheel
Improved saving loading, added duplicate and delete buttons, icons
Add name and description labels to show info on a tile
Overmap chunks will stay consistent even after changing scenes.
@snipercup snipercup mentioned this pull request Dec 15, 2023
@snipercup snipercup marked this pull request as ready for review March 5, 2024 15:34
@snipercup snipercup merged commit 726309b into Khaligufzel:main Mar 5, 2024
@snipercup snipercup deleted the Refactor-editors branch March 5, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant