Skip to content

changes to gui/gm-editor.lua:#2

Merged
lethosor merged 1 commit intoDFHack:masterfrom
warmist:master
Jul 7, 2016
Merged

changes to gui/gm-editor.lua:#2
lethosor merged 1 commit intoDFHack:masterfrom
warmist:master

Conversation

@warmist
Copy link
Copy Markdown
Member

@warmist warmist commented Jul 3, 2016

added shift-esc to fully exit from editor
added 'gui/gm-editor toggle' to toggle editor (by mifki's req). This saves position in editor.

added shift-esc to fully exit from editor
added 'gui/gm-editor toggle' to toggle editor (by mifki's req). This saves position in editor.
@lethosor lethosor merged commit b0c5d0e into DFHack:master Jul 7, 2016
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Dec 23, 2017
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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Dec 23, 2017
-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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Dec 23, 2017
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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Dec 23, 2017
-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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Dec 24, 2017
 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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Aug 20, 2018
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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Aug 20, 2018
-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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Oct 7, 2018
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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Oct 7, 2018
-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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Oct 13, 2018
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
cppcooper added a commit to cppcooper/dfhack-scripts that referenced this pull request Oct 13, 2018
-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
lethosor pushed a commit that referenced this pull request Jul 16, 2019
merging dfhack script changes
TheBloke added a commit to TheBloke/DFHack-scripts that referenced this pull request Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants