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

Function spectate_setSetting

plugins/spectate.cpp:563–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561// Lua API
562
563static void spectate_setSetting(color_ostream &out, string name, int val) {
564 DEBUG(control,out).print("entering spectate_setSetting {} = {}\n", name, val);
565
566 if (name == "auto-unpause") {
567 if (val && !config.auto_unpause) {
568 announcement_settings.save_and_scrub_settings(out);
569 } else if (!val && config.auto_unpause) {
570 announcement_settings.restore_settings(out);
571 }
572 config.auto_unpause = val;
573 } else if (name == "cinematic-action") {
574 config.cinematic_action = val;
575 } else if (name == "include-animals") {
576 config.include_animals = val;
577 } else if (name == "include-hostiles") {
578 config.include_hostiles = val;
579 } else if (name == "include-visitors") {
580 config.include_visitors = val;
581 } else if (name == "include-wildlife") {
582 config.include_wildlife = val;
583 } else if (name == "prefer-conflict") {
584 config.prefer_conflict = val;
585 } else if (name == "prefer-new-arrivals") {
586 config.prefer_new_arrivals = val;
587 } else if (name == "prefer-nicknamed") {
588 config.prefer_nicknamed = val;
589 } else if (name == "follow-seconds") {
590 if (val <= 0) {
591 WARN(control,out).print("follow-seconds must be a positive integer\n");
592 return;
593 }
594 config.follow_ms = val * 1000;
595 } else {
596 WARN(control,out).print("Unknown setting: {}\n", name);
597 }
598}
599
600static void spectate_followPrev(color_ostream &out) {
601 DEBUG(control,out).print("entering spectate_followPrev\n");

Callers

nothing calls this directly

Calls 3

restore_settingsMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected