Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 263 264 [265] 266 267 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1459459 times)

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3960 on: June 10, 2013, 10:24:24 am »

The problem with changing diggability is you'd have to regularly override the in-game job assigner thing, cancelling and assigning jobs yourself in code. I don't know exactly how the existing algorithm works so anything I wrote might assign dig jobs unfairly often or unfairly rarely.

I guess a "liquid factory" could be done. It'd be a moderate pain to make it "pressurize" in the same way that screw pumps do, but it'd certainly be doable.

edit: It would be easier to modify the time it takes to dig based on the pick used. You could just set the time to dig to be ridiculously high for inappropriately weak picks, and leave it up to the player to organize who digs where with what.
« Last Edit: June 10, 2013, 10:27:24 am by expwnent »
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #3961 on: June 10, 2013, 10:41:08 am »

Quote
edit: It would be easier to modify the time it takes to dig based on the pick used. You could just set the time to dig to be ridiculously high for inappropriately weak picks, and leave it up to the player to organize who digs where with what.

That sounds useful :) How high is high? Ingame ticks? That would be more then enough.

Shovel: Soil_template: 10 ticks. Stone_template: 999999 ticks.
Pick: Soil_template: 10 ticks. Stone_template: 20 ticks.

Done. That is more or less what I asked for. ^^

The pumps dont necessarily need to pressurize things, magma is not pressurized anyway. The reason I asked about it is the liquid generation. If people want to pressurize something, they can just build a regular pump right next to it. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3962 on: June 10, 2013, 11:06:25 am »

I haven't tried it, but there might be a problem with dwarves not cancelling the job until they're starving to death if it's an absurdly long dig job. Something to keep in mind.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #3963 on: June 10, 2013, 11:22:41 am »

Thats fine. I would only use it on kobolds. Their own fault for trying to mine rock using a wooden shovel.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Mr S

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3964 on: June 10, 2013, 02:51:38 pm »

So, whichever Kobold comes up with the job assignment is doomed.  The RNG, she is a cruel mistress.
Logged

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3965 on: June 10, 2013, 03:38:08 pm »

removing the dig designation should end the job, freeing whomever glued their shovel to the wall

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3966 on: June 10, 2013, 09:25:36 pm »

Did more testing with some liposuction and force-feeding by altering unit.counters2.stored_fat between 1000 and 1000000. Also tried altering the (actual) strength attribute value.

Turns out that creatures with unit.flags3.unk1=false (old or young) also happen to be immune to size (physical_attr_tissues[0]) changes from alteration to muscle or fat. They can also walk around with an incorrect hacked unit.appearance.unk_4c8 and it doesn't change or matter.

Creatures with unit.flags3.unk1=true, which happen to grow properly, will change size within a few ticks, and their unit.appearance.unk_4c8 will recalculate to a correct value.

However, the flag is NOT the cause of the problem but rather another symptom. The evidence indicates that the size calculation function is being bypassed completely for some creatures, regardless of if they are growing or not. If the bug was fixed, all your old lazy corpulent dwarves would suddenly gain a few belt notches and move slower due to their increased size.

On another topic, the game appears to use unit.body.body_plan.unk15c and unit.body.body_plan.unk15d to determine if a creature has ANY fat or muscle in its body - it checks if the numbers are greater than zero.

It appears that dwarves who were not born at your fort (old dwarves) who have unit.flags3.unk1=true and have size calculated correctly, also have unit.relations.birth_time==-1 (It says "1st of granite" when you view their birth day).

If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3967 on: June 10, 2013, 09:32:38 pm »

If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?

Someone needs to make a plugin or script or something which can apply this automatically.  Unless it has side effects worse than non-growing units?  (also - does it work on animals?)
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3968 on: June 11, 2013, 12:32:47 am »

I have made a small sample confirmation of the -1 birth time, but then through a process found that a multiple of 10 also works.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3969 on: June 11, 2013, 12:51:05 am »

Code: (fixgrowthbug.lua) [Select]
--Fixes the body size bug.

local function fixAllCreaturesOfSizeBug()
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10) --Kurik Amudnil's code; if it's not clear, it sets a creature's birth_time to the nearest multiple of 10 of the previous one.
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
end

args = {...}

for k,arg in ipairs(args) do
    if v == "enable" or v == "Enable" then enable = true end
    if v == "disable" or v == "Disable" then enable = false end
    if v == "force" or v == "Force" then force = true end
end

if enable then
    automateTheFix = function()
        fixAllCreaturesOfSizeBug()
        dfhack.timeout(1,"months",automateTheFix)
    end
    automateTheFix()
else
    automateTheFix = function() end
end

if force then fixAllCreaturesOfSizeBug()

Here's something that will (hopefully) automate the fix that I whipped up real quick.
« Last Edit: June 11, 2013, 07:02:31 pm by Putnam »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3970 on: June 11, 2013, 12:57:59 am »

It appears that dwarves who were not born at your fort (old dwarves) who have unit.flags3.unk1=true and have size calculated correctly, also have unit.relations.birth_time==-1 (It says "1st of granite" when you view their birth day).

If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?

Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?
« Last Edit: June 11, 2013, 01:00:03 am by expwnent »
Logged

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3971 on: June 11, 2013, 01:55:54 am »

This is my attempt in ruby


However, yours looks shorter but instead of unit.relations.birth_time = -1,  I would want to use
Code: [Select]
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10)
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
so that the unit doesn't gain months and days of age.  Also of note, is that the historical figure and hidden identities have their own birth time which might get confusing somewhere or somehow if they are far different.

Edit:
...
Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?

Setting the birth_time to -1 or a multiple of 10 does cause unit.flags3.unk1 to become true.  I am not sure if it happens the next tick or a few more but it did so for me.
« Last Edit: June 11, 2013, 02:48:44 am by Kurik Amudnil »
Logged

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3972 on: June 11, 2013, 04:28:25 am »

You can use the modulo operator to simplify that.

r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10)
same as
r = unit.relations.birth_time % 10

It's the same syntax in ruby and lua.

Edit: Also, well done! :)  Although I am going to miss my exploity fast bird growth.
« Last Edit: June 11, 2013, 04:56:11 am by kingubu »
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3973 on: June 11, 2013, 07:21:09 am »

Looking at the code, it seems it's basically doing something like this for some reason:

Code: [Select]
if (cur_year_tick % 10 == 0 && (cur_year_tick - birth_time) % 1200 == 0) { update stuff }
Also added various fields mentioned recently: https://github.com/angavrilov/df-structures/commits/master
Logged

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3974 on: June 11, 2013, 09:21:28 am »

...
...
Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?

Setting the birth_time to -1 or a multiple of 10 does cause unit.flags3.unk1 to become true.  I am not sure if it happens the next tick or a few more but it did so for me.

unit.flags3.unk1 is an after-effect of having your size calculated properly. It can be used to find creatures that need to be fixed.
Pages: 1 ... 263 264 [265] 266 267 ... 373