예제 #1
0
In general, you will use the other script to update the mod NOT THIS SCRIPT. This script is a one-time use only dealio

"""

import sys
sys.path.append("../pa_tools")


import loader
from collections import OrderedDict
import patcher
import utils
import os

# get base pa directory
base_path = utils.pa_media_dir()
# the directory where the mod files are (right here in this case xD)
mod_path = '.'

# get the unit list file dir
unit_list_path = os.path.join(base_path, "pa/units/unit_list.json")

# unit list files for comparing
unit_list = loader.load(unit_list_path)

patches = []

# iterate over all the units
for unit_file in unit_list['units']:
    # get rid of the extra slash at the start so that path join works
    unit_file = unit_file[1:]
예제 #2
0
def run():
    pa_base = utils.pa_media_dir()


    t1_sub_path = "pa/units/sea/attack_sub/attack_sub.json"
    t2_sub_path = "pa/units/sea/nuclear_sub/nuclear_sub.json"


    trail_offsets = {}
    trail_offsets['attack_sub'] = (0, 8, 0)
    trail_offsets['nuclear_sub'] = (0, 17.5, -2)

    

    units = [t1_sub_path, t2_sub_path]

    patches = []

    for boat_path in units:

        boat = loader.load(os.path.join(pa_base, boat_path))

        boat_name = os.path.splitext(os.path.basename(boat_path))[0]


        offset_x = []
        offset_z = []

        bounds = boat.get('mesh_bounds', [0, 0, 0])

        print (boat_name, bounds)

        trail = base_spiral_trail()

        for bubble_spiral in trail['emitters']:
            time_end = float(bubble_spiral['emitterLifetime'])
            rate = float(bubble_spiral['emissionRate'])

            bubble_spiral['offsetX'] = {'keys': [], "stepped" : True}
            bubble_spiral['offsetZ'] = {'keys': [], "stepped" : True}

            steps = int(time_end * rate)

            coils = 4

            radius = bounds[0] / 4.5

            for j in range(steps):
                o = j % 2

                d = 1

                a = float(j) / steps
                bubble_spiral['offsetX']['keys'].append([time_end * a, radius * math.cos(o * math.pi + d * a * math.pi * 2 * coils)])
                bubble_spiral['offsetZ']['keys'].append([time_end * a, radius * math.sin(o * math.pi + d * a * math.pi * 2 * coils)])

            #bubble_spiral['gravity'] = 1
            bubble_spiral['velocity'] = float(boat['navigation']['move_speed']) / 2

            bubble_spiral['velocityY'] = 1
            bubble_spiral['velocityZ'] = 0.25

            bubble_spiral['drag'] = 0.9887
        patches.append(loader.loads('''{
            "target" : "/base/wake_trail.pfx",
            "destination" : "/mod/sea/''' + boat_name + '''/trail.pfx",
            "patch" : [
                {"op" : "replace", "path" : "", "value" : ''' + loader.dumps(trail) + '''}
            ]
        }'''))
        patches.append(loader.loads('''{
            "target" : "/pa/effects/specs/default_explosion.pfx",
            "destination" : "/mod/sea/''' + boat_name + '''/death.pfx",
            "patch" : [
                {"op" : "replace", "path" : "/emitters", "value" : ''' + loader.dumps(sub_explosion(boat_name, boat), indent=2) + '''}
            ]
        }'''))
        patches.append(loader.loads('''{
            "target" : "/''' + boat_path + '''",
            "patch" : [
                {"op" : "add", "path" : "/fx_offsets", "value" : [
                    {
                        "type" : "moving",
                        "bone" : "bone_root",
                        "filename" : "/mod/sea/''' + boat_name + '''/trail.pfx",
                        "offset" : ''' + loader.dumps(trail_offsets.get(boat_name, [0, bounds[1]/2, 0])) + '''
                    }
                ]
                },
                {"op" : "add", "path" : "/events/died/effect_spec", "value" : "/mod/sea/''' + boat_name + '''/death.pfx"},
                {"op" : "add", "path" : "/events/died/effect_scale", "value" : 1}
            ]
        }'''))

    # print(loader.dumps(patches))

    return patches
예제 #3
0
- it's only here for reference sake in terms of how I made the patch file.
RUN ./update.py INSTEAD
"""

import sys

sys.path.append("../pa_tools")

import loader
from collections import OrderedDict
import patcher
import utils
import os

# get base pa directory
base_path = utils.pa_media_dir()
# the directory where the mod files are (right here in this case xD)
mod_path = '.'

# get the unit list file dir
unit_list_path = os.path.join(base_path, "pa/units/unit_list.json")

# unit list files for comparing
unit_list = loader.load(unit_list_path)

patches = []

# iterate over all the units
for unit_file in unit_list['units']:
    # get rid of the extra slash at the start so that path join works
    unit_file = unit_file[1:]
import loader
import pajson
import utils
import os
import copy

PREFER_EX1 = True
PA_MEDIA_DIR = utils.pa_media_dir()
BACKUP_DIR = os.path.join(PA_MEDIA_DIR, "../_media")

base_dot = pajson.loadf("dot.json")

dot_small = copy.deepcopy(base_dot)
dot_small["sizeX"] = 1

dot_medium = copy.deepcopy(base_dot)
dot_medium["sizeX"] = 2

dot_large = copy.deepcopy(base_dot)
dot_large["sizeX"] = 3

dot_huge = copy.deepcopy(base_dot)
dot_huge["sizeX"] = 4

dots = {"small": dot_small, "medium": dot_medium, "large": dot_large, "huge": dot_huge}
# get all the units
#  - get each weapon on the unit
#  - get each ammo type
#  		- use damage to decide dot size
#         (small, medium, large)