Vortex-Tunnels
Aus EnigmaWiki
Verfügbare Sprachen: Deutsch, English, Русский
Manchmal will man ein Vortex so mit einem 2. verbinden, dass die Kugel diese Verbindung in beide Richtungen benutzen kann. Also von A nach B und von B nach A. Dazu muss man 2 Vortex setzten, die jeweils an der Position des Anderen "enden".
Zusammengefasst in eine Funktion könnte das in etwa so aussehen:
function linked_vortex(pos1, pos2) set_item("it-vortex-open", pos1[1], pos1[2], {targetx=pos2[1]+0.5, targety=pos2[2]+0.5}) set_item("it-vortex-open", pos2[1], pos2[2], {targetx=pos1[1]+0.5, targety=pos1[2]+0.5}) end
Benutzt wird das dann so:
linked_vortex({1,3},{4,6}) linked_vortex({3,6},{8,2}) linked_vortex({1,7},{2,7}) linked_vortex({5,7},{4,9})
Will man längere Tunnels machen, wird es etwas komplizierter. Hier ist eine generelle Lösung für Tunnels der folgenden Form:
A->B->C->D->...->A
Zusammengefasst in eine Funktion könnte das in etwa so aussehen:
function vortex_roundtrip(vortices) local max_vortices = table.getn(vortices) for i=1, max_vortices do local vortex1, vortex2 = vortices[i] if i ~= max_vortices then vortex2 = vortices[i+1] else vortex2 = vortices[1] end set_item("it-vortex-open", vortex1[1], vortex1[2], {targetx=vortex2[1]+0.5, targety=vortex2[2]+0.5}) end end
Benutzt wird das dann so:
vortex_roundtrip({{1,1},{2,2},{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}})

