Skip to content

Conversation

@Vegita2
Copy link
Member

@Vegita2 Vegita2 commented Jul 26, 2024

This pull request adds two things

  1. Custom JSON Configurations
  2. Improved Autotiles

Custom JSON Configurations

Users can now provide custom JSON configs for the map editor through mods.

Implementation Details:

  • Configs from all mods are loaded and combined
  • Mod configs override default configs

Usage:

  1. Create a map-editor folder in your mods directory:
    CrossCode/assets/mods/[mod_name]/map-editor/
    
  2. Add JSON files to override base map editor configs

Improved Autotiles

This update enhances autotile functionality and introduces a new autotile type.

Changes:

  • Autotile definitions changed from strings to size objects
  • New 4x4 autotile type implemented

Autotile Types:

  1. Height 2 autotiles:

    • Width options: 8, 10, 12, 14
    • Example:
  2. 4x4 autotiles:

    • Example:
      4x4 Autotile

I made a simple tool to help creating autotile definitions: https://github.com/Vegita2/cc-autotiler

Copy link
Member

@2767mr 2767mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works exactly as I would expect. I think this will actually have a major impact on mod developers.

Just some minor nitpicks (mostly internal stuff).

One small bug I found:
After selecting a different layer, the selection box is not rendered properly.

We should probably document which .json file does what and how it is structured but I wouldn't block the PR on that.


// cancel current selection when out of bounds
const phaserLayer = this.layer.getPhaserLayer();
if (!this.rightClickStart || !this.rightClickEnd || !phaserLayer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to check phaserLayer.layer for undefined otherwise there is an error is the user deletes all layers and then interacts with the tile selector

Suggested change
if (!this.rightClickStart || !this.rightClickEnd || !phaserLayer) {
if (!this.rightClickStart || !this.rightClickEnd || !phaserLayer || !phaserLayer.layer) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed, but would be good if you could try it out a bit. There could be some edge cases left

@Vegita2
Copy link
Member Author

Vegita2 commented Jul 28, 2024

One small bug I found:
After selecting a different layer, the selection box is not rendered properly.

Can you elaborate a bit? I don't know what you mean

@2767mr
Copy link
Member

2767mr commented Jul 28, 2024

One small bug I found:
After selecting a different layer, the selection box is not rendered properly.

Can you elaborate a bit? I don't know what you mean

Start:
image

After selecting "Upper":
image

@Vegita2
Copy link
Member Author

Vegita2 commented Jul 28, 2024

fixed issues

Copy link
Member

@2767mr 2767mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it again and found 2 small nitpicks:

  • The history texts are above the tile drawer
    image
  • The tile drawer does not resize itself anymore, so on 1080p monitors it does not fit all of the arid tileset at once

@Vegita2
Copy link
Member Author

Vegita2 commented Jul 31, 2024

The tile drawer does not resize itself anymore, so on 1080p monitors it does not fit all of the arid tileset at once

I don't know what you mean. The tile selector always had a fixed size

@2767mr
Copy link
Member

2767mr commented Aug 1, 2024

I was sure that it did resize at some point and did some digging. Apparently, 5 years ago in 0.4.0 it would resize itself to fit the tileset.

Obviously, I do not expect you to add it back in this PR (or at all for that matter)

@Vegita2 Vegita2 merged commit c68d2ac into master Aug 1, 2024
@Vegita2 Vegita2 deleted the autotiles branch August 1, 2024 12:15
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.

3 participants