Read nearby 26.3 sign text
This commit is contained in:
@@ -324,6 +324,29 @@ class Commands:
|
||||
tree = next(self.g.world.find_trees(pos, 50))
|
||||
reply = str(tree)[1:-1]
|
||||
|
||||
## !signs [distance] - prints nearby sign text
|
||||
if command == 'signs':
|
||||
distance = float(data) if data else 32
|
||||
signs = self.g.world.find_signs(
|
||||
utils.pint(self.g.pos), distance)
|
||||
if signs:
|
||||
results = []
|
||||
for sign in signs:
|
||||
text = ' | '.join(line for line in sign['lines']
|
||||
if line.strip())
|
||||
entry = '{} {}: {}'.format(
|
||||
sign['side'], sign['position'], text)
|
||||
results.append(entry)
|
||||
print('Sign {} {}:'.format(
|
||||
sign['side'], sign['position']))
|
||||
for line in sign['lines']:
|
||||
print(' ' + line)
|
||||
reply = '; '.join(results)
|
||||
if len(reply) > 240:
|
||||
reply = reply[:237] + '...'
|
||||
else:
|
||||
reply = 'no signs found within {} blocks'.format(distance)
|
||||
|
||||
## !info [query] - replies with info on a coordinate, block, item, or player
|
||||
if command == 'info':
|
||||
if not reply:
|
||||
|
||||
Reference in New Issue
Block a user