Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 52 53 [54] 55 56 ... 61

Author Topic: [SUGGESTIONS] for DFhack plugins  (Read 135828 times)

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #795 on: April 07, 2016, 11:48:55 pm »

And I thought I was the last person on Earth still making Stonesense sprites :)

Hey, I just took a... I-got-distracted-by-Crusader-Kings-II hiatus.  (Although I only really did some icons... which I probably need to check and see if the new professions are represented...)
Just to be clear, I didn't do any of the core artwork for Stonesense, which increased a lot with the multitile trees.  I just put a tutorial on the wiki and made sprites for my own mod.  I'm just not noticing other modders doing that  :'(

I think you're on the right track with modular subsprites.  My suggestion was just about from where to pull the assembly information at runtime.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Xune

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #796 on: April 10, 2016, 10:20:22 am »

In the adventure mode (Q)uest screen there is a section for (p)eople. It would be great if the information on these people were more detailed, for example their gender, age and physical description. Other good info would be where you last saw them.

Not sure if this exists already or is even doable.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #797 on: April 13, 2016, 02:54:53 am »

If worst comes to worst you could always just have a hook that redraws the tiles containing the given creatures every frame. It wouldn't work very well though.
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #798 on: April 22, 2016, 10:35:55 am »

Hopefully, I'm not repeating something...

Could there be an interface hack to make it so you could designate for butchering from the animal's "look" page, or from a cage?

For that matter, a way to estimate muscle mass of an animal from the animal's look page?

I had a discussion on the suggestions page, and it occurred to me that autobutcher really doesn't handle deliberate breeding programs well.  (Although setting up a script for autobutcher to favor butchering the weak and skinny first could also accomplish something similar.)
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

lethosor

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #799 on: April 22, 2016, 09:02:14 pm »

Could there be an interface hack to make it so you could designate for butchering from the animal's "look" page, or from a cage?
Looks pretty simple.
Quote
For that matter, a way to estimate muscle mass of an animal from the animal's look page?
I'm not sure how to go about calculating it, but displaying it would be easy enough.

I added the first one to the Github issue tracker just now. It's generally easier for us to keep track of things there than here.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Dozebôm Lolumzalìs

  • Bay Watcher
  • what even is truth
    • View Profile
    • test
Re: [SUGGESTIONS] for DFhack plugins
« Reply #800 on: April 24, 2016, 03:38:56 pm »

Hmm. How about a thing that is like revflood, except it does not flood through constructed walls? Maybe a command for revflood?

revflood -c

or such
Logged
Quote from: King James Programming
...Simplification leaves us with the black extra-cosmic gulfs it throws open before our frenzied eyes...
Quote from: Salvané Descocrates
The only difference between me and a fool is that I know that I know only that I think, therefore I am.
Sigtext!

expwnent

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #801 on: April 24, 2016, 04:30:12 pm »

I don't remember what they are but I remember there are good reasons it doesn't work that way. Maybe it messes up re-exploration.
Logged

klassekatze

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #802 on: April 28, 2016, 03:17:32 am »

Hopefully, I'm not repeating something...

Could there be an interface hack to make it so you could designate for butchering from the animal's "look" page, or from a cage?

For that matter, a way to estimate muscle mass of an animal from the animal's look page?

I had a discussion on the suggestions page, and it occurred to me that autobutcher really doesn't handle deliberate breeding programs well.  (Although setting up a script for autobutcher to favor butchering the weak and skinny first could also accomplish something similar.)

I have something you might have a use for. Still a bit of a mess internally, but it currently marks for slaughter the smallest animals first - genetically smaller, that is. The value it uses is related to the ones that declare creatures gigantic and so on. It does not currently evaluate muscle or other useful things, but I imagine it would be easier to tweak this script than to write one from whole cloth.

Code: [Select]
--animalhusbandry.lua

local utils = require 'utils'

local arglist = {
 'help',
 'maxmales',
 'maxfemales',
 'fullreport',
 'dryrun',
 'dbg_force_egg_hatching',
 'dbg_force_birth',
 'run',
 'bestworst',
}

validArgs = --[[validArgs or ]]utils.invert(arglist)
args = utils.processArgs({...}, validArgs)

helpmsg = true
for i = 1, # arglist do
if args[arglist[i] ] ~= nil then
--print('invoked '..arglist[i])
helpmsg = false
break
end
end

MAX_MALES = 3
MAX_FEMALES = 5

if args.help or helpmsg then
if helpmsg then
print('You didn\'t give any of the arguments. Displaying help message.')
end
print([[
Arguments:
-help                      This message.
-run                       Actually makes it do the thing. The killing of the undesireables.
-maxmales                  Sets maximum living males. Default is 3.
-maxfemales                Sets maximum living females. Default is 5.
-fullreport                Tells you stuff about animals even if it didn't kill any and none are pregnant and so on.
-dryrun                    Only pretends to slaughter them.
-dbg_force_egg_hatching    Forces all the incubating eggs to hatch immediately, for debug purposes.
-dbg_force_birth           Forces all the mothers to give birth immediately, for debug purposes.
-bestworst                 Displays the best and worst sizes for a species.
Ex1: animalhusbandry -run -dryrun -fullreport
Ex2: animalhusbandry -run -maxmales 1 -maxfemales 20
Ex3: animalhusbandry -run
]])
end

function pad(str, space, len, front)
str=tostring(str)
if front then
while # str < len do str = space..str end
else
while # str < len do str = str..space end
end
return str
end

function dumpobject(object)
for k,v in pairs(object) do
key=k
val=v
if k == nil then key='' end
if v == nil then val='' end
print ('obj.'..tostring(key)..'='..tostring(val))
end
end


function raceid2str(id)
return df.global.world.raws.creatures.all[id].name[0]
end

function pairsByKeys (t, f, sortfunc)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f, sortfunc)
local i = 0   -- iterator variable
local iter = function ()   -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end

end
return iter
end

if args.dbg_force_egg_hatching then
hatched = 0
for derp,item in ipairs(df.global.world.items.all) do
if string.match(tostring(item._type),'egg') then
if item.egg_flags and item.egg_flags.fertile then
item.incubation_counter = 9999999
hatched = hatched + 1
end
end
end
print('debug: forced '..hatched..' eggs to hatch')
end

if args.dbg_force_birth then
hatched = 0
for derp,unit in ipairs(df.global.world.units.all) do
if unit.relations.pregnancy_genes then
unit.relations.pregnancy_timer = 1
hatched = hatched + 1
end
end
print('debug: forced '..hatched..' mothers to give birth')
end



--this whole affair is kind of annoying-- but I can't find a method to look up items at a given coordinate w/out iterating all items.
eggs = {}
function buildegglist()
for derp,item in ipairs(df.global.world.items.all) do
if string.match(tostring(item._type),'egg') then
need = true
for k,v in pairs(eggs) do
if v.x == item.pos.x and v.y == item.pos.y and v.z == item.pos.z then
need = false
break
end
end
if need then
local pos = df.coord:new()
pos.x = item.pos.x
pos.y= item.pos.y
pos.z = item.pos.z
eggs[#eggs+1] = pos
end
end
end
--print('indexed '..tostring(#eggs)..' unique egg coordinates')
end
buildegglist()
function sitting_on_egg(unit)
ret = false
for k,v in pairs(eggs) do
if v.x == unit.pos.x and v.y == unit.pos.y and v.z == unit.pos.z then
ret = true
break
end
end
return ret
end
--dfhack.items.getPosition(item)


function runcull()


if args.maxmales and tonumber(args.maxmales) > 0 then
print('max males to keep is '..tostring(args.maxmales))
MAX_MALES = tonumber(args.maxmales)
end
if args.maxfemales and tonumber(args.maxfemales) > 0 then
print('max females to keep is '..tostring(args.maxfemales))
MAX_FEMALES = tonumber(args.maxfemales)
end

local species = { }

for fnUnitCount,unit in ipairs(df.global.world.units.all) do
if unit.race ~= df.global.ui.race_id and not unit.flags1.dead and unit.flags1.tame and not unit.flags2.slaughter then
if species[unit.race] == nil then species[unit.race] = {} end

species[unit.race][ # species[unit.race] + 1 ] = unit
end
end
for raceid,racelist in pairs(species) do
--racelist = v
--print('there are '..tostring(#racelist)..' '..raceid2str(raceid))
if racelist then

function sortfunc(a, b)
local amin = a.appearance.size_modifier
local bmin = b.appearance.size_modifier
return amin > bmin
end
table.sort(racelist,sortfunc)
--print('best '..raceid2str(raceid)..'='..tostring(racelist[1].appearance.size_modifier)..'; worst '..raceid2str(raceid)..'='..tostring(racelist[#racelist].appearance.size_modifier))
local malecount = 0
local femalecount = 0
local skippedegg = 0
local pregnant = 0
local mkilled = 0
local fkilled = 0
for i, v in pairs(racelist) do
v.flags2.slaughter = false
if v.sex == 1 then -- then gender = 'f'
if malecount > MAX_MALES then
if args.dryrun == nil then
v.flags2.slaughter = true
end
mkilled = mkilled + 1
end
malecount = malecount + 1
else-- gender = 'm'
if femalecount > MAX_FEMALES then
if sitting_on_egg(v) then
skippedegg = skippedegg + 1
else
if args.dryrun == nil and v.relations.pregnancy_genes == nil then
v.flags2.slaughter = true
fkilled = fkilled + 1
end
end
end
femalecount = femalecount + 1
if v.relations.pregnancy_genes and v.relations.pregnancy_timer > 0 then
pregnant = pregnant + 1
end
end
end

outstr = raceid2str(raceid)..':'..tostring(#racelist)..' m:'..tostring(malecount)..' f:'..tostring(femalecount)
if pregnant > 0 then
outstr = outstr .. '(' ..tostring(pregnant)..')'
end
if skippedegg > 0 then
outstr = outstr .. '(' ..tostring(skippedegg)..')'
end
if mkilled > 0 then
outstr = outstr .. ' m-'..tostring(mkilled)
end
if fkilled > 0 then
outstr = outstr .. ' f-'..tostring(fkilled)
end
if args.bestworst then
--print('best '..raceid2str(raceid)..'='..tostring(racelist[1].appearance.size_modifier)..'; worst '..raceid2str(raceid)..'='..tostring(racelist[#racelist].appearance.size_modifier))
best=tostring(racelist[1].appearance.size_modifier)
worst=tostring(racelist[#racelist].appearance.size_modifier)
outstr = outstr .. ' b:'..best..' w:'..worst
end
if pregnant > 0 or skippedegg > 0 or mkilled > 0 or fkilled > 0 or args.fullreport then
print(outstr)
end


--print(raceid2str(raceid)..':'..tostring(#racelist)..' m:'..malecount..' f:'..femalecount)
--[[
if malecount > MAX_MALES then
print('set '..mkilled..' males to be slaughtered for species '..raceid2str(raceid)..'.')
end
if femalecount > MAX_FEMALES then
print('set '..fkilled..' females to be slaughtered for species '..raceid2str(raceid)..'.')
end
if skippedegg > 0 then
print('skipped slaughtering '..tostring(skippedegg)..' females because they are sitting on eggs.')
end
if pregnant > 0 then
print('skipped slaughtering '..tostring(skippedegg)..' females because they are sitting on eggs.')
end]]

end


end

out='species:count m:males f:females(pregnant) m-slaughteredm f-slaughteredf'
if args.bestworst then
out=out..' b:largestsize w:smallestsize (in pop.)'
end
print(out)


end


if args.run then
runcull()
end


Logged

Hamelin

  • Escaped Lunatic
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #803 on: June 10, 2016, 01:40:17 pm »

Would it be possible for DFhack to change possible embark size? nanofort hasn't been updated in forever and I'd like to play a 1x1 fort again.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #804 on: June 10, 2016, 02:04:11 pm »

Would it be possible for DFhack to change possible embark size? nanofort hasn't been updated in forever and I'd like to play a 1x1 fort again.
I thought this was now a vanilla feature?
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

lethosor

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #805 on: June 10, 2016, 02:13:08 pm »

Yep, since 0.40.24 (January 2015). There was also a DFHack plugin (embark-tools) that did that since July 2014.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #806 on: June 25, 2016, 06:21:46 am »

Is there a script to fix missing floors? Tree cave-ins destroy floor tiles without touching the walls below them. They can be fixed with obsidian floors (using liquids command); however it's difficult to find all the affected areas. It should probably leave constructed fortifications alone, and ideally it would repair the floors with the appropriate layer material.

Maybe have a floating cobweb fix, too. Yet again a tree collapse issue. At least there's deramp for the floating ramps.
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #807 on: June 26, 2016, 02:52:51 pm »

Shilling myself a little bit here with this thread.

Topic: Advanced building reaction idea - Assistance required please

There is a particular idea that came forth from this thread that i'd like to share with you.

A gui/ui bestiary of all creatures, methodically using the DF raws in effect in that world as a bibliographical corpus to read, meaning it would be modification & procedural creature compatible and therefore not hard-coded to require maintenance. Would allow greater control over other plugin effects by distinguishing individual features to be shortcutted in other DFhack applications and allow precision in allowing them to target specific traits (such as via exterminate commands, killing all dwarves with a brown beard as per selecting them from the plugin screen and linking them to that command)

For another example, if the dfhack plugin could also read in-game ID to distinguish, it could help users set up scripts like natural selection amongst livestock (as mentioned by NW_Kohaku for breeding only the desirable animals) and shearing creatures automatically when the appearance changes proc and become woolen to force a shearing job.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #808 on: June 26, 2016, 03:13:26 pm »

oh is that what you were going for

df::global::world->raws is already a fully-featured complete corpus of all raws including generated raws in the save and there are a multitude of scripts and plugins that already use it.

The problem isn't a GUI that can call a script on a variety of units, that's easy. The problem is what specifically the conditions should be; appearance modifiers are hilariously obtuse, for example.
« Last Edit: June 26, 2016, 03:20:35 pm by Putnam »
Logged

FantasticDorf

  • Bay Watcher
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #809 on: June 26, 2016, 04:00:21 pm »

oh is that what you were going for

df::global::world->raws is already a fully-featured complete corpus of all raws including generated raws in the save and there are a multitude of scripts and plugins that already use it.

The problem isn't a GUI that can call a script on a variety of units, that's easy. The problem is what specifically the conditions should be; appearance modifiers are hilariously obtuse, for example.

I couldn't help but beam a huge smile when i re-opened this thread to be greeted with this answer. For more reasons than one.

Getting on topic. Thats interesting information to know for future reference, i evidently wasn't 100% aware of that, and it certainly saves a lot of time if it was required to turn it into a individual unrelated plugin.

Certainly by using arguments within the plugin i am suggesting which could be co-dependent or modeled on df::global::world->raws, couldn't you just assign each (obtuse for most sentient creatures may i add, if it was pet discriminatory it might be able to bypass extreme facial differences etc until it was fine tuned for basic fields) true/false arguements via what features the df.global.world.raws plucks out until it narrows it down to a result? A dog for instance has a wide range of colours but only a set amount of groups to which those range of colours can be assigned.

Setting via the plugin UI and pre-determined set of options as set out by the df::global::world->raws to set everything else not selected to 'false' as to say IRIS:TRUE, TURQUOISE:FALSE, BROWN:FALSE etc etc. in order to engineer what you want in the script.
Logged
Pages: 1 ... 52 53 [54] 55 56 ... 61