From aa83dadc1e20b989fd71664bc7824a4ce73bc788 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 17 Mar 2023 20:13:29 +0200 Subject: [PATCH] Add stormy level flag Which makes clouds create lightning bolts at random. This flag is used on the plane of air. Breaks saves and bones. --- dat/air.lua | 2 +- doc/lua.adoc | 1 + include/patchlevel.h | 2 +- include/rm.h | 1 + src/sp_lev.c | 2 ++ src/timeout.c | 4 ++-- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dat/air.lua b/dat/air.lua index 8a2882266..af27b86ac 100644 --- a/dat/air.lua +++ b/dat/air.lua @@ -6,7 +6,7 @@ -- des.level_init({ style = "solidfill", fg = " " }); -des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted") +des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted", "stormy") -- The following messages are somewhat obtuse, to make then -- equally meaningful if the player can see or not. des.message("What a strange feeling!") diff --git a/doc/lua.adoc b/doc/lua.adoc index 6de9a16c9..b05dfeb89 100644 --- a/doc/lua.adoc +++ b/doc/lua.adoc @@ -615,6 +615,7 @@ Set flags for this level. | nomongen | Prevents random monster generation. | nodeathdrops | Prevents killed monsters from dropping corpses or random death drops. | fumaroles | Lava emits poison gas clouds at random. +| stormy | Clouds create lightning bolts at random. |=== Example: diff --git a/include/patchlevel.h b/include/patchlevel.h index b67307b1f..668992e6d 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 79 +#define EDITLEVEL 80 /* * Development status possibilities. diff --git a/include/rm.h b/include/rm.h index 2b74524d5..8f04fac8c 100644 --- a/include/rm.h +++ b/include/rm.h @@ -393,6 +393,7 @@ struct levelflags { Bitfield(deathdrops, 1); /* monsters may drop corpses/death drops */ Bitfield(noautosearch, 1); /* automatic searching disabled */ Bitfield(fumaroles, 1); /* lava emits poison gas at random */ + Bitfield(stormy, 1); /* clouds create lightning bolts at random */ schar temperature; /* +1 == hot, -1 == cold */ }; diff --git a/src/sp_lev.c b/src/sp_lev.c index 29117f925..4a53eb4ac 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3749,6 +3749,8 @@ lspo_level_flags(lua_State *L) gl.level.flags.noautosearch = 1; else if (!strcmpi(s, "fumaroles")) gl.level.flags.fumaroles = 1; + else if (!strcmpi(s, "stormy")) + gl.level.flags.stormy = 1; else { char buf[BUFSZ]; Sprintf(buf, "Unknown level flag %s", s); diff --git a/src/timeout.c b/src/timeout.c index 8671fb1c1..42de676da 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1706,8 +1706,8 @@ do_storms(void) int dirx, diry; int count; - /* no lightning if not the air level or too often, even then */ - if (!Is_airlevel(&u.uz) || rn2(8)) + /* no lightning if not stormy level or too often, even then */ + if (!gl.level.flags.stormy || rn2(8)) return; /* the number of strikes is 8-log2(nstrike) */