I wrote basic functionality to bake unitdefs post into the individual unitdef files. Probably it has been done before, but I couldn't find it. You can find it attached to this post.
It works by saving the entire unitdef table into ud.customParams as a string, and then unpacking it and writing to file from LuaUI, because there is no io access from unitdefs_post. It doesn't handle OO unitdefs (in the style of e.g. S44), but it wouldn't be hard to modify it to do so.
update: BA 8.19+ contains a more complicated version of this system, which also has the ability to bake weapondefs, allowing for unitdef files which contain weapondefs.
Instructions:
(1) Put unitdefs_post_save_to_customparams.lua in gamedata
(2) Put unitdefs_write.lua in widgets
(3) Add VFS.Include("gamedata/unitdefs_post_save_to_customparams.lua") to unitdefs_post, at the point where you want to bake
(4) Load Spring, then load the widget
(5) Look in the spring folder, unitdefs should all be written to file, cut/paste these over the original files.
(6) Clean out the stuff you just baked into unitdefs from your unitdefs_post.lua.
Notes:
! Make sure your unitdefs don't contain lua keywords as table keys (remove them with unitdefs_post if so)
! Make sure you don't bake in any modoptions that alter unitdefs
! It will round all numbers to 5dp and then remove trailing 0s after the decimal point, to avoid e.g. 0==0.000000234876
! It will convert all string keys to lower case
! It won't bake weapondefs_post (make the changes in unitdefs_post and bake that instead)
baking unitdefs_post
baking unitdefs_post
Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.
Moderator: Moderators
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
baking unitdefs_post
Post by Silentwings »
- Attachments
-
- unitdefs_write.lua
- (5.79 KiB) Downloaded 15 times
-
- unitdefs_post_save_to_customparams.lua
- (1.31 KiB) Downloaded 10 times
Jump to
- Community
- ↳ General Discussion
- ↳ Help & Bugs
- ↳ Ingame Community
- ↳ Spring Clans
- ↳ Tournaments
- ↳ Linux
- ↳ Mac OS X
- ↳ Off Topic Discussion
- Content Development
- ↳ Game Development
- ↳ Game Development Tutorials & Resources
- ↳ Game Releases
- ↳ Map Creation
- ↳ Map Tutorials & Resources
- ↳ Map Releases
- ↳ Lua Scripts
- ↳ Art & Modelling
- ↳ Modelling & Texturing Tutorials & Resources
- ↳ Sound Effects & Music
- ↳ Project Subforums
- ↳ Balanced Annihilation
- ↳ Balanced Annihilation Reloaded
- ↳ Conflict Terra
- ↳ The Cursed
- ↳ Evolution RTS
- ↳ Jauria RTS
- ↳ Kernel Panic
- ↳ Journeywar
- ↳ Ludum Dare
- ↳ MechCommander: Legacy
- ↳ Metal Factions
- ↳ MOSAIC
- ↳ NOTA
- ↳ Phoenix Annihilation
- ↳ SpringBoard
- ↳ Spring: 1944
- ↳ Star Wars: Imperial Winter
- ↳ TA Prime
- ↳ Tech Annihilation
- ↳ XTA
- ↳ Zero-K
- ↳ Project Archive
- ↳ Argh's Projects
- ↳ Caydr's Projects
- ↳ Damned
- ↳ Dune: Evolution
- ↳ Engines Of War
- ↳ Evolution RTS
- ↳ Progressive Annihilation
- ↳ Supreme Annihilation
- ↳ Spring Tanks
- ↳ PanzerStahl
- Development
- ↳ News
- ↳ Engine
- ↳ Dedicated Developer Discussion
- ↳ New Developer Discussion
- ↳ Meeting Minutes
- ↳ AI
- ↳ Lobby Clients & Server
- ↳ Infrastructure Development
- ↳ Lobby Meeting Minutes
- ↳ SPADS AutoHost
- ↳ SpringLobby Client
- ↳ Feature Requests
- ↳ Bounty Offers
- ↳ The Werewolf Game
- ↳ News Submissions
- Site content
- ↳ Community Blog
- ↳ Site content
- ↳ Banners
- ↳ Welcome images
- ↳ Videos
- ↳ Videos - contributions
- ↳ Screenshots
- ↳ Screenshots - contributions