diff options
author | Jesusaves <cpntb1@ymail.com> | 2018-06-19 11:23:46 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2018-06-19 11:23:46 -0300 |
commit | 2ad6aa593a246004068a791d9522a18e72e27055 (patch) | |
tree | 2b4f59c18da9d54c81afe2d1c4714ec1ced1a7e1 /npc/functions/weather.txt | |
parent | c6c7c3132e741908141f71dffb668d5fe38687af (diff) | |
download | serverdata-2ad6aa593a246004068a791d9522a18e72e27055.tar.gz serverdata-2ad6aa593a246004068a791d9522a18e72e27055.tar.bz2 serverdata-2ad6aa593a246004068a791d9522a18e72e27055.tar.xz serverdata-2ad6aa593a246004068a791d9522a18e72e27055.zip |
Simplify weather code, to make easier to read/edit
Diffstat (limited to 'npc/functions/weather.txt')
-rw-r--r-- | npc/functions/weather.txt | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/npc/functions/weather.txt b/npc/functions/weather.txt index cb426516d..631934bad 100644 --- a/npc/functions/weather.txt +++ b/npc/functions/weather.txt @@ -50,13 +50,13 @@ OnInit: // Icelands htput(.wcore, "001-7", "iceland"); + debugmes "[Weather.sys] Total Maps = " + htsize(.wcore); // No "end" here, so server starts with weather OnMinute00: OnMinute15: OnMinute30: OnMinute45: - debugmes "[Weather.sys] Total Maps = " + htsize(.wcore); .@hti = htiterator(.wcore); for(.@key$ = htinextkey(.@hti); hticheck(.@hti); .@key$ = htinextkey(.@hti)) { @@ -68,33 +68,28 @@ OnMinute45: // Local variables: .@key$ .@type .@r .@type$=htget(.wcore, .@key$); .@r=rand(0,10000); + .@mk=MASK_NONE; // Remove all current masks, and add rain/snow/sand if (.@type$ == "desert") { if (.@r < 10) - setmapmask .@key$, MASK_RAIN; + .@mk=MASK_RAIN; else if (.@r < 100) - setmapmask .@key$, MASK_SANDSTORM; - else - setmapmask .@key$, MASK_NONE; + .@mk=MASK_SANDSTORM; } else if (.@type$ == "woodland") { if (.@r < 100) - setmapmask .@key$, MASK_RAIN; + .@mk=MASK_RAIN; else if (.@r < 120) - setmapmask .@key$, MASK_SANDSTORM; + .@mk=MASK_SANDSTORM; else if (.@r < 140) - setmapmask .@key$, MASK_SNOW; - else - setmapmask .@key$, MASK_NONE; + .@mk=MASK_SNOW; } else if (.@type$ == "iceland") { if (.@r < 10) - setmapmask .@key$, MASK_RAIN; + .@mk=MASK_RAIN; else if (.@r < 100) - setmapmask .@key$, MASK_SNOW; - else - setmapmask .@key$, MASK_NONE; + .@mk=MASK_SNOW; } else { debugmes "Warning warning, blame Saulc! Weather system error on map "+.@key$; @@ -102,6 +97,8 @@ OnMinute45: atcommand "@mapexit"; } + setmapmask .@key$, .@mk; + // Is it night time? // For convenience, night time is from 00:15 to 00:45, every hour. // 2 = GETTIME_MINUTE |