Advertisement
Guest User

Untitled

a guest
Aug 13th, 2013
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. from pywmo import Wmo
  3.  
  4. wmo_name = input('Enter WMO Filename : ');
  5. building = Wmo(wmo_name);
  6.  
  7. nLight = building.num_lights;
  8.  
  9. print("There are " + str(nLight) + " lights in this WMO.");
  10.  
  11. while(1):
  12.     command = input("What do you want to do ?\n\"a\" - Add a light\n\"i\" - Get informations about a light\n\"q\" - Exit\n")
  13.    
  14.     if(command == "q"):
  15.        
  16.         while(1):
  17.             save = input("Do you want to save (yes/no) ? ")
  18.            
  19.             if save.upper() == "YES":
  20.                 print("Saving file")
  21.                 building.write_file("./output/" + wmo_name)
  22.                 break;
  23.             elif save.upper() == "NO":
  24.                 print("Exiting without saving")
  25.                 break;
  26.             else:
  27.                 print("You have to write \"yes\" or \"no\"");
  28.                
  29.         print("See ya later"); 
  30.         sys.exit();
  31.     elif(command == "a"):
  32.         print("Light definition")
  33.        
  34.         light = { }
  35.        
  36.         light["flag1"] = int(input("LightType : "))
  37.         light["flag2"] = int(input("type : "))
  38.         light["flag3"] = int(input("useAtten : "))
  39.         light["flag4"] = int(input("pad : "))
  40.        
  41.         light["color"] = (float(input("R : ")), float(input("G : ")), float(input("B : ")), float(input("A : ")))
  42.         light["position"] = (float(input("X : ")), float(input("Y : ")), float(input("Z : ")))
  43.        
  44.         light["intensity"] = float(input("intensity : "))
  45.        
  46.         light["attenuation_start"] = float(input("attenuation_start : "))
  47.         light["attenuation_stop"] = float(input("attenuation_stop : "))
  48.        
  49.         light["unknown1"] = float(input("Unknown 1 : "))
  50.         light["unknown2"] = float(input("Unknown 2 : "))
  51.         light["unknown3"] = float(input("Unknown 3 : "))
  52.         light["unknown4"] = float(input("Unknown 4 : "))
  53.        
  54.         building.num_lights += 1;
  55.         building.lights.append(light);
  56.            
  57.         print("There are " + str(len(building.groups)) + " groups")
  58.        
  59.         while(1):
  60.             group = input("In which group do you want to reference that light ( type \"s\" to return the main menu ) ? ")
  61.            
  62.             if(group == "s"):
  63.                 break;
  64.            
  65.             group = int(group)
  66.            
  67.             if(group >= 0 and group < len(building.groups)):
  68.            
  69.                 if not building.groups[group].flags & 0x200:
  70.                     building.groups[group].flags &= 0x200
  71.                     building.groups[group].light_refs = []
  72.                    
  73.                 building.groups[group].light_refs.append(building.num_lights)
  74.                 print("Light ref added to group " + str(group))
  75.             else:
  76.                 print("Bad group.")
  77.        
  78.        
  79.         print("Light succefully added. There are now " + str(building.num_lights) + " lights.")
  80.        
  81.        
  82.     else:
  83.         print("Unknown command")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement