def save_go_outlines(go_outlines: List[TerryRegion], entities: Element): for go_outline in go_outlines: entity = create_entity_node(entities) ECGoRegion = SubElement(entity, "ECGoRegion", {}) ectransform_to_xml(entity, go_outline.ectransform) ECTransform2D = SubElement(entity, "ECTransform2D", {}) ecpolyline_to_xml(entity, go_outline.polyline)
def save_decals_list(decals: List[TerryDecal], entities: Element): for terry_decal in decals: entity = create_entity_node(entities) ECDecal = SubElement( entity, "ECDecal", { "model_path": terry_decal.model_path, "parallax_scale": str(terry_decal.parallax_scale), "tiling": str(terry_decal.tiling), "normal_mode": terry_decal.normal_mode, "apply_to_terrain": s_bool(terry_decal.flags["apply_to_terrain"]), "apply_to_objects": s_bool(terry_decal.flags["apply_to_objects"]), "render_above_snow": s_bool(terry_decal.flags["render_above_snow"]), }) ecterrainclamp_to_xml(entity, terry_decal.ecterrainclamp) ectransform_to_xml(entity, terry_decal.ectransform) ecbattleproperties_to_xml(entity, terry_decal.ecbattleproperties) return entities
def save_point_light_list(point_lights: List[TerryPointLight], entities: Element): for point_light in point_lights: entity = create_entity_node(entities) ECPointLight = SubElement( entity, "ECPointLight", { "colour": str(point_light.colour.red) + " " + str(point_light.colour.green) + " " + str(point_light.colour.blue) + " " + "255", "colour_scale": s_float(point_light.colour_scale), "radius": s_float(point_light.radius), "animation_type": point_light.animation_type, "animation_speed_scale": " ".join(map(str, point_light.animation_speed_scale)), "colour_min": s_float(point_light.colour_min), "random_offset": s_float(point_light.random_offset), "falloff_type": point_light.falloff_type, "for_light_probes_only": s_bool(point_light.for_light_probes_only), }) ectransform_to_xml(entity, point_light.ectransform)
def save_spot_light_list(spot_lights: List[TerrySpotLight], entities: Element): for spot_light in spot_lights: entity = create_entity_node(entities) ECSpotLight = SubElement( entity, "ECSpotLight", { "colour": str(spot_light.colour.red) + " " + str(spot_light.colour.green) + " " + str(spot_light.colour.blue) + " " + str(spot_light.colour.alpha), "intensity": s_float(spot_light.intensity), "length": s_float(spot_light.length), "inner_angle": s_float(spot_light.inner_angle), "outer_angle": s_float(spot_light.outer_angle), "falloff": s_float(spot_light.falloff), "volumetric": s_bool(spot_light.volumetric), "gobo": spot_light.gobo, }) ectransform_to_xml(entity, spot_light.ectransform)
def save_river_list(terry_rivers: List[TerryRiver], entities: Element): for terry_river in terry_rivers: entity = create_entity_node(entities) ECRiver = SubElement(entity, "ECRiver", { }) ectransform_to_xml(entity, terry_river.ectransform) save_spline(entity, terry_river)
def save_non_terrain_outlines(non_terrain_outlines: List[TerryRegion], entities: Element): for non_terrain_outline in non_terrain_outlines: entity = create_entity_node(entities) ECNoGoRegion = SubElement(entity, "ECNoGoRegion", {}) ectransform_to_xml(entity, non_terrain_outline.ectransform) ECTransform2D = SubElement(entity, "ECTransform2D", {}) ecpolyline_to_xml(entity, non_terrain_outline.polyline)
def save_tree_list(trees: List[TerryTree], entities: Element): for tree in trees: entity = create_entity_node(entities) ECVegetation = SubElement(entity, "ECVegetation", { "key": tree.key, }) ectransform_to_xml(entity, tree.ectransform) ecterrainclamp_to_xml(entity, tree.ecterrainclamp)
def save_sound_shape_list(sound_shapes: List[TerrySoundShape], entities: Element): for sound_shape in sound_shapes: entity = create_entity_node(entities) ECSoundMarker = SubElement(entity, "ECSoundMarker", { "key": sound_shape.key, }) # sound_type_savers.get_reader(sound_shape.type)(sound_shape, entity) get_type_saver(sound_shape.type)(sound_shape, entity)
def save_building_projectile_emitter_list( building_projectile_emitters: List[TerryBuildingProjectileEmitter], entities: Element): for building_projectile_emitter in building_projectile_emitters: entity = create_entity_node(entities) ECBuildingProjectileEmitter = SubElement( entity, "ECBuildingProjectileEmitter", {}) ectransform_to_xml(entity, building_projectile_emitter.ectransform)
def save_composite_scene_list(composite_scenes: List[TerryCompositeScene], entities: Element): for composite_scene in composite_scenes: entity = create_entity_node(entities) ECCompositeScene = SubElement( entity, "ECCompositeScene", { "path": composite_scene.path, "autoplay": s_bool(composite_scene.autoplay), }) ectransform_to_xml(entity, composite_scene.ectransform)
def save_prefab_instance_list(prefab_instances: List[TerryPrefabInstance], entities: Element): for prefab_instance in prefab_instances: entity = create_entity_node(entities) ECPrefab = SubElement(entity, "ECPrefab", { "key": str(prefab_instance.key), }) ecterrainclamp_to_xml(entity, prefab_instance.ecterrainclamp) ectransform_to_xml(entity, prefab_instance.ectransform) return entities
def save_light_probe_list(light_probes: List[TerryLightProbe], entities: Element): for light_probe in light_probes: entity = create_entity_node(entities) ECLightProbe = SubElement(entity, "ECLightProbe", { "primary": s_bool(light_probe.is_primary), }) ectransform_to_xml(entity, light_probe.ectransform) ECSphere = SubElement(entity, "ECSphere", { "radius": str(light_probe.radius), })
def save_zone_template_list(zone_templates: List[TerryZoneTemplate], entities: Element): for zone_template in zone_templates: entity = create_entity_node(entities) ECBattlefieldZone = SubElement(entity, "ECBattlefieldZone", { }) ECTerryBattlefieldZone = SubElement(entity, "ECTerryBattlefieldZone", { "locked": s_bool(zone_template.locked), "rank_distance": s_float(zone_template.rank_distance), "zone_skirt_distance": s_float(zone_template.zone_skirt_distance), }) ectransform_to_xml(entity, zone_template.ectransform) ECTransform2D = SubElement(entity, "ECTransform2D", { }) ecpolyline_to_xml(entity, zone_template.polyline)
def save_playable_area(playable_area: TerryPlayableArea, entities: Element): entity = create_entity_node(entities) ECPlayableArea = SubElement(entity, "ECPlayableArea", {}) ECPlayerDeploymentLocations = SubElement( entity, "ECPlayerDeploymentLocations", { "deployment_locations": ",".join(map(str, playable_area.deployment_locations)), }) ectransform_to_xml(entity, playable_area.ectransform) ECTransform2D = SubElement(entity, "ECTransform2D", {}) ECRectangle = SubElement(entity, "ECRectangle", { "width": str(playable_area.width), "height": str(playable_area.height), })
def save_particles_list(particles: List[TerryParticle], entities: Element): for terry_particle in particles: # terry_particle = convert_particle(particle) entity = create_entity_node(entities) ECVFX = SubElement(entity, "ECVFX", { "vfx": terry_particle.vfx, "autoplay": "true", "scale": "1", "instance_name": "", }) ecterrainclamp_to_xml(entity, terry_particle.ecterrainclamp) ectransform_to_xml(entity, terry_particle.ectransform) ecbattleproperties_to_xml(entity, terry_particle.ecbattleproperties) return entities
def save_prop_buildings_list(prop_buildings: List[TerryPropBuilding], entities: Element): for prop_building in prop_buildings: entity = create_entity_node(entities) ECPropMesh = SubElement(entity, "ECPropMesh") ECMesh = SubElement( entity, "ECMesh", { "model_path": prop_building.model_path, "animation_path": "", "opacity": "1", }) ecterrainclamp_to_xml(entity, prop_building.ecterrainclamp) ectransform_to_xml(entity, prop_building.ectransform) ecbattleproperties_to_xml(entity, prop_building.ecbattleproperties) return entities
def save_custom_material_mesh_list( custom_material_meshes: List[TerryCustomMaterialMesh], entities: Element): for mesh in custom_material_meshes: entity = create_entity_node(entities) ECPolygonMesh = SubElement(entity, "ECPolygonMesh", { "material": mesh.material, "affects_protection_map": "false", }) ectransform_to_xml(entity, mesh.ectransform) ECPolyline = SubElement(entity, "ECPolyline", {}) polyline = SubElement(ECPolyline, "polyline", {"closed": "true"}) for i in mesh.polyline: point = SubElement(polyline, "point", { "x": s_float(i.x), "y": s_float(i.y), })
def save_buildings_list(buildings: List[TerryBuilding], entities: Element): for building in buildings: entity = create_entity_node(entities) ECBuilding = SubElement( entity, "ECBuilding", { "key": building.key, "damage": str(building.damage), "indestructible": s_bool(building.flags["indestructible"]), "toggleable": s_bool(building.flags["toggleable"]), "capture_location": "", "export_as_prop": s_bool(building.flags["export_as_prop"]), "allow_in_outfield_as_prop": s_bool(building.flags["allow_in_outfield_as_prop"]), }) ecmeshrendersettings_to_xml(entity, building.ecmeshrendersettings) ectransform_to_xml(entity, building.ectransform) ecterrainclamp_to_xml(entity, building.ecterrainclamp)