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

Assign IDs to new objects automatically #1

Closed
akesterson opened this issue Apr 20, 2014 · 2 comments
Closed

Assign IDs to new objects automatically #1

akesterson opened this issue Apr 20, 2014 · 2 comments

Comments

@akesterson
Copy link
Collaborator

@akesterson akesterson commented Apr 20, 2014

Consider if I add a new script to the Scripts/ directory. I need to add it to YAML/Scripts.yaml so that the designer will have the script available to them the next time they repack & load the game in the editor. The current structure of the YAML makes this hard:

- - 70955878
  - ▼ Scenes
  -
- - 87906638
  - Scene_Base
  - Scene_Base.rb
- - 48831177
  - Scene_Title
  - Scene_Title.rb

Every object in the YAML has an ID that should be assigned when it is repacked into the database. This ID is pulled in from the initial unpack operation, so we have no way of saying "This is a new object, assign it an ID when you repack it". We need a mechanism for this.

Criteria for success

  • I can add a new entry in the .YAML files, and put in some placeholder value for the ID
  • 'rvpacker --action pack' will determine the next available ID and assign it to the object upon repacking
  • 'rvpacker --action unpack' will preserve the ID into the next unpack operation, so it is no longer marked as 'new'
@akesterson
Copy link
Collaborator Author

@akesterson akesterson commented Apr 20, 2014

This only appears to be problematic in Scripts, everything else appears to use sequential ID numbers.

akesterson added a commit that referenced this issue Apr 20, 2014
… their YAML

This also changes the way scripts are serialized. Scripts are serialized with a magic number, but I couldn't figure out how it was calculated. Thankfully, the editor does not appear to care about the number - at least, VX Ace doesn't - so I just got rid of it, and used the same sequential ID numbering that is used in the rest of the YAML structures. Works great.

Items with an ID already set should be preserved, so you should be safe to do this without worrying about references to item ID numbers changing in events & etc. In other words, this should be collaboration-safe.
akesterson added a commit that referenced this issue Apr 20, 2014
If the yaml loader detects a duplicate ID (2 items with ID #12 for example), then the import will abort.

Also adds formatador for pretty output and easier parsing of errors.
@akesterson
Copy link
Collaborator Author

@akesterson akesterson commented Apr 20, 2014

Complete, merged. All success criteria met. Also added formatador for pretty output formatting.

@akesterson akesterson closed this Apr 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.