Changeset 9282 for code/branches
- Timestamp:
- Jun 9, 2012, 4:42:19 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/data/gui/scripts/ShipSelectionMenu.lua
r9281 r9282 6 6 P.shipList = {} 7 7 function P.onLoad() 8 local dircmd = "ls -l ../levels/templates/ | awk '{print $9}' | grep \"spaceship\" | sed -e 's/\\.[a-zA-Z]*$//'" -- go to spaceships folder and generate a list of installed shipmodels. 9 os.execute(dircmd .. " > ../levels/templates/.shipmodels") --saves output in a textfile 10 --[[TODO: program a Windows Version / platform independent version here: 11 if string.sub(package.config,1,1) == '\\' then 12 -- Windows 13 dircmd = "dir /b/s" 14 end]] 15 P.createFilterTab("All Ships") 8 orxonox.execute("set shipmodelsfile [open {../levels/templates/.shipmodels} w+]") 9 orxonox.execute("foreach line [glob -directory ../levels/templates/ spaceship*] { regexp {.*/(.*)\\..*} $line matchall match1; puts $shipmodelsfile $match1 }") 10 orxonox.execute("close $shipmodelsfile") 11 P.createFilterTab("All Ships") 16 12 end 17 13 18 14 function P.createShipList() --generates list with tagged shipmodels 19 P.shipList = {} 20 for line in io.lines("../levels/templates/.shipmodels") do --checks if shipmodel is included in level file 21 if selectedlevel:hasStartingShip(string.lower(line)) then 22 P.shipList[#P.shipList+1] = string.lower(line) 15 P.shipList = {} 16 file = io.open("../levels/templates/.shipmodels") 17 if file ~= nil then 18 for line in file:lines() do --checks if shipmodel is included in level file 19 if selectedlevel:hasStartingShip(string.lower(line)) then 20 P.shipList[#P.shipList+1] = string.lower(line) 21 end 22 end 23 --file.close() -- TODO: investigate why close() seems to crash? 23 24 end 24 end25 25 end 26 26
Note: See TracChangeset
for help on using the changeset viewer.