forked from Mirrors/openclonk
remove celestial environment object in favor of scenario callback
parent
1cf1e309ea
commit
e9b076f6d3
|
@ -10,7 +10,6 @@ protected func Initialize()
|
||||||
{
|
{
|
||||||
// Environment
|
// Environment
|
||||||
CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36);
|
CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36);
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time=CreateObject(Environment_Time);
|
var time=CreateObject(Environment_Time);
|
||||||
time->SetTime();
|
time->SetTime();
|
||||||
time->SetCycleSpeed();
|
time->SetCycleSpeed();
|
||||||
|
|
|
@ -13,7 +13,6 @@ func DoInit(int first_player)
|
||||||
|
|
||||||
// Set time of day to evening and create some clouds and celestials.
|
// Set time of day to evening and create some clouds and celestials.
|
||||||
Cloud->Place(20);
|
Cloud->Place(20);
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(600);
|
time->SetTime(600);
|
||||||
time->SetCycleSpeed(20);
|
time->SetCycleSpeed(20);
|
||||||
|
|
|
@ -16,7 +16,6 @@ func DoInit(int first_player)
|
||||||
{
|
{
|
||||||
// Set time of day to morning and create some clouds and celestials.
|
// Set time of day to morning and create some clouds and celestials.
|
||||||
Cloud->Place(20);
|
Cloud->Place(20);
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(400);
|
time->SetTime(400);
|
||||||
time->SetCycleSpeed(6);
|
time->SetCycleSpeed(6);
|
||||||
|
|
|
@ -14,7 +14,6 @@ func DoInit(int first_player)
|
||||||
//CreateObjectAbove(LiftTower, 178,405, first_player);
|
//CreateObjectAbove(LiftTower, 178,405, first_player);
|
||||||
// Set time of day to evening and create some clouds and celestials.
|
// Set time of day to evening and create some clouds and celestials.
|
||||||
Cloud->Place(15);
|
Cloud->Place(15);
|
||||||
EnsureObject(Environment_Celestial,0,0,-1);
|
|
||||||
EnsureObject(Rule_BuyAtFlagpole,0,0,-1);
|
EnsureObject(Rule_BuyAtFlagpole,0,0,-1);
|
||||||
SetSkyAdjust(0xff000000);
|
SetSkyAdjust(0xff000000);
|
||||||
var storm = EnsureObject(Storm,0,0,NO_OWNER);
|
var storm = EnsureObject(Storm,0,0,NO_OWNER);
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[DefCore]
|
|
||||||
id=Environment_Celestial
|
|
||||||
Version=6,0
|
|
||||||
Category=C4D_Environment|C4D_StaticBack
|
|
||||||
Picture=0,0,128,128
|
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
|
@ -58,16 +58,17 @@ protected func Initialize()
|
||||||
// Only one time control object.
|
// Only one time control object.
|
||||||
if (ObjectCount(Find_ID(Environment_Time)) > 1)
|
if (ObjectCount(Find_ID(Environment_Time)) > 1)
|
||||||
return RemoveObject();
|
return RemoveObject();
|
||||||
|
|
||||||
|
// Determine the frame times for day and night events.
|
||||||
time_set = {
|
time_set = {
|
||||||
sunrise_start = 10800, // 3:00
|
sunrise_start = 3 * 60 * 60, // 3:00
|
||||||
sunrise_end = 32400, // 9:00
|
sunrise_end = 9 * 60 * 60, // 9:00
|
||||||
sunset_start = 54000, // 15:00
|
sunset_start = 15 * 60 * 60, // 15:00
|
||||||
sunset_end = 75600, // 21:00
|
sunset_end = 21 * 60 * 60, // 21:00
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create moon and stars.
|
// Create moon and stars if celestial objects are not blocked by the scenario.
|
||||||
if (FindObject(Find_ID(Environment_Celestial)))
|
if (!GameCall("HasNoCelestials"))
|
||||||
{
|
{
|
||||||
PlaceStars();
|
PlaceStars();
|
||||||
CreateObjectAbove(Moon, LandscapeWidth() / 2, LandscapeHeight() / 6);
|
CreateObjectAbove(Moon, LandscapeWidth() / 2, LandscapeHeight() / 6);
|
||||||
|
@ -102,12 +103,12 @@ public func IsNight()
|
||||||
|
|
||||||
private func PlaceStars()
|
private func PlaceStars()
|
||||||
{
|
{
|
||||||
// since stars are almost completely parallax (=in screen coordinates), we only need
|
// Since stars are almost completely parallax (=in screen coordinates), we only need
|
||||||
// to place stars for max. a reasonable maximum resolution. Lets say 1600x1200
|
// to place stars for max. a reasonable maximum resolution, let's say 1920x1200.
|
||||||
var lw = Min(LandscapeWidth(), 1600);
|
var lw = Min(LandscapeWidth(), 1920);
|
||||||
var lh = Min(LandscapeHeight(), 1200);
|
var lh = Min(LandscapeHeight(), 1200);
|
||||||
|
|
||||||
//Star Creation
|
// Star Creation.
|
||||||
var maxfailedtries = lw * lh / 40000;
|
var maxfailedtries = lw * lh / 40000;
|
||||||
var failed = 0;
|
var failed = 0;
|
||||||
|
|
||||||
|
@ -120,8 +121,7 @@ private func PlaceStars()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
failed++;
|
failed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,11 +285,6 @@ public func SaveScenarioObject(props)
|
||||||
{
|
{
|
||||||
if (!inherited(props, ...))
|
if (!inherited(props, ...))
|
||||||
return false;
|
return false;
|
||||||
// Initialize function depends on this object implicitely.
|
|
||||||
// So make sure it's created before this.
|
|
||||||
var celestial_env = FindObject(Find_ID(Environment_Celestial));
|
|
||||||
if (celestial_env)
|
|
||||||
celestial_env->MakeScenarioSaveName();
|
|
||||||
// Save time props.
|
// Save time props.
|
||||||
if (GetTime() != 43200)
|
if (GetTime() != 43200)
|
||||||
props->AddCall("Time", this, "SetTime", GetTime());
|
props->AddCall("Time", this, "SetTime", GetTime());
|
||||||
|
|
|
@ -108,3 +108,7 @@ global func FxSnowfallTimer(object target, effect, int timer)
|
||||||
CastPXS("Snow", 5, 1, RandomX(0, LandscapeWidth()), 1);
|
CastPXS("Snow", 5, 1, RandomX(0, LandscapeWidth()), 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This scenario has day and night but no celestial objects.
|
||||||
|
public func HasNoCelestials() { return true; }
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ protected func Initialize()
|
||||||
// Environment
|
// Environment
|
||||||
PlaceGrass(85);
|
PlaceGrass(85);
|
||||||
Cloud->Place(15);
|
Cloud->Place(15);
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(22*60);
|
time->SetTime(22*60);
|
||||||
time->SetCycleSpeed(0);
|
time->SetCycleSpeed(0);
|
||||||
|
|
|
@ -25,8 +25,7 @@ protected func Initialize()
|
||||||
Volcano->SetMaterial("DuroLava");
|
Volcano->SetMaterial("DuroLava");
|
||||||
Meteor->SetChance(22);
|
Meteor->SetChance(22);
|
||||||
// We aren't doing much outside anyway; celestials are a bit of a waste
|
// We aren't doing much outside anyway; celestials are a bit of a waste
|
||||||
/*CreateObject(Environment_Celestial);
|
/*var time = CreateObject(Environment_Time);
|
||||||
var time = CreateObject(Environment_Time);
|
|
||||||
time->SetTime(60*12);
|
time->SetTime(60*12);
|
||||||
time->SetCycleSpeed(20);*/
|
time->SetCycleSpeed(20);*/
|
||||||
// Starting materials in lorry
|
// Starting materials in lorry
|
||||||
|
|
|
@ -91,7 +91,6 @@ protected func InitializePlayer(int plr)
|
||||||
private func InitEnvironment(int difficulty)
|
private func InitEnvironment(int difficulty)
|
||||||
{
|
{
|
||||||
// Set time to almost night and have stars.
|
// Set time to almost night and have stars.
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(20 * 60 + 15);
|
time->SetTime(20 * 60 + 15);
|
||||||
time->SetCycleSpeed(0);
|
time->SetCycleSpeed(0);
|
||||||
|
|
|
@ -96,7 +96,6 @@ private func InitEnvironment()
|
||||||
// Set time of day to evening and create some clouds and celestials.
|
// Set time of day to evening and create some clouds and celestials.
|
||||||
Cloud->Place(10);
|
Cloud->Place(10);
|
||||||
Cloud->SetPrecipitation("Water", 8);
|
Cloud->SetPrecipitation("Water", 8);
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(60 * 12);
|
time->SetTime(60 * 12);
|
||||||
time->SetCycleSpeed(20);
|
time->SetCycleSpeed(20);
|
||||||
|
|
|
@ -107,8 +107,6 @@ private func InitEnvironment(int difficulty)
|
||||||
// Set time of day to evening and create some clouds and celestials.
|
// Set time of day to evening and create some clouds and celestials.
|
||||||
Cloud->Place(20);
|
Cloud->Place(20);
|
||||||
Cloud->SetPrecipitation("Snow", 20 + 5 * difficulty);
|
Cloud->SetPrecipitation("Snow", 20 + 5 * difficulty);
|
||||||
|
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(60 * 22);
|
time->SetTime(60 * 22);
|
||||||
time->SetCycleSpeed(0);
|
time->SetCycleSpeed(0);
|
||||||
|
|
|
@ -113,7 +113,6 @@ private func InitEnvironment(int difficulty)
|
||||||
SetGamma(RGB(0, 0, 0), RGB(128 - dark, 128 - dark, 128 - dark), RGB(255 - 2 * dark, 255 - 2 * dark, 255 - 2 * dark));
|
SetGamma(RGB(0, 0, 0), RGB(128 - dark, 128 - dark, 128 - dark), RGB(255 - 2 * dark, 255 - 2 * dark, 255 - 2 * dark));
|
||||||
|
|
||||||
// Time of days and celestials.
|
// Time of days and celestials.
|
||||||
CreateObject(Environment_Celestial);
|
|
||||||
var time = CreateObject(Environment_Time);
|
var time = CreateObject(Environment_Time);
|
||||||
time->SetTime(60 * 20);
|
time->SetTime(60 * 20);
|
||||||
time->SetCycleSpeed(20);
|
time->SetCycleSpeed(20);
|
||||||
|
|
Loading…
Reference in New Issue