Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4

Author Topic: Lesbians???  (Read 6055 times)

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Lesbians???
« Reply #30 on: December 07, 2014, 01:00:00 pm »

All of that should theoretically be doable with DFHack, but the transgender / intersex stuff would be hard and I doubt the solution would be all that satisfying.  The adoption stuff at least should be fairly straightforward.  You'd just have to create a script that periodically checked for kids who had no living parents and couples with no kids, then reassign the parent relationships.

I need to get back into writing DFHack scripts.  If I was up to date on the current version I'd give it a shot.
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #31 on: December 07, 2014, 05:15:48 pm »

I hope transgenderism is added soon too, to be able to train my surgeons, suturers and wound dressers in between sieges.

edit edit: Putnam, are you able to write a script to make orphans available for adoption by any couple that currently doesn't have an infant, or is that impossible?

...I am not sure why I didn't think of it.

It would require more micromanagement than that, in that you would literally replace the child's parents with the new set.

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #32 on: December 07, 2014, 05:18:17 pm »

I hope transgenderism is added soon too, to be able to train my surgeons, suturers and wound dressers in between sieges.

edit edit: Putnam, are you able to write a script to make orphans available for adoption by any couple that currently doesn't have an infant, or is that impossible?

...I am not sure why I didn't think of it.

It would require more micromanagement than that, in that you would literally replace the child's parents with the new set.

so like you would have to pick the parents and do it for each child?

I was hoping for a random chance with a couple of any sexuality to adopt any orphan. As long as they didn't currently have an infant, as the adoption could be of an infant and I think two or more would get problematic.
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #33 on: December 07, 2014, 05:20:55 pm »

Yeah.

It could be done randomly quite easily, though. Heh, sometimes I don't outside the box enough.

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #34 on: December 07, 2014, 05:42:25 pm »

I will be you bff forever if you can explain to me how to go about that or magic it up. I will include it in my enhanced genders download, which everyone else is pretty much doing for me, because I am clueless.
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #35 on: December 07, 2014, 07:32:43 pm »

Code: [Select]
-- lets babies be adopted by couples with no infants.

local function getSpouseOrLover(unit)
    local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id)
    if lover_unit then
        return lover_unit.hist_figure_id
    else
        local hist_fig=df.historical_figure.find(unit.hist_figure_id)
        for k,v in ipairs(hist_fig.histfig_links) do
            if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then
                return v.target_hf
            end
        end
    end
    return false
end

local function getNumberOfChildren(unit)
    local children=0
    for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
        if df.histfig_hf_link_childst:is_instance(v) then children=children+1 end
    end
    return children
end

local function figureIsAlive(hist_figure)
    return hist_figure.died_year==-1
end

local function unitIsChild(unit)
    return df.global.cur_year-unit.relations.birth_year<12
end

local function unitIsOrphan(unit)
    if unitIsChild(unit) then
        local fatherIsAlive,motherIsAlive=false,false
        for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
            if df.histfig_hf_link_motherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then motherIsAlive=true end
            elseif df.histfig_hf_link_fatherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then fatherIsAlive=true end           
            end
        end
        return (fatherIsAlive or motherIsAlive)
    end
    return false
end

local function adopt(baby,couple)
    local mother,father=false,false
    if df.historical_figure.find(couple.unit).sex==0 then
        mother=couple.unit
        father=couple.lover --yeah, the "father" will be female if the unit's lover is female, but the game will correctly display both as "mother"
    else
        father=couple.unit
        mother=couple.lover --similar to the above, the "mother" will be male if the unit's lover is male, but they'll both be "father" pretty elegantly.
    end
    local mother_fig=df.historical_figure.find(mother)
    local father_fig=df.historical_figure.find(father)
    local baby_hist_fig=df.historical_figure.find(baby.hist_figure_id)
    for k,v in ipairs(baby_hist_fig.histfig_links) do
        if df.histfig_hf_link_motherst:is_instance(v) then
            v.target_hf=mother --yeah, adoption will remove any relation other than genetics between biological parents and children.
        elseif df.histfig_hf_link_fatherst:is_instance(v) then
            v.target_hf=father
        end
    end
    mother_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    father_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    baby.relations.mother_id=mother_fig.unit_id
    baby.relations.father_id=father_fig.unit_id
end

local function findBabiesWithNoParents()
    local couples_histfig={}
    local orphans={}
    for k,unit in ipairs(df.global.world.units.active) do
        if dfhack.units.isCitizen(unit) then
            local spouseOrLover=getSpouseOrLover(unit)
            if spouseOrLover then
                couples_histfig[unit.hist_figure_id]=couples_histfig[unit.hist_figure_id] or {children=getNumberOfChildren(unit),lover=spouseOrLover,unit=unit.hist_figure_id}
                couples_histfig[spouseOrLover]=true --this weird sequence of crap makes it so that 1. I can easily cull redundant units and 2. I can still sort the table
            elseif unitIsOrphan(unit) then
                table.insert(orphans,unit)
            end
        end
    end
    local couples={}
    for k in pairs(couples_histfig) do
        if couples[k]==true then couples[k]=nil end --not doing this will make an error show up when sorting the couples table due to true.children being nonsense
    end
    for k,v in pairs(couples_histfig) do
        table.insert(couples,v) --makes the keys of the couples table be 1,2,3 etc. instead of being all over the place as histfigs
    end
    table.sort(couples,function(a,b) return a.children<b.children end)
    if #orphans>1 then
        for k,orphan in ipairs(orphans) do
            adopt(orphan,math.ceil(couples[k]/2))
        end
    end
end

require('repeat-util').scheduleUnlessAlreadyScheduled('Orphan Adoption Service',1,'days',findBabiesWithNoParents)

Put this into raw/onLoad.init or just run it and it'll go through all the orphans daily and dole them out among the parents with the least children.

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #36 on: December 07, 2014, 11:24:42 pm »

woot, thanks a ton!

Now if I can recover my transgender thread from burning into flames I can get something out there that has adoption and transgender. With credit to the sources.

The transgender thing will be clunky, but workable, I think.
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #37 on: December 08, 2014, 01:13:31 am »

okay so I made a file, onload.ini with that script in the raw folder. That is correct right?

Do you mind if I upload this to dffd with credit to you?
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #38 on: December 08, 2014, 01:14:27 am »

1. Nope, for that you probably want a file called init.lua instead

2. uh okay

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #39 on: December 08, 2014, 01:17:14 am »

1. Nope, for that you probably want a file called init.lua instead

2. uh okay

I don't have to if you prefer I don't, I just want it available. If you were prefer to upload it, more the better.

Okay init.lua would need dfhack or no?
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #40 on: December 08, 2014, 01:29:58 am »

Yes, and so would onLoad.init. That is a DFHack script I posted.

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #41 on: December 08, 2014, 01:44:28 am »

okay I'm sorry, I'm a tad confused.

Do I want onLoad.init or init.lua and does this go in the dfhack raw folder or just the regular raw folder?
Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #42 on: December 08, 2014, 02:08:38 am »

init.lua, raw folder.

It would best go into its own file in the dfhack/scripts folder, which is then called as a script in onLoad.init.

smeeprocket

  • Bay Watcher
  • Collectivist Socialist Feminist Freeloader
    • View Profile
Re: Lesbians???
« Reply #43 on: December 08, 2014, 08:35:16 am »

I have to make onLoad.init, it doesn't exist. SO what I'm wondering is, do I have the same script in both files?

Am I missing something.

Right now, in scripts for dfhack, I have the script you posted in a folder called adoption, the file name is onLoad.init

then I have the same script in the actual DF raw folder, but called init.lua.

That doesn't seem like I am doing it right, tho.

I'm really sorry, this is very new to me so things that might seem obvious will go right over my head.

Logged
Steam Name: Ratpocalypse
Transpersons and intersex persons mod for Fortress mode of DF: http://dffd.wimbli.com/file.php?id=10204

Twitch: http://www.twitch.tv/princessslaughter/

"I can't wait to throw your corpse on to a jump pad and watch it take to the air like a child's imagination."

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Lesbians???
« Reply #44 on: December 08, 2014, 01:55:24 pm »

You are missing something. You either put THE WHOLE SCRIPT in init.lua OR you put it into its own file in the scripts folder and put JUST THE FILENAME (minus lua) into onLoad.init.
Pages: 1 2 [3] 4