Accept "waiting" on special level des.monster() specifications
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 });
This commit is contained in:
@@ -234,7 +234,7 @@ themerooms = {
|
|||||||
if (percent(50)) then
|
if (percent(50)) then
|
||||||
local mons = { "M", "V", "L", "Z" };
|
local mons = { "M", "V", "L", "Z" };
|
||||||
shuffle(mons);
|
shuffle(mons);
|
||||||
des.monster(mons[1], 0,0);
|
des.monster({ class = mons[1], x=0,y=0, waiting = 1 });
|
||||||
else
|
else
|
||||||
des.object({ id = "corpse", montype = "@", coord = {0,0} });
|
des.object({ id = "corpse", montype = "@", coord = {0,0} });
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ typedef struct {
|
|||||||
xchar x, y, class, appear;
|
xchar x, y, class, appear;
|
||||||
schar peaceful, asleep;
|
schar peaceful, asleep;
|
||||||
short female, invis, cancelled, revived, avenge, fleeing, blinded,
|
short female, invis, cancelled, revived, avenge, fleeing, blinded,
|
||||||
paralyzed, stunned, confused;
|
paralyzed, stunned, confused, waiting;
|
||||||
long seentraps;
|
long seentraps;
|
||||||
short has_invent;
|
short has_invent;
|
||||||
} monster;
|
} monster;
|
||||||
|
|||||||
@@ -2028,7 +2028,9 @@ create_monster(monster* m, struct mkroom* croom)
|
|||||||
mtmp->mflee = 1;
|
mtmp->mflee = 1;
|
||||||
mtmp->mfleetim = (m->fleeing % 127);
|
mtmp->mfleetim = (m->fleeing % 127);
|
||||||
}
|
}
|
||||||
|
if (m->waiting) {
|
||||||
|
mtmp->mstrategy |= STRAT_WAITFORU;
|
||||||
|
}
|
||||||
if (m->has_invent) {
|
if (m->has_invent) {
|
||||||
discard_minvent(mtmp, TRUE);
|
discard_minvent(mtmp, TRUE);
|
||||||
invent_carrying_monster = mtmp;
|
invent_carrying_monster = mtmp;
|
||||||
@@ -3026,6 +3028,7 @@ lspo_monster(lua_State* L)
|
|||||||
tmpmons.confused = 0;
|
tmpmons.confused = 0;
|
||||||
tmpmons.seentraps = 0;
|
tmpmons.seentraps = 0;
|
||||||
tmpmons.has_invent = 0;
|
tmpmons.has_invent = 0;
|
||||||
|
tmpmons.waiting = 0;
|
||||||
|
|
||||||
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
|
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
|
||||||
const char *paramstr = luaL_checkstring(L, 1);
|
const char *paramstr = luaL_checkstring(L, 1);
|
||||||
@@ -3089,6 +3092,7 @@ lspo_monster(lua_State* L)
|
|||||||
tmpmons.paralyzed = get_table_int_opt(L, "paralyzed", 0);
|
tmpmons.paralyzed = get_table_int_opt(L, "paralyzed", 0);
|
||||||
tmpmons.stunned = get_table_int_opt(L, "stunned", 0);
|
tmpmons.stunned = get_table_int_opt(L, "stunned", 0);
|
||||||
tmpmons.confused = get_table_int_opt(L, "confused", 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.seentraps = 0; /* TODO: list of trap names to bitfield */
|
||||||
tmpmons.has_invent = 0;
|
tmpmons.has_invent = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user