def font(df, variety='24x24'): # Copy over the font image mapfile = 'gemset_map.png' df.add(path=pydwarf.rel(gemset_dir, 'data/art/', variety, mapfile), loc='data/art', kind=raws.reffile) # Copy over the curses image cursesfile = 'gemset_curses_%s.png' % curses_resolutions.get(variety) df.add(path=pydwarf.rel(gemset_dir, 'data/art/', variety, cursesfile), loc='data/art', kind=raws.reffile) # Adjust init.txt settings accordingly init = df['data/init/init.txt'].raw() init.set(value='FONT', arg=cursesfile) init.set(value='FULLFONT', arg=cursesfile) init.set('GRAPHICS:YES') init.set(value='GRAPHICS_FONT', arg=mapfile) init.set(value='GRAPHICS_FULLFONT', arg=mapfile) init.set('PRINT_MODE:TWBT') init.set('BLACK_SPACE:YES') init.set('TRUETYPE:NO') # All done return pydwarf.success()
def font(df, variety='24x24'): # Copy over the font image mapfile = 'gemset_map.png' df.add( path = pydwarf.rel(gemset_dir, 'data/art/', variety, mapfile), loc = 'data/art', kind = raws.reffile ) # Copy over the curses image cursesfile = 'gemset_curses_%s.png' % curses_resolutions.get(variety) df.add( path = pydwarf.rel(gemset_dir, 'data/art/', variety, cursesfile), loc = 'data/art', kind = raws.reffile ) # Adjust init.txt settings accordingly init = df['data/init/init.txt'].raw() init.set(value='FONT', arg=cursesfile) init.set(value='FULLFONT', arg=cursesfile) init.set('GRAPHICS:YES') init.set(value='GRAPHICS_FONT', arg=mapfile) init.set(value='GRAPHICS_FULLFONT', arg=mapfile) init.set('PRINT_MODE:TWBT') init.set('BLACK_SPACE:YES') init.set('TRUETYPE:NO') # All done return pydwarf.success()
def deterioratefood(df, auto_run=True): return pydwarf.urist.getfn('pineapple.utils.addhack')( df, auto_run='deterioratefood start' if auto_run is True else auto_run, loc='hack/scripts', path=pydwarf.rel(decay_dir, 'deterioratefood.rb'), kind=raws.reffile)
def starvingdead(df, start=1, die=3, auto_run=True): return pydwarf.urist.getfn('pineapple.utils.addhack')( df, auto_run='starvingdead start %d %d' % (start, die) if auto_run is True else auto_run, loc='hack/scripts', path=pydwarf.rel(decay_dir, 'starvingdead.rb'), kind=raws.reffile)
def twbt(df, variety='24x24'): # Copy over the overrides.txt file df.add(path=pydwarf.rel(gemset_dir, 'data/init/overrides.txt'), loc='data/init', kind=raws.reffile, replace=True) # Copy over the image files for overridefile in override_files: df.add(path=pydwarf.rel(gemset_dir, 'data/art/', variety, overridefile), loc='data/art', kind=raws.reffile, replace=True) # All done return pydwarf.success()
def art(df, variety='24x24'): # Copy over image files for artfile in art_files: df.add(path=pydwarf.rel(gemset_dir, 'data/art', variety, artfile), loc='data/art', replace=True, kind=raws.reffile) # All done return pydwarf.success()
def twbt(df, variety='24x24'): # Copy over the overrides.txt file df.add( path = pydwarf.rel(gemset_dir, 'data/init/overrides.txt'), loc = 'data/init', kind = raws.reffile, replace = True ) # Copy over the image files for overridefile in override_files: df.add( path = pydwarf.rel(gemset_dir, 'data/art/', variety, overridefile), loc = 'data/art', kind = raws.reffile, replace = True ) # All done return pydwarf.success()
def art(df, variety='24x24'): # Copy over image files for artfile in art_files: df.add( path = pydwarf.rel(gemset_dir, 'data/art', variety, artfile), loc = 'data/art', replace = True, kind = raws.reffile ) # All done return pydwarf.success()
def graphics(df, variety='24x24', remove_example=True): # Remove example file if it still exists examplepath = 'raw/graphics/graphics_example.txt' if remove_example and examplepath in df: df.remove(examplepath) # Copy over image and graphics files df.add(path=pydwarf.rel(gemset_dir, 'raw/graphics', variety), loc='raw/graphics', replace=True) # All done return pydwarf.success()
def graphics(df, variety='24x24', remove_example=True): # Remove example file if it still exists examplepath = 'raw/graphics/graphics_example.txt' if remove_example and examplepath in df: df.remove(examplepath) # Copy over image and graphics files df.add( path = pydwarf.rel(gemset_dir, 'raw/graphics', variety), loc = 'raw/graphics', replace = True ) # All done return pydwarf.success()
import pydwarf reduce_dir = pydwarf.rel(__file__, 'raw/microreduce') default_entities = 'MOUNTAIN' @pydwarf.urist( name = 'putnam.microreduce', version = '1.0.1', author = ('Putnam', 'Sophie Kirschner'), description = 'A mod to reduce the amount of micromanagement in Dwarf Fortress. One-step soap making and clothesmaking!', compatibility = pydwarf.df_0_40 ) def microreduce(df, entities=default_entities): return pydwarf.urist.getfn('pineapple.easypatch')( df, files = reduce_dir, loc = 'raw/objects', permit_entities = entities )
import pydwarf import raws threats_path = pydwarf.rel(__file__, 'data/smallthings/threat.txt') nofamily_path = pydwarf.rel(__file__, 'data/smallthings/no_family.txt') small_dir = pydwarf.rel(__file__, 'raw/smallthings') # A bit of esoteric code which makes smallraws only be read once def getsmallraws(): if 'smallraws' not in globals(): globals()['smallraws'] = raws.dir(root=small_dir, log=pydwarf.log) return smallraws # Help shapes get mapped to words shapenamedict = { 'ELF': 'FOREST', 'DWARF': 'MOUNTAIN', 'HUMAN': 'PLAIN', 'MALE': 'MAN', 'FEMALE': 'WOMAN', 'OVERSEER': 'STAND', 'MESSAGE': 'PAPER', 'BADLAND': 'SAVAGE', 'PARTY': 'CELEBRATE', 'WATERFALL': 'WATER',
import pydwarf creation_dir = pydwarf.rel(__file__, 'raw/creationforge') default_entities = ('MOUNTAIN', ) @pydwarf.urist( name='shukaro.creationforge', version='1.0.1', author=('Shukaro', 'Sophie Kirschner'), description= '''This is a simple workshop I modded in to help test custom reactions, buildings, and creatures. It's used to create various different items so that you don't have to set up an entire fortress to test some reactions. Hopefully it's a useful tool to people, even if it's just to look at the raw formatting. ''', compatibility=(pydwarf.df_0_40, pydwarf.df_0_3x)) def creationforge(df, entities=default_entities): return pydwarf.urist.getfn('pineapple.easypatch')(df, files=creation_dir, loc='raw/objects', permit_entities=entities)
import pydwarf import raws import json gemset_dir = pydwarf.rel(__file__, 'gemset') properties_path = pydwarf.rel(__file__, 'gemsetproperties.json') @pydwarf.urist( name='dragondeplatino.gemset.full', version='1.0.0', author=('DragonDePlatino', 'Sophie Kirschner'), description=''' Performs a full installation, and this is probably what you want to run. ''', arguments={ 'variety': '''Which tileset to use. Should be either '24x24' or '48x48'.''', 'properties': '''File path to indicate where to find the json outputted by the gemsetproperties.py utility script.''' }, compatibility=pydwarf.df_0_40) def full(df, variety='24x24', properties=properties_path): pydwarf.log.info('Running dragondeplatino.gemset.twbt.') response = twbt(df, variety) if not response: return response pydwarf.log.info('Running dragondeplatino.gemset.graphics.') response = graphics(df, variety) if not response: return response
import pydwarf import raws threats_path = pydwarf.rel(__file__, 'data/smallthings/threat.txt') nofamily_path = pydwarf.rel(__file__, 'data/smallthings/no_family.txt') small_dir = pydwarf.rel(__file__, 'raw/smallthings') # A bit of esoteric code which makes smallraws only be read once def getsmallraws(): if 'smallraws' not in globals(): globals()['smallraws'] = raws.dir(root=small_dir, log=pydwarf.log) return smallraws # Help shapes get mapped to words shapenamedict = { 'ELF': 'FOREST', 'DWARF': 'MOUNTAIN', 'HUMAN': 'PLAIN', 'MALE': 'MAN', 'FEMALE': 'WOMAN', 'OVERSEER': 'STAND', 'MESSAGE': 'PAPER', 'BADLAND': 'SAVAGE', 'PARTY': 'CELEBRATE', 'WATERFALL': 'WATER', 'SKIRMISH': 'WAR', 'HUNTER': 'BOW', 'RETREAT': 'DEN', 'STRONGHOLD': 'FORTRESS',
import pydwarf import raws greendir = pydwarf.rel(__file__, 'raw/greensteel') default_entities = 'MOUNTAIN' @pydwarf.urist( name = 'pineapple.greensteel', version = '1.0.1', author = 'Sophie Kirschner', description = '''Adds an alloy which is lighter and sharper than steel but not so much as adamantine. It can be made from similar ingredients as steel with the addition of adamantine bars or a new adamant ore.''', arguments = { 'entities': '''The entities which should be permitted this reaction. Defaults to only MOUNTAIN.''' }, compatibility = (pydwarf.df_0_3x, pydwarf.df_0_40) ) def greensteel(df, entities=default_entities): # Add greensteel raws return pydwarf.urist.getfn('pineapple.easypatch')( df, files = greendir, loc = 'raw/objects', permit_entities = entities
import pydwarf import raws greendir = pydwarf.rel(__file__, 'raw/greensteel') default_entities = 'MOUNTAIN' @pydwarf.urist( name='pineapple.greensteel', title='Green Steel Alloy', version='1.0.1', author='Sophie Kirschner', description='''Adds an alloy which is lighter and sharper than steel but not so much as adamantine. It can be made from similar ingredients as steel with the addition of adamantine bars or a new adamant ore.''', arguments={ 'entities': '''The entities which should be permitted this reaction. Defaults to only MOUNTAIN.''' }, compatibility=(pydwarf.df_0_3x, pydwarf.df_0_40)) def greensteel(df, entities=default_entities): # Add greensteel raws return pydwarf.urist.getfn('pineapple.easypatch')(df, files=greendir, loc='raw/objects', permit_entities=entities)
import pydwarf import raws toolsdir = pydwarf.rel(__file__, 'raw/tools') @pydwarf.urist( name = 'pineapple.tools.dagger', title = 'Add Dagger', version = '1.0.0', author = 'Sophie Kirschner', description = '''Adds daggers, which are smaller and less lethal than short swords, and may be held as tools by civilians. They can be made from one unit of metal, stone, or ceramics.''', arguments = { 'entities': '''The entities which should be allowed to produce daggers. Defaults to all entities.''' } ) def dagger(df, entities='*'): return pydwarf.scripts.pineapple.easypatch( df, files = toolsdir + '/item_weapon_dagger_pineapple.txt', loc = 'raw/objects', permit_entities = entities ) @pydwarf.urist(
import pydwarf library_dir = pydwarf.rel(__file__, 'raw/higherlearning') default_entities = 'MOUNTAIN' librarian_position = ''' [POSITION:LIBRARIAN] [NAME:librarian:librarians] [SITE] [NUMBER:1] [RESPONSIBILITY:MEET_WORKERS] [APPOINTED_BY:EXPEDITION_LEADER] [APPOINTED_BY:MAYOR] [PRECEDENCE:180] [DO_NOT_CULL] [COLOR:5:0:0] [DUTY_BOUND] [REQUIRED_BEDROOM:1] [REQUIRED_OFFICE:1] ''' @pydwarf.urist( name='shukaro.higherlearning', version='1.0.1', author=('Shukaro', 'Sophie Kirschner'), description= '''Have you ever wondered to yourself, "Man, my dwarves are such idiots, I wish I could chisel some intelligence into their heads."? No? Then, er, disregard that last bit. What I present to you, here and now, no strings attached, is a workshop
import pydwarf reduce_dir = pydwarf.rel(__file__, 'raw/microreduce') default_entities = 'MOUNTAIN' @pydwarf.urist( name='putnam.microreduce', version='1.0.1', author=('Putnam', 'Sophie Kirschner'), description= 'A mod to reduce the amount of micromanagement in Dwarf Fortress. One-step soap making and clothesmaking!', compatibility=pydwarf.df_0_40) def microreduce(df, entities=default_entities): return pydwarf.urist.getfn('pineapple.easypatch')(df, files=reduce_dir, loc='raw/objects', permit_entities=entities)
import os import json import pydwarf import raws # Armoury raws are located in this directory entities_json = pydwarf.rel(__file__, 'armouryentities.json') armoury_dir = pydwarf.rel(__file__, 'raw/armoury') # Armory raws are variations on vanilla names, this records them so they can be changed back. # Without this, other mods which attempt to make changes to the same items might run into problems. weird_armoury_names = { 'ITEM_AMMO_ARROWS_WAR': 'ITEM_AMMO_ARROWS', 'ITEM_ARMOR_JERKIN': 'ITEM_ARMOR_LEATHER', 'ITEM_ARMOR_PLATE': 'ITEM_ARMOR_BREASTPLATE', 'ITEM_SHOES_SANDALS': 'ITEM_SHOES_SANDAL', 'ITEM_WEAPON_MACE_MORNINGSTAR': 'ITEM_WEAPON_MORNINGSTAR', 'ITEM_WEAPON_HAMMER_MAUL': 'ITEM_WEAPON_MAUL', 'ITEM_WEAPON_MACE_FLAIL': 'ITEM_WEAPON_FLAIL', 'ITEM_WEAPON_PIKE_HALBERD': 'ITEM_WEAPON_HALBERD', 'ITEM_WEAPON_PIKE_PIKE': 'ITEM_WEAPON_PIKE', 'ITEM_WEAPON_SWORD_SCIMITAR': 'ITEM_WEAPON_SCIMITAR', 'ITEM_WEAPON_SWORD_TRAINING': 'ITEM_WEAPON_SWORD_SHORT_TRAINING', 'ITEM_WEAPON_WHIP_SCOURGE': 'ITEM_WEAPON_SCOURGE' } # These are vanilla items without obvious analogs in the armoury raws. # Mostly just here for my own sake. missing_armoury_names = [ 'ITEM_ARMOR_MAIL_SHIRT', 'ITEM_ARMOR_TOGA', 'ITEM_HELM_HELM', 'ITEM_HELM_MASK', 'ITEM_HELM_TURBAN', 'ITEM_HELM_VEIL_FACE',
import pydwarf library_dir = pydwarf.rel(__file__, 'raw/higherlearning') default_entities = 'MOUNTAIN' librarian_position = ''' [POSITION:LIBRARIAN] [NAME:librarian:librarians] [SITE] [NUMBER:1] [RESPONSIBILITY:MEET_WORKERS] [APPOINTED_BY:EXPEDITION_LEADER] [APPOINTED_BY:MAYOR] [PRECEDENCE:180] [DO_NOT_CULL] [COLOR:5:0:0] [DUTY_BOUND] [REQUIRED_BEDROOM:1] [REQUIRED_OFFICE:1] ''' @pydwarf.urist( name = 'shukaro.higherlearning', version = '1.0.1', author = ('Shukaro', 'Sophie Kirschner'), description = '''Have you ever wondered to yourself, "Man, my dwarves are such idiots,
import os import json import pydwarf import raws # Armoury raws are located in this directory entities_json = pydwarf.rel(__file__, 'armouryentities.json') armoury_dir = pydwarf.rel(__file__, 'raw/armoury') # Armory raws are variations on vanilla names, this records them so they can be changed back. # Without this, other mods which attempt to make changes to the same items might run into problems. weird_armoury_names = { 'ITEM_AMMO_ARROWS_WAR': 'ITEM_AMMO_ARROWS', 'ITEM_ARMOR_JERKIN': 'ITEM_ARMOR_LEATHER', 'ITEM_ARMOR_PLATE': 'ITEM_ARMOR_BREASTPLATE', 'ITEM_SHOES_SANDALS': 'ITEM_SHOES_SANDAL', 'ITEM_WEAPON_MACE_MORNINGSTAR': 'ITEM_WEAPON_MORNINGSTAR', 'ITEM_WEAPON_HAMMER_MAUL': 'ITEM_WEAPON_MAUL', 'ITEM_WEAPON_MACE_FLAIL': 'ITEM_WEAPON_FLAIL', 'ITEM_WEAPON_PIKE_HALBERD': 'ITEM_WEAPON_HALBERD', 'ITEM_WEAPON_PIKE_PIKE': 'ITEM_WEAPON_PIKE', 'ITEM_WEAPON_SWORD_SCIMITAR': 'ITEM_WEAPON_SCIMITAR', 'ITEM_WEAPON_SWORD_TRAINING': 'ITEM_WEAPON_SWORD_SHORT_TRAINING', 'ITEM_WEAPON_WHIP_SCOURGE': 'ITEM_WEAPON_SCOURGE' } # These are vanilla items without obvious analogs in the armoury raws. # Mostly just here for my own sake. missing_armoury_names = [ 'ITEM_ARMOR_MAIL_SHIRT', 'ITEM_ARMOR_TOGA',
import pydwarf import raws toolsdir = pydwarf.rel(__file__, 'raw/tools') @pydwarf.urist( name='pineapple.tools.dagger', title='Add Dagger', version='1.0.0', author='Sophie Kirschner', description='''Adds daggers, which are smaller and less lethal than short swords, and may be held as tools by civilians. They can be made from one unit of metal, stone, or ceramics.''', arguments={ 'entities': '''The entities which should be allowed to produce daggers. Defaults to all entities.''' }) def dagger(df, entities='*'): return pydwarf.scripts.pineapple.easypatch( df, files=toolsdir + '/item_weapon_dagger_pineapple.txt', loc='raw/objects', permit_entities=entities) @pydwarf.urist( name='pineapple.tools.hatchet', title='Add Hatchet', version='1.0.0',
import pydwarf import raws import json gemset_dir = pydwarf.rel(__file__, 'gemset') properties_path = pydwarf.rel(__file__, 'gemsetproperties.json') @pydwarf.urist( name = 'dragondeplatino.gemset.full', version = '1.0.0', author = ('DragonDePlatino', 'Sophie Kirschner'), description = ''' Performs a full installation, and this is probably what you want to run. ''', arguments = { 'variety': '''Which tileset to use. Should be either '24x24' or '48x48'.''', 'properties': '''File path to indicate where to find the json outputted by the gemsetproperties.py utility script.''' }, compatibility = pydwarf.df_0_40 ) def full(df, variety='24x24', properties=properties_path): pydwarf.log.info('Running dragondeplatino.gemset.twbt.') response = twbt(df, variety) if not response: return response pydwarf.log.info('Running dragondeplatino.gemset.graphics.')
import os import pydwarf import raws mats_dir = pydwarf.rel(__file__, 'raw/objects') dwarf_entities = 'MOUNTAIN' add_paths = [ os.path.join(mats_dir, path) for path in [ 'inorganic_alloys_mat_plus.txt', 'inorganic_metals_mat_plus.txt', 'inorganic_other_mat_plus.txt', ] ] patch_paths = [ os.path.join(mats_dir, path) for path in [ 'building_fantastic_dwarf.txt' 'reaction_alloys_mat_plus.txt', 'reaction_production_mat_plus.txt' ] ] add_properties = [ ( # Identifier for making the log easier to understand 'zircon', # Regex to match inorganic IDs '.* ZIRCON', # Add these properties 'MATERIAL_REACTION_PRODUCT:KROLL_PROCESS:INORGANIC:ZIRCONIUM_PUTNAM'),
import pydwarf creation_dir = pydwarf.rel(__file__, 'raw/creationforge') default_entities = ('MOUNTAIN',) @pydwarf.urist( name = 'shukaro.creationforge', version = '1.0.1', author = ('Shukaro', 'Sophie Kirschner'), description = '''This is a simple workshop I modded in to help test custom reactions, buildings, and creatures. It's used to create various different items so that you don't have to set up an entire fortress to test some reactions. Hopefully it's a useful tool to people, even if it's just to look at the raw formatting. ''', compatibility = (pydwarf.df_0_40, pydwarf.df_0_3x) ) def creationforge(df, entities=default_entities): return pydwarf.urist.getfn('pineapple.easypatch')( df, files = creation_dir, loc = 'raw/objects', permit_entities = entities )
import pydwarf import raws decay_dir = pydwarf.rel(__file__, 'hack/decay') @pydwarf.urist( name='omniclasm.decay.starvingdead', version='1.0.0', author=('Omniclasm', 'Sophie Kirschner'), description= '''With this script running, all undead that have been on the map for a time (default: 1 month) start to gradually decay, losing strength, speed, and toughness. After they have been on the map for even longer (default: 3 months), they collapse upon themselves, never to be reanimated. ''', arguments={ 'start': 'Number of months before decay sets in.', 'die': 'Number of months before collapsing entirely.', 'auto_run': 'If set to True then the script will be started automatically upon startup.' }, compatibility=(pydwarf.df_0_40, pydwarf.df_0_3x)) def starvingdead(df, start=1, die=3, auto_run=True): return pydwarf.urist.getfn('pineapple.utils.addhack')( df, auto_run='starvingdead start %d %d' % (start, die) if auto_run is True else auto_run, loc='hack/scripts',
import os import pydwarf import raws mats_dir = pydwarf.rel(__file__, 'raw/materialsplus') default_entities = 'MOUNTAIN' add_paths = [os.path.join(mats_dir, path) for path in [ 'inorganic_alloys_mat_plus.txt', 'inorganic_metals_mat_plus.txt', 'inorganic_other_mat_plus.txt', 'item_mat_plus.txt' ]] patch_paths = [os.path.join(mats_dir, path) for path in [ 'reaction_alloys_mat_plus.txt', 'reaction_production_mat_plus.txt' ]] add_properties = [ ( # Identifier for making the log easier to understand 'zircon', # Regex to match inorganic IDs '.* ZIRCON', # Add these properties
import pydwarf import raws rawsdir = pydwarf.rel(__file__, 'raw/agriculture') default_entities = '*' # Helper function for adding files from the raw/agriculture directory def addfile(df, filename): with open('%s/%s' % (rawsdir, filename), 'rb') as rawfile: df.add(raws.rawfile(path='raw/objects/%s' % filename, file=rawfile)) return pydwarf.success('Added file "%s".' % filename) @pydwarf.urist( name='azerty.agriculture.castorbean', title='Castorbean', version='1.0.0', author='Azerty', description='''Adds the castorbean or castor-oil-plant, a flowering plant from which castor oil may be extracted.''') def castorbean(df): return addfile(df, 'plant_castorbean_azerty.txt') @pydwarf.urist( name='azerty.agriculture.madder', title='Madder', version='1.0.0', author='Azerty',