Add "change-build-menu" and "if-entity".#8
Conversation
change-build-menu provides a simple API for adding or removing buildings from DF's build sidebar. if-entity runs a command if the current entity matches the given ID.
|
Yep, these look like modtools scripts. Thanks for organizing them! The one thing I noticed is that they use tabs for indentation. That should probably be changed to spaces to be consistent with other DFHack code. (Travis would've complained about it, but it's been disabled - I really ought to fix and re-enable that.) |
|
I always use tabs and forgot that DFHack uses spaces. Is it a big deal? I know some scripts use four spaces, and others use 1 (?!?) |
|
Yeah, we should standardize on something (all of the C++ code uses 4 spaces, as far as I know, but some scripts vary). The only rule I'm aware of for scripts is "no tabs". It's not a lot of effort to change on our end, though, so as long as this script works, I'd be fine with merging this and changing the indentation afterward. I do recognize that having the version here use spaces would make it a little harder to merge future changes from your end, though (and I don't want to force you to change your indentation style). Would it be possible to stick with spaces in your dfhack/scripts fork? It looks to me like you're basically copying changes from wherever you keep your Rubble code, so hopefully changing whitespace when you do that wouldn't interfere with your Rubble repo. |
|
OK, I'll make the changes, its not a big deal. I don't see me making many changes to them in the future, the main reason I want to get them into DFHack now is that they are "finished" and stable... |
|
Thanks! Do let us know if you make any changes later, though. |
modtools/change-build-menu.lua
Outdated
| end | ||
|
|
||
| if not dfhack.isWorldLoaded() then | ||
| dfhack.color(RED) |
There was a problem hiding this comment.
Did you avoid dfhack.printerr() here intentionally? I was about to suggest it, but it looks like you used it later in this file.
There was a problem hiding this comment.
Yes, but I forget why...
It had something to do with the exact way I wanted the output formatted, but for the life of me I can't remember why I changed it now...
There was a problem hiding this comment.
I can't see where RED is defined (it's not built-in), so maybe this isn't actually changing the color. Also, if it were COLOR_RED, it could be a darker red or non-bold red, depending on the terminal. Either way, I think printerr() might be better for consistency, unless there's a good reason for this.
There was a problem hiding this comment.
Looking at it I can only assume I was sleep deprived at the time, since printerr would do exactly what I had intended... Like I said, I can't remember what I was thinking (was I thinking?). I'll change it.
I would say I was drunk, but I don't drink...
|
(Reopened this and #9 to see if Travis complained about anything else.) Edit: yep, \r\n newlines and docs. I can fix those. |
|
What is the expected format for documentation? |
|
Oh, and \r\n newlines are a fluke, I have my editor set to use \n always. I must have copied an old file instead of creating a new one when I started writing those scripts... |
modtools/change-build-menu.lua
Outdated
|
|
||
| change-build-menu revert <ID> <CATEGORY> | ||
| Revert an earlier remove or add operation. It is NOT safe to "remove" | ||
| and "add"ed building or vice versa, use this option to reverse any |
There was a problem hiding this comment.
Oops...
Actually I was reviewing the offline master copy this morning (backporting changes I had made to the DFHack copy) and noticed that myself. Thank you for reminding me though, or I would have forgotten to change it in the online copy.
|
I did not fix the newlines or documentation. The newlines because it would be practically impossible on this computer (the linux mint default editor does not support that operation and neither does the github web UI), the documentation because I have no idea what the supported format is... |
This should fix all formatting nitpicks, as well as adding documentation.
|
Closer, but it seems I have errors in the doc formatting... Looks like I'll have to read up on yet another doc format. |
|
Fixed in f0080ac, plus some other changes. I'm not quite sure what the issues were, but one was probably ReST wanting an extra newline after a list item, before an indented section. Also, I removed the Markdown displays them as you (presumably) expected, though, which is confusing: |
|
I had a "hopefully fixed" version ready to go (created after much reading of the ReST docs), but your fixes are much better, so it looks like this is all done... |
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
This is a combination of 10 commits. At least one of which was a combination of commits. (It might get confusing)
Add tests.lua to .gitignore
Changes to be committed:
new file: .gitignore
Implement dorf-buffing in pimp-it.lua
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
Tweak configuration data in dorf_tables.lua
Modifications were made in order to get a better spread of diversity.
eg.
>Farmer now includes the formerly defunct FARMER profession which includes the GELD skill
>Doctor now prioritizes SURGEON, and has DIAGNOSER and BONE_SETTER as tertiary professions
>Ratios of various professions were modified (eg. WOODWORKER, ANIMAL_CARETAKER, STONEWORKER, etc.)
>Minor changes to dorf_types (eg. added TEACHING skill to 'leader')
Changes to be committed:
modified: dorf_tables.lua
Update dorf_tables.lua
global:
-added Query(profession) function
->prints prof.cur for queried profession
-renamed 'ResetProfessionTable()' to 'ResetDataTables()'
'dorf_jobs' modifications:
-added cur{} and min{}
->implemented to ensure the script can be run for fresh embarks with 7 dwarves
->implemented as tables to placate the algorithm and avoid changing it
-added tertiary professions to the Leader job
-renamed Grunt to _Grunt (alphabetic ordering)
'professions' modifications:
-modified maximum values
Todo list:
-re-implement maximums
->perhaps ratios should be kept for professions but..
->maximums should be kept in jobs, as a table like cur{} and min{}
-add a help option, write-up a help doc/function
Update pimp-it.lua (major revision)
New Functions:
-isDwarfNamed //Returns true if the DWARF has a name (nickname) this dwarf is treated as sacred unless '-clear* allnamed' is specified
-isDwarfCustom //Returns true if the DWARF has a custom_profession
-isDwarfPimped //Returns true if the DWARF has a job
-isDwarfUnpimped //Returns true if the DWARF is a drunk with no job
-isDwarfCustomUnpimped //Returns true if the DWARF is custom, but also probably a drunk
-isDwarfProtected //Returns true if the DWARF has a job, or is custom with protection
-isDwarfUnprotected //Returns true if the DWARF has no job and or is not custom with protection
~~~~~~~~
New Script Arguments:
-clear
-clearfirst
options:
> allcustom
> allpimped
> allunpimped
> allcustomunpimped
> allprotected
> allunprotected
> allnamed
> all
Note:
'-clear all' will reset all dwarves
'-clearfirst all' will reset all dwarves except named
~~~~~~~~
isValidProfession() modifications:
-local current = math.floor(prof.cur) + increment
->this is a major change for the comparison (current < prof.max) -- because increment <= 1.0
-boundaries for rounding up/down ratio limits
->limit still prefers to be a value of at least 1
~~~~~~~~
isValidJob() modifications:
-implemented dorf_jobs minimums
-when pimped_count < 7 forces only jobs with unmet minimums to be valid
-added the same check for once the 7 pimped-dwarf minimum has been met
->this is in addition to the regular check however, though it does run first
~~~~~~~~
ApplyJob() modifications:
-rewrote sections to enforce newly implemented job minimums
-modified priority/tertiary profession increments to 0.66 and 0.22 respectively
-added code to ensure dwf.profession2 is assigned a value
~~~~~~~~
FindJob() modifications:
-implemented clearfirst argument with all its glorious options
->see top of commit message
-integrated isDwarfProtected & isDwarfPimped
->simplified FindJob's job counting for already pimped dwarves
~~~~~~~~
ZeroDwarf() modifications:
-integrated zeroed_count
-now resets dwarf professions to 'DRUNK'
-now resets dwarf nicknames (because there is built in protection to avoid overwriting named dwarves)
~~~~~~~~
general changes:
-added checks to ensure skill.ration >= 0
-added 'pimped_count'
-added 'zeroed_count'
-rewrote argument parsing/script execution decisions
-script prints a new line when it finishes
~~~~~~~~
todo:
-write help
-force help to display when no arguments are given (to avoid fucking up an unsaved game)
-implement optimize argument
Overhaul dorf_tables.lua
-Added 'job_distributions' table.
This table is responsible for allocation of all jobs from dorf_jobs.
It defines 12 population thresholds. Allocation can take place from 1-138 dwarves
thresholds: { 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 138 }
Each threshold allocates 7 jobs for a population <= threshold.
This benefits dorf_jobs and professions allowing these two tables to be slimmed down.
-Removed cur/min/max from 'dorf_jobs'
-Removed prio tables from dorf_jobs
Priority professions were moved to the Tertiary section with heavily weighted probabilities.
-Removed cur/max/ratio from 'professions'
C++11 offers pretty decent random booleans. The statistics are pretty damn precise.
With this consideration, the tertiary probabilities can be used to control ratios.
This may require tweaking, but is far more streamlined.
todo:
-revise `pimp-it.lua`
*priority professions are gone, the tertiary loop will need to use a point system for min/max ranges
*implement persistent job counts, perhaps via json
Changes to be committed:
modified: dorf_tables.lua
Squashing commits:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the commit message DFHack#2:
Add field 'max' to job distributions
Changes to be committed:
modified: dorf_tables.lua
------------------
The commit message DFHack#3 will be skipped:
Fix! dorf_tables.lua
-Fixes a missing comma in the job_distributions table.
-Fixes a missing profession in the professions table. (ie. DYER)
Changes to be committed:
modified: dorf_tables.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: Tue Dec 19 23:40:18 2017 -0800
Rebasing branch 'lua-dorf-buffing' on '2898c5f'.
Changes to be committed:
modified: dorf_tables.lua
Overhaul Job Finding
Summary:
-Added functions for comparing and sorting table entries.
-Refactored and abstracted top level loop
-Revised FindJob(dwf)
--Implemented job distributions
--Removed job counting
--Removed args.clearfirst processing
-Separated job finding from job counting
--Now job counting happens all at once, and before any jobs are found
-Combined ZeroDwarf processing of args.clear & args.clearfirst
--Still utilized in disparate ways
New Functions:
- safecompare(a,b)
--Compares two numbers safely accounting for nil values.
Nil is considered the lowest number.
- twofield_compare(table,ak,bk,field1,field2,cmp1,cmp2)
--This can probably be abstracted further, to the point of
only passing a & b and not keys to obtain a & b.
--ak/bk are the keys to obtain a and b.
--field1/2 are the fields of a and b to compare.
--cmp1/2 are the compare functions to use to compare field1
and then field 2 respectively.
- spairs(table, cmp)
--Sorted pairs function, you guessed it. It allows you to
iterate a table in a sorted fashion
- PrepareDistributions()
--Runs through each dorf job, grabs the appropriate
job distribution. Checks the max field for nil.
If nil it calculates a value.
--Calculation is based on dwarven work force population.
It loops through the job distribution population thresholds,
finds the closest >= threshold (W.F. >= T.). Using the threshold
another loop tallies up how many jobs should be allocated.
--Distributions leave no random wiggle room for job allocation
- TrySecondPassExpansion()
--Tries to recalculate distribution maximums to account for all
dwarven workers.
--PrepareDistributions() calculates maximums for a work force
population which is either <= the actual work force population.
This means there could be some workers left over when we're done
allocating jobs.
- LoopUnits(units, check, fn)
--Loops through all the units.
--If check passes, the unit is counted toward the total looped units.
--If fn ~= nil the loops calls fn(dwf)
- isDwarfCitizen(dwf)
--Just a shorthand version of dfhack.units.isCitizen(dwf)
- CanWork(dwf)
--Checks if unit is a dwarf citizen, and an adult.
- TryClearDwarf(dwf)
--Runs processing on args.clear and args.clearfirst and then
also 'dwf' itself to see if 'dwf' should be passed to ZeroDwarf(dwf).
- CountJob(dwf)
--Checks if 'dwf' has a custom profession.
--Tries to look up custom profession in dorf jobs.
--If dorf job is found, the cur workers for the job is incremented
Removed:
- isValidProfession()
--This was deemed unneccessary with the new implementation of FindJob()
- LoopDwarfCitizens(units, callback)
--This was abstracted further into LoopUnits
Changes to be committed:
modified: pimp-it.lua
Convert Tabs to Spaces
Changes to be committed:
modified: pimp-it.lua
Delete valid args: -resetdata -query
Changes to be committed:
modified: pimp-it.lua
Refactor cxxrandom calls
Changes to be committed:
modified: pimp-it.lua
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
This is a rough, but working implementation of `pimp-it.lua` and sister file `dorf_tables.lua`
dorf_tables.lua:
- Implements configuration data for pimp-it.lua
pimp-it.lua:
- optimizes dwarves for labor
--selects jobs from configuration data and applies them to dwarven citizens
--applies professions from the above 'jobs'
--generates pseudo-random labor skill ratings for the above 'professions'
--applies dwarf types according to job configurations, and random chance (eg. soldier, smart, speedy, etc)
Date: Thu Dec 14 19:12:38 2017 -0800
Rebasing branch 'lua-dorf-buffing' on 'f08b1a3'.
Changes to be committed:
new file: dorf_tables.lua
new file: pimp-it.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a combination of 8 commits.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the 1st commit message:
{WWasIP} Adds pimp-it.lua - dorf_jobs partially implemented
On branch lua-dorf-buffing
Changes to be committed:
new file: pimp-it.lua
----------------------------------
This is the commit message DFHack#2:
{WWasIP} Updates tables: dorf_types, dorf_profs
----------------------------------
This is the commit message DFHack#3:
{WWasIP} Completes dorf_types{} and dorf_profs{}
----------------------------------
This is the commit message DFHack#4:
{WWasIP} Completes first section of professions{}
----------------------------------
This is the commit message DFHack#5:
{WWasIP} Groups and Sorts the remaining professions{} entries.
----------------------------------
This is the commit message DFHack#6:
{WWasIP} Completes professions{}, Modified dorf_jobs{} (renamed it also)
----------------------------------
This is the commit message DFHack#7:
Adds dorf_tables.lua - Moved config tables from pimp-it.lua
Cut dorf tables from pimp-it.lua and included with new file 'dorf_tables.lua'
Tables:
> attrib_levels - levels of competency for attributes
> dorf_types - types of dorfs (eg. soldier, artist, strong, genius, etc.)
> dorf_jobs - custom profession configurations (required professions, prioritized professions, tertiary-professions, dorf types to apply)
> professions - profession definitions (current dwarves with the profession, maximum dwarves, ratio of dwarves relative to population, skills with any bonuses to
apply)
Changes to be committed:
new file: dorf_tables.lua
----------------------------------
This is the commit message DFHack#8:
{WWasIP:done} Completes (pimp-it algo complete)
Fully implemented pimp-it algorithm.
pimp-it.lua changes:
- Added a number of debug print lines (requires argument)
- Removed all configuration data tables from pimp-it.lua
- Rewrote entire algorithm based on new data structures
-- Fully~ debugged (*fingers crossed*)
- Rewrote argument processing
dorf_tables.lua changes:
- Removed keyword local from table declarations
- Added function to Reset the 'cur' field throughout the 'professions' table
Changes to be committed:
modified: dorf_tables.lua
modified: pimp-it.lua
change-build-menu provides a simple API for adding or removing buildings from DF's build sidebar. if-entity runs a command if the current entity matches the given ID.