From d2c4027ec84c886436833d2da898d8d8d74a29d2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Sep 2019 10:56:32 -0300 Subject: Add season constants so if a script is written changing based on season, we don't end up with unreadable `if (season_direction() == DOWN)` And have much better `if (season_direction() == WINTER)`. PS. Both versions work. --- db/constants.conf | 6 ++++++ 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)); -- cgit v1.2.3-70-g09d2