From ba60bfac25d0dd46b609429f1c5b35cf15fb036d Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 1 Apr 2023 14:05:14 +0300 Subject: [PATCH] Themeroom: buried zombies - add a themeroom with random buried zombifying corpses - disturbing buried zombies makes them revive much faster - lua des.object() now returns the object it created --- dat/themerms.lua | 11 +++++++++++ doc/lua.adoc | 4 +++- src/hack.c | 2 +- src/sp_lev.c | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dat/themerms.lua b/dat/themerms.lua index caeaa8eea..3bf6a1b34 100644 --- a/dat/themerms.lua +++ b/dat/themerms.lua @@ -93,6 +93,17 @@ themeroom_fills = { end }); end, + -- Buried zombies + function(rm) + local zombifiable = { "kobold", "gnome", "orc", "dwarf", "elf", "human", "ettin", "giant" }; + for i = 1, (rm.width * rm.height) / 2 do + shuffle(zombifiable); + local o = des.object({ id = "corpse", montype = zombifiable[1], buried = true }); + o:stop_timer("rot-corpse"); + o:start_timer("zombify-mon", 1000); + end + end, + -- Massacre function(rm) local mon = { "apprentice", "warrior", "ninja", "thug", diff --git a/doc/lua.adoc b/doc/lua.adoc index 45a179ea3..3c70ee6d7 100644 --- a/doc/lua.adoc +++ b/doc/lua.adoc @@ -786,7 +786,8 @@ Example: === object -Create an object. The table parameter accepts the following: +Create an object. Returns the object as an <> class. +The table parameter accepts the following: [options="header"] |=== @@ -828,6 +829,7 @@ Example: des.object({ class = "%" }); des.object({ id = "boulder", x = 03, y = 12}); des.object({ id = "chest", coord = {03, 12}, locked = true, contents = function(obj) des.object("rock"); end }); + local o = des.object(); === random_corridors diff --git a/src/hack.c b/src/hack.c index d0a81ddab..3edfb66a2 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1605,7 +1605,7 @@ check_buried_zombies(coordxy x, coordxy y) && otmp->oy >= y - 1 && otmp->oy <= y + 1 && (t = peek_timer(ZOMBIFY_MON, obj_to_any(otmp))) > 0) { t = stop_timer(ZOMBIFY_MON, obj_to_any(otmp)); - (void) start_timer(max(1, t - rn2(10)), TIMER_OBJECT, + (void) start_timer(max(1, (t*2/3)), TIMER_OBJECT, ZOMBIFY_MON, obj_to_any(otmp)); } } diff --git a/src/sp_lev.c b/src/sp_lev.c index 699272f57..26c59cbfb 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3691,7 +3691,9 @@ lspo_object(lua_State *L) Free(tmpobj.name.str); - return 0; + nhl_push_obj(L, otmp); + + return 1; } /* level_flags("noteleport", "mazelevel", ... ); */