"forum": "https://forums.uberent.com/threads/rel-cresources.65932/", "icon": "http://s2.postimg.org/6wie5qiyd/CResources.jpg", "category": [ "in-game", "shader", "colours", "particles", "effects", "buildings" ], "priority": 100 }""") patcher_mod_file = OrderedDict([ ('options', options), ('modinfo', modinfo), ('mod', patches) ]) # now store all these patches in a single file loader.dump(patcher_mod_file, 'mod.json', indent=2)
# changes you make must follow the smap schema and you will get a # SmapSchemaException if you try to write an invalid object. s.get_timeseries("/sensor0")['Metadata'] = \ {'Instrument' : { 'Manufacturer' : "Stephen Dawson-Haggerty" }, 'Extra' : { 'Sucks' : 'Andrew' } } s.get_collection("/")["Metadata"] = {"Extra" : {"foo" : "bar"} } # loader.dump(s, 'default.ini') else: s = loader.load('default.ini') loader.dump(s, 'foo.ini') counter = 0 def newreading(): global counter #print '-'*50 s.get_collection('/')['Metadata']['Location'] = {'Room' : counter} s.get_collection('/').dirty_children() for i in xrange(0, 1): # s.get_timeseries('/sensor0')._add(util.now(), counter) # s.get_timeseries('/sensor1')._add(counter) s._add('/sensor0', util.now(), counter) s._add('/sensor1', counter) counter += 1 # the default flush period is one second, so we'll just rely on that
# remove anything that isn't to do with fx_offsets (since those changes represent balance/configuration changes) diff = [op for op in diff if op['path'].startswith('/fx_offsets')] for op in diff: # here just to make things robust, we use the more generic version of 'add' to array if op['path'].startswith('/fx_offsets/'): # this path just means append to the end of the array # which means we are not relying on the number of fx that are already on a unit in PA's base game files # this makes the patch itself more robust op['path'] = '/fx_offsets/-' # store this patch loader.dump(OrderedDict([('target', unit_file), ('patch', diff)]), 'src/' + unit_file + '.patch', indent=2) patches.append({'from_file': unit_file + '.patch'}) options = loader.loads("""{ "output_dir" : "..", "pretty_print_effects" : true, "indent" : 2 }""") modinfo = loader.load("modinfo.json") patcher_mod_file = OrderedDict([('options', options), ('modinfo', modinfo), ('mod', patches)]) # now store all these patches in a single file
diff = patcher.from_diff(unit_base, unit_mod) # remove anything that isn't to do with fx_offsets (since those changes represent balance/configuration changes) diff = [op for op in diff if op['path'].startswith('/fx_offsets')] for op in diff: # here just to make things robust, we use the more generic version of 'add' to array if op['path'].startswith('/fx_offsets/'): # this path just means append to the end of the array # which means we are not relying on the number of fx that are already on a unit in PA's base game files # this makes the patch itself more robust op['path'] = '/fx_offsets/-' # store this patch loader.dump(OrderedDict([('target', unit_file),('patch', diff )]), 'src/' + unit_file + '.patch', indent=2) patches.append({'from_file' : unit_file + '.patch'}) options = loader.loads("""{ "output_dir" : "..", "pretty_print_effects" : true, "indent" : 2 }""") modinfo = loader.load("modinfo.json") patcher_mod_file = OrderedDict([ ('options', options), ('modinfo', modinfo), ('mod', patches) ])