diff --git a/Contributors.rst b/Contributors.rst index 7fb774085..08cbce113 100644 --- a/Contributors.rst +++ b/Contributors.rst @@ -81,6 +81,7 @@ acwatkins acwatkins Wes Malone wesQ3 Michon van Dooren MaienM Seth Woodworth sethwoodworth +Vjek ======================= ==================== =========================== And these are the cool people who made **Stonesense**. diff --git a/NEWS b/NEWS index dd2acc430..34d90269f 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,8 @@ DFHack Future view-item-info: adds information and customisable descriptions to item viewscreens warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found points: set number of points available at embark screen + Vjek's script collection: armoks-blessing, brainwash, elevate-mental, + elevate-physical, make-legendary, pref0adjust, rejuvenate New tweaks embark-profile-name: Allows the use of lowercase letters when saving embark profiles kitchen-keys: Fixes DF kitchen meal keybindings diff --git a/Readme.rst b/Readme.rst index dea56d40e..379b7f970 100644 --- a/Readme.rst +++ b/Readme.rst @@ -2380,6 +2380,13 @@ directory. Don't forget to `enable stockpiles` and create the `stocksettings` directory in the DF folder before trying to use this plugin. + +modtools/* +========== +Scripts which provide tools for modders, often with changes to the raw files. +Not intended to be called manually by end-users. + + adaptation ========== View or set level of cavern adaptation for the selected unit or the whole fort. @@ -2391,6 +2398,13 @@ add-thought Adds a thought or emotion to the selected unit. Can be used by other scripts, or the gui invoked by running ``add-thought gui`` with a unit selected. +armoks-blessing +=============== +Runs the equivalent of rejuvenate, elevate_physical, elevate_mental, and brainwash +on all dwarves currently on the map. This is an extreme change, which sets every +stat to an ideal - legendary skills, great traits, and easy-to-satisfy preferences. +Use in moderation; it's as 'cheaty' as DFHack gets. + autofarm ======== Automatically handle crop selection in farm plots based on current plant stocks. @@ -2424,6 +2438,12 @@ If the name of the patch has no extension or directory separators, the script uses ``hack/patches//.dif``, thus auto-selecting the version appropriate for the currently loaded executable. +brainwash +========= +Modify the personality traits of the selected dwarf to match an 'ideal' +personality - as stable and reliable as possible. This makes dwarves very +stable, preventing tantrums even after months of misery. + burial ====== Sets all unowned coffins to allow burial. ``burial -pets`` also allows burial @@ -2492,6 +2512,17 @@ drain-aquifer ============= Remove all 'aquifer' tag from the map blocks. Irreversible. +elevate-mental +============== +Set all mental attributes of a dwarf to 2600, which is very high. +Other numbers can be passed as an argument: ``elevate-mental 100`` +for example would make the dwarf very stupid indeed. + +elevate-physical +================ +As for elevate-mental, but for physical traits. High is good for soldiers, +while having an ineffective hammerer can be useful too... + exterminate =========== Kills any unit of a given race. @@ -2644,6 +2675,13 @@ There are the following ways to invoke this command: Parses and executes the lua statement like the interactive interpreter would. +make-legendary +============== +Makes the selected dwarf legendary in one skill, a group of skills, or all +skills. View groups with ``make-legendary classes``, or all skills with +``make-legendary list``. Use ``make-legendary MINING`` when you need something +dug up, or ``make-legendary all`` when only perfection will do. + make-monarch ============ Make the selected unit King or Queen of your civilisation. @@ -2682,6 +2720,18 @@ position Reports the current time: date, clock time, month, and season. Also reports location: z-level, cursor position, window size, and mouse location. +pref-adjust +=========== +A two-stage script: ``pref-adjust clear`` removes preferences from all dwarves, +and ``pref-adjust`` inserts an 'ideal' set which is easy to satisfy:: + + Feb Idashzefon likes wild strawberries for their vivid red color, fisher berries + for their round shape, prickle berries for their precise thorns, plump helmets + for their rounded tops, prepared meals, plants, drinks, doors, thrones, tables and + beds. When possible, she prefers to consume wild strawberries, fisher berries, + prickle berries, plump helmets, strawberry wine, fisher berry wine, prickle berry + wine, and dwarven wine. + putontable ========== Makes item appear on the table, like in adventure mode shops. Arguments: '-a' @@ -2696,6 +2746,11 @@ region-pops =========== Show or modify the populations of animals in the region. Use ``region-pops`` for details. +rejuvenate +========== +Set the age of the selected dwarf to 20 years. Useful if valuable citizens are +getting old, or there are too many babies around... + remove-stress ============= Sets stress to -1,000,000; the normal range is 0 to 500,000 with very stable or diff --git a/scripts/armoks-blessing.lua b/scripts/armoks-blessing.lua index 0228908f5..cb9478846 100644 --- a/scripts/armoks-blessing.lua +++ b/scripts/armoks-blessing.lua @@ -1,11 +1,9 @@ -- Adjust all attributes, personality, age and skills of all dwarves in play --- place in /hack/scripts/ for ease of use -- without arguments, all attributes, age & personalities are adjusted -- arguments allow for skills to be adjusted as well -- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY! --- by vjek, version 5, 20140816, for DF(hack) 40.08 --- Praise Armok! --- --------------------------------------------------------------------------- +-- by vjek + function rejuvenate(unit) if unit==nil then @@ -193,4 +191,4 @@ else print ("No skillname supplied, no skills will be adjusted. Pass argument 'list' to see a skill list, 'classes' to show skill classes, or use 'all' if you want all skills legendary.") end -adjust_all_dwarves(skillname) \ No newline at end of file +adjust_all_dwarves(skillname) diff --git a/scripts/brainwash.lua b/scripts/brainwash.lua index 0b83580d9..5492017c8 100644 --- a/scripts/brainwash.lua +++ b/scripts/brainwash.lua @@ -1,9 +1,6 @@ -- This script will brainwash a dwarf, modifying their personality -- usage is: target a unit in DF, and execute this script in dfhack --- via ' lua /path/to/script ' --- by vjek, version 5, 20140816, for DF(hack) 40.08 --- Praise Armok! --- for a in `awk -F= '{ print $2 }' input.txt`; do echo -n $a,; done +-- by vjek function brainwash_unit(profile) local i,unit_name @@ -61,4 +58,4 @@ else print ("baseline will reset all personality traits to a default / the average.") print ("stepford amplifies all good qualities to an excessive degree.") print ("wrecked amplifies all bad qualities to an excessive degree.") - end \ No newline at end of file +end diff --git a/scripts/elevate-mental.lua b/scripts/elevate-mental.lua index 1adf2a8f1..487ad40ef 100644 --- a/scripts/elevate-mental.lua +++ b/scripts/elevate-mental.lua @@ -1,8 +1,7 @@ -- This script will elevate all the mental attributes of a unit -- usage is: target a unit in DF, and execute this script in dfhack -- all physical attributes will be set to whatever the max value is --- by vjek, version 5, 20140816, for DF(hack) 40.08 --- Praise Armok! +-- by vjek function ElevateMentalAttributes(value) unit=dfhack.gui.getSelectedUnit() diff --git a/scripts/elevate-physical.lua b/scripts/elevate-physical.lua index 12c50cc0f..41d7ef1a0 100644 --- a/scripts/elevate-physical.lua +++ b/scripts/elevate-physical.lua @@ -1,8 +1,7 @@ -- This script will elevate all the physical attributes of a unit -- usage is: target a unit in DF, and execute this script in dfhack -- all physical attributes will be set to whatever the max value is --- by vjek, version 5, 20140816, for DF(hack) 40.08 --- Praise Armok! +-- by vjek function ElevatePhysicalAttributes(value) unit=dfhack.gui.getSelectedUnit() diff --git a/scripts/make-legendary.lua b/scripts/make-legendary.lua index 5247e3ebd..4e487484b 100644 --- a/scripts/make-legendary.lua +++ b/scripts/make-legendary.lua @@ -1,10 +1,8 @@ -- This script will modify a skill or the skills of a single unit -- usage is: target a unit in DF, and execute this script in dfhack --- via ' lua /path/to/script skillname ' -- the skill will be increased to 20 (Legendary +5) -- arguments 'list', 'classes' and 'all' added --- by vjek, version 4, 20141016, for DF(hack) 40.08 --- Praise Armok! +-- by vjek -- this function will return the number of elements, starting at zero. -- useful for counting things where #foo doesn't work @@ -129,4 +127,4 @@ else return end -make_legendary(skillname) \ No newline at end of file +make_legendary(skillname) diff --git a/scripts/pref-adjust.lua b/scripts/pref-adjust.lua index fea32525c..1f6607b04 100644 --- a/scripts/pref-adjust.lua +++ b/scripts/pref-adjust.lua @@ -1,16 +1,15 @@ -- Adjust all preferences of all dwarves in play --- place in /hack/scripts/ for ease of use -- all preferences are cleared, then set -- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY! --- by vjek, version 4, 20141016, for DF(hack) 40.08 --- Praise Armok! +-- by vjek + -- --------------------------------------------------------------------------- function brainwash_unit(unit) - if unit==nil then - print ("No unit available! Aborting with extreme prejudice.") - return - end + if unit==nil then + print ("No unit available! Aborting with extreme prejudice.") + return + end local pss_counter=31415926 @@ -63,31 +62,31 @@ function clear_preferences(v) unit=v local prefs=unit.status.current_soul.preferences - for index,pref in ipairs(prefs) do - pref:delete() - end + for index,pref in ipairs(prefs) do + pref:delete() + end prefs:resize(0) end -- --------------------------------------------------------------------------- function clearpref_all_dwarves() - for _,v in ipairs(df.global.world.units.active) do - if v.race == df.global.ui.race_id then - print("Clearing Preferences for "..dfhack.TranslateName(dfhack.units.getVisibleName(v))) - clear_preferences(v) - end - end + for _,v in ipairs(df.global.world.units.active) do + if v.race == df.global.ui.race_id then + print("Clearing Preferences for "..dfhack.TranslateName(dfhack.units.getVisibleName(v))) + clear_preferences(v) + end + end end -- --------------------------------------------------------------------------- function adjust_all_dwarves() - for _,v in ipairs(df.global.world.units.active) do - if v.race == df.global.ui.race_id then - print("Adjusting "..dfhack.TranslateName(dfhack.units.getVisibleName(v))) - brainwash_unit(v) - end - end + for _,v in ipairs(df.global.world.units.active) do + if v.race == df.global.ui.race_id then + print("Adjusting "..dfhack.TranslateName(dfhack.units.getVisibleName(v))) + brainwash_unit(v) + end + end end -- --------------------------------------------------------------------------- -- main script operation starts here -- --------------------------------------------------------------------------- clearpref_all_dwarves() -adjust_all_dwarves() \ No newline at end of file +adjust_all_dwarves() diff --git a/scripts/rejuvenate.lua b/scripts/rejuvenate.lua index 9b0ec7403..597bfd528 100644 --- a/scripts/rejuvenate.lua +++ b/scripts/rejuvenate.lua @@ -1,29 +1,24 @@ -- This script will make any "old" dwarf 20 years old -- usage is: target a unit in DF, and execute this script in dfhack --- via ' lua /path/to/script ' -- the target will be changed to 20 years old --- by vjek, version 5, 20141016, for DF(hack) 40.08 --- Paise Armok! +-- by vjek function rejuvenate() -local current_year,newbirthyear -unit=dfhack.gui.getSelectedUnit() + local current_year,newbirthyear + unit=dfhack.gui.getSelectedUnit() -if unit==nil then - print ("No unit under cursor! Aborting with extreme prejudice.") - return - end + if unit==nil then print ("No unit under cursor! Aborting.") return end -current_year=df.global.cur_year -newbirthyear=current_year - 20 -if unit.relations.birth_year < newbirthyear then - unit.relations.birth_year=newbirthyear -end -if unit.relations.old_year < current_year+100 then - unit.relations.old_year=current_year+100 -end -print (dfhack.TranslateName(dfhack.units.getVisibleName(unit)).." is now 20 years old and will live at least 100 years") + current_year=df.global.cur_year + newbirthyear=current_year - 20 + if unit.relations.birth_year < newbirthyear then + unit.relations.birth_year=newbirthyear + end + if unit.relations.old_year < current_year+100 then + unit.relations.old_year=current_year+100 + end + print (dfhack.TranslateName(dfhack.units.getVisibleName(unit)).." is now 20 years old and will live at least 100 years") end -rejuvenate() \ No newline at end of file +rejuvenate()