Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lake Lighting Project #938

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
98 changes: 98 additions & 0 deletions Scripts/Python/islmLakeLightMeter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
""" *==LICENSE==*

CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Additional permissions under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.

You can contact Cyan Worlds, Inc. by email [email protected]
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021

*==LICENSE==* """

from Plasma import *
from PlasmaTypes import *

stringSDLVarName = ptAttribString(0, "Lake Light State SDL Variable")
LightMeterVis = ptAttribString(1, "Lake Light Meter Vis State SDL Variable")
Zero = ptAttribSceneobject(2, "Scene Object: Digital_0")
One = ptAttribSceneobject(3, "Scene Object: Digital_1")
Two = ptAttribSceneobject(4, "Scene Object: Digital_2")
Three = ptAttribSceneobject(5, "Scene Object: Digital_3")
Four = ptAttribSceneobject(6, "Scene Object: Digital_4")
LakeLightMeter = [Zero, One, Two, Three, Four]


class islmLakeLightMeter(ptResponder):
###########################
def __init__(self):
ptResponder.__init__(self)
self.id = 986548
version = 1
self.version = version
PtDebugPrint(f"__init__islmLakeLightMeter v.{version}")

def OnServerInitComplete(self):
ageSDL = PtGetAgeSDL()
SDLvalue = 0
if stringSDLVarName:
ageSDL.setNotify(self.key, stringSDLVarName.value, 0.0)
ageSDL.setNotify(self.key, LightMeterVis.value, 0.0)
SDLvalue = ageSDL[stringSDLVarName.value][0]
MeterVis = ageSDL[LightMeterVis.value][0]

if MeterVis:
for i in LakeLightMeter:
i.sceneobject.draw.disable()
i.sceneobject.physics.suppress(True)

LakeLightMeter[SDLvalue].sceneobject.draw.enable()
LakeLightMeter[SDLvalue].sceneobject.physics.suppress(False)


def OnSDLNotify(self, VARname, SDLname, PlayerID, tag):
if (VARname != stringSDLVarName.value and VARname != LightMeterVis.value):
Hazado marked this conversation as resolved.
Show resolved Hide resolved
return

ageSDL = PtGetAgeSDL()
SDLvalue = ageSDL[stringSDLVarName.value][0]
MeterVis = ageSDL[LightMeterVis.value][0]

if MeterVis:
for i in LakeLightMeter:
i.sceneobject.draw.disable()
i.sceneobject.physics.suppress(True)

LakeLightMeter[SDLvalue].sceneobject.draw.enable()
LakeLightMeter[SDLvalue].sceneobject.physics.suppress(False)
Hazado marked this conversation as resolved.
Show resolved Hide resolved
109 changes: 109 additions & 0 deletions Scripts/Python/xLakeLightCycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-
""" *==LICENSE==*

CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Additional permissions under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.

You can contact Cyan Worlds, Inc. by email [email protected]
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021

*==LICENSE==* """

"""
SDLvalue
0 = Dark
1 = Quarter
2 = Half
3 = Three Quarter
4 = Full

Full Dni Day is 108,750 Earth seconds
FullDniDay variable is divided by 100 due to layer animations not being able to go that high

"""

from Plasma import *
from PlasmaTypes import *

stringSDLVarName = ptAttribString(0, "Lake Light State SDL Variable")
DarkMatAnim = ptAttribMaterialAnimation(1, "mat anim: Lake Light Dark")
QuarterMatAnim = ptAttribMaterialAnimation(2, "mat anim: Lake Light Quarter")
HalfMatAnim = ptAttribMaterialAnimation(3, "mat anim: Lake Light Half")
ThreeQuarterMatAnim = ptAttribMaterialAnimation(4, "mat anim: Lake Light Three Quarter")
FullMatAnim = ptAttribMaterialAnimation(5, "mat anim: Lake Light Full")
MatAnimLakeLight = [DarkMatAnim, QuarterMatAnim, HalfMatAnim, ThreeQuarterMatAnim, FullMatAnim]
FullDniDay = 1087.5


class xLakeLightCycle(ptResponder):
###########################
def __init__(self):
ptResponder.__init__(self)
self.id = 986547
version = 1
self.version = version
PtDebugPrint(f"__init__xLakeLightCycle v.{version}")

def OnServerInitComplete(self):
ageSDL = PtGetAgeSDL()
dniSecsElapsed = PtGetAgeTimeOfDayPercent() * FullDniDay
SDLvalue = 0
if stringSDLVarName:
ageSDL.setNotify(self.key, stringSDLVarName.value, 0.0)
SDLvalue = ageSDL[stringSDLVarName.value][0]

PtDebugPrint(f"xLakeLightCycle - Animation {SDLvalue} set to time {dniSecsElapsed}")
MatAnimLakeLight[SDLvalue].animation.backwards(0)
MatAnimLakeLight[SDLvalue].animation.looped(1)
MatAnimLakeLight[SDLvalue].animation.skipToTime(dniSecsElapsed)
MatAnimLakeLight[SDLvalue].animation.resume()


def OnSDLNotify(self, VARname, SDLname, PlayerID, tag):
if VARname != stringSDLVarName.value:
return

ageSDL = PtGetAgeSDL()
dniSecsElapsed = PtGetAgeTimeOfDayPercent() * FullDniDay
SDLvalue = ageSDL[stringSDLVarName.value][0]

for i in MatAnimLakeLight:
i.animation.stop()

PtDebugPrint(f"xLakeLightCycle - Animation {SDLvalue} set to time {dniSecsElapsed}")
MatAnimLakeLight[SDLvalue].animation.backwards(0)
MatAnimLakeLight[SDLvalue].animation.looped(1)
MatAnimLakeLight[SDLvalue].animation.skipToTime(dniSecsElapsed)
MatAnimLakeLight[SDLvalue].animation.resume()
28 changes: 22 additions & 6 deletions Scripts/SDL/BaronCityOffice.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
#
# *==LICENSE==*/
#==============================================================
# READ: When modifying an SDL record, do *not* modify the
# existing record. You must copy and paste a new version
# below the current one and make your changes there.
# READ: When modifying an SDL record, do *not* modify the
# existing record. You must copy and paste a new version
# below the current one and make your changes there.
#==============================================================


Expand All @@ -51,7 +51,7 @@

STATEDESC BaronCityOffice
{
VERSION 5
VERSION 5

# Boolean variables
VAR BOOL tldnTreasureBook03Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
Expand All @@ -63,7 +63,7 @@ STATEDESC BaronCityOffice

STATEDESC BaronCityOffice
{
VERSION 6
VERSION 6

# Boolean variables
VAR BOOL tldnTreasureBook03Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
Expand All @@ -77,7 +77,7 @@ STATEDESC BaronCityOffice

STATEDESC BaronCityOffice
{
VERSION 7
VERSION 7

# Boolean variables
VAR BOOL tldnTreasureBook03Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
Expand All @@ -88,3 +88,19 @@ STATEDESC BaronCityOffice
VAR BOOL bcoChristmasVis[1] DEFAULT=0 DEFAULTOPTION=VAULT

}

STATEDESC BaronCityOffice
{
VERSION 8

# Boolean variables
VAR BOOL tldnTreasureBook03Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
VAR BOOL tldnJourneyCloth03Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
VAR BOOL tldnRopeBridgeFromBCOVis[1] DEFAULT=0 DEFAULTOPTION=VAULT
VAR BOOL bcoGZMarkerVis[1] DEFAULT=0 DEFAULTOPTION=VAULT
VAR BOOL bcoGZBeamVis[1] DEFAULT=0 DEFAULTOPTION=VAULT
VAR BOOL bcoChristmasVis[1] DEFAULT=0 DEFAULTOPTION=VAULT

# State variables
VAR BYTE nb01LakeLightState[1] DEFAULT=0 DEFAULTOPTION=VAULT
}
24 changes: 19 additions & 5 deletions Scripts/SDL/ErcanaCitySilo.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
#
# *==LICENSE==*/
#==============================================================
# READ: When modifying an SDL record, do *not* modify the
# existing record. You must copy and paste a new version
# below the current one and make your changes there.
# READ: When modifying an SDL record, do *not* modify the
# existing record. You must copy and paste a new version
# below the current one and make your changes there.
#==============================================================


Expand All @@ -51,12 +51,26 @@

STATEDESC ErcanaCitySilo
{
VERSION 1
VERSION 1

## Age Mechanics ##
VAR INT ercaGotPellet[1] DEFAULT=0 DISPLAYOPTION=red

# Boolean variables
VAR BOOL ercaGZMarkerVis[1] DEFAULT=0 DEFAULTOPTION=VAULT

}
}

STATEDESC ErcanaCitySilo
{
VERSION 2

## Age Mechanics ##
VAR INT ercaGotPellet[1] DEFAULT=0 DISPLAYOPTION=red

# Boolean variables
VAR BOOL ercaGZMarkerVis[1] DEFAULT=0 DEFAULTOPTION=VAULT

# State variables
VAR BYTE nb01LakeLightState[1] DEFAULT=0 DEFAULTOPTION=VAULT
}
Loading