When making a custom stack block holding down on the hat block to open the context menu (the one where you make block variables and whatnot) would have a new option to turn the block into a cap
This would also work with c blocks
That’s it, this really shouldn’t be too hard to implement because the functionality of changing a block between a cap and stack is already in snap 10. if you use the “primitive” block and set the block to be one that has a cap on it in the pallete it will make the custom block into a cap as well
Sadly the “primitive” block stops the script below it whenever it’s run and runs the vanilla function meaning you can’t make any custom cap blocks that don’t function identically to the vinnilla ones. But this shows the functionality isn’t hard coded and could easily be implemented
Yes, I agree about the "could easily be implemented" part, and I'm guessing we'll get around to it eventually, but it's not high priority because cap blocks don't add functionality; they're basically a form of program documentation.
I actually looked at the code for cap blocks; they're just commands with special code to change them look of them and make them unable to be stacked.
CommandBlockMorph.prototype.isStop = function () {
var choice;
if (this.selector === 'doStopThis') { // this could be cached...
choice = this.inputs()[0].evaluate();
return choice instanceof Array && choice[0].length < 12;
}
return ([ // list of blocks to be capped
'doForever',
'doReport',
'removeClone',
'doSwitchToScene'
].indexOf(this.selector) > -1);
};
since custom blocks dont have a function name like first class blocks do, it would be hard to implement this
Im pretty sure this works differently than it would just making a custom cap.
It probably just sees that it has the definition of a pre-existing one and interprets it as one.
im just using that to say the functionality of turning a block into a cap and into a normal block exists so its at least possible and theres a base to how it would work