| 201 | } |
| 202 | |
| 203 | String CommandProcessor::timewarp(ConnectionId connectionId, String const& argumentsString) { |
| 204 | if (auto errorMsg = adminCheck(connectionId, "do the time warp again")) |
| 205 | return *errorMsg; |
| 206 | |
| 207 | auto arguments = m_parser.tokenizeToStringList(argumentsString); |
| 208 | if (arguments.empty()) |
| 209 | return "Not enough arguments to /timewarp"; |
| 210 | |
| 211 | try { |
| 212 | auto time = lexicalCast<double>(arguments.at(0)); |
| 213 | if (time == 0.0) |
| 214 | return "You suck at time travel."; |
| 215 | else if (time < 0.0 && (arguments.size() < 2 || arguments[1] != "please")) |
| 216 | return "Great Scott! We can't go back in time!"; |
| 217 | |
| 218 | m_universe->universeClock()->adjustTime(time); |
| 219 | return time > 0.0 ? "It's just a jump to the left..." : "And then a step to the right..."; |
| 220 | } catch (BadLexicalCast const&) { |
| 221 | return strf("Could not parse the argument {} as a time adjustment", arguments[0]); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | String CommandProcessor::timescale(ConnectionId connectionId, String const& argumentsString) { |
| 226 | if (auto errorMsg = adminCheck(connectionId, "mess with time")) |
nothing calls this directly
no test coverage detected