[Mod] Incognito [incognito]

Post Reply
User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

[Mod] Incognito [incognito]

by ChimneySwift » Post

Incognito
Minetest mod that lets you become completely* invisible - even to server status.

Image

GitHub
ZIP Download

Code license: [MIT](https://opensource.org/licenses/MIT)

Dependencies: None

Description
The issue with the available invisibility Minetest mods is they don't make you _completely_ invisible. Like sure you can't be seen, but what if it was as if you weren't even there, you can be playing the game, but also avoiding all of the annoying players begging for you to give them mese/gold/diamonds all day long.

This mod does just that, when you join with the incognito privilage, you are immediately set to incognito mode and given the option to become incognito this session, if you select "no", you lose your incognito status, the join message shows and it's as if you just joined, if you select "yes", you enter incognito mode until you leave the game or run /incognito.

So... what does incognito do exactly?

A few things:
  • Makes the player and player nametag invisible (without resetting player skin and nametag color)
  • Makes you invincible (Just in case of any death message mod)
  • Makes you invisible to server status (Your name will no longer show up in the server status client list (viewable at login or via /status))
  • Supresses your ability to send public chat messages (Messages and messages sent with /me will be stopped, can't have you leaking the fact you're incognito ;)
  • Makes you silent (No footstep noises!)
  • Lets you know you're incognito (via a HUD)
  • Shows you a warning HUD if there are players nearby (so you don't go placing blocks or anything and blow your cover)
That said, it's not all sunshine and rainbows, Clients are still sent your nametag and player position, so you'll show up in the minimap and .list_players if you're within nametag range, or if the client is using a 0.5.0-dev or above client.

Installing
This isn't going to be like any regular mod installation, we're going to also have to modify a built-in mod to get it to work properly, don't worry, it's fairly simple ;)
  1. Alright first up navigate to your minetest folder, then to the folder called builtin, then to game, the path should look something like this: .\minetest-0.4.16-win64\builtin\game
  2. Now open misc.lua in a text editor
  3. Navigate to the end of line 45, it should say core.register_on_joinplayer(function(player), if it doesn't, try scroll up and down to find that block of code
  4. Press enter and add below that line: if not minetest.get_modpath("incognito") then
  5. Navigate to the end of line 51 (should say end), press enter and type end
  6. Now find line 55, it should say core.register_on_leaveplayer(function(player, timed_out), and navigate to the end of it, we're going to do a similar thing to that function.
  7. You know the drill, press enter and add below that line: if not minetest.get_modpath("incognito") then
  8. Now navigate to the end of line 64 (should say end), press enter and type end
By the end of all that, the code from and including line 45 to and including 65 should look like this:

Code: Select all

core.register_on_joinplayer(function(player)
    if not minetest.get_modpath("incognito") then
    local player_name = player:get_player_name()
    player_list[player_name] = player
    if not minetest.is_singleplayer() then
        core.chat_send_all("*** " .. player_name .. " joined the game.")
    end
    end
end)

core.register_on_leaveplayer(function(player, timed_out)
    if not minetest.get_modpath("incognito") then
    local player_name = player:get_player_name()
    player_list[player_name] = nil
    local announcement = "*** " ..  player_name .. " left the game."
    if timed_out then
        announcement = announcement .. " (timed out)"
    end
    core.chat_send_all(announcement)
    end
end)
Of course now install the mod into the mods folder as normal, and you should be ready to rock and roll.

Settings
There are a couple of setting which might be of interest of course:
  • On line 1 of init.lua you'll see a variable called INCOGNITOCOOLDOWN, now you can change that to modify how long (in seconds, set to 0 to disable) to cooldown for using /incognito is, since over use would make it really obvious.
  • On line 3 of init.lua you'll find a variable called PLAYERRANGE, set this one to how many nodes as a radius you want to search for other players (if they are in the radius a warning HUD will pop up), the default is 100, and we wouldn't recomend setting it too high because you'll probably end up with a fair amount of load on your server.
Notes
  • This mod is still a work-in-progress, expect functionality to change slightly, if you have any improvements, please feel free to create a GitHub issue, Pull Request or comment on the Minetest Forums (forum.minetest.net)
Last edited by ChimneySwift on Tue Dec 19, 2017 10:10, edited 1 time in total.
A spoon is basically a tiny bowl with a stick on it

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: [Mod] Incognito [incognito]

by GreenXenith » Post

I don't see how this couldn't be done without modifying the client. Any sent message can be intercepted before being shown, so you can keep them from being shown. Also, for chat, you can intercept the message after the <name> and replace it with <fakename> message.
Also, you can use this method for pretty much anything and eliminate the death message problem. If the playername is detected and a <> is not found (which means it wasn't a player that sent the message), then intercept the message and change the name.
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Incognito [incognito]

by Andrey01 » Post

I want to ask why you have not put ')' symbol in the end of paramyter set in function core.register_on_joinplayer(function(*paramyters); instructions block)? It turns out you made the instructions block in paramyters, but the description of function is absent here.

I have asked it for my curiosity and because so it should be done in script language Python.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Incognito [incognito]

by ChimneySwift » Post

GreenDimond wrote:I don't see how this couldn't be done without modifying the client. Any sent message can be intercepted before being shown, so you can keep them from being shown. Also, for chat, you can intercept the message after the <name> and replace it with <fakename> message.
Also, you can use this method for pretty much anything and eliminate the death message problem. If the playername is detected and a <> is not found (which means it wasn't a player that sent the message), then intercept the message and change the name.
This mod doesn't replace your name, although that may become possible in future iterations (it might be an option to set up so you look like another player instead, in which case all messages will be intercepted and replaced with the fake name) the issue is your nametag and player position will still be sent to the client, meaning someone can figure out you're online if they access the list of players using CSM, so far it's not much of an issue provided you aren't in nametag distance (and many players just don't know how to run .list_players), but when 0.5.0 becomes mainstream it could become a problem for this mod.
A spoon is basically a tiny bowl with a stick on it

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Incognito [incognito]

by ChimneySwift » Post

Andrey01 wrote:I want to ask why you have not put ')' symbol in the end of paramyter set in function core.register_on_joinplayer(function(*paramyters); instructions block)? It turns out you made the instructions block in paramyters, but the description of function is absent here.
I was trying to make the instructions as easy to understand as possible, since not everyone installing mods is comfortable with coding (Although granted, this mod probably appeals more to people who code than others may), all I did was copy exactly what that line said, there was no ')' on that line, so I didn't put it in the instructions.

If anyone is confused they can just replace line 45 to line 61 in misc.lua with the code block listed below the instructions.
A spoon is basically a tiny bowl with a stick on it

Chem871
Member
Posts: 999
Joined: Sat Aug 19, 2017 21:49
GitHub: Chemguy99
In-game: Chem Nyx
Location: My Basement's Attic

Re: [Mod] Incognito [incognito]

by Chem871 » Post

If a player is bugging you for things and demanding tools/food/etc, swords do the trick nicely.
What is SCP-055?

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Incognito [incognito]

by ChimneySwift » Post

Chem871 wrote:If a player is bugging you for things and demanding tools/food/etc, swords do the trick nicely.
That is one way of doing it XD
A spoon is basically a tiny bowl with a stick on it

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: [Mod] Incognito [incognito]

by sorcerykid » Post

I wonder is .list_players a client-side chat command? Can't it be disabled?

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Mod] Incognito [incognito]

by ChimneySwift » Post

sorcerykid wrote:I wonder is .list_players a client-side chat command? Can't it be disabled?
.list_players is client-side, it can be disabled on the client, but I'm not sure it's possible to stop clients being sent the names for the client to view, at least without modifying and compiling the server itself (viewtopic.php?f=47&t=19024)
A spoon is basically a tiny bowl with a stick on it

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] Incognito [incognito]

by ManElevation » Post

thank you so much, this is exactly what i was looking for. i asked a minetest dev if this was possible like a year ago and they said no, finally found something that does what i needed.
+1000
My Public Mods! Discord: Rottweiler Games#3368

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] Incognito [incognito]

by ManElevation » Post

is it possible to do the same with mods and privs?
My Public Mods! Discord: Rottweiler Games#3368

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests