summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/System.c4g/Sun.c
diff options
context:
space:
mode:
Diffstat (limited to 'TemplePushing.c4s/System.c4g/Sun.c')
-rw-r--r--TemplePushing.c4s/System.c4g/Sun.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/TemplePushing.c4s/System.c4g/Sun.c b/TemplePushing.c4s/System.c4g/Sun.c
new file mode 100644
index 0000000..9a52923
--- /dev/null
+++ b/TemplePushing.c4s/System.c4g/Sun.c
@@ -0,0 +1,47 @@
+/*-- Sun --*/
+
+#strict
+
+#appendto SONE
+
+private func BerechneSonneY()
+{
+ var ZeitObjekt = FindObject(TIME);
+ if(!ZeitObjekt)
+ SonneY = 30;
+
+ else return _inherited();
+}
+
+protected func TuWasBraves()
+{
+ // Bei vorhandenem Lenseflare (mit integrierter Sonne) kann dieses Objekt gelöscht werden
+ if(ObjectCount(LENS))
+ {
+ RemoveObject(this());
+ return();
+ }
+ // Hat es seinen Besitzer verloren? :(
+ if((!GetPlayerName(GetOwner())) || GetOwner()==-1)
+ {
+ RemoveObject(this());
+ return();
+ }
+ // Sonnenposition anpassen
+ BerechneSonne();
+ SetPosition(SonneX,SonneY);
+ // Nachts ausblenden
+ if(IsDay())
+ SetVisibility (VIS_Owner());
+ else
+ SetVisibility (VIS_None());
+ // Bei Nähe zur Sonne blenden
+ var VektorDist=GibVektorDist(GetOwner());
+ if(IsDay())
+ {
+ var Gelbstich = BoundBy((500-VektorDist)/5,0,100); // Prozentangabe 0 = weit weg, 100 = nahe; 500 Pixel sind dabei "weit weg"
+ SetGamma (RGB(000+(30*Gelbstich)/100,000+(30*Gelbstich)/100,000),
+ RGB(128+(60*Gelbstich)/100,128+(60*Gelbstich)/100,128),
+ RGB(255,255,255), GammaRampe_Lenseflare());
+ }
+} \ No newline at end of file