AutoSyndrome: allowed for triggering DFHack commands from in game reactions.

develop
expwnent 2012-12-22 00:13:07 -05:00
parent 0b157974f5
commit a4dc79565a
1 changed files with 22 additions and 2 deletions

@ -234,12 +234,32 @@ void processJob(color_ostream& out, void* jobPtr) {
//must be a boiling rock syndrome //must be a boiling rock syndrome
df::inorganic_raw* inorganic = df::global::world->raws.inorganics[bob->mat_index]; df::inorganic_raw* inorganic = df::global::world->raws.inorganics[bob->mat_index];
if ( inorganic->material.heat.boiling_point > 10000 ) if ( inorganic->material.heat.boiling_point > 10000 ) {
continue; //continue;
}
for ( size_t b = 0; b < inorganic->material.syndrome.size(); b++ ) { for ( size_t b = 0; b < inorganic->material.syndrome.size(); b++ ) {
//add each syndrome to the guy who did the job //add each syndrome to the guy who did the job
df::syndrome* syndrome = inorganic->material.syndrome[b]; df::syndrome* syndrome = inorganic->material.syndrome[b];
bool foundCommand = false;
string commandStr;
vector<string> args;
for ( size_t c = 0; c < syndrome->syn_class.size(); c++ ) {
std::string* clazz = syndrome->syn_class[c];
out.print("Class = %s\n", clazz->c_str());
if ( foundCommand ) {
if ( commandStr == "" )
commandStr = *clazz;
else
args.push_back(*clazz);
} else if ( *clazz == "command" ) {
foundCommand = true;
}
}
if ( commandStr != "" ) {
out.print("Running command thingy.");
Core::getInstance().runCommand(out, commandStr, args);
}
//check that the syndrome applies to that guy //check that the syndrome applies to that guy
/* /*
* If there is no affected class or affected creature, then anybody who isn't immune is fair game. * If there is no affected class or affected creature, then anybody who isn't immune is fair game.