formatted notes, deleted more
went through `blame` and `history` to work out value of remaining stuff, formatted notes for other people to read and deleted a few more pluginsdevelop
parent
09620b65fb
commit
e011c390f1
@ -1,72 +1,30 @@
|
||||
Notes by PeridexisErrant, on the needs_porting scripts and plugins:
|
||||
|
||||
I've deleted "reveal", "lair", and "dfstatus.cpp" - they've been replaced by other more recent versions. (I added the dfstatus script).
|
||||
Also deleted "digger", less useful than "digger2" and generally replaced by autochop. "digger2" is replaced by digfort.
|
||||
And now "veinswap"; replaced by "changevein". "fix-3708.cpp" deals with a bug that the Mantis tracker marks as resolved.
|
||||
I deleted:
|
||||
attachtest.py obsolete
|
||||
digger.cpp less useful than digger2, replaced by autochop
|
||||
digger2.cpp replaced by digfort
|
||||
dfstatus.cpp replaced by dfstatus.lua (which needs a little work too)
|
||||
drawtile.cpp replaced by tiletypes
|
||||
fix-3708.cpp obsolete, bug fixed in vanilla
|
||||
lair.cpp replaced by lair
|
||||
reveal.py replaced by reveal
|
||||
treedump.py replaced by prospect & autochop
|
||||
veinlook.cpp replaced by prospect
|
||||
veinswap.cpp replaced by changevein
|
||||
|
||||
|
||||
To investigate further:
|
||||
creaturemanager.cpp modify skills and labors of creatures, kill creatures, etc; impressive but I suspect most functions implemented elsewhere
|
||||
digpattern.cpp allows multi-Z designations. Obsolete, or is there more here?
|
||||
incrementalsearch.cpp linux-only memory stuff; unqualified to judge
|
||||
SegementedFinder.h more memory stuff
|
||||
|
||||
|
||||
Need confirmation that they're obsolete before deleting (notes below):
|
||||
attachtest.py, dfbauxtite.cpp, digpattern.cpp, drawtile.cpp, treedump.py, and veinlook.cpp
|
||||
|
||||
To port:
|
||||
copypaste.cpp, hellhole.cpp, hotkeynotedump.py, itemdesignator.cpp (partial), position.py
|
||||
|
||||
|
||||
All undeleted plugins:
|
||||
|
||||
attachtest.py
|
||||
- checks if dfhack is working with DF (i think)
|
||||
- definitely replaced on windows, pretty sure also on other platforms
|
||||
|
||||
copypaste.cpp
|
||||
- a proof-of-concept plugin to allow copy-pasting in DF
|
||||
- if I read it right, it does both terrain and buildings/constructions
|
||||
- would be awesome if someone ported it!
|
||||
|
||||
creaturemanager.cpp
|
||||
- Display creatures; modify skills and labors of creatures; kill creatures; etc
|
||||
- looks pretty impressive if incomplete (at 1500 lines I only looked over the comments)
|
||||
- could maybe do with porting, but it's unfinished and I suspect that most functions are available elsewhere
|
||||
|
||||
dfbauxtite.cpp
|
||||
- as far as I can tell, this plugin changes the material of all mechanisms (printed string 'mechanisms', class 'item_trapparts') to Bauxtite; presumably from when this was the only magma-safe stone.
|
||||
- I don't know of a newer alternative, but it's not really neccessary anymore
|
||||
|
||||
digpattern.cpp
|
||||
- I think all this one does is allow multi-z designations - no longer required.
|
||||
|
||||
drawtile.cpp
|
||||
- draws changes to tiles
|
||||
- I think this is replaced by tiletypes, but not sure
|
||||
|
||||
hellhole.cpp
|
||||
- digs a hole to HFS instantly
|
||||
- no known equivilant, needs porting
|
||||
|
||||
hotkeynotedump.py
|
||||
- outputs a list of hotkeys with names
|
||||
- less useful with propper dfhack keybindings available, but still useful
|
||||
- trivial to redo in lua (it's 20 lines, could be 10)
|
||||
|
||||
incrementalsearch.cpp
|
||||
- linux-only memory voodoo; leaving this alone
|
||||
|
||||
itemdesignator.cpp
|
||||
- applies flags to categories of items (eg item_microcline; forbid/dump/melt/on fire)
|
||||
- appart from fire, replaced by Falconne's enhanced stocks screen
|
||||
- port the fire part?
|
||||
|
||||
position.py
|
||||
- prints information about time (year/month/day/tick) and place (embark location/cursor pos) and window size
|
||||
- the wider context can be written to gamelog on world load by "log-region.lua"; this doesn't seem to be included yet
|
||||
|
||||
SegementedFinder.h
|
||||
- no idea what's happening here
|
||||
|
||||
treedump.py
|
||||
- looks like it outputs a list of trees in a given volume
|
||||
- overlaps with 'prospect' and 'autochop'; probably does not need porting
|
||||
|
||||
veinlook.cpp
|
||||
- I'm not sure what this does that "digv" and "reveal" don't but there must be something since it was around at the same time as reveal.
|
||||
|
||||
copypaste.cpp high value target - a proof of concept plugin to allow copy-pasting in DF; does both terrain and buildings/constructions
|
||||
dfbauxtite.cpp changes material of mechanisms to bauxtite (ie magma-safe)
|
||||
hellhole.cpp instantly creates a hole to the HFS
|
||||
hotkeynotedump.py outputs a list of hotkeys and names; most useful before keybindings were possible. Trival to port but low value.
|
||||
itemdesignator.cpp mostly replaced by Falconne's enhanced stocks, but could port the interesting 'set fire to things' function
|
||||
position.py outputs very detailed time& place info
|
||||
|
@ -1,53 +0,0 @@
|
||||
import time
|
||||
from pydfhack import ContextManager
|
||||
|
||||
df_cm = ContextManager("Memory.xml")
|
||||
df = None
|
||||
|
||||
def test_attach():
|
||||
global df
|
||||
|
||||
if not df:
|
||||
df = df_cm.get_single_context()
|
||||
|
||||
if not df.attach():
|
||||
print "Unable to attach!"
|
||||
return False
|
||||
elif not df.detach():
|
||||
print "Unabled to detach!"
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def suspend_test():
|
||||
global df
|
||||
|
||||
if not df:
|
||||
df = df_cm.get_single_context()
|
||||
|
||||
print "Testing suspend/resume"
|
||||
|
||||
df.attach()
|
||||
|
||||
t1 = time.time()
|
||||
|
||||
for i in xrange(1000):
|
||||
df.suspend()
|
||||
|
||||
if i % 10 == 0:
|
||||
print "%i%%" % (i / 10.0,)
|
||||
|
||||
df.resume()
|
||||
|
||||
t2 = time.time()
|
||||
|
||||
df.detach()
|
||||
|
||||
print "suspend test done in $0.9f seconds" % (t2 - t1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if test_attach():
|
||||
suspend_test()
|
||||
|
||||
print "Done. Press any key to continue"
|
||||
raw_input()
|
@ -1,315 +0,0 @@
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
using namespace std;
|
||||
|
||||
#include <conio.h>
|
||||
|
||||
|
||||
#include <DFHack.h>
|
||||
#include <DFTileTypes.h>
|
||||
|
||||
//Avoid including Windows.h because it causes name clashes
|
||||
extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long milliseconds);
|
||||
|
||||
//Trim
|
||||
#define WHITESPACE " \t\r\n"
|
||||
inline string trimr(const string & s, const string & t = WHITESPACE)
|
||||
{
|
||||
string d (s);
|
||||
string::size_type i (d.find_last_not_of (t));
|
||||
if (i == string::npos)
|
||||
return "";
|
||||
else
|
||||
return d.erase (d.find_last_not_of (t) + 1) ;
|
||||
}
|
||||
inline string triml(const string & s, const string & t = WHITESPACE)
|
||||
{
|
||||
string d (s);
|
||||
return d.erase (0, s.find_first_not_of (t)) ;
|
||||
}
|
||||
inline string trim(const string & s, const string & t = WHITESPACE)
|
||||
{
|
||||
string d (s);
|
||||
return triml(trimr(d, t), t);
|
||||
}
|
||||
|
||||
void printtiletype( int i ){
|
||||
printf("%s\n%4i ; %-13s ; %-11s ; %c ; %-12s ; %s\n",
|
||||
( DFHack::tileTypeTable[i].name ? DFHack::tileTypeTable[i].name : "[invalid tile]" ),
|
||||
i,
|
||||
( DFHack::tileTypeTable[i].name ? DFHack::TileShapeString[ DFHack::tileTypeTable[i].shape ] : "" ),
|
||||
( DFHack::tileTypeTable[i].name ? DFHack::TileMaterialString[ DFHack::tileTypeTable[i].material ] : "" ),
|
||||
( DFHack::tileTypeTable[i].variant ? '0'+ DFHack::tileTypeTable[i].variant : ' ' ),
|
||||
( DFHack::tileTypeTable[i].special ? DFHack::TileSpecialString[ DFHack::tileTypeTable[i].special ] : "" ),
|
||||
( DFHack::tileTypeTable[i].direction.whole ? DFHack::tileTypeTable[i].direction.getStr() : "" ),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int32_t x,y,z,tx,ty;
|
||||
//DFHack::designations40d designations;
|
||||
DFHack::tiletypes40d tiles;
|
||||
//DFHack::t_temperatures temp1,temp2;
|
||||
uint32_t x_max,y_max,z_max;
|
||||
int32_t oldT, newT;
|
||||
int count, dirty;
|
||||
|
||||
//Brush defaults
|
||||
DFHack::TileShape BrushClass = DFHack::WALL;
|
||||
DFHack::TileMaterial BrushMat = DFHack::tilematerial_invalid;
|
||||
int BrushType = -1;
|
||||
|
||||
DFHack::ContextManager DFMgr("Memory.xml");
|
||||
DFHack::Context *DF;
|
||||
DFHack::Maps * Maps;
|
||||
DFHack::Gui * Gui;
|
||||
try
|
||||
{
|
||||
DF=DFMgr.getSingleContext();
|
||||
DF->Attach();
|
||||
Maps = DF->getMaps();
|
||||
Maps->Start();
|
||||
Maps->getSize(x_max,y_max,z_max);
|
||||
Gui = DF->getGui();
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cerr << e.what() << endl;
|
||||
#ifndef LINUX_BUILD
|
||||
cin.ignore();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
bool end = false;
|
||||
cout << "Welcome to the Tile Drawing tool.\nType 'help' or ? for a list of available commands, 'q' to quit" << endl;
|
||||
string mode = "wall";
|
||||
string command = "";
|
||||
|
||||
while(!end)
|
||||
{
|
||||
DF->Resume();
|
||||
|
||||
cout << endl << ":";
|
||||
getline(cin, command);
|
||||
int ch = command[0];
|
||||
if(command.length()<=0) ch=0;
|
||||
if( ((int)command.find("help")) >=0 ) ch='?'; //under windows, find was casting unsigned!
|
||||
switch(ch)
|
||||
{
|
||||
case '?':
|
||||
cout << "Modes:" << endl
|
||||
<< "O - draw Open Space" << endl
|
||||
<< "M - draw material only (shape unchanged)" << endl
|
||||
<< "m number - use Material value entered" << endl
|
||||
<< "r - use Rock/stone material" << endl
|
||||
<< "l - use Soil material" << endl
|
||||
<< "v - use Vein material" << endl
|
||||
<< "H - draw tile shape only (material unchanged)" << endl
|
||||
<< "h number - draw Tile Shape value entered" << endl
|
||||
<< "w - draw Wall tiles" << endl
|
||||
<< "f - draw Floor tiles" << endl
|
||||
<< "t number - draw exact tile type entered" << endl
|
||||
<< "Commands:" << endl
|
||||
<< "p - print tile shapes and materials, and current brush" << endl
|
||||
<< "P - print all tile types" << endl
|
||||
<< "q - quit" << endl
|
||||
<< "help OR ? - print this list of commands" << endl
|
||||
<< "d - being drawing" << endl
|
||||
<< endl
|
||||
<< "Usage:\nChoose a mode (default is walls), then enter 'd' to being drawing.\nMove the cursor in DF wherever you want to draw.\nPress any key to pause drawing." << endl;
|
||||
break;
|
||||
case 'p':
|
||||
//Classes
|
||||
printf("\nTile Type Classes:\n");
|
||||
for(int i=0;i<DFHack::tileshape_count;++i)
|
||||
{
|
||||
printf("%4i ; %s\n", i, DFHack::TileShapeString[i] ,0 );
|
||||
}
|
||||
//Materials
|
||||
printf("\nTile Type Materials:\n");
|
||||
for(int i=0;i<DFHack::tilematerial_count;++i)
|
||||
{
|
||||
printf("%4i ; %s\n", i, DFHack::TileMaterialString[i] ,0 );
|
||||
}
|
||||
//fall through...
|
||||
case 10:
|
||||
case 13:
|
||||
case 0:
|
||||
//Print current cursor & brush settings.
|
||||
cout << "\nCurrent Brush:\n";
|
||||
cout << "tile = ";
|
||||
if(BrushClass<0) cout<<"(not drawing)"; else cout<<DFHack::TileShapeString[BrushClass]; cout << endl;
|
||||
cout << "mat = ";
|
||||
if(BrushMat<0) cout<<"(not drawing)"; else cout<<DFHack::TileMaterialString[BrushMat]; cout << endl;
|
||||
cout << "type = ";
|
||||
if(BrushType<0){
|
||||
cout<<"(not drawing)";
|
||||
}else{
|
||||
printtiletype(BrushType);
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
cout << "\nAll Valid Tile Types:\n";
|
||||
for(int i=0;i<TILE_TYPE_ARRAY_LENGTH;++i)
|
||||
{
|
||||
if( DFHack::tileTypeTable[i].name )
|
||||
printtiletype(i);
|
||||
}
|
||||
case 'w':
|
||||
BrushType=-1;
|
||||
BrushClass = DFHack::WALL;
|
||||
cout << "Tile brush shape set to Wall." << endl;
|
||||
break;
|
||||
case 'f':
|
||||
BrushType=-1;
|
||||
BrushClass = DFHack::FLOOR;
|
||||
cout << "Tile brush shape set to Floor." << endl;
|
||||
break;
|
||||
case 'h':
|
||||
BrushType=-1;
|
||||
BrushClass = (DFHack::TileShape)atol( command.c_str()+1 );
|
||||
cout << "Tile brush shape set to " << BrushClass << endl;
|
||||
break;
|
||||
case 'M':
|
||||
BrushClass = DFHack::tileshape_invalid;
|
||||
cout << "Tile brush will not draw tile shape." << endl;
|
||||
break;
|
||||
case 'r':
|
||||
BrushType=-1;
|
||||
BrushMat = DFHack::STONE;
|
||||
cout << "Tile brush material set to Rock." << endl;
|
||||
break;
|
||||
case 'l':
|
||||
BrushType=-1;
|
||||
BrushMat = DFHack::SOIL;
|
||||
cout << "Tile brush material set to Soil." << endl;
|
||||
break;
|
||||
case 'v':
|
||||
BrushType=-1;
|
||||
BrushMat = DFHack::VEIN;
|
||||
cout << "Tile brush material set to Vein." << endl;
|
||||
break;
|
||||
case 'm':
|
||||
BrushType=-1;
|
||||
BrushMat = (DFHack::TileMaterial)atol( command.c_str()+1 );
|
||||
cout << "Tile brush material set to " << BrushMat << endl;
|
||||
break;
|
||||
case 'H':
|
||||
BrushMat = DFHack::tilematerial_invalid;
|
||||
cout << "Tile brush will not draw material." << endl;
|
||||
break;
|
||||
case 'O':
|
||||
BrushType=-1;
|
||||
BrushClass = DFHack::EMPTY;
|
||||
BrushMat = DFHack::AIR;
|
||||
cout << "Tile brush will draw Open Space." << endl;
|
||||
break;
|
||||
case 't':
|
||||
BrushClass = DFHack::tileshape_invalid ;
|
||||
BrushMat = DFHack::tilematerial_invalid;
|
||||
BrushType = atol( command.c_str()+1 );
|
||||
cout << "Tile brush type set to:" << endl;
|
||||
printtiletype(BrushType);
|
||||
break;
|
||||
case 'q':
|
||||
end = true;
|
||||
cout << "Bye!" << endl;
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
count=0;
|
||||
cout << "Beginning to draw at cursor." << endl << "Press any key to stop drawing." << endl;
|
||||
//DF->Suspend();
|
||||
kbhit(); //throw away, just to be sure.
|
||||
for(;;)
|
||||
{
|
||||
if(!Maps->Start())
|
||||
{
|
||||
cout << "Can't see any DF map loaded." << endl;
|
||||
break;
|
||||
}
|
||||
if(!Gui->getCursorCoords(x,y,z))
|
||||
{
|
||||
cout << "Can't get cursor coords! Make sure you have a cursor active in DF." << endl;
|
||||
break;
|
||||
}
|
||||
//cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
|
||||
tx=x%16; ty=y%16;
|
||||
|
||||
if(!Maps->isValidBlock(x/16,y/16,z))
|
||||
{
|
||||
cout << "Invalid block." << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
//Read the tiles.
|
||||
dirty=0;
|
||||
Maps->ReadTileTypes((x/16),(y/16),z, &tiles);
|
||||
oldT = tiles[tx][ty];
|
||||
|
||||
newT = -1;
|
||||
if( 0<BrushType ){
|
||||
//Explicit tile type set. Trust the user.
|
||||
newT = BrushType;
|
||||
}else if( 0==BrushMat && 0==BrushClass ){
|
||||
//Special case, Empty Air.
|
||||
newT = 32;
|
||||
}else if( BrushMat>=0 && BrushClass>=0 && ( BrushClass != DFHack::tileTypeTable[oldT].shape || BrushMat != DFHack::tileTypeTable[oldT].material) ){
|
||||
//Set tile material and class
|
||||
newT = DFHack::findTileType(BrushClass,BrushMat, DFHack::tileTypeTable[oldT].variant , DFHack::tileTypeTable[oldT].special , DFHack::tileTypeTable[oldT].direction );
|
||||
if(newT<0) newT = DFHack::findTileType(BrushClass,BrushMat, DFHack::tilevariant_invalid, DFHack::tileTypeTable[oldT].special , DFHack::tileTypeTable[oldT].direction );
|
||||
if(newT<0) newT = DFHack::findTileType(BrushClass,BrushMat, DFHack::tilevariant_invalid , DFHack::tileTypeTable[oldT].special , (uint32_t)0 );
|
||||
}else if( BrushMat<0 && BrushClass>=0 && BrushClass != DFHack::tileTypeTable[oldT].shape ){
|
||||
//Set current tile class only, as accurately as can be expected
|
||||
newT = DFHack::findSimilarTileType(oldT,BrushClass);
|
||||
}else if( BrushClass<0 && BrushMat>=0 && BrushMat != DFHack::tileTypeTable[oldT].material ){
|
||||
//Set current tile material only
|
||||
newT = DFHack::findTileType(DFHack::tileTypeTable[oldT].shape,BrushMat, DFHack::tileTypeTable[oldT].variant , DFHack::tileTypeTable[oldT].special , DFHack::tileTypeTable[oldT].direction );
|
||||
if(newT<0) newT = DFHack::findTileType(DFHack::tileTypeTable[oldT].shape,BrushMat, DFHack::tilevariant_invalid , DFHack::tileTypeTable[oldT].special , DFHack::tileTypeTable[oldT].direction );
|
||||
if(newT<0) newT = DFHack::findTileType(DFHack::tileTypeTable[oldT].shape,BrushMat, DFHack::tilevariant_invalid , DFHack::tileTypeTable[oldT].special , (uint32_t)0 );
|
||||
}
|
||||
//If no change, skip it (couldn't find a good tile type, or already what we want)
|
||||
if ( newT > 0 && oldT != newT ){
|
||||
//Set new tile type
|
||||
tiles[tx][ty] = newT;
|
||||
dirty=-1;
|
||||
}
|
||||
//If anything was changed, write it all.
|
||||
if (dirty)
|
||||
{
|
||||
//Maps->WriteDesignations(x/16,y/16,z/16, &designations);
|
||||
Maps->WriteTileTypes(x/16,y/16,z, &tiles);
|
||||
printf("(%4d,%4d,%4d)",x,y,z);
|
||||
++count;
|
||||
}
|
||||
|
||||
Maps->Finish();
|
||||
|
||||
Sleep(10);
|
||||
if( kbhit() ) break;
|
||||
}
|
||||
cin.clear();
|
||||
cout << endl << count << " tiles were drawn." << endl << "Drawing halted. Entering command mode." << endl;
|
||||
}
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown command: " << command << endl;
|
||||
}
|
||||
|
||||
}
|
||||
DF->Detach();
|
||||
#ifndef LINUX_BUILD
|
||||
cout << "Done. Press any key to continue" << endl;
|
||||
cin.ignore();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
from context import Context, ContextManager
|
||||
|
||||
cm = ContextManager("Memory.xml")
|
||||
df = cm.get_single_context()
|
||||
|
||||
df.attach()
|
||||
|
||||
gui = df.gui
|
||||
veg = df.vegetation
|
||||
mps = df.maps
|
||||
mat = df.materials
|
||||
|
||||
x, y, z = gui.get_cursor_coords()
|
||||
|
||||
num_veg = veg.start()
|
||||
|
||||
if x == -30000:
|
||||
print "----==== Trees ====----"
|
||||
|
||||
for i in xrange(num_veg):
|
||||
t = veg.read(i)
|
||||
|
||||
print "%d/%d/%d, %d:%d" % (t.x, t.y, t.z, t.type, t.material)
|
||||
else:
|
||||
#new method, gets the list of trees in a block. can show farm plants
|
||||
if mps.start():
|
||||
pos_tuple = (x, y, z)
|
||||
trees = mps.read_vegetation(x / 16, y / 16, z)
|
||||
|
||||
if trees is not None:
|
||||
for t in trees:
|
||||
if (t.x, t.y, t.z) == pos_tuple:
|
||||
print "----==== Tree at %d/%d/%d ====----" % pos_tuple
|
||||
print str(t)
|
||||
break
|
||||
mps.finish()
|
||||
|
||||
#old method, get the tree from the global vegetation vector. can't show farm plants
|
||||
for i in xrange(num_veg):
|
||||
t = veg.read(i)
|
||||
|
||||
if (t.x, t.y, t.z) == pos_tuple:
|
||||
print "----==== Tree at %d/%d/%d ====----" % pos_tuple
|
||||
print str(t)
|
||||
break
|
||||
|
||||
veg.finish()
|
||||
|
||||
df.detach()
|
||||
|
||||
print "Done. Press any key to continue"
|
||||
raw_input()
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue