]> granicus.if.org Git - nethack/commitdiff
Allow creating unhidden traps in special levels
authorPasi Kallinen <paxed@alt.org>
Sat, 19 Feb 2022 10:38:24 +0000 (12:38 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 19 Feb 2022 10:38:28 +0000 (12:38 +0200)
des.trap({ type = "rust", seen = true });

doc/fixes3-7-0.txt
doc/lua.adoc
include/hack.h
include/sp_lev.h
src/mklev.c
src/sp_lev.c

index 0cdfcf83763796d8559e60394a7fcc4653738901..1b91edaa39cf2baad8a43385eaf64336fcf370ad 100644 (file)
@@ -788,6 +788,7 @@ knights get no caitiff penalty against undead
 candy bars are bright blue in text mode
 towels weigh more than blindfolds
 knight quest home level contains some saddled warhorses
+allow creating unhidden traps in special levels
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 886ba2d711033f90814f235126058036c0dcb2e9..9e1f71ef4c5a377a4f0c8687d10dae019dbc8ef6 100644 (file)
@@ -741,10 +741,13 @@ Example:
 
 === trap
 
+Create a trap.
+
 Example:
 
  des.trap({ type = "hole", x = 1, y = 1 });
  des.trap({ type = "hole", coord = {2, 2} });
+ des.trap({ type = "web", coord = {2, 2}, spider_on_web = false, seen = true });
  des.trap("hole", 3, 4);
  des.trap("level teleport", {5, 8});
  des.trap("rust")
index 2ed2e882d2fb6550c08f1374a442860c2086e0ad..032cc9946aef89ca096968f6e1338202f3fb1fb8 100644 (file)
@@ -519,6 +519,7 @@ enum bodypart_types {
 #define MKTRAP_NOFLAGS       0x0
 #define MKTRAP_MAZEFLAG      0x1 /* trap placed on coords as if in maze */
 #define MKTRAP_NOSPIDERONWEB 0x2 /* web will not generate a spider */
+#define MKTRAP_SEEN          0x4 /* trap is seen */
 
 #define MON_POLE_DIST 5 /* How far monsters can use pole-weapons */
 #define PET_MISSILE_RANGE2 36 /* Square of distance within which pets shoot */
index 920253543a57fb44f008bdba83bd74283da4ba77..77c4dbd5cf382079702fa3319a79b7a91796a92e 100644 (file)
@@ -128,6 +128,7 @@ typedef struct {
     packed_coord coord;
     xchar x, y, type;
     boolean spider_on_web;
+    boolean seen;
 } spltrap;
 
 typedef struct {
index 98a14593669c8a2a31bd35f89fe09106f00b1cb8..be78a4504e0b2fd104a196990ab333300ee93901 100644 (file)
@@ -1468,6 +1468,8 @@ mktrap(int num, int mktrapflags, struct mkroom *croom, coord *tm)
 
     if (kind == WEB && !(mktrapflags & MKTRAP_NOSPIDERONWEB))
         (void) makemon(&mons[PM_GIANT_SPIDER], m.x, m.y, NO_MM_FLAGS);
+    if ((mktrapflags & MKTRAP_SEEN))
+        t->tseen = TRUE;
 
     /* The hero isn't the only person who's entered the dungeon in
        search of treasure. On the very shallowest levels, there's a
index cde1642950d99e118cc82c977efc5a33e2acea48..19af374d9031b5f25286227557c973fcd36ba059 100644 (file)
@@ -1743,6 +1743,8 @@ create_trap(spltrap* t, struct mkroom* croom)
 
     if (!t->spider_on_web)
         mktrap_flags |= MKTRAP_NOSPIDERONWEB;
+    if (t->seen)
+        mktrap_flags |= MKTRAP_SEEN;
 
     tm.x = x;
     tm.y = y;
@@ -4117,6 +4119,7 @@ lspo_trap(lua_State *L)
         get_table_xy_or_coord(L, &x, &y);
         tmptrap.type = get_table_traptype_opt(L, "type", -1);
         tmptrap.spider_on_web = get_table_boolean_opt(L, "spider_on_web", 1);
+        tmptrap.seen = get_table_boolean_opt(L, "seen", FALSE);
     }
 
     if (tmptrap.type == NO_TRAP)