forked from BisUmTo/scarpet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlookme.sc
40 lines (38 loc) · 1.14 KB
/
lookme.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import('math','_euclidean');
__config() -> {
'stay_loaded' -> true,
'scope' -> 'global',
'commands' -> {
'' -> _() -> _lookme([player() ~ ['trace', 5, 'entities']]),
'<entities>' -> '_lookme'
}
};
_lookme(entities) ->
if(entities:0 == null,
print(player(), format('r No entity found'))
, player() ~ 'permission_level' >= 2, // elif
for(entities,
i += 1;
run(str(
'execute as %s at @s run teleport @s ~ ~ ~ facing entity %s',
_ ~ 'command_name',
player() ~ 'command_name'
))
);
print(player(), str('Affected %d entit%s', i, if(i==1,'y','ies')));
, // else
for(entities,
if(_euclidean(pos(player()), pos(_)) <= 5,
i += 1;
run(str(
'execute as %s at @s run teleport @s ~ ~ ~ facing entity %s',
_ ~ 'command_name',
player() ~ 'command_name'
))
, // else
j += 1
)
);
print(player(), str('Affected %d entit%s', i, if(i==1,'y','ies')));
print(player(), format(str('r %d entit%s too far', j, if(j==1,'y was','ies were'))))
)