Open ckwakman opened 7 years ago
In the same way that smelt.getCurrentCommandBlock()
returns a CommandBlock
object, I think I would implement a smelt.getModule()
that returns a CommandModule
object.
This would allow you to query the values.
To set the values, I'm not sure if this is a good idea. They module settings should really bet set BEFORE the rest of the module (.mcc) is processed. Allowing a plugin to change them mid-way through processing would have unintended effects.
@bananenbroek4 If you think I'm missing something, please could you give me an example of how changing module settings inside a plugin would be used to create command block contraptions?
Something that I'm currently working on revolves around placing wool blocks on the first block on the x axis and shifting the command blocks by one on the x axis. To do this currently, you'd need to specify the starting location of the command blocks in the .mcc file ( >{ "moduleStartX": 1} ) when it'd be easier to automatically set the starting position using plugins.
Why would it be easier in a plugin? That's the bit I don't get.
Can't you set the module size using the JSON options, and then build your container "walls" using the !pre
command?
I suppose it isn't actually easier, but just prevents people from thinking that they are doing something wrong if they don't do it in the JSON options beforehand.
I've never heard of the !pre
command, is it something that's documented?
Oh you're right, the !pre
command is missing from the docs.
You can see the code here: https://github.com/GnaspGames/Smelt/blob/master/BangCommands/Included/pre.js
It allows you to add a command that is run at the start of the module build, it will run just once.
E.g.
!pre say Building module now...
Mostly inspired by wanting to add containers and signs to one-commands for public use besides map making (e.g. one-command contraptions that add certain things to a world). Whilst it's possible to use custom variables that can be plugged into plugins and moduleStart/End x/y/z within .mcc files, it'd be easier if plugins could read this directly.