(planet_name)
| 61 | |
| 62 | |
| 63 | def get_complete_location_data(planet_name): |
| 64 | try: |
| 65 | if not config.is_initialized: |
| 66 | if not config.initialize(): |
| 67 | return {"error": "Failed to initialize config"} |
| 68 | |
| 69 | constants = PhysicalConstants() |
| 70 | universe = Universe(config.seed, constants) |
| 71 | |
| 72 | galaxy_data = session.get("galaxy") |
| 73 | system_index = session.get("system") |
| 74 | |
| 75 | if not galaxy_data or system_index is None: |
| 76 | return {"error": "No galaxy or system data in session"} |
| 77 | galaxy = universe.get_galaxy(*galaxy_data["coordinates"]) |
| 78 | system = galaxy.get_solar_system(system_index) |
| 79 | planet = None |
| 80 | planet_index = None |
| 81 | planet_name_lower = planet_name.lower() |
| 82 | |
| 83 | for index, planet_obj in system.planets.items(): |
| 84 | if planet_obj.name.lower() == planet_name_lower: |
| 85 | planet = planet_obj |
| 86 | planet_index = index |
| 87 | break |
| 88 | |
| 89 | if planet is None: |
| 90 | return {"error": f"Planet {planet_name} not found in system"} |
| 91 | |
| 92 | seedmaster_values = {} |
| 93 | for i in range(1, 13): |
| 94 | seedmaster_values[f"seedmaster_{i}"] = seedmaster(i) |
| 95 | |
| 96 | system_planets = [] |
| 97 | for idx, planet_obj in system.planets.items(): |
| 98 | system_planets.append({"index": idx, "name": planet_obj.name, "planet_type": planet_obj.planet_type, "has_rings": planet_obj.planet_rings}) |
| 99 | |
| 100 | ring_decision_seed = planet.generate_planet_seed() |
| 101 | |
| 102 | ring_data = generate_ring_data(planet) |
| 103 | |
| 104 | return { |
| 105 | "success": True, |
| 106 | "universe": {"config_seed": config.seed, "cosmic_origin_time": config.cosmic_origin_time}, |
| 107 | "galaxy": {"name": galaxy.name, "coordinates": galaxy.coordinates, "seed": galaxy.seed, "galaxy_type": galaxy.galaxy_type, "num_systems": galaxy.num_systems}, |
| 108 | "system": {"name": system.name, "index": system.index, "seed": system.seed, "num_planets": system.num_planets, "star_system_type": system.star_system_type, "planets": system_planets}, |
| 109 | "planet": {"name": planet.name, "index": planet_index, "seed": planet.seed, "planet_type": planet.planet_type, "atmosphere": planet.atmosphere, "life_forms": planet.life_forms, "has_rings": planet.planet_rings, "diameter": planet.diameter, "density": planet.density, "gravity": planet.gravity, "mass": planet.mass, "orbital_radius": planet.orbital_radius, "orbital_radius_m": planet.orbital_radius_m, "orbital_period_seconds": planet.orbital_period_seconds, "orbital_speed": planet.orbital_speed, "rotation_period_seconds": planet.rotation_period_seconds, "surface_temperature": planet.surface_temperature, "mean_temperature": planet.mean_temperature, "atmosphere_factor": planet.atmosphere_factor, "axial_tilt": planet.axial_tilt, "elements": planet.elements, "initial_angle_rotation": planet.initial_angle_rotation, "initial_orbital_angle": planet.initial_orbital_angle}, |
| 110 | "rings": ring_data, |
| 111 | "seeds": {"config_seed": config.seed, "galaxy_seed": galaxy.seed, "system_seed": system.seed, "planet_seed": planet.seed, "ring_decision_seed": ring_decision_seed}, |
| 112 | "seedmaster_values": seedmaster_values, |
| 113 | "debug": {"galaxy_coordinates_str": f"{galaxy.coordinates[0]},{galaxy.coordinates[1]},{galaxy.coordinates[2]}", "system_name_lower": system.name.lower(), "planet_name_lower": planet.name.lower(), "planet_name_spaced": planet.name.replace("_", " ")}, |
| 114 | } |
| 115 | |
| 116 | except Exception as e: |
| 117 | import traceback |
| 118 | |
| 119 | return {"error": f"Error generating location data: {str(e)}", "traceback": traceback.format_exc()} |
| 120 |
no test coverage detected