2011-06-19 20:29:38 -06:00
|
|
|
#include <dfhack/Core.h>
|
2011-06-22 00:14:21 -06:00
|
|
|
#include <dfhack/Console.h>
|
2011-06-19 20:29:38 -06:00
|
|
|
#include <dfhack/Export.h>
|
2011-06-24 21:35:29 -06:00
|
|
|
#include <dfhack/PluginManager.h>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
using std::string;
|
|
|
|
using namespace DFHack;
|
|
|
|
//FIXME: possible race conditions with calling kittens from the IO thread and shutdown from Core.
|
|
|
|
bool shutdown_flag = false;
|
|
|
|
bool final_flag = true;
|
|
|
|
|
|
|
|
DFhackCExport command_result kittens (Core * c, vector <string> & parameters);
|
2011-06-19 20:29:38 -06:00
|
|
|
|
|
|
|
DFhackCExport const char * plugin_name ( void )
|
|
|
|
{
|
|
|
|
return "kittens";
|
|
|
|
}
|
|
|
|
|
2011-06-24 21:35:29 -06:00
|
|
|
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
|
|
|
|
{
|
|
|
|
commands.clear();
|
|
|
|
commands.push_back(PluginCommand("kittens","Rainbow kittens. What else?",kittens));
|
|
|
|
commands.push_back(PluginCommand("kittanz","Guess what. More rainbow kittenz.",kittens));
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
DFhackCExport command_result plugin_shutdown ( Core * c )
|
|
|
|
{
|
|
|
|
shutdown_flag = true;
|
|
|
|
while(!final_flag)
|
|
|
|
{
|
|
|
|
c->con->msleep(60);
|
|
|
|
}
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
DFhackCExport command_result kittens (Core * c, vector <string> & parameters)
|
2011-06-19 20:29:38 -06:00
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
final_flag = false;
|
|
|
|
Console * con = c->con;
|
2011-06-19 20:29:38 -06:00
|
|
|
const char * kittenz1 []=
|
|
|
|
{
|
|
|
|
" ____",
|
|
|
|
" (. \\",
|
|
|
|
" \\ | ",
|
|
|
|
" \\ |___(\\--/)",
|
|
|
|
" __/ ( . . )",
|
|
|
|
" \"'._. '-.O.'",
|
|
|
|
" '-. \\ \"|\\",
|
|
|
|
" '.,,/'.,,mrf",
|
|
|
|
0
|
|
|
|
};
|
2011-06-22 00:14:21 -06:00
|
|
|
con->cursor(false);
|
|
|
|
con->clear();
|
2011-06-19 20:29:38 -06:00
|
|
|
int color = 1;
|
|
|
|
while(1)
|
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
if(shutdown_flag)
|
|
|
|
{
|
|
|
|
final_flag = true;
|
2011-06-25 00:05:17 -06:00
|
|
|
c->con->reset_color();
|
|
|
|
dfout << std::endl << "MEOW!" << std::endl << std::flush;
|
2011-06-24 21:35:29 -06:00
|
|
|
return CR_OK;
|
|
|
|
}
|
2011-06-22 00:14:21 -06:00
|
|
|
con->color(color);
|
2011-06-19 20:29:38 -06:00
|
|
|
int index = 0;
|
|
|
|
const char * kit = kittenz1[index];
|
2011-06-22 00:14:21 -06:00
|
|
|
con->gotoxy(1,1);
|
|
|
|
dfout << "Your DF is now full of kittens!" << std::endl;
|
2011-06-19 20:29:38 -06:00
|
|
|
while (kit != 0)
|
|
|
|
{
|
2011-06-22 00:14:21 -06:00
|
|
|
con->gotoxy(5,5+index);
|
|
|
|
dfout << kit;
|
2011-06-19 20:29:38 -06:00
|
|
|
index++;
|
|
|
|
kit = kittenz1[index];
|
|
|
|
}
|
2011-06-22 00:14:21 -06:00
|
|
|
dfout.flush();
|
2011-06-24 21:35:29 -06:00
|
|
|
con->msleep(60);
|
2011-06-19 20:29:38 -06:00
|
|
|
color ++;
|
|
|
|
if(color > 15)
|
|
|
|
color = 1;
|
|
|
|
}
|
|
|
|
}
|