-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify code #330
Comments
What kind of behavior? |
all of them I think this complexifies the code without any real usecase |
Well I'll probably let them be for now, but I think we should make flying squid code as simple as possible so people can jump in easily, and this is really bringing complexity. |
I admit, coming back to it, it is a bit clunky. It was mainly built for external plugins (based off of Spigot/Bukkit's method of handling events), however, at the moment, there aren't very many external plugins. For internal stuff, it could be useful. For example, the vanilla feature where non-ops can't build near spawn would have to be placed in I know, I pressed a little hard on making this become a reality. If we can simplify the behavior without giving up any power/flexibility, I'm totally for it. As for general simplification, one thing that might help is a bit more organization, since
module.exports.player = function (player, serv) {
player.addCommand('weather', '/weather <clear|rain>', 'Sets the weather.', {
op: true,
parse: /^clear|rain$/,
action (args) {
serv._writeAll('game_state_change', {reason: (args[1] === 'rain' ? 2 : 1), gameMode: 0})
}
});
} 24 to 9 lines (although I admit maybe have 3 strings on one line could make it harder to read). Still a large improvement. Let's get away from commands for now. Duplicate code is a big one when it comes to simplifying. Back to events for a hot sec, we have some issues referencing events multiple. For example, both if (direction === -1 || heldItem.blockId === -1 || !blocks[heldItem.blockId]) return
const referencePosition = new Vec3(location.x, location.y, location.z)
const directionVector = directionToVector[direction]
const placedPosition = referencePosition.plus(directionVector) To simplify code, we should only listen on the |
rationale for not having behavior can be found in discord flying-squid chat of 24/10/2020 |
Might include removing behavior
The text was updated successfully, but these errors were encountered: