Allow specifying "waiting" for monsters created via lua level scripts.
This sets the monster strategy to make it wait for the hero
to be in visual range before allowing the monster to move.
Also makes the monster inside the Mausoleum themed room use this feature,
to prevent out of depth liches bothering the player unprovoked.
For example:
des.monster({ class = "D", waiting = 1 });
if (percent(50)) then
local mons = { "M", "V", "L", "Z" };
shuffle(mons);
- des.monster(mons[1], 0,0);
+ des.monster({ class = mons[1], x=0,y=0, waiting = 1 });
else
des.object({ id = "corpse", montype = "@", coord = {0,0} });
end
xchar x, y, class, appear;
schar peaceful, asleep;
short female, invis, cancelled, revived, avenge, fleeing, blinded,
- paralyzed, stunned, confused;
+ paralyzed, stunned, confused, waiting;
long seentraps;
short has_invent;
} monster;
mtmp->mflee = 1;
mtmp->mfleetim = (m->fleeing % 127);
}
-
+ if (m->waiting) {
+ mtmp->mstrategy |= STRAT_WAITFORU;
+ }
if (m->has_invent) {
discard_minvent(mtmp, TRUE);
invent_carrying_monster = mtmp;
tmpmons.confused = 0;
tmpmons.seentraps = 0;
tmpmons.has_invent = 0;
+ tmpmons.waiting = 0;
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
const char *paramstr = luaL_checkstring(L, 1);
tmpmons.paralyzed = get_table_int_opt(L, "paralyzed", 0);
tmpmons.stunned = get_table_int_opt(L, "stunned", 0);
tmpmons.confused = get_table_int_opt(L, "confused", 0);
+ tmpmons.waiting = get_table_int_opt(L, "waiting", 0);
tmpmons.seentraps = 0; /* TODO: list of trap names to bitfield */
tmpmons.has_invent = 0;