[Mod] cloaking [cloaking]

Post Reply
User avatar
luk3yx
Member
Posts: 83
Joined: Sun Oct 21, 2012 18:14
GitHub: luk3yx
IRC: luk3yx
In-game: luk3yx
Location: Earth
Contact:

[Mod] cloaking [cloaking]

by luk3yx » Post

Minetest cloaking mod

Allows players to cloak and uncloak, inspired by Star Trek's cloaking device.

What is cloaking?

In this instance, cloaking is a way to go invisible and become undetectable by most mods (unless they explicitly want to detect cloaked players, so they can still send chat messages to them).

Why is cloaking so hacky, and where does it send the 'left the game' messages?

Cloaking sends no left the game messages, it leaves that up to the built-in left the game functions. The aim of cloaking is to trick other mods into thinking the player is not in-game, and for this it must be hacky.

Help, it crashes

If it crashes, it is either caused by a mod not liking non-existent players running around, or by a bug in cloaking itself.

How do I use cloaking?

Cloaking adds a modding API and two chatcommands. Both of these require the cloaking privilege to execute, however you can uncloak yourself without any privileges.
  • /cloak [​victim]: Cloaks yourself, alternatively an unsuspecting victim.
  • /uncloak [​victim]: Uncloaks yourself, or a victim.
  • /cloak_chat <message>: Sends <message> to all online players with the cloaking privilege. You can disable cloaked chat by setting cloaking.enable_cloaked_chat to false in minetest.conf.
How do I download cloaking?

You can either run git clone https://gitlab.com/luk3yx/minetest-cloaking.git, or download a zip or tar.gz file. You will need to rename the downloaded folder to cloaking (if it doesn't already have that name) for it to work properly.

How do I use the API?

Cloaking adds the following functions:
  • cloaking.cloak(player): Cloaks a player.
  • cloaking.uncloak(player): Uncloaks a player.
  • cloaking.get_cloaked_players(): Gets a list of cloaked player names.
  • cloaking.get_connected_names(): Gets a list of cloaked and uncloaked player names.
  • cloaking.is_cloaked(player): Checks if a player is cloaked.
  • cloaking.hide_player(player): Hides a player without cloaking them. If/when minetest.hide_player() gets introduced, this will become an alias for that.
  • cloaking.unhide_player(player): Unhides a player previously hidden with cloaking.hide_player().
  • cloaking.chat: Cloaked chat API, this is nil if cloaked chat is disabled.
    • cloaking.chat.send(message): Sends a message to cloaked chat.
    • cloaking.chat.prefix: The text (-Cloaked-) that is prepended to cloaked chat messages before they are sent to players.
Any above functions requiring "player" as a parameter also accept a player name, provided the player is online.

It also adds the following functions that ignore cloaked players and can interact with them: cloaking.get_connected_players, cloaking.get_objects_inside_radius and cloaking.get_player_by_name.

If you have made chatcommand work with players that aren't in-game, you can add _allow_while_cloaked = true to the chatcommand definition. If you explicitly don't want your chatcommand working with cloaked players, you can add _disallow_while_cloaked = true to the definition. These modifications do not require that you add cloaking to depends.txt, as when cloaking is not loaded this parameter is simply ignored.

License

Cloaking is licensed under the MIT license. You can see the full license here.

Dependencies

Cloaking has no mandatory dependencies, however it has some optional ones (chat3 and irc), as these mods need special treatment so they can function correctly. While cloaked, you cannot opt out of IRC messages.
Last edited by luk3yx on Wed Nov 17, 2021 02:53, edited 18 times in total.
git_undo() { [ -e .git ] || return 1; local r=$(git remote get-url origin); cd ..; rm -rf "$OLDPWD"; git clone "$r" "$OLDPWD"; cd "$OLDPWD"; }

User avatar
BillyS
Member
Posts: 29
Joined: Thu May 31, 2018 17:10
GitHub: Billy-S
IRC: BillyS
In-game: BillyS
Location: By my computer
Contact:

Re: [Mod] cloaking [cloaking]

by BillyS » Post

gr8t crashy m0d m3 lik3z it +1
<SHAMELESS PLUG> Play on my server Blocky Survival! It's unique! </SHAMELESS PLUG>

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] cloaking [cloaking]

by orwell » Post

Is it possible to do the same the other way round: making players join that are not there actually?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
luk3yx
Member
Posts: 83
Joined: Sun Oct 21, 2012 18:14
GitHub: luk3yx
IRC: luk3yx
In-game: luk3yx
Location: Earth
Contact:

Re: [Mod] cloaking [cloaking]

by luk3yx » Post

orwell wrote:Is it possible to do the same the other way round: making players join that are not there actually?
Yes, that would be possible, with a lot of work. Pipeworks does something similar to use with node breakers.

User avatar
luk3yx
Member
Posts: 83
Joined: Sun Oct 21, 2012 18:14
GitHub: luk3yx
IRC: luk3yx
In-game: luk3yx
Location: Earth
Contact:

Re: [Mod] cloaking [cloaking]

by luk3yx » Post

BillyS wrote:gr8t crashy m0d m3 lik3z it +1
it iZ NoW LEzZ CraZHY, YaY!

Cloaking now works nicely with the mod profiler loaded.
git_undo() { [ -e .git ] || return 1; local r=$(git remote get-url origin); cd ..; rm -rf "$OLDPWD"; git clone "$r" "$OLDPWD"; cd "$OLDPWD"; }

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests