Dehardcode the monk minetown food shop conversion
Instead of trying to figure out in core whether to change a minetown food shop to health food shop for monks, just figure it out in the minetown level creation script.
This commit is contained in:
@@ -106,7 +106,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
|
||||
end
|
||||
});
|
||||
|
||||
des.room({ type = "food shop", chance=90, lit=1, x=24,y=5, w=3,h=4,
|
||||
des.room({ type = monkfoodshop(), chance=90, lit=1, x=24,y=5, w=3,h=4,
|
||||
contents = function()
|
||||
des.door({ state="closed", wall="north" })
|
||||
end
|
||||
|
||||
@@ -84,7 +84,7 @@ des.room({ type = "ordinary",lit=1,x=3,y=3,
|
||||
end
|
||||
})
|
||||
|
||||
des.room({ type = "food shop", chance=90,lit=1,x=26,y=8,w=3,h=2,
|
||||
des.room({ type = monkfoodshop(), chance=90,lit=1,x=26,y=8,w=3,h=2,
|
||||
contents = function()
|
||||
des.door({ state="closed", wall="west" })
|
||||
end
|
||||
|
||||
@@ -69,7 +69,7 @@ des.room({ type = "ordinary", lit=1, x=3,y=3,
|
||||
end
|
||||
})
|
||||
|
||||
des.room({ type = "food shop", chance=90, lit=1, x=11, y=11, w=3, h=2,
|
||||
des.room({ type = monkfoodshop(), chance=90, lit=1, x=11, y=11, w=3, h=2,
|
||||
contents = function()
|
||||
des.door({ state = "closed", wall="east" })
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ des.region({ region={59, 9, 67,10}, lit=1, type="shop", prefilled=0 })
|
||||
des.door("closed",66,08)
|
||||
des.region({ region={57,13, 60,15}, lit=1, type="tool shop", prefilled=0 })
|
||||
des.door("closed",56,14)
|
||||
des.region({ region={05,09, 08,10}, lit=1, type="food shop", prefilled=0 })
|
||||
des.region({ region={05,09, 08,10}, lit=1, type=monkfoodshop(), prefilled=0 })
|
||||
des.door("closed",07,11)
|
||||
-- Gnome homes
|
||||
des.door("closed",04,14)
|
||||
|
||||
@@ -39,7 +39,7 @@ des.region(selection.area(13,5,14,6),"unlit")
|
||||
des.region({ region={09,07, 11,09}, lit=1, type="candle shop", prefilled=0 })
|
||||
des.region({ region={16,04, 18,06}, lit=1, type="tool shop", prefilled=0 })
|
||||
des.region({ region={23,01, 25,03}, lit=1, type="shop", prefilled=0 })
|
||||
des.region({ region={22,12, 24,13}, lit=1, type="food shop", prefilled=0 })
|
||||
des.region({ region={22,12, 24,13}, lit=1, type=monkfoodshop(), prefilled=0 })
|
||||
des.region({ region={31,12, 36,14}, lit=1, type="temple", prefilled=0 })
|
||||
des.altar({ x=35,y=13,align=align[1],type="shrine"})
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
|
||||
})
|
||||
end
|
||||
|
||||
des.room({ type="food shop", chance=50, lit=1, x=19,y=5, w=2,h=3,
|
||||
des.room({ type=monkfoodshop(), chance=50, lit=1, x=19,y=5, w=2,h=3,
|
||||
contents = function()
|
||||
des.door({ state = "closed", wall="south" })
|
||||
end
|
||||
@@ -131,7 +131,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
|
||||
})
|
||||
end
|
||||
|
||||
des.room({ type="food shop", chance=50, lit=1, x=25,y=11, w=3,h=2,
|
||||
des.room({ type=monkfoodshop(), chance=50, lit=1, x=25,y=11, w=3,h=2,
|
||||
contents = function()
|
||||
des.door({ state = "closed", wall="east" })
|
||||
end
|
||||
|
||||
@@ -41,3 +41,10 @@ end
|
||||
function percent(threshold)
|
||||
return math.random(0, 99) < threshold
|
||||
end
|
||||
|
||||
function monkfoodshop()
|
||||
if (u.role == "Monk") then
|
||||
return "health food shop";
|
||||
end
|
||||
return "food shop";
|
||||
end
|
||||
|
||||
@@ -929,6 +929,9 @@ lua_State *L;
|
||||
if (!strcmp(tkey, "inventory")) {
|
||||
nhl_push_obj(L, g.invent);
|
||||
return 1;
|
||||
} else if (!strcmp(tkey, "role")) {
|
||||
lua_pushstring(L, g.urole.name.m);
|
||||
return 1;
|
||||
}
|
||||
|
||||
nhl_error(L, "Unknown u table index");
|
||||
|
||||
@@ -498,13 +498,6 @@ const char *const *nlp;
|
||||
int name_wanted;
|
||||
s_level *sptr;
|
||||
|
||||
if (nlp == shkfoods && In_mines(&u.uz) && Role_if(PM_MONK)
|
||||
&& (sptr = Is_special(&u.uz)) != 0 && sptr->flags.town) {
|
||||
/* special-case override for minetown food store for monks */
|
||||
nlp = shkhealthfoods;
|
||||
ESHK(shk)->shoptype = FODDERSHOP;
|
||||
}
|
||||
|
||||
if (nlp == shklight && In_mines(&u.uz)
|
||||
&& (sptr = Is_special(&u.uz)) != 0 && sptr->flags.town) {
|
||||
/* special-case minetown lighting shk */
|
||||
@@ -676,8 +669,6 @@ struct mkroom *sroom;
|
||||
if (shp->shknms == shkrings)
|
||||
(void) mongets(shk, TOUCHSTONE);
|
||||
nameshk(shk, shp->shknms);
|
||||
/* might have changed delicatessen to health food store */
|
||||
sroom->rtype = eshkp->shoptype;
|
||||
|
||||
return sh;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user