Exemple #1
0
void QNetCtlTool::scanWifi(QString device)
{
    if (device.isNull() && sender())
        device = sender()->property("QNetCtlScanDevice").toString();

    if (myScanningDevices.contains(device))
        return;

    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    env.remove("LC_ALL");
    env.remove("LANG");
    QProcess *proc = new QProcess(this);
    proc->setProcessEnvironment(env);

    bool isDown = false;
    proc->start(TOOL(ip) + " link show " + device, QIODevice::ReadOnly);
    proc->waitForFinished();
    if (proc->exitStatus() == QProcess::NormalExit && !proc->exitCode())
        isDown = !QString::fromLocal8Bit(proc->readAllStandardOutput()).section('>', 0, 0).contains("UP");

    bool waitsForUp = myUplinkingDevices.contains(device);

    if (isDown) {
        if (!waitsForUp) {
            waitsForUp = true;
            myUplinkingDevices << device;
            proc->start(TOOL(ip) + " link set " + device + " up", QIODevice::ReadOnly);
            proc->waitForFinished();
        }

        // we're waiting for the device to come up
        delete proc;
        QTimer *t = new QTimer(this);
        t->setProperty("QNetCtlScanDevice", device);
        t->setSingleShot(true);
        connect(t, SIGNAL(timeout()), this, SLOT(scanWifi()));
        connect(t, SIGNAL(timeout()), t, SLOT(deleteLater()));
        t->start(500);
        return;
    }

    myScanningDevices << device;

    proc->setProperty("QNetCtlTag", "scan_wifi");
    proc->setProperty("QNetCtlInfo", device);
    // if we set it up, we've to set it back down through the chain slot
    connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), waitsForUp ? SLOT(chain()) : SLOT(reply()));
    connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));
    proc->start(TOOL(iw) + " dev " + device + " scan");
}
Exemple #2
0
void QNetCtlTool::chain()
{
    QProcess *proc = static_cast<QProcess*>(sender());
    const QString tag = proc->property("QNetCtlTag").toString();
    const QString info = proc->property("QNetCtlInfo").toString();
    if (proc->exitStatus() != QProcess::NormalExit || proc->exitCode()) {
        myClient->call(QDBus::NoBlock, "reply", tag, QString("ERROR: %1, %2").arg(proc->exitStatus()).arg(proc->exitCode()));
        return;
    }
    myClient->call(QDBus::NoBlock, "reply", tag, QString::fromLocal8Bit(proc->readAllStandardOutput()));

    QString cmd;
    if (tag == "remove_profile") {
        QFile::remove(gs_profilePath + info);
    } else if (tag == "scan_wifi") {
        myScanningDevices.removeAll(info);
        myUplinkingDevices.removeAll(info);
        cmd = TOOL(ip) + " link set " + info + " down";
    }

    if (cmd.isNull()) // should not happen
        return;

    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    env.remove("LC_ALL");
    env.remove("LANG");
    proc = new QProcess(this);
    proc->setProcessEnvironment(env);
//     proc->setProperty("QNetCtlTag", tag);
//     connect (proc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(reply()));
    connect (proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));
    proc->start(cmd, QIODevice::ReadOnly);
}
Exemple #3
0
void toc_destroy( WINDOW *win )
{
  toc_valid( TOOL( win ) );
  destroy_toc_data( DataSearch( win, TW_MAGIC ) );
  WindClose( win );
  WindDelete( win );
  toc_win = NULL;
}
Exemple #4
0
void toc_toolbar( WINDOW * win )
{
  OBJECT * tool;
  int obj;
  tool = TOOL( win );
  obj = evnt.buff[4];
  switch( obj )
  {
  case TTB_SOURCE:
  case TTB_SRCCYC:
    if( popup_mgr( win, &toc_popup, obj ) == 0 )
    {
      fileselect( toc_info.toc_file, "*.cd", "TXT_DAOFILE" );
      tool[ TTB_SOURCE ].ob_spec.free_string = toc_info.toc_fred;
      reduce_name( toc_info.toc_fred, toc_info.toc_file, MAX_FRED_TOC );
      ObjcDraw( OC_TOOLBAR, win, TTB_SOURCE, MAX_DEPTH );
    }
    toc_gestion_acces( win );
    break;
  case TTB_EXTRACT:
    toc_extract( win );
    break;
  case TTB_FORMAT:
  case TTB_FRMTCYC:
    popup_mgr( win, &fmt_popup, obj );
    break;
  case TTB_LOAD:
  case TTB_EJECT:
    dev_insert_open( toc_popup.item[toc_popup.selected].info, obj == TTB_EJECT );
    break;
  case TTB_READTOC:
    toc_readtoc( win );
    toc_gestion_acces( win );
    break;
  case TTB_CANCEL:
    ApplWrite( app.id, WM_DESTROY, win->handle );
    break;
  }
}
Exemple #5
0
void toc_gestion_acces( WINDOW * win )
{
  struct _toc_data * data;
  OBJECT * tool;
  int i, enable;
  tool = TOOL( win );
  data = DataSearch( win, TW_MAGIC );

  enable = toc_popup.selected != 0;
  objc_lock( tool, TTB_LOAD, !enable );
  objc_lock( tool, TTB_EJECT, !enable );

  if( data )
  {
    enable = 0;
    i = 0;
    while( i < data->n_tracks && !enable )
      enable = data->tree[ 2 + data->n_obj * i++ ].ob_state & SELECTED;
    objc_lock( tool, TTB_EXTRACT, !enable );
  }
  else
    objc_lock( tool, TTB_EXTRACT, 1 );
}
void game::init_construction()
{
 int id = -1;
 int tl, cl, sl;

 #define CONSTRUCT(name, difficulty, able, done) \
  sl = -1; id++; \
  constructions.push_back( new constructable(id, name, difficulty, able, done))

 #define STAGE(...)\
  tl = 0; cl = 0; sl++; \
  constructions[id]->stages.push_back(construction_stage(__VA_ARGS__));
 #define TOOL(...)   setvector(constructions[id]->stages[sl].tools[tl], \
                               __VA_ARGS__); tl++
 #define COMP(...)   setvector(constructions[id]->stages[sl].components[cl], \
                               __VA_ARGS__); cl++

/* CONSTRUCT( name, time, able, done )
 * Name is the name as it appears in the menu; 30 characters or less, please.
 * time is the time in MINUTES that it takes to finish this construction.
 *  note that 10 turns = 1 minute.
 * able is a function which returns true if you can build it on a given tile
 *  See construction.h for options, and this file for definitions.
 * done is a function which runs each time the construction finishes.
 *  This is useful, for instance, for removing the trap from a pit, or placing
 *  items after a deconstruction.
 */

 CONSTRUCT(_("Dig Pit"), 0, &construct::able_dig, &construct::done_pit);
  STAGE(t_pit_shallow, 10);
   TOOL(itm_shovel, NULL);
  STAGE(t_pit, 10);
   TOOL(itm_shovel, NULL);

 CONSTRUCT(_("Spike Pit"), 0, &construct::able_pit, &construct::done_trap_pit);
  STAGE(t_pit_spiked, 5);
   COMP(itm_spear_wood, 4, NULL);

 CONSTRUCT(_("Fill Pit"), 0, &construct::able_pit, &construct::done_fill_pit);
  STAGE(t_pit_shallow, 5);
   TOOL(itm_shovel, NULL);
  STAGE(t_dirt, 5);
   TOOL(itm_shovel, NULL);

 CONSTRUCT(_("Clean Broken Window"), 0, &construct::able_broken_window,
                                     &construct::done_nothing);
  STAGE(t_window_empty, 5);

 CONSTRUCT(_("Remove Window Pane"),  1, &construct::able_window_pane,
                                     &construct::done_window_pane);
  STAGE(t_window_empty, 10);
   TOOL(itm_hammer, itm_rock, itm_hatchet, NULL);
   TOOL(itm_screwdriver, itm_knife_butter, itm_toolset, NULL);

 CONSTRUCT(_("Repair Door"), 1, &construct::able_door_broken,
                             &construct::done_nothing);
  STAGE(t_door_c, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 3, NULL);
   COMP(itm_nail, 12, NULL);

 CONSTRUCT(_("Board Up Door"), 0, &construct::able_door, &construct::done_nothing);
  STAGE(t_door_boarded, 8);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 8, NULL);

 CONSTRUCT(_("Board Up Window"), 0, &construct::able_window,
                                 &construct::done_nothing);
  STAGE(t_window_boarded, 5);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 8, NULL);

 CONSTRUCT(_("Build Wall"), 2, &construct::able_empty, &construct::done_nothing);
  STAGE(t_wall_half, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 10, NULL);
   COMP(itm_nail, 20, NULL);
  STAGE(t_wall_wood, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 10, NULL);
   COMP(itm_nail, 20, NULL);

 CONSTRUCT(_("Build Window"), 3, &construct::able_wall_wood,
                              &construct::done_nothing);
  STAGE(t_window_empty, 10);
   TOOL(itm_saw, NULL);
  STAGE(t_window, 5);
   COMP(itm_glass_sheet, 1, NULL);

 CONSTRUCT(_("Build Door"), 4, &construct::able_wall_wood,
                              &construct::done_nothing);
  STAGE(t_door_frame, 15);
   TOOL(itm_saw, NULL);
  STAGE(t_door_b, 15);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 12, NULL);
  STAGE(t_door_c, 15);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 12, NULL);

/*  Removed until we have some way of auto-aligning fences!
 CONSTRUCT("Build Fence", 1, 15, &construct::able_empty);
  STAGE(t_fence_h, 10);
   TOOL(itm_hammer, itm_hatchet, NULL);
   COMP(itm_2x4, 5, itm_nail, 8, NULL);
*/

 CONSTRUCT(_("Build Roof"), 4, &construct::able_between_walls,
                            &construct::done_nothing);
  STAGE(t_floor, 40);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 8, NULL);
   COMP(itm_nail, 40, NULL);

}
void game::init_construction()
{
 int id = -1;
 int tl, cl, sl;

 #define CONSTRUCT(name, difficulty, able, done) \
  sl = -1; id++; \
  constructions.push_back( new constructable(id, name, difficulty, able, done))

 #define STAGE(...)\
  tl = -1; cl = -1; sl++; \
  constructions[id]->stages.push_back(construction_stage(__VA_ARGS__));
 #define TOOL(item)  ++tl; constructions[id]->stages[sl].tools[tl].push_back(component(item, -1))
 #define TOOLCONT(item) constructions[id]->stages[sl].tools[tl].push_back(component(item, -1))
 #define COMP(item, amount)  ++cl; constructions[id]->stages[sl].components[cl].push_back(component(item,amount))
 #define COMPCONT(item, amount) constructions[id]->stages[sl].components[cl].push_back(component(item,amount))


/* CONSTRUCT( name, time, able, done )
 * Name is the name as it appears in the menu; 30 characters or less, please.
 * time is the time in MINUTES that it takes to finish this construction.
 *  note that 10 turns = 1 minute.
 * able is a function which returns true if you can build it on a given tile
 *  See construction.h for options, and this file for definitions.
 * done is a function which runs each time the construction finishes.
 *  This is useful, for instance, for removing the trap from a pit, or placing
 *  items after a deconstruction.
 */

 CONSTRUCT("Dig Pit", 0, &construct::able_dig, &construct::done_nothing);
  STAGE(t_pit_shallow, 10);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   TOOLCONT("digging_stick");
  STAGE(t_pit, 10);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");

 CONSTRUCT("Spike Pit", 0, &construct::able_pit, &construct::done_nothing);
  STAGE(t_pit_spiked, 5);
   COMP("spear_wood", 4);
   COMPCONT("pointy_stick", 4);

 CONSTRUCT("Fill Pit", 0, &construct::able_pit, &construct::done_nothing);
  STAGE(t_pit_shallow, 5);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
  STAGE(t_dirt, 5);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");

 CONSTRUCT("Chop Down Tree", 0, &construct::able_tree, &construct::done_tree);
  STAGE(t_dirt, 10);
   TOOL("ax");
   TOOLCONT("primitive_axe");
   TOOLCONT("chainsaw_on");

 CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
  STAGE(t_dirt, 20);
   TOOL("ax");
   TOOLCONT("primitive_axe");
   TOOLCONT("chainsaw_on");

 CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
  STAGE(t_null, 1);

 CONSTRUCT("Clean Broken Window", 0, &construct::able_broken_window,
                                     &construct::done_nothing);
  STAGE(t_window_empty, 5);

/* CONSTRUCT("Remove Window Pane",  1, &construct::able_window_pane,
                                     &construct::done_window_pane);
  STAGE(t_window_empty, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("rock");
   TOOLCONT("hatchet");
   TOOL("screwdriver");
   TOOLCONT("knife_butter");
   TOOLCONT("toolset");
*/

 CONSTRUCT("Repair Door", 1, &construct::able_door_broken,
                             &construct::done_nothing);
  STAGE(t_door_c, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 3);
   COMP("nail", 12);

 CONSTRUCT("Board Up Door", 0, &construct::able_door, &construct::done_nothing);
  STAGE(t_door_boarded, 8);
   TOOL("hammer");
   TOOLCONT("hammer_sledge");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 4);
   COMP("nail", 8);

 CONSTRUCT("Board Up Window", 0, &construct::able_window,
                                 &construct::done_nothing);
  STAGE(t_window_boarded, 5);
   TOOL("hammer");
   TOOLCONT("hammer_sledge");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 4);
   COMP("nail", 8);

 CONSTRUCT("Build Wall", 2, &construct::able_empty, &construct::done_nothing);
  STAGE(t_wall_half, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 10);
   COMP("nail", 20);
  STAGE(t_wall_wood, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 10);
   COMP("nail", 20);

 CONSTRUCT("Build Log Wall", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_wall_log_half, 20);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   COMP("log", 2);
   COMP("stick", 3);
   COMPCONT("2x4", 6);
  STAGE(t_wall_log, 20);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   COMP("log", 2);
   COMP("stick", 3);
   COMPCONT("2x4", 6);

 CONSTRUCT("Build Palisade Wall", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_palisade, 20);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   COMP("log", 3);
   COMP("rope_6", 2);

 CONSTRUCT("Build Rope & Pulley System", 2, &construct::able_empty, &construct::done_nothing);
  STAGE(t_palisade_pulley, 0);
   COMP("rope_30", 1);
   COMP("stick", 8);
   COMPCONT("2x4", 8);

 CONSTRUCT("Build Palisade Gate", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_palisade_gate, 20);
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   COMP("log", 2);
   COMP("2x4", 3);
   COMP("rope_6", 2);

 CONSTRUCT("Build Window", 2, &construct::able_make_window,
                              &construct::done_nothing);
  STAGE(t_window_empty, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 15);
   COMPCONT("log", 2);
   COMP("nail", 30);
  STAGE(t_window, 5);
   COMP("glass_sheet", 1);
  STAGE(t_window_domestic, 5);
   TOOL("saw");
   COMP("nail", 4);
   COMP("sheet", 2);
   COMP("stick", 1);
   COMP("string_36", 1);

 CONSTRUCT("Build Door", 2, &construct::able_empty,
                              &construct::done_nothing);
  STAGE(t_door_frame, 15);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 12);
   COMP("nail", 24);
  STAGE(t_door_c, 15);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 4);
   COMP("nail", 12);

 CONSTRUCT("Build Wire Fence",3, &construct::able_dig,
                                 &construct::done_nothing);
  STAGE(t_chainfence_posts, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("rock");
   COMP("pipe", 6);
   COMP("scrap", 8);
  STAGE(t_chainfence_v, 20);
   COMP("wire", 20);

 CONSTRUCT("Realign Fence",   0, &construct::able_chainlink,
                                 &construct::done_nothing);
  STAGE(t_chainfence_h, 0);
  STAGE(t_chainfence_v, 0);

 CONSTRUCT("Build Wire Gate", 3, &construct::able_between_walls,
                                 &construct::done_nothing);
  STAGE(t_chaingate_c, 15);
   COMP("wire", 20);
   COMP("steel_chunk", 3);
   COMPCONT("scrap", 12);
   COMP("pipe", 6);

/*  Removed until we have some way of auto-aligning fences!
 CONSTRUCT("Build Fence", 1, 15, &construct::able_empty);
  STAGE(t_fence_h, 10);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   COMP("2x4", 5);
   COMPCONT("nail", 8);
   */

 CONSTRUCT("Build Roof", 3, &construct::able_between_walls,
                            &construct::done_nothing);
  STAGE(t_floor, 40);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 8);
   COMP("nail", 40);

 CONSTRUCT("Build Log & Sod Roof", 3, &construct::able_between_walls,
                            &construct::done_nothing);
  STAGE(t_floor, 80);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOL("shovel");
   TOOLCONT("primitive_shovel");
   COMP("log", 2);
   COMP("stick", 4);
   COMPCONT("2x4", 8);


// Base stuff
 CONSTRUCT("Build Bulletin Board", 0, &construct::able_empty,
 		                                   &construct::done_nothing);
  STAGE(t_bulletin, 10)
   TOOL("saw");
   TOOL("hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("2x4", 4);
   COMP("nail", 8);

// Household stuff
 CONSTRUCT("Build Dresser", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_dresser, 20);
   TOOL("saw");
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("nail", 8);
   COMP("2x4", 6);

 CONSTRUCT("Build Bookcase", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_bookcase, 20);
   TOOL("saw");
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("nail", 16);
   COMP("2x4", 12);

 CONSTRUCT("Build Locker", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_locker, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOL("wrench");
   COMP("sheet_metal", 2);
   COMP("pipe", 8);

 CONSTRUCT("Build Metal Rack", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_rack, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOL("wrench");
   COMP("pipe", 12);

 CONSTRUCT("Build Counter", 0, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_counter, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("nail", 8);
   COMP("2x4", 6);

 CONSTRUCT("Build Makeshift Bed", 0, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_makeshift_bed, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   COMP("nail", 8);
   COMP("2x4", 10);
   COMP("blanket", 1);

 CONSTRUCT("Tape up window", 0, &construct::able_window_pane,
                                &construct::done_tape);
  STAGE(t_null, 2);
  COMP("duct_tape", 50);

 CONSTRUCT("Deconstruct Furniture", 0, &construct::able_deconstruct,
                                &construct::done_deconstruct);
  STAGE(t_null, 20);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("hatchet");
   TOOLCONT("nailgun");
   TOOL("screwdriver");
   TOOLCONT("toolset");

 CONSTRUCT("Start vehicle construction", 0, &construct::able_empty, &construct::done_vehicle);
  STAGE(t_null, 10);
   COMP("frame", 1);

 CONSTRUCT("Fence Posts", 0, &construct::able_dig,
                             &construct::done_nothing);
  STAGE(t_fence_post, 5);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("shovel");
   TOOLCONT("primitive_shovel");
   TOOLCONT("rock");
   TOOLCONT("hatchet");
   TOOLCONT("ax");
   TOOLCONT("primitive_axe");
   COMP("pointy_stick", 2);
   COMPCONT("spear_wood", 2);

 CONSTRUCT("Build Wood Stove", 0, &construct::able_empty,
 		                                   &construct::done_nothing);
  STAGE(t_woodstove, 10);
   TOOL("hacksaw");
   COMP("metal_tank", 1);
   COMP("pipe", 1);

 CONSTRUCT("Build Stone Fireplace", 0, &construct::able_empty,
 		                                   &construct::done_nothing);
  STAGE(t_fireplace, 40);
   TOOL("hammer");
   TOOLCONT("primitive_hammer");
   TOOLCONT("shovel");
   TOOLCONT("primitive_shovel");
   COMP("rock", 40);
}
Exemple #8
0
// This function just defines the recipes used throughout the game.
void game::init_recipes()
{
 int id = -1;
 int tl, cl;

 #define RECIPE(result, category, skill1, skill2, difficulty, time) \
  tl = 0; cl = 0; id++;\
  recipes.push_back( recipe(id, result, category, skill1, skill2, difficulty, \
                            time) )
 #define TOOL(...)	setvector(recipes[id].tools[tl],      __VA_ARGS__); tl++
 #define COMP(...)	setvector(recipes[id].components[cl], __VA_ARGS__); cl++

/* A recipe will not appear in your menu until your level in the primary skill
 * is at least equal to the difficulty.  At that point, your chance of success
 * is still not great; a good 25% improvement over the difficulty is important
 */

// WEAPONS

 RECIPE(itm_spear_wood, CC_WEAPON, sk_null, sk_null, 0, 800);
  TOOL(itm_hatchet, -1, itm_knife_steak, -1, itm_knife_butcher, -1,
	itm_knife_combat, -1, itm_machete, -1, NULL);
  COMP(itm_stick, 1, itm_broom, 1, itm_mop, 1, itm_2x4, 1, NULL);

 RECIPE(itm_nailboard, CC_WEAPON, sk_null, sk_null, 0, 1000);
  TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
  COMP(itm_2x4, 1, itm_bat, 1, NULL);
  COMP(itm_nail, 6, NULL);

 RECIPE(itm_molotov, CC_WEAPON, sk_null, sk_null, 0, 500);
  COMP(itm_rag, 1, NULL);
  COMP(itm_whiskey, 1, itm_vodka, 1, itm_rum, 1, itm_tequila, 1,
       itm_gasoline, 1, NULL);

 RECIPE(itm_pipebomb, CC_WEAPON, sk_mechanics, sk_null, 1, 750);
  TOOL(itm_hacksaw, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_gasoline, 1, itm_shot_bird, 6, itm_shot_00, 2, itm_shot_slug, 2,
       NULL);
  COMP(itm_string_36, 1, itm_string_6, 1, NULL);

 RECIPE(itm_shotgun_sawn, CC_WEAPON, sk_gun, sk_null, 1, 500);
  TOOL(itm_hacksaw, -1,  NULL);
  COMP(itm_shotgun_d, 1, itm_remington_870, 1, itm_mossberg_500, 1,
       itm_saiga_12, 1, NULL);

 RECIPE(itm_bolt_wood, CC_WEAPON, sk_mechanics, sk_gun, 1, 5000);
  TOOL(itm_hatchet, -1, itm_knife_steak, -1, itm_knife_butcher, -1,
	itm_knife_combat, -1, itm_machete, -1, NULL);
  COMP(itm_stick, 1, itm_broom, 1, itm_mop, 1, itm_2x4, 1, itm_bee_sting, 1,
       NULL);

 RECIPE(itm_crossbow, CC_WEAPON, sk_mechanics, sk_gun, 3, 15000);
  TOOL(itm_wrench, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_2x4, 1, itm_stick, 4, NULL);
  COMP(itm_hose, 1, NULL);

 RECIPE(itm_rifle_22, CC_WEAPON, sk_mechanics, sk_gun, 3, 12000);
  TOOL(itm_hacksaw, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_2x4, 1, NULL);

 RECIPE(itm_rifle_9mm, CC_WEAPON, sk_mechanics, sk_gun, 3, 14000);
  TOOL(itm_hacksaw, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_2x4, 1, NULL);

 RECIPE(itm_smg_9mm, CC_WEAPON, sk_mechanics, sk_gun, 5, 18000);
  TOOL(itm_hacksaw, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_hammer, -1, itm_rock, -1, itm_hatchet, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_2x4, 2, NULL);
  COMP(itm_nail, 4, NULL);

 RECIPE(itm_smg_45, CC_WEAPON, sk_mechanics, sk_gun, 5, 20000);
  TOOL(itm_hacksaw, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_hammer, -1, itm_rock, -1, itm_hatchet, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_2x4, 2, NULL);
  COMP(itm_nail, 4, NULL);

 RECIPE(itm_flamethrower_simple, CC_WEAPON, sk_mechanics, sk_gun, 6, 12000);
  TOOL(itm_hacksaw, -1, NULL);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_pipe, 1, NULL);
  COMP(itm_hose, 2, NULL);
  COMP(itm_bottle_glass, 4, itm_bottle_plastic, 6, NULL);

 RECIPE(itm_grenade, CC_WEAPON, sk_mechanics, sk_null, 2, 5000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_superglue, 1, itm_string_36, 1, NULL);
  COMP(itm_can_food, 1, itm_can_drink, 1, itm_canister_empty, 1, NULL);
  COMP(itm_nail, 30, itm_bb, 100, NULL);
  COMP(itm_shot_bird, 6, itm_shot_00, 3, itm_shot_slug, 2,
       itm_gasoline, 1, NULL);

 RECIPE(itm_chainsaw_off, CC_WEAPON, sk_mechanics, sk_null, 4, 20000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_hammer, -1, itm_hatchet, -1, NULL);
  TOOL(itm_wrench, -1, NULL);
  COMP(itm_motor, 1, NULL);
  COMP(itm_chain, 1, NULL);

 RECIPE(itm_smokebomb, CC_WEAPON, sk_cooking, sk_mechanics, 3, 7500);
  TOOL(itm_screwdriver, -1, itm_wrench, -1, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, itm_salt_water, 1, NULL);
  COMP(itm_candy, 1, itm_cola, 1, NULL);
  COMP(itm_vitamins, 10, itm_aspirin, 8, NULL);
  COMP(itm_canister_empty, 1, itm_can_food, 1, NULL);
  COMP(itm_superglue, 1, NULL);

 RECIPE(itm_gasbomb, CC_WEAPON, sk_cooking, sk_mechanics, 4, 8000);
  TOOL(itm_screwdriver, -1, itm_wrench, -1, NULL);
  COMP(itm_bleach, 2, NULL);
  COMP(itm_ammonia, 2, NULL);
  COMP(itm_canister_empty, 1, itm_can_food, 1, NULL);
  COMP(itm_superglue, 1, NULL);

 RECIPE(itm_mininuke, CC_WEAPON, sk_mechanics, sk_electronics, 10, 40000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_wrench, -1, NULL);
  COMP(itm_can_food, 2, itm_steel_chunk, 2, itm_canister_empty, 1, NULL);
  COMP(itm_plut_cell, 6, NULL);
  COMP(itm_battery, 2, NULL);
  COMP(itm_power_supply, 1, NULL);

// FOOD

 RECIPE(itm_meat_cooked, CC_FOOD, sk_cooking, sk_null, 0, 5000);
  TOOL(itm_hotplate, 7, NULL);
  TOOL(itm_pan, -1, itm_pot, -1, NULL);
  COMP(itm_meat, 1, NULL);

 RECIPE(itm_veggy_cooked, CC_FOOD, sk_cooking, sk_null, 0, 4000);
  TOOL(itm_hotplate, 5, NULL);
  TOOL(itm_pan, -1, itm_pot, -1, NULL);
  COMP(itm_veggy, 1, NULL);

 RECIPE(itm_spaghetti_cooked, CC_FOOD, sk_cooking, sk_null, 0, 10000);
  TOOL(itm_hotplate, 4, NULL);
  TOOL(itm_pot, -1, NULL);
  COMP(itm_spaghetti_raw, 1, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);

 RECIPE(itm_cooked_dinner, CC_FOOD, sk_cooking, sk_null, 0, 5000);
  TOOL(itm_hotplate, 3, NULL);
  COMP(itm_frozen_dinner, 1, NULL);

 RECIPE(itm_macaroni_cooked, CC_FOOD, sk_cooking, sk_null, 1, 10000);
  TOOL(itm_hotplate, 4, NULL);
  TOOL(itm_pot, -1, NULL);
  COMP(itm_macaroni_raw, 1, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);

 RECIPE(itm_potato_baked, CC_FOOD, sk_cooking, sk_null, 1, 15000);
  TOOL(itm_hotplate, 3, NULL);
  TOOL(itm_pan, -1, itm_pot, -1, NULL);
  COMP(itm_potato_raw, 1, NULL);

 RECIPE(itm_oj, CC_FOOD, sk_cooking, sk_null, 1, 5000);
  TOOL(itm_rock, -1, NULL);
  COMP(itm_bottle_plastic, 1, NULL);
  COMP(itm_orange, 2, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);

 RECIPE(itm_apple_cider, CC_FOOD, sk_cooking, sk_null, 2, 7000);
  TOOL(itm_rock, -1, NULL);
  COMP(itm_bottle_plastic, 1, NULL);
  COMP(itm_apple, 3, NULL);
 
 RECIPE(itm_jerky, CC_FOOD, sk_cooking, sk_null, 2, 30000);
  TOOL(itm_hotplate, 10, NULL);
  COMP(itm_salt_water, 1, itm_salt, 4, NULL);
  COMP(itm_meat, 1, NULL);

 RECIPE(itm_V8, CC_FOOD, sk_cooking, sk_null, 2, 5000);
  COMP(itm_can_drink, 1, NULL);
  COMP(itm_tomato, 1, NULL);
  COMP(itm_broccoli, 1, NULL);
  COMP(itm_zucchini, 1, NULL);

 RECIPE(itm_broth, CC_FOOD, sk_cooking, sk_null, 2, 10000);
  TOOL(itm_hotplate, 5, NULL);
  TOOL(itm_pot, -1, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);
  COMP(itm_broccoli, 1, itm_zucchini, 1, itm_veggy, 1, NULL);
  COMP(itm_can_food, 1, NULL);

 RECIPE(itm_soup, CC_FOOD, sk_cooking, sk_null, 3, 10000);
  TOOL(itm_hotplate, 5, NULL);
  TOOL(itm_pot, -1, NULL);
  COMP(itm_broth, 2, NULL);
  COMP(itm_macaroni_raw, 1, itm_potato_raw, 1, NULL);
  COMP(itm_tomato, 2, itm_broccoli, 2, itm_zucchini, 2, itm_veggy, 2, NULL);
  COMP(itm_can_food, 1, NULL);

 RECIPE(itm_bread, CC_FOOD, sk_cooking, sk_null, 3, 20000);
  TOOL(itm_hotplate, 8, NULL);
  TOOL(itm_pot, -1, NULL);
  COMP(itm_flour, 3, NULL);
  COMP(itm_water, 2, itm_water_dirty, 2, NULL);

 RECIPE(itm_pie, CC_FOOD, sk_cooking, sk_null, 4, 25000);
  TOOL(itm_hotplate, 6, NULL);
  TOOL(itm_pan, -1, NULL);
  COMP(itm_flour, 2, NULL);
  COMP(itm_strawberries, 2, itm_apple, 2, itm_blueberries, 2, NULL);
  COMP(itm_sugar, 2, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);

 RECIPE(itm_pizza, CC_FOOD, sk_cooking, sk_null, 4, 20000);
  TOOL(itm_hotplate, 8, NULL);
  TOOL(itm_pan, -1, NULL);
  COMP(itm_flour, 2, NULL);
  COMP(itm_veggy, 1, itm_tomato, 2, itm_broccoli, 1, NULL);
  COMP(itm_sauce_pesto, 1, itm_sauce_red, 1, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);

 RECIPE(itm_meth, CC_FOOD, sk_cooking, sk_null, 4, 20000);
  TOOL(itm_hotplate, 15, NULL);
  TOOL(itm_bottle_glass, -1, itm_hose, -1, NULL);
  COMP(itm_dayquil, 2, itm_royal_jelly, 1, NULL);
  COMP(itm_aspirin, 40, NULL);
  COMP(itm_caffeine, 20, itm_adderall, 5, itm_energy_drink, 2, NULL);

 RECIPE(itm_royal_jelly, CC_FOOD, sk_cooking, sk_null, 5, 5000);
  COMP(itm_honeycomb, 1, NULL);
  COMP(itm_bleach, 2, itm_purifier, 1, NULL);

 RECIPE(itm_heroin, CC_FOOD, sk_cooking, sk_null, 6, 2000);
  TOOL(itm_hotplate, 3, itm_lighter, 25, NULL);
  TOOL(itm_pan, -1, itm_pot, -1, NULL);
  COMP(itm_salt_water, 1, itm_salt, 4, NULL);
  COMP(itm_oxycodone, 40, NULL);

 RECIPE(itm_mutagen, CC_FOOD, sk_cooking, sk_firstaid, 8, 10000);
  TOOL(itm_hotplate, 25, NULL);
  COMP(itm_meat_tainted, 3, itm_veggy_tainted, 5, itm_fetus, 1, itm_arm, 2,
       itm_leg, 2, NULL);
  COMP(itm_bleach, 2, NULL);
  COMP(itm_ammonia, 1, NULL);

 RECIPE(itm_purifier, CC_FOOD, sk_cooking, sk_firstaid, 9, 10000);
  TOOL(itm_hotplate, 25, NULL);
  COMP(itm_royal_jelly, 3, itm_mutagen, 1, NULL);
  COMP(itm_bleach, 3, NULL);
  COMP(itm_ammonia, 2, NULL);

// ELECTRONICS

 RECIPE(itm_antenna, CC_ELECTRONIC, sk_null, sk_null, 0, 3000);
  TOOL(itm_hacksaw, -1, NULL);
  COMP(itm_radio, 1, itm_two_way_radio, 1, itm_motor, 1, itm_knife_butter, 2,
       NULL);

 RECIPE(itm_amplifier, CC_ELECTRONIC, sk_electronics, sk_null, 1, 4000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_flashlight, 1, itm_radio, 1, itm_two_way_radio, 1, itm_geiger_off, 1,
       itm_goggles_nv, 1, itm_transponder, 2, NULL);

 RECIPE(itm_power_supply, CC_ELECTRONIC, sk_electronics, sk_null, 1, 6500);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 3, NULL);
  COMP(itm_amplifier, 2, itm_soldering_iron, 1, itm_electrohack, 1,
       itm_battery, 800, itm_geiger_off, 1, NULL);

 RECIPE(itm_receiver, CC_ELECTRONIC, sk_electronics, sk_null, 2, 12000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 4, NULL);
  COMP(itm_amplifier, 2, itm_radio, 1, itm_two_way_radio, 1, NULL);

 RECIPE(itm_transponder, CC_ELECTRONIC, sk_electronics, sk_null, 2, 14000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 7, NULL);
  COMP(itm_receiver, 3, itm_two_way_radio, 1, NULL);

 RECIPE(itm_flashlight, CC_ELECTRONIC, sk_electronics, sk_null, 1, 10000);
  COMP(itm_amplifier, 1, NULL);
  COMP(itm_bottle_plastic, 1, itm_bottle_glass, 1, itm_can_drink, 1, NULL);

 RECIPE(itm_soldering_iron, CC_ELECTRONIC, sk_electronics, sk_null, 1, 20000);
  COMP(itm_screwdriver, 1, itm_antenna, 1, itm_xacto, 1, itm_knife_butter, 1,
       NULL);
  COMP(itm_power_supply, 1, NULL);

 RECIPE(itm_battery, CC_ELECTRONIC, sk_electronics, sk_mechanics, 2, 5000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_ammonia, 1, itm_lemon, 1, NULL);
  COMP(itm_steel_chunk, 1, itm_knife_butter, 1, itm_knife_steak, 1,
       itm_bolt_steel, 1, NULL);
  COMP(itm_can_drink, 1, itm_can_food, 1, NULL);

 RECIPE(itm_radio, CC_ELECTRONIC, sk_electronics, sk_null, 2, 25000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 10, NULL);
  COMP(itm_receiver, 1, NULL);
  COMP(itm_antenna, 1, NULL);

 RECIPE(itm_water_purifier, CC_ELECTRONIC, sk_mechanics,sk_electronics,3,25000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_hotplate, 1, NULL);
  COMP(itm_bottle_glass, 2, itm_bottle_plastic, 5, NULL);
  COMP(itm_hose, 1, NULL);

 RECIPE(itm_hotplate, CC_ELECTRONIC, sk_electronics, sk_null, 3, 30000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_soldering_iron, 1, itm_amplifier, 1, NULL);
  COMP(itm_pan, 1, itm_pot, 1, itm_knife_butcher, 2, itm_knife_steak, 6,
       itm_knife_butter, 6, itm_muffler, 1, NULL);

 RECIPE(itm_tazer, CC_ELECTRONIC, sk_electronics, sk_null, 3, 25000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 10, NULL);
  COMP(itm_amplifier, 1, NULL);
  COMP(itm_power_supply, 1, NULL);

 RECIPE(itm_two_way_radio, CC_ELECTRONIC, sk_electronics, sk_null, 4, 30000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 14, NULL);
  COMP(itm_amplifier, 1, NULL);
  COMP(itm_transponder, 1, NULL);
  COMP(itm_receiver, 1, NULL);
  COMP(itm_antenna, 1, NULL);

 RECIPE(itm_electrohack, CC_ELECTRONIC, sk_electronics, sk_computer, 4, 35000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 10, NULL);
  COMP(itm_processor, 1, NULL);
  COMP(itm_RAM, 1, NULL);

 RECIPE(itm_EMPbomb, CC_ELECTRONIC, sk_electronics, sk_null, 4, 32000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 6, NULL);
  COMP(itm_superglue, 1, itm_string_36, 1, NULL);
  COMP(itm_can_food, 1, itm_can_drink, 1, itm_canister_empty, 1, NULL);
  COMP(itm_power_supply, 1, itm_amplifier, 1, NULL);

 RECIPE(itm_mp3, CC_ELECTRONIC, sk_electronics, sk_computer, 5, 40000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 5, NULL);
  COMP(itm_superglue, 1, NULL);
  COMP(itm_antenna, 1, NULL);
  COMP(itm_amplifier, 1, NULL);

 RECIPE(itm_geiger_off, CC_ELECTRONIC, sk_electronics, sk_null, 5, 35000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 14, NULL);
  COMP(itm_power_supply, 1, NULL);
  COMP(itm_amplifier, 2, NULL);

 RECIPE(itm_UPS_off, CC_ELECTRONIC, sk_electronics, sk_null, 5, 45000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 24, NULL);
  COMP(itm_power_supply, 4, NULL);
  COMP(itm_amplifier, 3, NULL);

 RECIPE(itm_bionics_battery, CC_ELECTRONIC, sk_electronics, sk_null, 6, 50000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 20, NULL);
  COMP(itm_UPS_off, 1, itm_power_supply, 4, NULL);
  COMP(itm_amplifier, 2, NULL);

 RECIPE(itm_teleporter, CC_ELECTRONIC, sk_electronics, sk_null, 8, 50000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_wrench, -1, NULL);
  TOOL(itm_soldering_iron, 16, NULL);
  COMP(itm_power_supply, 3, itm_plut_cell, 5, NULL);
  COMP(itm_amplifier, 3, NULL);
  COMP(itm_transponder, 3, NULL);

// ARMOR

 RECIPE(itm_mocassins, CC_ARMOR, sk_tailor, sk_null, 1, 30000);
  TOOL(itm_sewing_kit,  5, NULL);
  COMP(itm_fur, 2, NULL);

 RECIPE(itm_boots, CC_ARMOR, sk_tailor, sk_null, 2, 35000);
  TOOL(itm_sewing_kit, 10, NULL);
  COMP(itm_leather, 2, NULL);

 RECIPE(itm_jeans, CC_ARMOR, sk_tailor, sk_null, 2, 45000);
  TOOL(itm_sewing_kit, 10, NULL);
  COMP(itm_rag, 6, NULL);

 RECIPE(itm_pants_cargo, CC_ARMOR, sk_tailor, sk_null, 3, 48000);
  TOOL(itm_sewing_kit, 16, NULL);
  COMP(itm_rag, 8, NULL);

 RECIPE(itm_pants_leather, CC_ARMOR, sk_tailor, sk_null, 4, 50000);
  TOOL(itm_sewing_kit, 10, NULL);
  COMP(itm_leather, 6, NULL);

 RECIPE(itm_tank_top, CC_ARMOR, sk_tailor, sk_null, 2, 38000);
  TOOL(itm_sewing_kit, 4, NULL);
  COMP(itm_rag, 4, NULL);

 RECIPE(itm_hoodie, CC_ARMOR, sk_tailor, sk_null, 3, 40000);
  TOOL(itm_sewing_kit, 14, NULL);
  COMP(itm_rag, 8, NULL);

 RECIPE(itm_trenchcoat, CC_ARMOR, sk_tailor, sk_null, 3, 42000);
  TOOL(itm_sewing_kit, 24, NULL);
  COMP(itm_rag, 10, NULL);

 RECIPE(itm_coat_fur, CC_ARMOR, sk_tailor, sk_null, 4, 100000);
  TOOL(itm_sewing_kit, 20, NULL);
  COMP(itm_fur, 10, NULL);

 RECIPE(itm_jacket_leather, CC_ARMOR, sk_tailor, sk_null, 5, 150000);
  TOOL(itm_sewing_kit, 30, NULL);
  COMP(itm_leather, 8, NULL);

 RECIPE(itm_gloves_light, CC_ARMOR, sk_tailor, sk_null, 1, 10000);
  TOOL(itm_sewing_kit, 2, NULL);
  COMP(itm_rag, 2, NULL);

 RECIPE(itm_gloves_fingerless, CC_ARMOR, sk_tailor, sk_null, 3, 16000);
  TOOL(itm_sewing_kit, 6, NULL);
  COMP(itm_leather, 2, NULL);

 RECIPE(itm_mask_filter, CC_ARMOR, sk_mechanics, sk_tailor, 1, 5000);
  COMP(itm_bottle_plastic, 1, itm_bag_plastic, 2, NULL);
  COMP(itm_muffler, 1, itm_bandana, 2, itm_rag, 2, itm_wrapper, 4, NULL);

 RECIPE(itm_mask_gas, CC_ARMOR, sk_tailor, sk_null, 3, 20000);
  TOOL(itm_wrench, -1, NULL);
  COMP(itm_goggles_swim, 2, itm_goggles_ski, 1, NULL);
  COMP(itm_mask_filter, 3, itm_muffler, 1, NULL);
  COMP(itm_hose, 1, NULL);

 RECIPE(itm_glasses_safety, CC_ARMOR, sk_tailor, sk_null, 1, 8000);
  TOOL(itm_scissors, -1, itm_xacto, -1, itm_knife_steak, -1,
       itm_knife_combat, -1, NULL);
  COMP(itm_string_36, 1, itm_string_6, 2, NULL);
  COMP(itm_bottle_plastic, 1, NULL);

 RECIPE(itm_goggles_nv, CC_ARMOR, sk_electronics, sk_tailor, 5, 40000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_goggles_ski, 1, itm_goggles_welding, 1, itm_mask_gas, 1, NULL);
  COMP(itm_power_supply, 1, NULL);
  COMP(itm_amplifier, 3, NULL);

 RECIPE(itm_hat_fur, CC_ARMOR, sk_tailor, sk_null, 2, 40000);
  TOOL(itm_sewing_kit, 8, NULL);
  COMP(itm_fur, 3, NULL);

 RECIPE(itm_helmet_chitin, CC_ARMOR, sk_tailor, sk_null, 6,  60000);
  COMP(itm_string_36, 1, itm_string_6, 5, NULL);
  COMP(itm_chitin_piece, 5, NULL);

 RECIPE(itm_armor_chitin, CC_ARMOR, sk_tailor, sk_null,  7, 100000);
  COMP(itm_string_36, 2, itm_string_6, 12, NULL);
  COMP(itm_chitin_piece, 15, NULL);

 RECIPE(itm_backpack, CC_ARMOR, sk_tailor, sk_null, 3, 50000);
  TOOL(itm_sewing_kit, 20, NULL);
  COMP(itm_rag, 20, itm_fur, 16, itm_leather, 12, NULL);

// MISC

 RECIPE(itm_superglue, CC_MISC, sk_cooking, sk_null, 2, 12000);
  TOOL(itm_hotplate, 5, NULL);
  COMP(itm_water, 1, itm_water_dirty, 1, NULL);
  COMP(itm_bleach, 1, itm_ant_egg, 1, NULL);

 RECIPE(itm_2x4, CC_MISC, sk_null, sk_null, 0, 8000);
  TOOL(itm_saw, -1, NULL);
  COMP(itm_stick, 1, NULL);

 RECIPE(itm_crowbar, CC_MISC, sk_mechanics, sk_null, 1, 1000);
  TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
  COMP(itm_pipe, 1, NULL);

 RECIPE(itm_tripwire, CC_MISC, sk_traps, sk_null, 1, 500);
  COMP(itm_string_36, 1, NULL);
  COMP(itm_superglue, 1, NULL);

 RECIPE(itm_board_trap, CC_MISC, sk_traps, sk_null, 2, 2500);
  TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
  COMP(itm_2x4, 3, NULL);
  COMP(itm_nail, 20, NULL);

 RECIPE(itm_beartrap, CC_MISC, sk_mechanics, sk_traps, 2, 3000);
  TOOL(itm_wrench, -1, NULL);
  COMP(itm_steel_chunk, 2, NULL);

 RECIPE(itm_crossbow_trap, CC_MISC, sk_mechanics, sk_traps, 3, 4500);
  COMP(itm_crossbow, 1, NULL);
  COMP(itm_bolt_steel, 1, itm_bolt_wood, 4, NULL);
  COMP(itm_string_36, 1, itm_string_6, 2, NULL);

 RECIPE(itm_shotgun_trap, CC_MISC, sk_mechanics, sk_traps, 3, 5000);
  COMP(itm_shotgun_sawn, 1, NULL);
  COMP(itm_shot_00, 2, NULL);
  COMP(itm_string_36, 1, itm_string_6, 2, NULL);

 RECIPE(itm_blade_trap, CC_MISC, sk_mechanics, sk_traps, 4, 8000);
  TOOL(itm_wrench, -1, NULL);
  COMP(itm_motor, 1, NULL);
  COMP(itm_machete, 1, NULL);
  COMP(itm_string_36, 1, NULL);

 RECIPE(itm_landmine, CC_WEAPON, sk_traps, sk_mechanics, 5, 10000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_superglue, 1, NULL);
  COMP(itm_can_food, 1, itm_steel_chunk, 1, itm_canister_empty, 1, NULL);
  COMP(itm_nail, 100, itm_bb, 200, NULL);
  COMP(itm_shot_bird, 30, itm_shot_00, 15, itm_shot_slug, 12, itm_gasoline, 3,
       itm_grenade, 1, NULL);

 RECIPE(itm_bandages, CC_MISC, sk_firstaid, sk_null, 1, 500);
  COMP(itm_rag, 1, NULL);
  COMP(itm_superglue, 1, NULL);

 RECIPE(itm_silencer, CC_MISC, sk_mechanics, sk_null, 1, 650);
  TOOL(itm_hacksaw, -1, NULL);
  COMP(itm_muffler, 1, itm_rag, 4, NULL);
  COMP(itm_pipe, 1, NULL);

 RECIPE(itm_pheromone, CC_MISC, sk_cooking, sk_null, 3, 1200);
  TOOL(itm_hotplate, 18, NULL);
  COMP(itm_meat_tainted, 1, NULL);
  COMP(itm_ammonia, 1, NULL);

 RECIPE(itm_laser_pack, CC_MISC, sk_electronics, sk_null, 5, 10000);
  TOOL(itm_screwdriver, -1, NULL);
  COMP(itm_superglue, 1, NULL);
  COMP(itm_plut_cell, 1, NULL);

 RECIPE(itm_bot_manhack, CC_MISC, sk_electronics, sk_computer, 6, 8000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 10, NULL);
  COMP(itm_knife_steak, 4, itm_knife_combat, 2, NULL);
  COMP(itm_processor, 1, NULL);
  COMP(itm_RAM, 1, NULL);
  COMP(itm_power_supply, 1, NULL);
  COMP(itm_battery, 400, itm_plut_cell, 1, NULL);

 RECIPE(itm_bot_turret, CC_MISC, sk_electronics, sk_computer, 7, 9000);
  TOOL(itm_screwdriver, -1, NULL);
  TOOL(itm_soldering_iron, 14, NULL);
  COMP(itm_smg_9mm, 1, itm_uzi, 1, itm_tec9, 1, itm_calico, 1, itm_hk_mp5, 1,
       NULL);
  COMP(itm_processor, 2, NULL);
  COMP(itm_RAM, 2, NULL);
  COMP(itm_power_supply, 1, NULL);
  COMP(itm_battery, 500, itm_plut_cell, 1, NULL);

}
void game::init_construction()
{
 int id = -1;
 int tl, cl, sl;

 #define CONSTRUCT(name, difficulty, able, done) \
  sl = -1; id++; \
  constructions.push_back( new constructable(id, name, difficulty, able, done))

 #define STAGE(...)\
  tl = 0; cl = 0; sl++; \
  constructions[id]->stages.push_back(construction_stage(__VA_ARGS__));
 #define TOOL(...)   setvector(constructions[id]->stages[sl].tools[tl], \
                               __VA_ARGS__); tl++
 #define COMP(...)   setvector(constructions[id]->stages[sl].components[cl], \
                               __VA_ARGS__); cl++

/* CONSTRUCT( name, time, able, done )
 * Name is the name as it appears in the menu; 30 characters or less, please.
 * time is the time in MINUTES that it takes to finish this construction.
 *  note that 10 turns = 1 minute.
 * able is a function which returns true if you can build it on a given tile
 *  See construction.h for options, and this file for definitions.
 * done is a function which runs each time the construction finishes.
 *  This is useful, for instance, for removing the trap from a pit, or placing
 *  items after a deconstruction.
 */

 CONSTRUCT("Dig Pit", 0, &construct::able_dig, &construct::done_nothing);
  STAGE(t_pit_shallow, 10);
   TOOL(itm_shovel, NULL);
  STAGE(t_pit, 10);
   TOOL(itm_shovel, NULL);

 CONSTRUCT("Spike Pit", 0, &construct::able_pit, &construct::done_nothing);
  STAGE(t_pit_spiked, 5);
   COMP(itm_spear_wood, 4, NULL);

 CONSTRUCT("Fill Pit", 0, &construct::able_pit, &construct::done_nothing);
  STAGE(t_pit_shallow, 5);
   TOOL(itm_shovel, NULL);
  STAGE(t_dirt, 5);
   TOOL(itm_shovel, NULL);

 CONSTRUCT("Chop Down Tree", 0, &construct::able_tree, &construct::done_tree);
  STAGE(t_dirt, 10);
   TOOL(itm_ax, itm_chainsaw_on, NULL);

 CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
  STAGE(t_dirt, 20);
   TOOL(itm_ax, itm_chainsaw_on, NULL);

 CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
  STAGE(t_null, 1);

 CONSTRUCT("Clean Broken Window", 0, &construct::able_broken_window,
                                     &construct::done_nothing);
  STAGE(t_window_empty, 5);

/* CONSTRUCT("Remove Window Pane",  1, &construct::able_window_pane,
                                     &construct::done_window_pane);
  STAGE(t_window_empty, 10);
   TOOL(itm_hammer, itm_rock, itm_hatchet, NULL);
   TOOL(itm_screwdriver, itm_knife_butter, itm_toolset, NULL);
*/

 CONSTRUCT("Repair Door", 1, &construct::able_door_broken,
                             &construct::done_nothing);
  STAGE(t_door_c, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 3, NULL);
   COMP(itm_nail, 12, NULL);

 CONSTRUCT("Board Up Door", 0, &construct::able_door, &construct::done_nothing);
  STAGE(t_door_boarded, 8);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 8, NULL);

 CONSTRUCT("Board Up Window", 0, &construct::able_window,
                                 &construct::done_nothing);
  STAGE(t_window_boarded, 5);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 8, NULL);

 CONSTRUCT("Build Wall", 2, &construct::able_empty, &construct::done_nothing);
  STAGE(t_wall_half, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 10, NULL);
   COMP(itm_nail, 20, NULL);
  STAGE(t_wall_wood, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 10, NULL);
   COMP(itm_nail, 20, NULL);

 CONSTRUCT("Build Log Wall", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_wall_log_half, 20);
   TOOL(itm_shovel, NULL);
   COMP(itm_log, 2, NULL);
   COMP(itm_stick, 3, NULL);
  STAGE(t_wall_log, 20);
   TOOL(itm_shovel, NULL);
   COMP(itm_log, 2, NULL);
   COMP(itm_stick, 3, NULL);

 CONSTRUCT("Build Palisade Wall", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_palisade, 20);
   TOOL(itm_shovel, NULL);
   COMP(itm_log, 3, NULL);
   COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);

 CONSTRUCT("Build Palisade Gate", 2, &construct::able_pit, &construct::done_nothing);
  STAGE(t_palisade_gate, 20);
   TOOL(itm_shovel, NULL);
   COMP(itm_log, 2, NULL);
   COMP(itm_2x4, 3, NULL);
   COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);

 CONSTRUCT("Build Window", 2, &construct::able_empty,
                              &construct::done_nothing);
  STAGE(t_window_empty, 10);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 15, itm_log, 2, NULL);
   COMP(itm_nail, 30, NULL);
  STAGE(t_window, 5);
   COMP(itm_glass_sheet, 1, NULL);
  STAGE(t_window_domestic, 5);
   TOOL(itm_saw, NULL);
   COMP(itm_nail, 4, NULL);
   COMP(itm_sheet, 2, NULL);
   COMP(itm_stick, 1, NULL);


 CONSTRUCT("Build Door", 2, &construct::able_empty,
                              &construct::done_nothing);
  STAGE(t_door_frame, 15);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 12, NULL);
   COMP(itm_nail, 24, NULL);
  STAGE(t_door_c, 15);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 4, NULL);
   COMP(itm_nail, 12, NULL);

 CONSTRUCT("Build Wire Fence",3, &construct::able_dig,
                                 &construct::done_nothing);
  STAGE(t_chainfence_posts, 20);
   TOOL(itm_hammer, itm_hatchet, itm_rock, NULL);
   COMP(itm_pipe, 6, NULL);
   COMP(itm_scrap, 8, NULL);
  STAGE(t_chainfence_v, 20);
   COMP(itm_wire, 15, NULL);

 CONSTRUCT("Realign Fence",   0, &construct::able_chainlink,
                                 &construct::done_nothing);
  STAGE(t_chainfence_h, 0);
  STAGE(t_chainfence_v, 0);

 CONSTRUCT("Build Wire Gate", 3, &construct::able_between_walls,
                                 &construct::done_nothing);
  STAGE(t_chaingate_c, 15);
   COMP(itm_wire, 20, NULL);
   COMP(itm_steel_chunk, 3, itm_scrap, 12, NULL);
   COMP(itm_pipe, 6, NULL);

/*  Removed until we have some way of auto-aligning fences!
 CONSTRUCT("Build Fence", 1, 15, &construct::able_empty);
  STAGE(t_fence_h, 10);
   TOOL(itm_hammer, itm_hatchet, NULL);
   COMP(itm_2x4, 5, itm_nail, 8, NULL);
*/

 CONSTRUCT("Build Roof", 3, &construct::able_between_walls,
                            &construct::done_nothing);
  STAGE(t_floor, 40);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_2x4, 8, NULL);
   COMP(itm_nail, 40, NULL);

// Household stuff
 CONSTRUCT("Build Dresser", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_dresser, 20);
   TOOL(itm_saw, NULL);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_nail, 8, NULL);
   COMP(itm_2x4, 6, NULL);

 CONSTRUCT("Build Bookcase", 1, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_bookcase, 20);
   TOOL(itm_saw, NULL);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_nail, 16, NULL);
   COMP(itm_2x4, 12, NULL);

 CONSTRUCT("Build Counter", 0, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_counter, 20);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_nail, 8, NULL);
   COMP(itm_2x4, 6, NULL);

 CONSTRUCT("Build Makeshift Bed", 0, &construct::able_indoors,
                                &construct::done_nothing);
  STAGE(t_makeshift_bed, 20);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   COMP(itm_nail, 8, NULL);
   COMP(itm_2x4, 10, NULL);
   COMP(itm_sheet, 1, NULL);

 CONSTRUCT("Tape up window", 0, &construct::able_window,
                                &construct::done_tape);
  STAGE(t_null, 2);
  COMP(itm_duct_tape, 50, NULL);

 CONSTRUCT("Deconstruct Furniture", 0, &construct::able_deconstruct,
                                &construct::done_deconstruct);
  STAGE(t_null, 20);
   TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
   TOOL(itm_screwdriver, itm_toolset, NULL);

 CONSTRUCT("Start vehicle construction", 0, &construct::able_empty, &construct::done_vehicle);
  STAGE(t_null, 10);
   COMP(itm_frame, 1, NULL);

 CONSTRUCT("Fence Posts", 0, &construct::able_dig,
                             &construct::done_nothing);
  STAGE(t_fence_post, 5);
  TOOL(itm_hammer, itm_shovel, itm_rock, itm_hatchet, itm_ax, NULL);
  COMP(itm_spear_wood, 2, NULL);

}
Exemple #10
0
void QNetCtlTool::request(const QString tag, const QString information)
{
    QString cmd;
    bool chain = false;
//     debug(tag + information);
    if (tag == "switch_to_profile") {
        cmd = TOOL(netctl) + " switch-to " + information;
    } else if (tag == "stop_profile") {
        cmd = TOOL(netctl) + " stop " + information;
    } else if (tag == "scan_wifi") {
        scanWifi(information);
        return;
    } else if (tag == "enable_profile") {
        cmd = TOOL(netctl) + " enable " + information;
    } else if (tag == "enable_service") {
        if (information.startsWith("netctl-"))
            cmd = TOOL(systemctl) + " enable " + information;
    }
    else if (tag == "disable_profile") {
        cmd = TOOL(netctl) + " disable " + information;
    } else if (tag == "disable_service") {
        if (information.startsWith("netctl-"))
            cmd = TOOL(systemctl) + " disable " + information;
    } else if (tag == "remove_profile") {
        chain = true;
        cmd = TOOL(netctl) + " disable " + information;
    } else if (tag.startsWith("write_profile")) {
        QString name = tag.section(' ', 1);
        QFile file(gs_profilePath + name);
        if (file.open(QIODevice::WriteOnly|QIODevice::Text)) {
            file.write(information.toLocal8Bit());
            file.close();
            myClient->call(QDBus::NoBlock, "reply", tag, "SUCCESS");
        } else {
            myClient->call(QDBus::NoBlock, "reply", tag, "ERROR");
        }
        return; // no process to run
    } else if (tag == "reparse_config") {
        return;
    } else if (tag == "quit") {
        quit();
        return;
    }

    if (cmd.isNull()) {
        myClient->call(QDBus::NoBlock, "reply", tag, "ERROR: unsupported command / request:" + information);
        return;
    }

    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    env.remove("LC_ALL");
    env.remove("LANG");
    QProcess *proc = new QProcess(this);
    proc->setProcessEnvironment(env);
    proc->setProperty("QNetCtlTag", tag);
    if (chain) {
        proc->setProperty("QNetCtlInfo", information);
        connect (proc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(chain()));
    } else {
        connect (proc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(reply()));
    }
    connect (proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));
//     debug(cmd);
    proc->start(cmd, QIODevice::ReadOnly);
}
Exemple #11
0
		wt, cost, 0, 0, 0, 0, wt, color )
#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,material,color) OBJECT( \
		OBJ(name,desc), BITS(kn,0,1,0,mgc,1,0,0,bi,0,material), 0, \
		TOOL_CLASS, prob, 0, \
		wt, cost, sdam, ldam, hitbon, 0, wt, color )
/* containers */
CONTAINER("large box",	    NULL,   1, 0, 0,  40,350,   8, WOOD, HI_WOOD),
CONTAINER("chest",	    NULL,   1, 0, 0,  35,600,  16, WOOD, HI_WOOD),
CONTAINER("ice box",	    NULL,   1, 0, 0,   5,900,  42, PLASTIC, WHITE),
CONTAINER("sack",	    "bag",  0, 0, 0,  35, 15,   2, CLOTH, HI_CLOTH),
CONTAINER("oilskin sack",   "bag",  0, 0, 0,   5, 15, 100, CLOTH, HI_CLOTH),
CONTAINER("bag of holding", "bag",  0, 1, 0,  20, 15, 100, CLOTH, HI_CLOTH),
CONTAINER("bag of tricks",  "bag",  0, 1, 1,  20, 15, 100, CLOTH, HI_CLOTH),
#undef CONTAINER
/* lock opening tools */
TOOL("skeleton key",    "key",  0, 0, 0, 0,  80,  3,    10, IRON, HI_METAL),
#ifdef TOURIST
TOOL("lock pick",       NULL,   1, 0, 0, 0,  60,  4,    20, IRON, HI_METAL),
TOOL("credit card",     NULL,   1, 0, 0, 0,  15,  1,    10, PLASTIC, WHITE),
#else
TOOL("lock pick",       NULL,   1, 0, 0, 0,  75,  4,    20, IRON, HI_METAL),
#endif
/* light sources */
TOOL("tallow candle", "candle", 0, 1, 0, 0,  20,  2,    10, WAX, WHITE),
TOOL("wax candle",    "candle", 0, 1, 0, 0,   5,  2,    20, WAX, WHITE),
#ifdef WALKIES
TOOL("brass lantern",   NULL,   1, 0, 0, 0,  30,100,    10, COPPER, YELLOW),
TOOL("oil lamp",        "lamp", 0, 0, 0, 0,  45, 80,    10, COPPER, YELLOW),
#else
TOOL("brass lantern",   NULL,   1, 0, 0, 0,  45,100,    10, COPPER, YELLOW),
TOOL("oil lamp",        "lamp", 0, 0, 0, 0,  75, 80,    10, COPPER, YELLOW),