luaPlayer:settings

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

luaPlayer:settings

Post by Nexela »

luaPlayer:settings -- just a simple shortcut that returns settings.get_player_settings(player)
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: luaPlayer:settings

Post by bobingabout »

Not to say that you idea is bad, but, if you have settings.get_player_settings(player), why would you need to do game.players[player_index].settings?
Q: does get_player_settings take player, or player_index?

if it takes index, there's no real need to add settings to LuaPlayer, however, if it takes player directly, then I can see how it could really cut things down to use player.settings.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: luaPlayer:settings

Post by Nexela »

get_player_settings() takes a luaPlayer, an index or a name


Usually by time I need a settings I already have the player so being able to do

Code: Select all

player.settings["mod-seting-name"].value  
is a lot quicker and cleaner then doing

Code: Select all

settings.get_player_settings(player)["mod-setting-name"].value
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1197
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: luaPlayer:settings

Post by Mooncat »

How about LuaPlayer::mod_settings?
I think it was added in 0.15.7.

Note: empty note. lol
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: luaPlayer:settings

Post by bobingabout »

that sounds like what you want is actually already in there

note: I haven't edited any of my scripting at all in 0.15, everything from 0.14 just seemed to work (Except for magical inserter dancing when you press SHIFT + R, because it triggers both the new base game's rotate left, and my script's rotate the input postion. this can be fixed by redefining either hotkey)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: luaPlayer:settings

Post by Rseding91 »

I fixed the empty note for 0.15.11. It just says it can be come invalid if the player is removed.
If you want to get ahold of me I'm almost always on Discord.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: luaPlayer:settings

Post by Nexela »

Mooncat wrote:How about LuaPlayer::mod_settings?
I think it was added in 0.15.7.

Note: empty note. lol
Ohhh I missed that ! Thanks
Post Reply

Return to “Implemented mod requests”