summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-10 00:36:21 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-10 00:36:21 +0100
commitb634310a2ce4e477e7700ecf4a484e30f548b5fc (patch)
tree48a180ac7f89cabad5fb4f8a96f1e2b5c35084de /source/cWorld.cpp
parentAdded random weather that persists per world. Also added SetWeather, GetWeather, and CastThunderbolt to lua bindings. (diff)
downloadcuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar.gz
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar.bz2
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar.lz
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar.xz
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.tar.zst
cuberite-b634310a2ce4e477e7700ecf4a484e30f548b5fc.zip
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 95a640902..d914cf05d 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -394,7 +394,7 @@ void cWorld::Tick(float a_Dt)
////////////////Weather///////////////////////
if ( GetWeather() == 0 ) { //if sunny
if( CurrentTick % 19 == 0 ) { //every 20 ticks random weather
- randWeather = (rand() %100);
+ randWeather = (rand() %1000);
if (randWeather == 0) {
LOG("Starting Rainstorm!");
SetWeather ( 1 );
@@ -407,11 +407,11 @@ void cWorld::Tick(float a_Dt)
if ( GetWeather() != 0 ) { //if raining or thunderstorm
if( CurrentTick % 19 == 0 ) { //every 20 ticks random weather
- randWeather = (rand() %49);
+ randWeather = (rand() %499);
if (randWeather == 0) { //2% chance per second
LOG("Back to sunny!");
SetWeather ( 0 );
- } else if ( (randWeather > 40) && (GetWeather() != 2) ) { //random chance for rainstorm to turn into thunderstorm.
+ } else if ( (randWeather > 400) && (GetWeather() != 2) ) { //random chance for rainstorm to turn into thunderstorm.
LOG("Starting Thunderstorm!");
SetWeather ( 2 );
}
@@ -419,7 +419,7 @@ void cWorld::Tick(float a_Dt)
}
if ( GetWeather() == 2 ) { //if thunderstorm
- if (rand() %99 == 0) { //1% chance per tick of thunderbolt
+ if (rand() %199 == 0) { //0.5% chance per tick of thunderbolt
CastThunderbolt ( 0, 0, 0 ); //todo: find random possitions near players to cast thunderbolts.
}
}