Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5] 6 7 ... 61

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

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #60 on: January 30, 2013, 05:56:53 am »

(on that note, if anyone manages to crack workshops that require power, compact logic gates would be a natural first step)
Done by angavrilov in power meter plugin (a presureplate new mode that detects when mechanical power is applied)

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #61 on: January 30, 2013, 11:28:24 am »

Also allowed to have different type:
  • Caravan
  • Migrants
  • Diplomat
  • CivAttack
  • FeatureAttack - unused, does nothing
  • Megabeast
  • WildlifeCurious
  • WildlifeMischievous
  • WildlifeFlier
  • NightCreature
Might need to set up entity for those entries that need it (civ attack/caravan/diplomat etc...) or other fields that are unknown.

Aha! Fixed that issue. Here's the script (preferably "force.lua" or "forceevent.lua":

Code: [Select]
-- Forces an event.
--Function codes all based on Quietust's code.


local EventType = ...


if EventType == "caravan" or EventType == "diplomat" or EventType == "siege" or EventType == "migrants" then
if dfhack.gui.getSelectedUnit().civ_id==nil then
qerror('Caravan, diplomat, migrants and siege require a civ unit to be highlighted.')
end
end

--code may be kind of bad below :V Putnam ain't experienced in lua...
if EventType ~= "caravan" and EventType ~= "migrants" and EventType ~= "diplomat" and EventType ~= "megabeast" and EventType ~= "curiousbeast" and EventType ~= "mischievousbeast" and EventType ~= "mischeviousbeast" and EventType ~= "flier" and EventType ~= "siege" and EventType ~= "nightcreature" then
qerror('Invalid argument. Valid arguments are caravan, migrants, diplomat, megabeast, curiousbeast, mischievousbeast, flier, siege and nightcreature.')
end

function force_megabeast()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Megabeast, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
end

function force_migrants()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Migrants, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(dfhack.gui.getSelectedUnit().civ_id) } )
end

function force_caravan()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Caravan, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(dfhack.gui.getSelectedUnit().civ_id) } )
end

function force_diplomat()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Diplomat, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(dfhack.gui.getSelectedUnit().civ_id) } )
end

function force_curious()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.WildlifeCurious, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
end

function force_mischievous()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.WildlifeMichievous, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
end

function force_flier()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.WildlifeFlier, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
end

function force_siege()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.CivAttack, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(dfhack.gui.getSelectedUnit().civ_id) } )
end

function force_nightcreature()
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.NightCreature, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
end

--this code may be bad too :V

if EventType=="caravan" then force_caravan()
elseif EventType=="migrants" then force_migrants()
elseif EventType=="diplomat" then force_diplomat()
elseif EventType=="megabeast" then force_megabeast()
elseif EventType=="curiousbeast" then force_curious()
elseif EventType=="mischievousbeast" or EventType=="mischeviousbeast" then force_mischievous()
elseif EventType=="flier" then force_flier()
elseif EventType=="siege" then force_siege()
elseif EventType=="nightcreature" then force_nightcreature()
end
« Last Edit: January 30, 2013, 01:11:00 pm by Putnam »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #62 on: January 30, 2013, 12:14:35 pm »

<...>
Quickly glancing over it looks okay. Although we really need to make some lua/dfhack tutorials (lua is a strange language, and most of the stuff can be done very simply by (ab)using tables).

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #63 on: January 30, 2013, 01:10:26 pm »

I saw some of the table stuff, and... haha, I'll learn that later :P

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #64 on: January 30, 2013, 04:02:14 pm »

Can dfhack affect pathfinding in any way?

Something to order dwarves to specifically build/dig from a particular direction would be massively useful. No more collapsing the floor they're standing on, no more walling themselves in, no more "creature occupying site" because they're standing where they're trying to build something.
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #65 on: January 30, 2013, 05:06:56 pm »

Can dfhack affect pathfinding in any way?

Something to order dwarves to specifically build/dig from a particular direction would be massively useful. No more collapsing the floor they're standing on, no more walling themselves in, no more "creature occupying site" because they're standing where they're trying to build something.
Not really. We could mark to recalc the pathfinding (i think, but that happens every time you lock doors). And maybe paint connected path areas (that is quite useless)

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID
Re: [SUGGESTIONS] for DFhack plugins
« Reply #66 on: January 30, 2013, 07:04:34 pm »

Can dfhack affect pathfinding in any way?

Something to order dwarves to specifically build/dig from a particular direction would be massively useful. No more collapsing the floor they're standing on, no more walling themselves in, no more "creature occupying site" because they're standing where they're trying to build something.
Not really. We could mark to recalc the pathfinding (i think, but that happens every time you lock doors). And maybe paint connected path areas (that is quite useless)
Speaking of pathfinding; I know this may seem rather pointless at first glance, but could there be a DFHack plugin that can draw on screen the shortest path between 2 points? Or something of the sort?

Think of it like how the (D)epot Access key can show the pathfinding range of wagons accessing the fortress (to the depot, at least). But that's only scaled to the wagon's width. In a way, it would be a way of seeing the path that migrants and kobolds would likely take; and depending on how you're building your fort or the walls, a way of seeing if there are any holes in the system (besides the entrances) that they can sneak through that you overlooked. Would be especially useful for multi-Z-level defense building.

It would also be a good way to see if the path to your base is truly airtight, and the only way through (besides the front door) is the gauntlet of death in an alternative entryway. I dunno. Kinda sounds noobish, now that I look back at it.

EDIT:
Considering you can choose the 2 points for it to pathfind ("open spaces only" being optional; as well as building destroyer pathfinding)), it could alternatively help as a way of optimizing military pathfinding to good defense points and such, especially if you have a fancy layout (planned (registers designations like open spaces (up/down, ramps and etc. could be included)); sounds more useful than before)) for your fort. It could even tell you how many tiles (best case scenario) are being traveled. But I think it would be more of a hindsight tool, unless you can use an overlay mode for when you set a designation (but then you would need more points for it to map out with, since you're testing a pathfinding on designated squares for mining), and want to see the distance traveled between points; which alternatively can work as a measuring device as well.

EDIT EDIT:
Alternatively, to save on processing power, the pathfinder can choose the nearest available corner (in case you have rivers cutting off portions of the map), and project a line towards the pointer, drawing a pathfinding vector similar to military waypoint pathfinding (unless those are direct vector paths, then nevermind; but have a similar style of projecting overlay), or something. It can even be integrated with the Depot Access screen to make that function a tad more flexible. Actually, while on Depot Access, hit TAB to change display modes (Merchant, Invaders, Dwarves (which displays the pathfinding you assigned in D-O mode). Personally, it's better than getting a visual by watching migrants reach your fort interior in order to find the leaks.
« Last Edit: February 03, 2013, 01:30:38 am by Itnetlolor »
Logged

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #67 on: January 30, 2013, 08:05:40 pm »

I'd really like to see some additional options to the prospect function.

Specifically, prospected a flood selected region, (such as through the dbc type flood selector) and an option to have it report types and depths of grass tiles.

I recently did some soil and mud experiments, but was unable to accurately get counts on grasses in arbitrary locations, and had to go through convoluted methods to selectively hide and reveal map areas to prospect for other plant types and numbers in arbitrary locations.

Something like:

PROSPECT FLOOD

And

PROSPECT FLOOD GRASS

Logged

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #68 on: January 30, 2013, 08:44:10 pm »

Are there any coordinate values that can be used to teleport a unit? Or perhaps force a unit to load in your map from anywhere in the world?
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

McGrog

  • Escaped Lunatic
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #69 on: January 31, 2013, 10:04:33 pm »

I am very interested in workshops that require power, as already mentioned. The ability to get rid of vanilla buildings is also cool, does this consider moods?

The other idea was allowing shops to use water and/or magma the way the Steam Engine does, perhaps through a <wateruser> and <magmauser> tags in the building RAWs? Hopefully could be combined with power use?
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #70 on: February 01, 2013, 01:31:18 am »

the ability to initiate "some migrants have arrived"

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #71 on: February 01, 2013, 01:34:09 am »

the ability to initiate "some migrants have arrived"

I posted that script just a few posts ago.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #72 on: February 01, 2013, 10:50:34 am »

Are there any coordinate values that can be used to teleport a unit? Or perhaps force a unit to load in your map from anywhere in the world?
well you can warp units base on their position, just that's separate from forcing a unit to load on to your map... hmm might test out the unit spawner to see if copying a unit data can be done.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #73 on: February 01, 2013, 05:03:58 pm »

But can you select off-map units for flag changing, if you know their id?
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [SUGGESTIONS] for DFhack plugins
« Reply #74 on: February 01, 2013, 06:34:20 pm »

Actually, I think I'd better ask this here...

Any way to detect a creature's body size?
Pages: 1 ... 3 4 [5] 6 7 ... 61