Skip to content

[Feature] Add weather.status console command #8

@lextpf

Description

@lextpf

Problem statement

The time.* and weather.* command families both report engine state to the console, but only
time.status exists. There is no weather.status to print the current weather state and intensity in
isolation. Users who want to query weather without also dumping the full time/clock state have to
issue time.status (which works, but reads as if weather state lives under time.*) or guess. The
full status of weather is already in scope of time.status (ConsoleCommands.cpp:1583), but a
dedicated weather.status would mirror the existing time.status pattern and round out the weather.*
family.

Suggested implementation

Two changes:

  1. Add Cmd_WeatherStatus near the other Cmd_Weather* implementations (around
    ConsoleCommands.cpp:1325-1390).
  2. Register weather.status next to the other weather.* registrations at
    ConsoleCommands.cpp:3585-3607.
bool Cmd_WeatherStatus(std::span<const std::string_view> args, CommandContext& ctx)
{
  if (ctx.time == nullptr)
  {
    ctx.out.PrintError("weather.status: time manager unavailable");
    return false;
  }
  if (!args.empty())
  {
    ctx.out.PrintError("weather.status: usage 'weather.status'");
    return false;
  }
  char line[128];
  std::snprintf(line,
  sizeof(line),
  "weather.status: %s intensity=%.2f",
  std::string(EnumTraits<WeatherState>::Name(ctx.time->GetWeather())).c_str(),
  static_cast<double>(ctx.time->GetWeatherIntensity()));
  ctx.out.Print(line);
  return true;
}

Register near the existing weather.* block:

m_Registry.Register("weather.status",
"print current weather state and intensity",
[makeContext](auto args, Console&)
{
  CommandContext ctx = makeContext();
  (void)Cmd_WeatherStatus(args, ctx);
});

Proposed solution

Add a weather.status console command that prints one line of the form:
weather.status: <StateName> intensity=<0.00-1.00>
Implementation mirrors Cmd_TimeStatus/time.status but reads only ctx.time->GetWeather() and
ctx.time->GetWeatherIntensity(). Register it next to the other weather.* commands at
ConsoleCommands.cpp:3585-3607.

Alternatives considered

Not applicable - this approach is simple

Scope

Not applicable - the scope is clear

Pre-submission checklist

  • I searched existing issues and this proposal is not a duplicate.
  • This is a user-facing capability or improvement and not a purely internal task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions