Disconnect and Connect /player bots [feature suggestion]
CodeF53 opened this issue ยท 2 comments
Concept:
give /player
"bots" the capability to remember where they were last disconnected, facing direction, and actions
Commands:
/player Example disconnect
- disconnects Player, saving XYZ & Actions to a file
/player Example connect
- reconnects an existing player, at the saved XYZ mentioned before.
Usecase:
piglin is a player far off in the nether that idles a piglin farm, swinging a sword
without /player disconnect functionality
to free up the mobcap, someone does /player piglin kill
, getting rid of all its data
(assuming you remember exact coordinates, facing direction, and actions) this is what you would need to get back piglin
/player piglin spawn at X Y Z facing A B in Minecraft:nether
/player piglin attack interval 13
in a world with many farms, it can become very inconvenient having to remember all of the exact coordinates, facing directions, and commands for each farm
with /player disconnect functionality
to free up the mobcap, someone does /player piglin disconnect
, leading to a config file being saved containing its data
to get the piglin farm back up and running, all someone would have to do is /player piglin connect
AFAIK bots are actually saved as regular players in playerdata (#135), it's just that summoning them again changes their position to be the one of the spawner.
I don't really think special management should be done to connect and disconnect bots, however, you could easily do what you suggest with a very simple Scarpet app which would basically run those commands with a single, short command. For example, something like (note: written in browser, may not work 100%):
//# This is without arguments.
//# It's the legacy way of doing it, but it works for simple apps
//# This would spawn the bot
__command() -> (
run('player piglin spawn at X Y Z facing A B in minecraft:nether');
run('player piglin attack interval 13');
);
//# This is with the disconnect argument
disconnect() -> (
run('player piglin kill');
);
Basically putting that in a whatever.sc
file in the world's script folder will make that command be available in the world/server, which would spawn the player when ran without arguments and kill it when ran with the disconnect
argument. It would probably work better by adding some checks to see if player is already online, etc, but I thought simplicity was enough here.
And if you need more, well, you could either add more apps like this or make a general one with more arguments (maybe getting to the new command system so you could do bot whatever connect
and bot whatever disconnect
with autocomplete and all that), feel free to ask for support in how to do so. BTW, the general docs are here, and specifically for the command system around here.