MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ConsoleCommandStaff

Function ConsoleCommandStaff

src/openrct2/interface/InteractiveConsole.cpp:458–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& argv)
459{
460 auto& gameState = getGameState();
461 if (!argv.empty())
462 {
463 if (argv[0] == "list")
464 {
465 for (auto peep : EntityList<Staff>())
466 {
467 auto name = peep->GetName();
468 console.WriteFormatLine(
469 "staff id %03d type: %02u energy %03u name %s", peep->id, peep->assignedStaffType, peep->Energy,
470 name.c_str());
471 }
472 }
473 else if (argv[0] == "set")
474 {
475 if (argv.size() < 4)
476 {
477 console.WriteFormatLine("staff set energy <staff id> <value 0-255>");
478 console.WriteFormatLine("staff set costume <staff id> <costume id>");
479
480 auto _availableCostumeIndexes = findAllPeepAnimationsIndexesForType(AnimationPeepType::entertainer);
481 auto _availableCostumeObjects = findAllPeepAnimationsObjectForType(AnimationPeepType::entertainer);
482
483 for (auto i = 0u; i < _availableCostumeIndexes.size(); i++)
484 {
485 auto index = _availableCostumeIndexes[i];
486 auto name = _availableCostumeObjects[i]->GetCostumeName();
487 console.WriteFormatLine(" costume %i: %s", index, name.c_str());
488 }
489 return;
490 }
491 if (argv[1] == "energy")
492 {
493 int32_t int_val[3];
494 bool int_valid[3] = { false };
495 int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
496 int_val[1] = ConsoleParseInt(argv[3], &int_valid[1]);
497
498 if (int_valid[0] && int_valid[1])
499 {
500 Peep* peep = gameState.entities.GetEntity<Peep>(EntityId::FromUnderlying(int_val[0]));
501 if (peep != nullptr)
502 {
503 peep->Energy = int_val[1];
504 peep->EnergyTarget = int_val[1];
505 }
506 }
507 }
508 else if (argv[1] == "costume")
509 {
510 int32_t int_val[2];
511 bool int_valid[2] = { false };
512 int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
513 int_val[1] = ConsoleParseInt(argv[3], &int_valid[1]);
514 if (!int_valid[0])
515 {

Callers

nothing calls this directly

Calls 13

ConsoleParseIntFunction · 0.85
GetContextFunction · 0.85
WriteFormatLineMethod · 0.80
GetCostumeNameMethod · 0.80
WriteLineErrorMethod · 0.80
isEntertainerMethod · 0.80
ExecuteFunction · 0.50
emptyMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected