Anemonex

QuickBuilder Work In Progress

Jul 6th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.98 KB | None | 0 0
  1. on load:
  2.     set {anemonex::builder} to true
  3.     clear {builder::*}
  4.     if folder "plugins/Skript/scripts/Anemonex" doesn't exists:
  5.         create folder "plugins/Skript/scripts/Anemonex"
  6.     if folder "plugins/Skript/scripts/Anemonex/Builder" doesn't exists:
  7.         create folder "plugins/Skript/scripts/Anemonex/Builder"
  8.     if folder "plugins/Skript/scripts/Anemonex/Builder/buildings" doesn't exists:
  9.         create folder "plugins/Skript/scripts/Anemonex/Builder/buildings"
  10.     if folder "plugins/Skript/scripts/Anemonex/Builder/effects" doesn't exists:
  11.         create folder "plugins/Skript/scripts/Anemonex/Builder/effects"
  12.  
  13. on unload:
  14.     clear {anemonex::builder}
  15.  
  16. command /builder [<text>] [<text>] [<int>] [<int>] [<int>] [<int>] [<int>] [<int>]:
  17.     trigger:
  18.         if sender is player:
  19.             if sender has permission "builder":
  20.                 if arg-1 is "build":
  21.                     if arg-2 is set:
  22.                         set {_x} to x-coordinate of targeted block
  23.                         set {_y} to y-coordinate of targeted block
  24.                         set {_z} to z-coordinate of targeted block
  25.                         if arg-3 is set:
  26.                             if arg-4 is set:
  27.                                 if arg-5 is set:
  28.                                     set {_x} to arg-3
  29.                                     set {_y} to arg-4
  30.                                     set {_z} to arg-5
  31.                         set {_w} to world of targeted block
  32.                         set {_t} to "%arg-2%"
  33.                         if file "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_t}%.schema" exists:
  34.                             function "build.build" {{_x} and {_y} and {_z} and {_w} and {_t}};
  35.                             stop
  36.                         else:
  37.                             send "&cPlik %{_t}%.schema nie zostal znaleziony w folderze plugins/Skript/scripts/Anemonex/Builder/buildings/"
  38.                             stop
  39.                     else:
  40.                         send "&cMusisz podac nazwe pliku!"
  41.                         stop
  42.                 if arg-1 is "save":
  43.                     if arg-2 is set:
  44.                         if arg-3 is 0 or 1:
  45.                             if arg-4 is 0 or 1:
  46.                                 if arg-5 is 0 or 1:
  47.                                     if file "plugins/Skript/scripts/Anemonex/Builder/buildings/%arg-2%.schema" doesn't exists:
  48.                                         if {builder::loc1.%player%} is set:
  49.                                             if {builder::loc2.%player%} is set:
  50.                                                 set {_f} to arg-2
  51.                                                 set {_a1} to arg-3
  52.                                                 set {_a2} to arg-4
  53.                                                 set {_a3} to arg-5
  54.                                                 set {_w} to world of player
  55.                                                 function "save.start" {{builder::loc1.%player%} and {builder::loc2.%player%} and {_w} and {_a1} and {_a2} and {_a3} and {_f}};
  56.                                                 send "&3Schemat zostal zapisany do pliku %arg-2%.schema!"
  57.                                                 stop
  58.                                             else:
  59.                                                 send "&cDruga lokalizacja nie zostala podana!"
  60.                                                 stop
  61.                                         else:
  62.                                             send "&cPierwsza lokalizacja nie zostala znaleziona!"
  63.                                             stop
  64.                                     else:
  65.                                         send "&cPlik o podanej nazwie istnieje!"
  66.                                         stop
  67.                                 else:
  68.                                     send "&cArgument ##3 (data) jest niepoprawny!"
  69.                             else:
  70.                                 send "&cArgument ##2 (air) jest niepoprawny!"
  71.                         else:
  72.                             send "&cArgument ##1 (quick) jest niepoprawny!"
  73.                     else:
  74.                         send "&cMusisz podac nazwe pliku, w ktorym zostanie zapisany schemat"
  75.                         stop
  76.                 if arg-1 is "help":
  77.                     if arg-2 is "2":
  78.                         send "&7=======================[ &32/4 &7]========================"
  79.                         send "&3/builder build <file> [x] [y] [z] &7- przy pomocy tej komendy stworzysz w wybranym miejscu schemat, ktory zostal zapisany w pliku &3<file>&7. Pamietaj, aby nazwe pliku podac &cbez rozszerzenia .schema&7. Dodatkowo mozesz podac koordynaty, na ktorych rozpoczeta zostanie budowanie. Jezeli tego nie zrobisz, obiekt pojawi sie na miejscu, na ktore patrzyles podczas uzywania komendy."
  80.                         stop
  81.                     if arg-2 is "3":
  82.                         send "&7=======================[ &33/4 &7]========================"
  83.                         send "&3/builder save <file> &7- zapisuje zaznaczony teren do pliku &3<file>&7. Teren mozesz zaznaczyc klikajac PPM i LPM trzymajac patyk. Potrzebujesz do tego pozwolenia &3builder&7 (ktore, jezeli mozesz to przeczytac, posiadasz)."
  84.                         stop
  85.                     if arg-2 is "4":
  86.                         send "&7=======================[ &34/4 &7]========================"
  87.                         send "&3 WKROTCE"
  88.                         stop
  89.                     send "&7=======================[ &31/4 &7]========================"
  90.                     send "&7* &3Strona 2: Wywolywanie schematu"
  91.                     send "&7* &3Strona 3: Zapisywanie schematu"
  92.                     send "&7* &3Strona 4: Linki i informacje od autora"
  93.                     send " "
  94.                     send "&7Wpisz &3/builder help [strona]&7, aby przejsc do wybranej strony"
  95.                     send " "
  96.                     send "&7Legenda:"
  97.                     send "&7* &3<wymagane>"
  98.                     send "&7* &3[opcjonalne]"
  99.                     stop
  100.                 send "&3/builder help"
  101.             else:
  102.                 send "&cBrak uprawnien!"
  103.         else:
  104.             send "Konsola potem, nie mialem czasu :v"
  105.  
  106.  
  107. on leftclick:
  108.     player is holding stick
  109.     player has permission "builder"
  110.     cancel event
  111.     set {builder::loc1.%player%} to location of clicked block
  112.     send "&3Pierwsza pozycja ustawiona!"
  113.     stop
  114.  
  115.  
  116. on rightclick:
  117.     player is holding stick
  118.     player has permission "builder"
  119.     set {builder::loc2.%player%} to location of clicked block
  120.     send "&3Druga pozycja ustawiona!"
  121.     stop
  122.  
  123.  
  124. # ROZPOCZNIJ BUDOWĘ
  125. method "build.rozpocznij" {x and y and z and w and file}:
  126.     set {_lokalizacja.x} to arg{1};
  127.     set {_lokalizacja.y} to arg{2};
  128.     set {_lokalizacja.z} to arg{3};
  129.     set {_lokalizacja.w} to arg{4};
  130.     set {_plik} to arg{5};
  131.     set {_schemat} to content of file "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema" parsed as text
  132.     replace all "%nl%" with "" in {_schemat}
  133.     replace all " " with "" in {_schemat}
  134.     if last character of {_schemat} is ";":
  135.         set {_skracanie} to length of {_schemat}
  136.         set {_schemat} to first {_skracanie}-1 characters of {_schemat}
  137.     set {_schemat.wiersze::*} to {_schemat} split at ";"
  138.     loop {_schemat.wiersze::*}:
  139.         set {_schemat.podzielone::*} to loop-value-1 split at "="
  140.         set {_schemat.koordynaty.pobierz} to {_schemat.podzielone::1}
  141.         set {_schemat.bloki.pobierz} to {_schemat.podzielone::2}
  142.         set {_schemat.koordynaty::*} to {_schemat.koordynaty.pobierz} split at ","
  143.         set {_schemat.koordynat.x} to {_schemat.koordynaty::1} parsed as integer
  144.         set {_schemat.koordynat.y} to {_schemat.koordynaty::2} parsed as integer
  145.         set {_schemat.koordynat.z} to {_schemat.koordynaty::3} parsed as integer
  146.         set {_schemat.bloki::*} to {_schemat.bloki.pobierz} split at ","
  147.         loop {_schemat.bloki::*}:
  148.             add 1 to {_liczba.x}
  149.             if "%loop-value-2%" contains "[" or "]":
  150.                 set {_stala} to "%loop-value-2%"
  151.                 if {_stala} contains "explosion":
  152.                     function "build.explosion" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  153.                 else if {_stala} contains "ecuboid":
  154.                     function "build.ecuboid" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  155.                 else if {_stala} contains "fcuboid":
  156.                     function "build.fcuboid" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  157.                 else if {_stala} contains "edge":
  158.                     function "build.edge" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  159.                 else if {_stala} contains "line":
  160.                     function "build.line" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  161.                 else if {_stala} contains "build":
  162.                     function "build.build" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  163.                 else if {_stala} contains "wall":
  164.                     function "build.wall" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  165.                 else if {_stala} contains "floor":
  166.                     function "build.floor" {{_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x} and {_lokalizacja.y}+{_schemat.koordynat.y} and {_lokalizacja.z}+{_schemat.koordynat.z} and {_lokalizacja.w} and {_stala}};
  167.             else:
  168.                 set {_blok} to loop-value-2 parsed as item
  169.                 set block at location at {_lokalizacja.x}-1+{_liczba.x}+{_schemat.koordynat.x}, {_lokalizacja.y}+{_schemat.koordynat.y}, {_lokalizacja.z}+{_schemat.koordynat.z} in world {_lokalizacja.w} to {_blok}
  170.         clear {_liczba.x}
  171.  
  172.  
  173. # EKSPLOZJA
  174. method "build.explosion" {x and y and z and w and text}:
  175.     set {_stala} to arg{5};
  176.     replace "explosion[" with "" in {_stala}
  177.     replace "]" with "" in {_stala}
  178.     set {_moc} to {_stala} parsed as integer
  179.     set {_x} to arg{1};
  180.     set {_y} to arg{2};
  181.     set {_z} to arg{3};
  182.     set {_w} to arg{4};
  183.     broadcast "%{_x}%, %{_y}%, %{_z}% in world %{_w}% with power %{_moc}%"
  184.     create an explosion of force {_moc} at location at {_x}, {_y}, {_z} in world {_w}
  185.  
  186.  
  187. # WYPEŁNIONY PROSTOKĄT
  188. method "build.fcuboid" {x and y and z and w and text}:
  189.     set {_x} to arg{1};
  190.     set {_y} to arg{2};
  191.     set {_z} to arg{3};
  192.     set {_w} to arg{4};
  193.     set {_stala} to arg{5};
  194.     replace all "fcuboid[" with "" in {_stala}
  195.     replace "]" with "" in {_stala}
  196.     set {_argumenty::*} to {_stala} split at "."
  197.     set {_blok} to {_argumenty::1} parsed as item
  198.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  199.     set {_wartosc.y} to {_argumenty::3} parsed as integer
  200.     set {_wartosc.z} to {_argumenty::4} parsed as integer
  201.     loop {_wartosc.y} times:
  202.         loop {_wartosc.z} times:
  203.             set {_blok.1} to block at location {_x}, {_y}-1+loop-number-1, {_z}-1+loop-number-2 in world {_w}
  204.             set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number-1, {_z}-1+loop-number-2 in world {_w}
  205.             loop blocks between {_blok.1} and {_blok.2}:
  206.                 set loop-block to {_blok}
  207.  
  208.  
  209. # PUSTY PROSTOKĄT
  210. method "build.ecuboid" {x and y and z and w and text}:
  211.     set {_x} to arg{1};
  212.     set {_y} to arg{2};
  213.     set {_z} to arg{3};
  214.     set {_w} to arg{4};
  215.     set {_stala} to arg{5};
  216.     replace all "ecuboid[" with "" in {_stala}
  217.     replace "]" with "" in {_stala}
  218.     set {_argumenty::*} to {_stala} split at "."
  219.     set {_blok} to {_argumenty::1} parsed as item
  220.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  221.     set {_wartosc.y} to {_argumenty::3} parsed as integer
  222.     set {_wartosc.z} to {_argumenty::4} parsed as integer
  223.     loop {_wartosc.z} times:
  224.         set {_blok.1} to block at location {_x}, {_y}, {_z}-1+loop-number in world {_w}
  225.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}, {_z}-1+loop-number in world {_w}
  226.         loop blocks between {_blok.1} and {_blok.2}:
  227.             set loop-block to {_blok}
  228.     loop {_wartosc.z} times:
  229.         set {_blok.1} to block at location {_x}, {_y}-1+{_wartosc.y}, {_z}-1+loop-number in world {_w}
  230.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+{_wartosc.y}, {_z}-1+loop-number in world {_w}
  231.         loop blocks between {_blok.1} and {_blok.2}:
  232.             set loop-block to {_blok}
  233.     loop {_wartosc.y} times:
  234.         set {_blok.1} to block at location {_x}, {_y}-1+loop-number, {_z} in world {_w}
  235.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number, {_z} in world {_w}
  236.         loop blocks between {_blok.1} and {_blok.2}:
  237.             set loop-block to {_blok}
  238.     loop {_wartosc.y} times:
  239.         set {_blok.1} to block at location {_x}, {_y}-1+loop-number, {_z}-1+{_wartosc.z} in world {_w}
  240.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number, {_z}-1+{_wartosc.z} in world {_w}
  241.         loop blocks between {_blok.1} and {_blok.2}:
  242.             set loop-block to {_blok}
  243.     loop {_wartosc.y} times:
  244.         set {_blok.1} to block at location {_x}, {_y}-1+loop-number, {_z} in world {_w}
  245.         set {_blok.2} to block at location {_x}, {_y}-1+loop-number, {_z}-1+{_wartosc.z} in world {_w}
  246.         loop blocks between {_blok.1} and {_blok.2}:
  247.             set loop-block to {_blok}
  248.     loop {_wartosc.y} times:
  249.         set {_blok.1} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number, {_z} in world {_w}
  250.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number, {_z}-1+{_wartosc.z} in world {_w}
  251.         loop blocks between {_blok.1} and {_blok.2}:
  252.             set loop-block to {_blok}
  253.  
  254.  
  255. # KRAWĘDZIE PROSTOKĄTA
  256. method "build.edge" {x and y and z and w and text}:
  257.     set {_x} to arg{1};
  258.     set {_y} to arg{2};
  259.     set {_z} to arg{3};
  260.     set {_w} to arg{4};
  261.     set {_stala} to arg{5};
  262.     replace all "edge[" with "" in {_stala}
  263.     replace "]" with "" in {_stala}
  264.     set {_argumenty::*} to {_stala} split at "."
  265.     set {_blok} to {_argumenty::1} parsed as item
  266.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  267.     set {_wartosc.y} to {_argumenty::3} parsed as integer
  268.     set {_wartosc.z} to {_argumenty::4} parsed as integer
  269.     set {_punkt.1} to block at location {_x}, {_y}, {_z} in world {_w}
  270.     set {_punkt.2} to block at location {_x}-1+{_wartosc.x}, {_y}, {_z} in world {_w}
  271.     set {_punkt.3} to block at location {_x}-1+{_wartosc.x}, {_y}, {_z}-1+{_wartosc.z} in world {_w}
  272.     set {_punkt.4} to block at location {_x}, {_y}, {_z}-1+{_wartosc.z} in world {_w}
  273.     set {_punkt.5} to block at location {_x}, {_y}-1+{_wartosc.y}, {_z} in world {_w}
  274.     set {_punkt.6} to block at location {_x}-1+{_wartosc.x}, {_y}-1+{_wartosc.y}, {_z} in world {_w}
  275.     set {_punkt.7} to block at location {_x}-1+{_wartosc.x}, {_y}-1+{_wartosc.y}, {_z}-1+{_wartosc.z} in world {_w}
  276.     set {_punkt.8} to block at location {_x}, {_y}-1+{_wartosc.y}, {_z}-1+{_wartosc.z} in world {_w}
  277.     loop blocks between {_punkt.1} and {_punkt.2}:
  278.         set loop-block to {_blok}
  279.     loop blocks between {_punkt.2} and {_punkt.3}:
  280.         set loop-block to {_blok}
  281.     loop blocks between {_punkt.3} and {_punkt.4}:
  282.         set loop-block to {_blok}
  283.     loop blocks between {_punkt.4} and {_punkt.1}:
  284.         set loop-block to {_blok}
  285.     loop blocks between {_punkt.1} and {_punkt.5}:
  286.         set loop-block to {_blok}
  287.     loop blocks between {_punkt.2} and {_punkt.6}:
  288.         set loop-block to {_blok}
  289.     loop blocks between {_punkt.3} and {_punkt.7}:
  290.         set loop-block to {_blok}
  291.     loop blocks between {_punkt.4} and {_punkt.8}:
  292.         set loop-block to {_blok}
  293.     loop blocks between {_punkt.5} and {_punkt.6}:
  294.         set loop-block to {_blok}
  295.     loop blocks between {_punkt.6} and {_punkt.7}:
  296.         set loop-block to {_blok}
  297.     loop blocks between {_punkt.7} and {_punkt.8}:
  298.         set loop-block to {_blok}
  299.     loop blocks between {_punkt.8} and {_punkt.5}:
  300.         set loop-block to {_blok}
  301.  
  302.  
  303. # PODŁOGA
  304. method "build.floor" {x and y and z and w and text}:
  305.     set {_x} to arg{1};
  306.     set {_y} to arg{2};
  307.     set {_z} to arg{3};
  308.     set {_w} to arg{4};
  309.     set {_stala} to arg{5};
  310.     replace all "floor[" with "" in {_stala}
  311.     replace "]" with "" in {_stala}
  312.     set {_argumenty::*} to {_stala} split at "."
  313.     set {_blok} to {_argumenty::1} parsed as item
  314.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  315.     set {_wartosc.z} to {_argumenty::3} parsed as integer
  316.     loop {_wartosc.z} times:
  317.         set {_blok.1} to block at location {_x}, {_y}, {_z}-1+loop-number in world {_w}
  318.         set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}, {_z}-1+loop-number in world {_w}
  319.         loop blocks between {_blok.1} and {_blok.2}:
  320.             set loop-block to {_blok}
  321.  
  322.  
  323. # ŚCIANA
  324. method "build.wall" {x and y and z and w and text}:
  325.     set {_x} to arg{1};
  326.     set {_y} to arg{2};
  327.     set {_z} to arg{3};
  328.     set {_w} to arg{4};
  329.     set {_stala} to arg{5};
  330.     replace all "wall[" with "" in {_stala}
  331.     replace "]" with "" in {_stala}
  332.     set {_argumenty::*} to {_stala} split at "."
  333.     set {_blok} to {_argumenty::1} parsed as item
  334.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  335.     set {_wartosc.y} to {_argumenty::3} parsed as integer
  336.     set {_kierunek} to {_argumenty::4} parsed as integer
  337.     loop {_wartosc.y} times:
  338.         set {_blok.1} to block at location {_x}, {_y}-1+loop-number, {_z} in world {_w}
  339.         if {_kierunek} is 0:
  340.             set {_blok.2} to block at location {_x}-1+{_wartosc.x}, {_y}-1+loop-number, {_z} in world {_w}
  341.         if {_kierunek} is 1:
  342.             set {_blok.2} to block at location {_x}, {_y}-1+loop-number, {_z}-1+{_wartosc.x} in world {_w}
  343.         loop blocks between {_blok.1} and {_blok.2}:
  344.             set loop-block to {_blok}
  345.  
  346.  
  347. # PROSTA
  348. method "build.line" {x and y and z and w and text}:
  349.     set {_x} to arg{1};
  350.     set {_y} to arg{2};
  351.     set {_z} to arg{3};
  352.     set {_w} to arg{4};
  353.     set {_stala} to arg{5};
  354.     replace all "line[" with "" in {_stala}
  355.     replace "]" with "" in {_stala}
  356.     set {_argumenty::*} to {_stala} split at "."
  357.     set {_blok} to {_argumenty::1} parsed as item
  358.     set {_wartosc.x} to {_argumenty::2} parsed as integer
  359.     set {_wartosc.y} to {_argumenty::3} parsed as integer
  360.     set {_wartosc.z} to {_argumenty::4} parsed as integer
  361.     set {_punkt.1} to block at location {_x}, {_y}, {_z} in world {_w}
  362.     set {_punkt.2} to block at location {_x}+{_wartosc.x}, {_y}+{_wartosc.y}, {_z}+{_wartosc.z} in world {_w}
  363.     loop blocks between {_punkt.1} and {_punkt.2}:
  364.         set loop-block to {_blok}
  365.  
  366.  
  367. # BUDYNEK ZE SCHEMATU
  368. method "build.build" {x and y and z and w and text}:
  369.     set {_x} to arg{1};
  370.     set {_y} to arg{2};
  371.     set {_z} to arg{3};
  372.     set {_w} to arg{4};
  373.     set {_stala} to arg{5};
  374.     replace all "build[" with "" in {_stala}
  375.     replace "]" with "" in {_stala}
  376.     if file "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_stala}%.schema" exists:
  377.         function "build.rozpocznij" {{_x} and {_y} and {_z} and {_w} and {_stala}};
  378.  
  379.  
  380. # ROZPOCZĘCIE ZAPISYWANIA
  381. method "save.start" {loc1 and loc2 and world and arg1 and arg2 and arg3 and file}:
  382.     set {_arg.1} to arg{4};
  383.     set {_arg.2} to arg{5}; # doesn't matter right now
  384.     set {_arg.3} to arg{6}; # doesn't matter right now
  385.     if {_arg.1} is 1:
  386.         function "save.quick" {arg{1} and arg{2} and arg{3} and arg{7}};
  387.     else:
  388.         function "save.smart" {arg{1} and arg{2} and arg{3} and arg{7}};
  389.        
  390.  
  391. method "save.smart" {loc1 and loc2 and world and file}:
  392.     set {_loc1} to arg{1};
  393.     set {_loc2} to arg{2};
  394.     set {_w} to arg{3};
  395.     set {_plik} to arg{4};
  396.     create file "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  397.     set {_x1} to x-coordinate of {_loc1}
  398.     set {_y1} to y-coordinate of {_loc1}
  399.     set {_z1} to z-coordinate of {_loc1}
  400.     set {_x2} to x-coordinate of {_loc2}
  401.     set {_y2} to y-coordinate of {_loc2}
  402.     set {_z2} to z-coordinate of {_loc2}
  403.     if {_x2} is bigger than {_x1}:
  404.         set {_temp} to {_x2}
  405.         set {_x2} to {_x1}
  406.         set {_x1} to {_temp}
  407.     if {_y2} is bigger than {_y1}:
  408.         set {_temp} to {_y2}
  409.         set {_y2} to {_y1}
  410.         set {_y1} to {_temp}
  411.     if {_z2} is bigger than {_z1}:
  412.         set {_temp} to {_z2}
  413.         set {_z2} to {_z1}
  414.         set {_z1} to {_temp}
  415.     set {_x} to {_x1} - {_x2} + 1
  416.     set {_y} to {_y1} - {_y2} + 1
  417.     set {_z} to {_z1} - {_z2} + 1
  418.     set {_loopnum} to 0
  419.     set {_skip} to 0
  420.     loop {_x} times:
  421.         loop {_y} times:
  422.             loop {_z} times:
  423.                 add 1 to {_loopnum}
  424.                 if {_data.%loop-number-1 + 1 - 2%.%loop-number-2 + 1 - 2%.%loop-number-3 + 1 - 2%} is set:
  425.                     set {_skip} to {_data.%loop-number-1 + 1 - 2%.%loop-number-2 + 1 - 2%.%loop-number-3 + 1 - 2%}
  426.                 if {_skip} is 0:
  427.                     set {_now.x} to {_x2} - 1 + loop-number-1
  428.                     set {_now.y} to {_y2} - 1 + loop-number-2
  429.                     set {_now.z} to {_z2} - 1 + loop-number-3
  430.                     set {_check.0.0.0} to block at location {_now.x}, {_now.y}, {_now.z} in world {_w}
  431.                     set {_check.0.0.1} to block at location {_now.x}, {_now.y}, {_now.z}+1 in world {_w}
  432.                     set {_check.0.1.0} to block at location {_now.x}, {_now.y}+1, {_now.z} in world {_w}
  433.                     set {_check.0.1.1} to block at location {_now.x}, {_now.y}+1, {_now.z}+1 in world {_w}
  434.                     set {_check.1.0.0} to block at location {_now.x}+1, {_now.y}, {_now.z} in world {_w}
  435.                     set {_check.1.0.1} to block at location {_now.x}+1, {_now.y}, {_now.z}+1 in world {_w}
  436.                     set {_check.1.1.0} to block at location {_now.x}+1, {_now.y}+1, {_now.z} in world {_w}
  437.                     set {_check.1.1.1} to block at location {_now.x}+1, {_now.y}+1, {_now.z}+1 in world {_w}
  438.                     if {_x} is loop-number-1:
  439.                         set {_check.1.0.0} to "null"
  440.                         set {_check.1.0.1} to "null"
  441.                         set {_check.1.1.0} to "null"
  442.                         set {_check.1.1.1} to "null"
  443.                     if {_y} is loop-number-2:
  444.                         set {_check.0.1.0} to "null"
  445.                         set {_check.0.1.1} to "null"
  446.                         set {_check.1.1.0} to "null"
  447.                         set {_check.1.1.1} to "null"
  448.                     if {_z} is loop-number-3:
  449.                         set {_check.0.0.1} to "null"
  450.                         set {_check.0.1.1} to "null"
  451.                         set {_check.1.0.1} to "null"
  452.                         set {_check.1.1.1} to "null"
  453.                     set {_type} to ""
  454.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.0.0.1}%:%data value of {_check.0.0.1}%":
  455.                         set {_type} to "%{_type}%1"
  456.                     else:
  457.                         set {_type} to "%{_type}%0"
  458.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.0.1.0}%:%data value of {_check.0.1.0}%":
  459.                         set {_type} to "%{_type}%1"
  460.                     else:
  461.                         set {_type} to "%{_type}%0"
  462.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.0.1.1}%:%data value of {_check.0.1.1}%":
  463.                         set {_type} to "%{_type}%1"
  464.                     else:
  465.                         set {_type} to "%{_type}%0"
  466.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.1.0.0}%:%data value of {_check.1.0.0}%":
  467.                         set {_type} to "%{_type}%1"
  468.                     else:
  469.                         set {_type} to "%{_type}%0"
  470.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.1.0.1}%:%data value of {_check.1.0.1}%":
  471.                         set {_type} to "%{_type}%1"
  472.                     else:
  473.                         set {_type} to "%{_type}%0"
  474.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.1.1.0}%:%data value of {_check.1.1.0}%":
  475.                         set {_type} to "%{_type}%1"
  476.                     else:
  477.                         set {_type} to "%{_type}%0"
  478.                     if "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%" is "%id of {_check.1.1.1}%:%data value of {_check.1.1.1}%":
  479.                         set {_type} to "%{_type}%1"
  480.                     else:
  481.                         set {_type} to "%{_type}%0"
  482.                     if "%{_type}%" is "1111111": # PROSTOKĄT
  483.                         set {_max.x} to {_x} - loop-number-1
  484.                         set {_max.y} to {_y} - loop-number-2
  485.                         set {_max.z} to {_z} - loop-number-3
  486.                         set {_count.x} to 2
  487.                         set {_count.y} to 2
  488.                         set {_count.z} to 2
  489.                         set {_mainblock} to "%id of {_check.0.0.0}%:%data value of {_check.0.0.0}%"
  490.                         set {_break} to 3
  491.                         while {_break} is not 0:
  492.                             set {_break} to 3
  493.                             if {_max.x} is not 0:
  494.                                 set {_checknum.1} to 0
  495.                                 set {_checknum.2} to 0
  496.                                 loop {_count.y} times:
  497.                                     loop {_count.z} times:
  498.                                         add 1 to {_checknum.1}
  499.                                         set {_checkblock} to "%id of block at location {_now.x} + {_count.x}, {_now.y} + loop-number-4 + 1 - 2, {_now.z} + loop-number-5 + 1 - 2 in world {_w}%:%data value of block at location {_now.x} + {_count.x}, {_now.y} + loop-number-4 + 1 - 2, {_now.z} + loop-number-5 + 1 - 2 in world {_w}%"
  500.                                         if "%{_mainblock}%" is "%{_checkblock}%":
  501.                                             add 1 to {_checknum.2}
  502.                                 remove 1 from {_max.x}
  503.                                 if {_checknum.1} is {_checknum.2}:
  504.                                     add 1 to {_count.x}
  505.                                 else:
  506.                                     set {_max.x} to 0
  507.                             else:
  508.                                 remove 1 from {_break}
  509.                             if {_max.y} is not 0:
  510.                                 set {_checknum.1} to 0
  511.                                 set {_checknum.2} to 0
  512.                                 loop {_count.x} times:
  513.                                     loop {_count.z} times:
  514.                                         add 1 to {_checknum.1}
  515.                                         set {_checkblock} to "%id of block at location {_now.x} + loop-number-4 + 1 - 2, {_now.y} + {_count.y}, {_now.z} + loop-number-5 + 1 - 2 in world {_w}%:%data value of block at location {_now.x} + loop-number-4 + 1 - 2, {_now.y} + {_count.y}, {_now.z} + loop-number-5 + 1 - 2 in world {_w}%"
  516.                                         if "%{_mainblock}%" is "%{_checkblock}%":
  517.                                             add 1 to {_checknum.2}
  518.                                 remove 1 from {_max.y}
  519.                                 if {_checknum.1} is {_checknum.2}:
  520.                                     add 1 to {_count.y}
  521.                                 else:
  522.                                     set {_max.x} to 0
  523.                             else:
  524.                                 remove 1 from {_break}
  525.                             if {_max.z} is not 0:
  526.                                 set {_checknum.1} to 0
  527.                                 set {_checknum.2} to 0
  528.                                 loop {_count.x} times:
  529.                                     loop {_count.y} times:
  530.                                         add 1 to {_checknum.1}
  531.                                         set {_checkblock} to "%id of block at location {_now.x} + loop-number-4 + 1 - 2, {_now.y} + loop-number-5 + 1 - 2, {_now.z} + {_count.z} in world {_w}%:%data value of block at location {_now.x} + loop-number-4 + 1 - 2, {_now.y} + loop-number-5 + 1 - 2, {_now.z} + {_count.z} in world {_w}%"
  532.                                         if "%{_mainblock}%" is "%{_checkblock}%":
  533.                                             add 1 to {_checknum.2}
  534.                                 remove 1 from {_max.z}
  535.                                 if {_checknum.1} is {_checknum.2}:
  536.                                     add 1 to {_count.z}
  537.                             else:
  538.                                 remove 1 from {_break}
  539.                         set {_save.x} to {_x2} - {_now.x}
  540.                         set {_save.y} to {_y2} - {_now.y}
  541.                         set {_save.z} to {_z2} - {_now.z}
  542.                        
  543.                         if {_now.x} is bigger than {_x2}:
  544.                             set {_save.x} to {_now.x} - {_x2}
  545.                            
  546.                         if {_now.y} is bigger than {_y2}:
  547.                             set {_save.y} to {_now.y} - {_y2}
  548.                            
  549.                         if {_now.z} is bigger than {_z2}:
  550.                             set {_save.z} to {_now.z} - {_z2}
  551.                         if id of {_check.0.0.0} is 0:
  552.                             wf "%{_save.x}%,%{_save.y}%,%{_save.z}% = fcuboid[%id of {_check.0.0.0}%.%{_count.x}%.%{_count.y}%.%{_count.z}%];" to "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  553.                         else:
  554.                             wf "%{_save.x}%,%{_save.y}%,%{_save.z}% = fcuboid[%id of {_check.0.0.0}%:%data of {_check.0.0.0}%.%{_count.x}%.%{_count.y}%.%{_count.z}%];" to "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  555.                         loop {_count.y} times:
  556.                             loop {_count.z} times:
  557.                                 set {_data.%loop-number-1 + loop-number-5 + 1 - 3%.%loop-number-2 + loop-number-4 + 1 - 3%.%loop-number-3 + 1 - 2%} to {_count.x}
  558.                         set {_skip} to {_count.x}
  559.                     else if "%{_type}%" is "1001100": # PODŁOGA
  560.                         send "nope" to console
  561.                     else if "%{_type}%" is "0101010": # ŚCIANA [0]
  562.                         send "nope" to console
  563.                     else if "%{_type}%" is "1110000": # ŚCIANA [1]
  564.                         send "nope" to console
  565.                     else if "%{_type}%" is "1000000": # PROSTA [0.0.1]
  566.                         send "nope" to console
  567.                     else if "%{_type}%" is "0100000": # PROSTA [0.1.0]
  568.                         send "nope" to console
  569.                     else if "%{_type}%" is "0010000": # PROSTA [0.1.1]
  570.                         send "nope" to console
  571.                     else if "%{_type}%" is "0001000": # PROSTA [1.0.0]
  572.                         send "nope" to console
  573.                     else if "%{_type}%" is "0000100": # PROSTA [1.0.1]
  574.                         send "nope" to console
  575.                     else if "%{_type}%" is "0000010": # PROSTA [1.1.0]
  576.                         send "nope" to console
  577.                     else if "%{_type}%" is "0000001": # PROSTA [1.1.1]
  578.                         send "nope" to console
  579.                     else: # SAMOTNY BLOK
  580.                         if id of {_check.0.0.0} is 0:
  581.                             wf "%loop-number-1 + 1 - 2%,%loop-number-2 + 1 - 21%,%loop-number-3 + 1 - 2% = %id of {_check.0.0.0}%;" to "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  582.                         else:
  583.                             wf "%loop-number-1 + 1 - 2%,%loop-number-2 + 1 - 2%,%loop-number-3 + 1 - 2% = %id of {_check.0.0.0}%:%data of {_check.0.0.0}%;" to "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  584.                     wait 0.1 second
  585.                 else:
  586.                     remove 1 from {_skip}
  587.  
  588.  
  589.  
  590. # ZAPISYWANIE SZYBKIE
  591. method "save.quick" {loc1 and loc2 and world and file}:
  592.     set {_loc1} to arg{1};
  593.     set {_loc2} to arg{2};
  594.     set {_w} to arg{3};
  595.     set {_plik} to arg{4};
  596.     create file "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
  597.     set {_x1} to x-coordinate of {_loc1}
  598.     set {_y1} to y-coordinate of {_loc1}
  599.     set {_z1} to z-coordinate of {_loc1}
  600.     set {_x2} to x-coordinate of {_loc2}
  601.     set {_y2} to y-coordinate of {_loc2}
  602.     set {_z2} to z-coordinate of {_loc2}
  603.     if {_x2} is bigger than {_x1}:
  604.         set {_temp} to {_x2}
  605.         set {_x2} to {_x1}
  606.         set {_x1} to {_temp}
  607.     if {_y2} is bigger than {_y1}:
  608.         set {_temp} to {_y2}
  609.         set {_y2} to {_y1}
  610.         set {_y1} to {_temp}
  611.     if {_z2} is bigger than {_z1}:
  612.         set {_temp} to {_z2}
  613.         set {_z2} to {_z1}
  614.         set {_z1} to {_temp}
  615.     set {_x} to {_x1} - {_x2} + 1
  616.     set {_y} to {_y1} - {_y2} + 1
  617.     set {_z} to {_z1} - {_z2} + 1
  618.     loop {_x} times:
  619.         loop {_y} times:
  620.             loop {_z} times:
  621.                 set {_nowy.x} to {_x2} - 1 + loop-number-1
  622.                 set {_nowy.y} to {_y2} - 1 + loop-number-2
  623.                 set {_nowy.z} to {_z2} - 1 + loop-number-3
  624.                 set {_b} to id of block at location {_nowy.x}, {_nowy.y}, {_nowy.z} in world {_w}
  625.                 set {_m} to data value of block at location {_nowy.x}, {_nowy.y}, {_nowy.z} in world {_w}
  626.                 set {_wf} to "%{_b}%"
  627.                 if {_m} is not 0:
  628.                     set {_wf} to "%{_b}%:%{_m}%"
  629.                 wf "%loop-number-1 + 1 - 2%,%loop-number-2 + 1 - 2%,%loop-number-3 + 1 - 2% = %{_wf}%;" to "plugins/Skript/scripts/Anemonex/Builder/buildings/%{_plik}%.schema"
Advertisement
Add Comment
Please, Sign In to add comment