Fix Time default initialization and add editor props

console-destruction
Sven Eberhardt 2016-08-30 02:00:02 -04:00
parent e7c11cf590
commit f3f475e38a
3 changed files with 23 additions and 5 deletions

View File

@ -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";

View File

@ -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.

View File

@ -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.