Change saveSettings() to be more mod friendly

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Post Reply
Message
Author
nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Change saveSettings() to be more mod friendly

#1 Post by nate »

I just managed to make a template for new graphical widgets in minimalist.lua, and check to notice that DarkGod's apparently just had a look in there, so I've got two comments:

1) saveSettings isn't mod (or maintenance) friendly, because it looks for specific fields ("player", "toolbar", "resources", etc) rather than writing all fields. That means that mods that want to introduce graphical widgets need to alter this function, right in the middle of the function, and so it's really tough to make them all play well together. I don't know how to fix it myself, but given the apparent power of Lua, I'd wager it's fixable.

2) Very very minor point, but desc_fct is a misleading choice of name, since anything you do on mouse-over (scaling or moving, for instance) has to occur in that function. mouseover_fct would be a better choice. Not a big deal, because mod authors can pick any name they want for that function when they use it, but for figuring out the code, better naming would be nice.

It's given me a real headache to trace this stuff out, but that's just because I'm new to it. I have to express my admiration to all of the coders (not just DarkGod?) for what is very readable, very clear code. Other than saveSettings, everything to make another widget can be easily superloaded.
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Change saveSettings() to be more mod friendly

#2 Post by darkgod »

I added a new hook UISet:Minimalist:saveSettings
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Re: Change saveSettings() to be more mod friendly

#3 Post by nate »

I see now that what I had in mind (writing all game.uiset.places[][] rather than specific places[][]) isn't good because it screws up the default game (errors on boundPlaces, maybe later too if boundPlaces got changed, because of unknown values). Writing something to settings/tome.uiset_minimalist other than .places (I tried .nateplaces = {}, .nateplaces.x = etc) didn't end up working-- not sure if there's something sitting in-between the .cfgs and game code that keeps it from getting through. The solution that ended up working for me was to use a different file extension for files that I wrote (don't get loaded by plain tome if they're not .cfg), but I'm not sure if that's the solution you'd like mod authors to settle on. Even with a hook, they'd have to do something like that.
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

Post Reply