diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-09-11 10:56:32 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-09-11 10:56:32 -0300 |
commit | d2c4027ec84c886436833d2da898d8d8d74a29d2 (patch) | |
tree | 26746ac547d250526b137d9219d6dfce830fec17 | |
parent | 713fb10129b502ae9559b9e62cf08593663ff93c (diff) | |
download | serverdata-jesusalva/housekeeping1.tar.gz serverdata-jesusalva/housekeeping1.tar.bz2 serverdata-jesusalva/housekeeping1.tar.xz serverdata-jesusalva/housekeeping1.zip |
Add season constants so if a script is written changing based on season,jesusalva/housekeeping1
we don't end up with unreadable `if (season_direction() == DOWN)`
And have much better `if (season_direction() == WINTER)`.
PS. Both versions work.
-rw-r--r-- | db/constants.conf | 6 | ||||
-rw-r--r-- | npc/functions/util.txt | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/db/constants.conf b/db/constants.conf index 2c6c4429..1dcca8cb 100644 --- a/db/constants.conf +++ b/db/constants.conf @@ -3939,6 +3939,12 @@ constants_db: { RIGHT: 6 DOWNRIGHT: 7 + comment__: "seasons" + WINTER: 0 + SPRING: 1 + SUMMER: 2 + AUTUMN: 3 + comment__: "speechflags" S_FIRST_BLANK_LINE: 1 S_LAST_BLANK_LINE: 2 diff --git a/npc/functions/util.txt b/npc/functions/util.txt index b45e7cdc..8e263eb0 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -8,10 +8,12 @@ // season_direction({day, month}) // returns the direction that represents our current season (approximation) -// DOWN: Winter, 21/12 -// DOWNLEFT: Spring, 20/03 -// LEFT: Summer, 21/06 -// UPLEFT: Autumn, 22/09 +// Note: You may also use WINTER/SPRING/SUMMER/AUTUMN constants for scripts +// where the direction is not important, but the season is. (Readability) +// DOWN: Winter, 21/12 WINTER +// DOWNLEFT: Spring, 20/03 SPRING +// LEFT: Summer, 21/06 SUMMER +// UPLEFT: Autumn, 22/09 AUTUMN function script season_direction { .@current_month = getarg(1, gettime(GETTIME_MONTH)); |