From 2b7163bef36b85127aa5a5fc1e8308bb7bbfd9fb Mon Sep 17 00:00:00 2001 From: jay Date: Tue, 11 May 2021 17:54:19 +0500 Subject: [PATCH] feat(informer): :sparkles: add block info based on other players Now should work for position of players other than the callee. Alternative implementation could use `entity` function. This allows to also work for named entities as a bonus. --- lib/plugins/informer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/plugins/informer.js b/lib/plugins/informer.js index bc6cfe9..36eaf1e 100644 --- a/lib/plugins/informer.js +++ b/lib/plugins/informer.js @@ -263,8 +263,15 @@ function command(message_parts, player) { block(player) break default: + const aPlayer = bot.players[message_parts[1]] if (message_parts[1] in RelativePosEnum) { block(undefined, message_parts[1]) + } else if (aPlayer) { + if (aPlayer.entity) { + block(aPlayer.entity) + } else { + quiet || bot.chat(`info: player ${aPlayer.username} too far!`) + } } else { // or entity(message_parts[1]).position console.log(bot.players[message_parts[1]])