int main()
{
    init_python_api();

    Py_InitModule("testmod", no_methods);

    run_python_string("import server");
    run_python_string("import testmod");
    run_python_string("from atlas import Operation");
    run_python_string("class settlerMind(server.Thing):\n"
                      " def look_operation(self, op): pass\n"
                      " def delete_operation(self, op):\n"
                      "  return Operation('sight') + Operation('move')\n"
                      " def test_hook(self, ent): pass\n"
                     );
    run_python_string("testmod.settlerMind=settlerMind");

    TypeNode * tn = new TypeNode();
    tn->name() = etype;

    MindFactory * mf = MindFactory::instance();

    mf->addMindType(etype, "testmod");

    mf->newMind("1", 1, tn);

    tn->name() = etype;

    mf->newMind("2", 2, tn);

    shutdown_python_api();
    return 0;
}
Esempio n. 2
0
int main()
{
    TypeNode * tn = new TypeNode();
    tn->name() = etype;

    MindFactory * mf = MindFactory::instance();

    mf->addMindType(etype, "testmod");

    mf->newMind("1", 1, tn);

    tn->name() = etype;

    mf->newMind("2", 2, tn);

    return 0;
}
Esempio n. 3
0
int main()
{
    World e("0", 0);
    TypeNode type;
    type.name() = "world";
    e.setType(&type);

    IGEntityExerciser ee(e);

    assert(e.m_location.m_loc == 0);

    // Throw an op of every type at the entity
    ee.runOperations();

    // Subscribe the entity to every class of op
    std::set<std::string> opNames;
    ee.addAllOperations(opNames);

    // Throw an op of every type at the entity again now it is subscribed
    ee.runOperations();

    return 0;
}
Esempio n. 4
0
void TypeNodeProvider::value(Atlas::Message::Element& value, const TypeNode& type) const
{
    if (m_attribute_name == "name") {
        value = type.name();
    }
}