MCPcopy Create free account
hub / github.com/DFHack/dfhack / df_cprobe

Function df_cprobe

plugins/probe.cpp:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44REQUIRE_GLOBAL(world);
45
46static command_result df_cprobe(color_ostream &out, vector<string> & parameters) {
47 auto unit = Gui::getSelectedUnit(out);
48 if (!unit)
49 return CR_FAILURE;
50
51 out.print("Creature {}, race {} (0x{:x}), civ {} (0x{:x})\n",
52 unit->id, unit->race, unit->race, unit->civ_id, unit->civ_id);
53
54 for (auto inv_item : unit->inventory) {
55 df::item* item = inv_item->item;
56 if (inv_item->mode == df::inv_item_role_type::Worn) {
57 out << " wears item: #" << item->id;
58 if (item->flags.bits.owned)
59 out << " (owned)";
60 else
61 out << " (not owned)";
62 if (item->getEffectiveArmorLevel() != 0)
63 out << ", armor";
64 out << std::endl;
65 }
66 }
67
68 return CR_OK;
69}
70
71static void describeTile(color_ostream &out, df::tiletype tiletype) {
72 out.print("{}", static_cast<int>(tiletype));

Callers

nothing calls this directly

Calls 2

getSelectedUnitFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected