mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 14:01:13 +00:00
properly implement /kill using selectors
This commit is contained in:
parent
31a8d18aa0
commit
a770046407
2 changed files with 13 additions and 6 deletions
|
|
@ -89,7 +89,7 @@ module.exports.player=function(player, serv) {
|
|||
else if (arr == null) return 'Could not find player';
|
||||
else player.chat(JSON.stringify(arr.map(a => a.id)));
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
player.handleCommand = async (str) => {
|
||||
|
|
|
|||
|
|
@ -36,12 +36,19 @@ module.exports.player=function(player,serv)
|
|||
});
|
||||
|
||||
player.commands.add({
|
||||
base: 'killall',
|
||||
info: 'Kill everything',
|
||||
usage: '/killall',
|
||||
base: 'kill',
|
||||
info: 'Kill entities',
|
||||
usage: '/kill <selector>',
|
||||
op: true,
|
||||
action() {
|
||||
Object.keys(serv.entities).forEach(key => serv.entities[key].takeDamage({damage:20}));
|
||||
parse(str) {
|
||||
return str || false;
|
||||
},
|
||||
action(sel) {
|
||||
var arr = serv.selectorString(sel, player.position.scaled(1/32), player.world);
|
||||
if (arr instanceof Error) return arr.toString();
|
||||
if (arr == null) return 'Could not find player';
|
||||
|
||||
arr.map(entity => entity.takeDamage({damage:20}));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue