Rev | Line | |
---|
[75] | 1 | using System;
|
---|
| 2 |
|
---|
| 3 | public class GetTime : ConsoleCommand
|
---|
| 4 | {
|
---|
| 5 | public GetTime (ConsoleSdtd cons) : base(cons)
|
---|
| 6 | {
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | public override string Description ()
|
---|
| 10 | {
|
---|
| 11 | return "retrieves current ingame time";
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | public override string[] Names ()
|
---|
| 15 | {
|
---|
| 16 | return new string[] { "gettime", "gt" };
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | public override void Run (string[] _params)
|
---|
| 20 | {
|
---|
| 21 | ulong time = this.m_Console.gameManager.World.gameTime;
|
---|
| 22 | int day = (int)(time / 24000) + 1;
|
---|
| 23 | int hour = (int)(time % 24000) / 1000 + 8;
|
---|
| 24 | if (hour > 23) {
|
---|
| 25 | day++;
|
---|
| 26 | hour -= 24;
|
---|
| 27 | }
|
---|
[84] | 28 | int min = (int)(time % 1000) * 60 / 1000;
|
---|
| 29 | m_Console.md000a (String.Format ("Day {0}, {1:00}:{2:00} ", day, hour, min));
|
---|
[75] | 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.