From f3f475e38a6b2a156cc196a3f39f393ade02791f Mon Sep 17 00:00:00 2001 From: Sven Eberhardt Date: Tue, 30 Aug 2016 02:00:02 -0400 Subject: [PATCH] Fix Time default initialization and add editor props --- .../Environment.ocd/Time.ocd/Script.c | 20 ++++++++++++++----- .../Environment.ocd/Time.ocd/StringTblDE.txt | 4 ++++ .../Environment.ocd/Time.ocd/StringTblUS.txt | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblDE.txt create mode 100644 planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblUS.txt diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c index bccb340c6..c375a1f69 100644 --- a/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/Time.ocd/Script.c @@ -216,15 +216,15 @@ protected func Initialize() CreateObject(Moon); } + // Set standard colour of the day + daycolour_global = [255, 255, 255]; + // Set the time to midday (12:00). - SetTime(43200); + SetTime(12*60); // Add effect that controls time cycle. SetCycleSpeed(30); AddEffect("IntTimeCycle", this, 100, 10, this); - - // Set standard colour of the day - daycolour_global = [255, 255, 255]; } // Cycles through day and night. @@ -390,7 +390,7 @@ public func SaveScenarioObject(props) if (!inherited(props, ...)) return false; // Save time props. - if (GetTime() != 43200) + if (GetTime() != 720) props->AddCall("Time", this, "SetTime", GetTime()); if (GetCycleSpeed() != 30) props->AddCall("CycleSpeed", this, "SetCycleSpeed", GetCycleSpeed()); @@ -398,6 +398,16 @@ public func SaveScenarioObject(props) } +/*-- Editor --*/ + +public func Definition(def) +{ + if (!def.EditorProps) def.EditorProps = {}; + def.EditorProps.Time = { Name="$Time$", EditorHelp="$TimeHelp$", Type="int", Min=0, Max=24*60 - 1, AsyncGet="GetTime", Set="SetTime" }; + def.EditorProps.CycleSpeed = { Name="$CycleSpeed$", EditorHelp="$CycleSpeedHelp$", Type="int", Min=0, AsyncGet="GetCycleSpeed", Set="SetCycleSpeed" }; +} + + /*-- Properties --*/ local Name = "Time"; diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblDE.txt b/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblDE.txt new file mode 100644 index 000000000..dbbfb86ff --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblDE.txt @@ -0,0 +1,4 @@ +Time=Zeit +TimeHelp=Aktuelle Tageszeit in Minuten seit Mitternacht. +CycleSpeed=Tagesgeschwindigkeit +CycleSpeedHelp=Geschwindigkeit des Tag-/Nachtrhythmus in Sekunden pro Tick. Standard 30. \ No newline at end of file diff --git a/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblUS.txt b/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblUS.txt new file mode 100644 index 000000000..8edcc55d3 --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Time.ocd/StringTblUS.txt @@ -0,0 +1,4 @@ +Time=Time +TimeHelp=Current time of the day in minutes since midnight. +CycleSpeed=Daily cycle speed +CycleSpeedHelp=Speed of the day/night cycle in seconds per tick. Default 30. \ No newline at end of file