Created
March 17, 2012 18:43
-
-
Save Brianetta/2063955 to your computer and use it in GitHub Desktop.
Flip Y on the local/bright stars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fp [open "data/systems/02_local_stars.lua" r] | |
#set fp [open "data/systems/03_bright_stars.lua" r] | |
set file_data [read $fp] | |
close $fp | |
set localsystems [split $file_data "\n"] | |
foreach systemdef $localsystems { | |
if {[lindex [split $systemdef ":"] 0] == "CustomSystem"} { | |
set parts_1 [split $systemdef ":"] | |
set parts_2 [split [lindex $parts_1 2] "("] | |
set parts_3a [split [lindex $parts_2 1] ","] | |
set parts_3b [split [lindex $parts_2 2] ","] | |
set sectorx [lindex $parts_3a 1] | |
set offsetx [lindex $parts_3b 1] | |
set sectorx [expr 0 - $sectorx] | |
# Crazy Tcl precision problems... | |
set offsetx [expr int((1 - $offsetx)*1000)/1000.0] | |
puts [join [lreplace $parts_1 2 2 [join [lreplace [lreplace $parts_2 2 2 [join [lreplace $parts_3b 1 1 $offsetx] ","]] 1 1 [join [lreplace $parts_3a 1 1 $sectorx] ","]] "("]] ":"] } {puts $systemdef} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment