mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-20 15:01:17 +00:00
24 lines
685 B
JavaScript
24 lines
685 B
JavaScript
module.exports.player = function (player, serv) {
|
|
player.commands.add({
|
|
base: 'weather',
|
|
info: 'Sets the weather.',
|
|
usage: '/weather <clear|rain>',
|
|
op: true,
|
|
parse (str) {
|
|
const args = str.split(' ')
|
|
if (args.length !== 1) { return false }
|
|
|
|
let condition = args[0]
|
|
if (['clear', 'rain'].indexOf(condition) === -1) { return false }
|
|
|
|
return {condition: condition}
|
|
},
|
|
action ({condition}) {
|
|
if (condition === 'rain') {
|
|
serv._writeAll('game_state_change', {reason: 2, gameMode: 0})
|
|
} else if (condition === 'clear') {
|
|
serv._writeAll('game_state_change', {reason: 1, gameMode: 0})
|
|
}
|
|
}
|
|
})
|
|
}
|