[Mod] Incognito [incognito]

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

[Mod] Incognito [incognito]

by ChimneySwift » Mon Dec 18, 2017 11:47

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.
"You have to be a pretty sad person to quote yourself" ~ ChimneySwift
 

User avatar
GreenDimond
Member
 
Posts: 1140
Joined: Wed Oct 28, 2015 01:26
Location: {x=0,y=0,z=0}
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: [Mod] Incognito [incognito]

by GreenDimond » Mon Dec 18, 2017 17:33

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.
My YuTube channel | I moderate the HOMETOWN Server. | Click here to see my (6) mods! ~Using gradient signatures since 2017. ✂️- - - - -
 

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

Re: [Mod] Incognito [incognito]

by Andrey01 » Mon Dec 18, 2017 21:28

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.
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

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

Re: [Mod] Incognito [incognito]

by ChimneySwift » Mon Dec 18, 2017 23:54

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.
"You have to be a pretty sad person to quote yourself" ~ ChimneySwift
 

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

Re: [Mod] Incognito [incognito]

by ChimneySwift » Tue Dec 19, 2017 00:13

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.
"You have to be a pretty sad person to quote yourself" ~ ChimneySwift
 

Chem871
Member
 
Posts: 780
Joined: Sat Aug 19, 2017 21:49
Location: Ankh-Morpork, Sometimes the Nether
GitHub: Chemguy99
In-game: Chem Nyx
 

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

Re: [Mod] Incognito [incognito]

by ChimneySwift » Tue Dec 19, 2017 01:05

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
"You have to be a pretty sad person to quote yourself" ~ ChimneySwift
 

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

Re: [Mod] Incognito [incognito]

by sorcerykid » Tue Dec 19, 2017 09:20

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

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

Re: [Mod] Incognito [incognito]

by ChimneySwift » Tue Dec 19, 2017 10:19

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 (https://forum.minetest.net/viewtopic.php?f=47&t=19024)
"You have to be a pretty sad person to quote yourself" ~ ChimneySwift
 

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

Re: [Mod] Incognito [incognito]

by ManElevation » Sat Jul 14, 2018 01:19

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: 865
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: [Mod] Incognito [incognito]

by ManElevation » Tue Jul 17, 2018 14:00

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


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 5 guests