Exemple #1
0
 def load(cls, gas_file: GasFile) -> DecalsGas:
     decals_section = gas_file.get_gas().get_section('decals')
     decals = [
         Decal.from_gas(decal_section)
         for decal_section in decals_section.get_sections('t:decal,n:*')
     ]
     return DecalsGas(decals)
Exemple #2
0
 def load(cls, gas_file: GasFile):
     gas = gas_file.get_gas()
     shd_section = gas.get_section('stitch_helper_data')
     srg = shd_section.get_attr_value('source_region_guid')
     srn = shd_section.get_attr_value('source_region_name')
     ses = list()
     stitch_editor_sections = shd_section.get_sections()
     for se_section in stitch_editor_sections:
         dest_region = se_section.get_attr_value('dest_region')
         assert se_section.header == f't:stitch_editor,n:{dest_region}'
         node_ids = dict()
         node_id_attrs = se_section.get_section('node_ids').get_attrs()
         for ni_attr in node_id_attrs:
             stitch_id = ni_attr.name
             node_guid, door = ni_attr.value.split(',')
             node_ids[stitch_id] = (node_guid, door)
         se = StitchEditor(dest_region, node_ids)
         ses.append(se)
     stitch_helper_gas = StitchHelperGas(srg, srn, ses)
     return stitch_helper_gas
Exemple #3
0
def load_plant_profile_gas(gas_file_path):
    plant_distributions = []
    gas_file = GasFile(gas_file_path)
    gas = gas_file.get_gas()
    ppp_section = gas.get_section('perlin_plant_profile')
    seed_default = ppp_section.get_attr_value('seed')
    templates_default = ppp_section.get_attr_value('templates')
    size_default = ppp_section.get_attr_value('size')
    for distro_section in ppp_section.get_sections('*'):
        seed = distro_section.get_attr_value('seed') or seed_default
        templates = distro_section.get_attr_value(
            'templates') or templates_default
        size = distro_section.get_attr_value('size') or size_default
        seed_factor, perlin_offset, perlin_spread = [
            float(x) for x in seed.split(',')
        ]
        plant_templates = templates.split()
        size = [float(s) for s in size.split()] if size else None
        distro = PerlinPlantDistribution(perlin_offset, perlin_spread,
                                         seed_factor, plant_templates, size)
        plant_distributions.append(distro)
    return PerlinPlantProfile(plant_distributions)
Exemple #4
0
    def load(cls, gas_file: GasFile):
        gas = gas_file.get_gas()
        siege_node_list = gas.get_section('t:terrain_nodes,n:siege_node_list')
        nodes_gas = NodesGas()

        # attributes
        nodes_gas.ambient_color = siege_node_list.get_attr_value('ambient_color')
        nodes_gas.ambient_intensity = siege_node_list.get_attr_value('ambient_intensity')
        nodes_gas.object_ambient_color = siege_node_list.get_attr_value('object_ambient_color')
        nodes_gas.object_ambient_intensity = siege_node_list.get_attr_value('object_ambient_intensity')
        nodes_gas.actor_ambient_color = siege_node_list.get_attr_value('actor_ambient_color')
        nodes_gas.actor_ambient_intensity = siege_node_list.get_attr_value('actor_ambient_intensity')
        nodes_gas.targetnode = siege_node_list.get_attr_value('targetnode')

        node_sections = siege_node_list.get_sections()
        nodes = list()
        for node_section in node_sections:
            guid = node_section.get_attr_value('guid')
            mesh_guid = node_section.get_attr_value('mesh_guid')
            texsetabbr = node_section.get_attr_value('texsetabbr')
            bounds_camera = node_section.get_attr_value('bounds_camera')
            camera_fade = node_section.get_attr_value('camera_fade')
            occludes_camera = node_section.get_attr_value('occludes_camera')
            occludes_light = node_section.get_attr_value('occludes_light')
            nodesection = node_section.get_attr_value('nodesection')
            nodelevel = node_section.get_attr_value('nodelevel')
            nodeobject = node_section.get_attr_value('nodeobject')
            snode = SNode(guid, mesh_guid, texsetabbr, bounds_camera, camera_fade, occludes_camera, occludes_light, nodesection, nodelevel, nodeobject)
            nodes.append(snode)
            snode.doors = list()
            door_sections = node_section.get_sections('door*')
            for door_section in door_sections:
                id = door_section.get_attr_value('id')
                farguid = door_section.get_attr_value('farguid')
                fardoor = door_section.get_attr_value('fardoor')
                snode.doors.append(Door(id, farguid, fardoor))
        nodes_gas.nodes = nodes

        return nodes_gas