not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.2 KiB

  1. //* comment *//
  2. Copyright (C) 2015 Ignacio Rodríguez
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. //* globals *//
  14. //* flow:setturtlename *//
  15. var cblk = logo.blocks.blockList[blk].connections[1];
  16. var sourceName = args[0];
  17. var targetName = args[1];
  18. var thisTurtle = null;
  19. var foundTurtle = false;
  20. for (var i = 0; i < turtles.turtleList.length; i++) {
  21. thisTurtle = turtles.turtleList[i];
  22. if (sourceName == thisTurtle.name) {
  23. thisTurtle.name = targetName;
  24. foundTurtle = true;
  25. break;
  26. }
  27. }
  28. if (!foundTurtle) {
  29. logo.errorMsg('Could not find turtle ' + sourceName, blk);
  30. }
  31. //* block:xturtle *//
  32. var getxTurtleBlock = new ProtoBlock('xturtle');
  33. getxTurtleBlock.palette = palettes.dict['extras'];
  34. blocks.protoBlockDict['xturtle'] = getxTurtleBlock;
  35. getxTurtleBlock.staticLabels.push(_('turtle x'));
  36. getxTurtleBlock.adjustWidthToLabel();
  37. getxTurtleBlock.oneArgBlock();
  38. getxTurtleBlock.dockTypes[1] = 'anyin';
  39. getxTurtleBlock.defaults.push('0');
  40. //* block:yturtle *//
  41. var getyTurtleBlock = new ProtoBlock('yturtle');
  42. getyTurtleBlock.palette = palettes.dict['extras'];
  43. blocks.protoBlockDict['yturtle'] = getyTurtleBlock;
  44. getyTurtleBlock.staticLabels.push(_('turtle y'));
  45. getyTurtleBlock.adjustWidthToLabel();
  46. getyTurtleBlock.oneArgBlock();
  47. getyTurtleBlock.dockTypes[1] = 'anyin';
  48. getyTurtleBlock.defaults.push('0');
  49. //* block:startTurtle *//
  50. var startTurtleBlock = new ProtoBlock('startTurtle');
  51. startTurtleBlock.palette = palettes.dict['extras'];
  52. blocks.protoBlockDict['startTurtle'] = startTurtleBlock;
  53. startTurtleBlock.staticLabels.push(_('start turtle'));
  54. startTurtleBlock.adjustWidthToLabel();
  55. startTurtleBlock.oneArgBlock();
  56. startTurtleBlock.dockTypes[1] = 'anyin';
  57. startTurtleBlock.defaults.push('0');
  58. //* block:stopTurtle *//
  59. var stopTurtleBlock = new ProtoBlock('stopTurtle');
  60. stopTurtleBlock.palette = palettes.dict['extras'];
  61. blocks.protoBlockDict['stopTurtle'] = stopTurtleBlock;
  62. stopTurtleBlock.staticLabels.push(_('stop turtle'));
  63. stopTurtleBlock.adjustWidthToLabel();
  64. stopTurtleBlock.oneArgBlock();
  65. stopTurtleBlock.dockTypes[1] = 'anyin';
  66. stopTurtleBlock.defaults.push('0');
  67. //* block:setturtlename *//
  68. var setTurtleName = new ProtoBlock('setturtlename');
  69. setTurtleName.palette = palettes.dict['extras'];
  70. blocks.protoBlockDict['setturtlename'] = setTurtleName;
  71. setTurtleName.staticLabels.push(_('turtle name'));
  72. setTurtleName.staticLabels.push(_('source'));
  73. setTurtleName.staticLabels.push(_('target'));
  74. setTurtleName.adjustWidthToLabel();
  75. setTurtleName.twoArgBlock();
  76. setTurtleName.dockTypes[1] = 'anyin';
  77. setTurtleName.dockTypes[2] = 'anyin';
  78. setTurtleName.defaults.push('0');
  79. setTurtleName.defaults.push('Yertle');