DavidPistelak
Alpinetrainz.cz
The last model is made with love. 

Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
mesh-table
{
mesh
{
auto-create 1
mesh "lod.lm"
effects
{
elektrosvit_albedo
{
kind "texture-replacement"
texture "elektrosvit_albedo.texture"
}
elektrosvit_parameters
{
kind "texture-replacement"
texture "elektrosvit_parameters.texture"
}
light-1
{
kind "corona"
att "a.light0"
texture-kuid <kuid:383363:101651>
directional 0
object-size 0.1
max-distance 7000
}
light-2
{
kind "corona"
att "a.light0"
texture-kuid <kuid:383363:101654>
directional 0
object-size 0.22
max-distance 50
}
light-3
{
kind "corona"
att "a.light0"
texture-kuid <kuid:383363:101652>
directional 0
object-size 4
max-distance 500
}
}
}
...
kuid-table
{
a <kuid:383363:101651>
b <kuid:383363:101654>
c <kuid:383363:101652>
}
}
include "asset.gs"
include "buildable.gs"
include "gs.gs"
class Engine isclass Buildable
{
thread void CheckTime();
int isDay;
int lastSet = -1;
void Init(Asset asset)
{
// call the parent
inherited(asset);
CheckTime();
}
Asset GetCorona(string mesh, string effect) {
Soup meshtable = GetAsset().GetConfigSoup().GetNamedSoup("mesh-table");
Soup effects = meshtable.GetNamedSoup(mesh).GetNamedSoup("effects");
KUID kuid = effects.GetNamedSoup(effect).GetNamedTagAsKUID("texture-kuid");
return World.FindAsset(kuid);
}
thread void CheckTime()
{
while (true)
{
if(World.GetGameTime() * 24 > 6 and World.GetGameTime() * 24 < 18)
{
isDay = 0;
}
else
{
isDay = 1;
}
if(lastSet != isDay)
{
if(isDay == 1)
{
Interface.Log("NOW UNLIT");
SetFXTextureReplacementTexture("elektrosvit_albedo", "elektrosvit_albedo.texture");
SetFXTextureReplacementTexture("elektrosvit_parameters", "elektrosvit_parameters.texture");
SetFXCoronaTexture("light-1",null);
SetFXCoronaTexture("light-2",null);
SetFXCoronaTexture("light-3",null);
lastSet = 1;
}
if(isDay == 0)
{
Interface.Log("NOW LIT");
SetFXTextureReplacementTexture("elektrosvit_albedo", "elektrosvit_n_albedo.texture");
SetFXTextureReplacementTexture("elektrosvit_parameters", "elektrosvit_n_parameters.texture");
// Activate Lights 1 ; 2 ; 3
SetFXCoronaTexture("light-1",GetCorona("light-1","a"));
SetFXCoronaTexture("light-2",GetCorona("light-2","b"));
SetFXCoronaTexture("light-3",GetCorona("light-3","c"));
lastSet = 0;
}
}
Sleep(10);
}
}
};