offline and online, singleplayer or not

User avatar
Posts: 65
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle

offline and online, singleplayer or not

by aristotle » Sun Aug 26, 2018 16:15

My 2 cents (really just 1)

I think that this snippet might help other newbies like me who would like to develop a mod that has different behaviors when it knows you are offline and not on a [public] server.
In fact, minetest.get_server_info().ip would return a valid ip address - even though you are in singleplayer because of its inner details and would not help.
The trick is to verify the username.

Code: Select all
local is_singleplayer = function()
  return minetest.localplayer:get_name() == 'singleplayer'

local is_offline = is_singleplayer
Happy builds & explorations!

Return to Client-side modding

Who is online

Users browsing this forum: No registered users and 1 guest