This is just the beginning of what problems I was facing which took me an enormous amount of time to find a solution for. More posts are coming soon.
The biggest and hardest problem of all, lacking script availability for items and ghost blocks...
Speaking about my usage of Map Editor API, I used it literally entirely. I have to say it can do a lot. It was a lot of fun to use it. Challenge works pretty much only because of it. In that project, I've written a wrapper of the static code for the Manialink code (layer code), so that the instructions for modifying a track are changeable with Manialink components in real time without having to update the title pack package or something similar. I packed this wrapper into Challenge API, which contains over 100 functions, more than half of them straight taken from CMapEditorPlugin.
But, even though it doesn't seem like, modifying a track wasn't the only thing I had to wrap. Tracks can have problems. Track can be super various, some instructions have to be defined by an individual, because the map doesn't have the required information - like which finish to replace with start block - there's no definition of which finish is the main one. But that's not my main problem anyway, sometimes it's good to give people an option. Problem solving had to come to a place someday.
To the actual items and ghost blocks:
Modifying works good on Nadeo maps, but when I had come to see the custom tracks by users, oh boy, the disappointment was real. More than half of these maps used ghost blocks or items! And the Map Editor API can't even work with them! It even almost lose me motivation at one point, but I luckily found some solutions to detect items and ghost blocks:
- Ghost blocks are still available in Blocks array
- To detect ghost block via model, coord and direction
- Scroll through every block on the map and see if all these 3 points meet. Also, compare by using GetBlock to see if the block is actually ghost block (as GetBlock detects only regular blocks)
- Decoration items are not available at all, you can only detect items that are considered as anchor (Start, Checkpoint, Multilap, Finish and Dispenser or whatever that is xd)
- To detect regular items
- As item is (probably) considered as CItemAnchor, you only have its position available, no rotation or item identification!
- Simply you have practically nothing to do
- To detect waypoint (anchor) items
- You can use the AnchorData array which still, however, can be block or item and it's a struggle to work with. But it at least gives a bit more info. Still no item rotation though...
So there are two things you would expect: Removing and placing items or ghost blocks. Actually NOPE.
- There's absolutely nothing that would make us place individual items with a script!
- There's absolutely nothing that would make us place individual ghost blocks with a script!
- BUT, for this one we found one solution: Macroblocks can store ghost blocks. So yes, we made a lot of single block macroblocks (not all indeed, the important ones), and to that, as macroblock can be only one variant, we had to make Ground, Air, and sometimes even Forest and Field variants. Then I had to create a system that chooses one or another macroblock depending on the place position. It took hours, just for the waypoints of each environment.
- There's absolutely nothing that would make us remove individual ghost blocks with a script!
- Placing ghost items is just a joke at this point I guess.
- There's actually something that can be used to remove items. It's a function called RemoveItem. It is only able to remove anchors though and it can't remove ghost anchors.
Also, about the latest update: Great stuff, I definitely don't want to criticize any of it, I'm so glad that Map Editor API is still alive, but I feel like there's some step back happening... CItemAnchor, the closest thing to an item, which still only handles Position - has been replaced to just Position in CAnchorData. Is CItemAnchor about to get deprecated? Deprecating a class that is the closest we've got for item script support? Items, the most used map editor element, with the least scripting features? Who is using only blocks these days?
So, to sum this mess entirely, I'll rewrite this into briefer suggestions:
- First of all, more item information available, please, revive CItemAnchor, it's been 6 years (maybe even more) since we got items in Maniaplanet and all we can script is to, see its position?
- Make us able to manipulate items more, place them, remove them, check by a file name, all of this like currently available for macroblocks.
- Add something like GetBlock, but for ghost blocks. Give us an additional variable for CBlock that defines if its a ghost block, like Boolean IsGhost. 4 or 5 years since we got official ghost block support, and nothing available in scripting.
- More manipulation with ghost blocks is also quite needed and I would personally heavily appreciate it. Removing and placing blocks as a ghost is enough I think. Barely any map these days don't use ghost blocks.
Also, not really part of the API thing, but it would be awesome for macroblocks to support 64x64 block size or just that it could be more flexible. It would be appreciated not only in the TMUF remake title packs.
Thank you so much Nadeo for listening to your community, it really makes the game a beautiful content creation place. I never felt more motivated to script this much before. But, it's been a long time dreaming about scriptable items/ghost blocks.
If anyone here wanted to get the best out of scripting items and ghost blocks, glad I could help/answer you in some way.