Fix editor getting stuck in PAINT mode when unsupported entity is placed - #274
Open
koenigstag wants to merge 5 commits into
Open
Fix editor getting stuck in PAINT mode when unsupported entity is placed#274koenigstag wants to merge 5 commits into
koenigstag wants to merge 5 commits into
Conversation
spawnPaintContainer() switched EditorMode to PAINT before constructing the PaintContainer subclass. If construction threw (e.g. for entities whose sprite drawing or item lookup isn't implemented, such as elevated rails), the mode stayed stuck at PAINT with no paint container attached, and buildStart()'s `mode !== PAINT` guard would never trip again — blocking placement of any entity afterwards until a full page reload. Now construction happens inside a try/catch and the mode is only flipped to PAINT after it succeeds, so a failing item just logs a warning instead of wedging the tool.
Falls back to the generic "Could not place this item." warning for any other unexpected failure, keeping the raw error in the console for debugging.
…prites Only the first transport-belt-textured sprite in these entities' part list was ever assigned a __zIndex; every other part (including the structure/structure_patch graphics) was left undefined. Since EntitySprite.compareFn subtracts __zIndex values to sort the global sprite list, an undefined operand produced NaN, making sort order for these parts unstable relative to neighboring entities. Give __zIndex a default of 0 and assign all belt-textured parts of splitter/underground-belt/loader a defined value (-6 for the first, -5 for the rest, matching the plain transport-belt branch), with other parts falling back to 0.
entity.station is undefined on a freshly placed train stop, so the DOM text input rendered the literal string "undefined". Default to an empty string instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.