- Option to notify about absorbed into dirt

- Fix crash if no cells found for god to appear.
- When calling fillpot from splashes moved/placed objects, make sure there is sufficient liquid to fill to container.
- Potion of blood sohuld always be a 'dark red potion'
This commit is contained in:
Rob Pearce 2016-06-06 15:21:47 +10:00
parent bd0f37f461
commit 8456ed6a74
5 changed files with 50 additions and 9 deletions

2
data.c
View File

@ -3787,6 +3787,7 @@ void initobjects(void) {
addot(OT_POT_BLOOD, "potion of blood", "A small quantity of blood.", MT_GLASS, 1, OC_POTION, SZ_TINY); addot(OT_POT_BLOOD, "potion of blood", "A small quantity of blood.", MT_GLASS, 1, OC_POTION, SZ_TINY);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_DIECONVERT, NA, NA, NA, "5 splashes of blood"); addflag(lastot->flags, F_DIECONVERT, NA, NA, NA, "5 splashes of blood");
modflag(lastot->flags, F_HASHIDDENNAME, NA, NA, NA, "dark red potion");
addflag(lastot->flags, F_VALUE, 15, NA, NA, NULL); addflag(lastot->flags, F_VALUE, 15, NA, NA, NULL);
addot(OT_POT_SANCTUARY, "potion of sanctuary", "Creates a temporary magical barrier abour the drinker.", MT_GLASS, 1, OC_POTION, SZ_TINY); addot(OT_POT_SANCTUARY, "potion of sanctuary", "Creates a temporary magical barrier abour the drinker.", MT_GLASS, 1, OC_POTION, SZ_TINY);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL);
@ -10331,6 +10332,7 @@ void initoptions(void) {
addoption(OPT_RETRIEVE_MISSILES, "automatically retrieve used missiles", B_TRUE); addoption(OPT_RETRIEVE_MISSILES, "automatically retrieve used missiles", B_TRUE);
addoption(OPT_STOPRUNONNOISE, "stop running if sound heard", B_TRUE); addoption(OPT_STOPRUNONNOISE, "stop running if sound heard", B_TRUE);
addoption(OPT_TIMEDEBUG, "enable performance debugging", B_FALSE); addoption(OPT_TIMEDEBUG, "enable performance debugging", B_FALSE);
addoption(OPT_ABSORBNOTIFY, "liquid absorption notifications", B_FALSE);
} }
void initrace(void) { void initrace(void) {

1
defs.h
View File

@ -4817,6 +4817,7 @@ enum OPTION {
OPT_RETRIEVE_MISSILES, OPT_RETRIEVE_MISSILES,
OPT_STOPRUNONNOISE, OPT_STOPRUNONNOISE,
OPT_TIMEDEBUG, OPT_TIMEDEBUG,
OPT_ABSORBNOTIFY,
}; };
typedef struct option_s { typedef struct option_s {

22
god.c
View File

@ -1076,13 +1076,32 @@ lifeform_t *godappears(enum RACE rid, cell_t *where) {
// somewhere next to the player. // somewhere next to the player.
where = real_getrandomadjcell(player->cell, &ccwalkable, B_ALLOWEXPAND, LOF_WALLSTOP, NULL, player); where = real_getrandomadjcell(player->cell, &ccwalkable, B_ALLOWEXPAND, LOF_WALLSTOP, NULL, player);
if (!where) { if (!where) {
// try somewhere nearby even if it's not walkable.
initcond(&cs); addcond(&cs, CC_IMPASSABLE, B_FALSE, NA); initcond(&cs); addcond(&cs, CC_IMPASSABLE, B_FALSE, NA);
where = real_getrandomadjcell(player->cell, &cs, B_ALLOWEXPAND, LOF_WALLSTOP, NULL, player); where = real_getrandomadjcell(player->cell, &cs, B_ALLOWEXPAND, LOF_WALLSTOP, NULL, player);
} }
if (!where) { if (!where) {
// try somewhere adjacent even if it's not walkable and has no line of fire to player.
initcond(&cs); addcond(&cs, CC_IMPASSABLE, B_FALSE, NA); initcond(&cs); addcond(&cs, CC_IMPASSABLE, B_FALSE, NA);
where = real_getrandomadjcell(player->cell, &cs, B_ALLOWEXPAND, LOF_DONTNEED, NULL, player); where = real_getrandomadjcell(player->cell, &cs, B_ALLOWEXPAND, LOF_DONTNEED, NULL, player);
} }
if (!where) {
// still nowhere? get anywhere adjacent.
where = real_getrandomadjcell(player->cell, NULL, B_ALLOWEXPAND, LOF_DONTNEED, NULL, player);
}
if (!where) {
// still nowhere? fail.
msg("You briefly feel the presence of %s.", godname);
return NULL;
}
}
// solid cell?
if (issolid(where)) {
// clear it.
msg("%s %s disappears!", needan(where->type->name) ? "An" : "A", where->type->name);
clearcell(where);
setcelltype(where, where->map->habitat->emptycelltype);
} }
// now see if anyone is there. // now see if anyone is there.
@ -1090,9 +1109,6 @@ lifeform_t *godappears(enum RACE rid, cell_t *where) {
// kill them. // kill them.
getlfname(where->lf, killedname); getlfname(where->lf, killedname);
killlf(where->lf); killlf(where->lf);
if (where->type->solid) {
setcelltype(where, where->habitat->emptycelltype);
}
teleportto(god, where, B_TRUE); teleportto(god, where, B_TRUE);
if (haslos(player, where) && strlen(killedname)) { if (haslos(player, where) && strlen(killedname)) {
msg("%s transforms into %s!", killedname, godname); msg("%s transforms into %s!", killedname, godname);

1
io.c
View File

@ -8206,6 +8206,7 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
} }
} }
break; break;
// TODO: EATCONFER, need getflagname
default: default:
break; break;
} }

View File

@ -1282,7 +1282,10 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
if (hasflag(ot->flags, F_DOOR)) { if (hasflag(ot->flags, F_DOOR)) {
setcelltype(where->where, getcellempty(where->where)); setcelltype(where->where, getcellempty(where->where));
} else { } else {
assert("BUG: trying to put object on solid cell." == 0); // the main thing which will cause this is placing objects
// in a radius - eg. clouds of steam.
if (localname) free(localname);
return NULL;
} }
} }
} }
@ -5159,6 +5162,18 @@ object_t *fillpotfrom(object_t *flask, object_t *fillfrom, int reduceliquid) {
break; break;
} }
} }
// is there enough liquid ?
if (fillflag->val[1] == NA) {
// ok
} else if (fillfrom->amt >= fillflag->val[1]) {
// ok
} else {
// fail, not enough liquid
return NULL;
}
if (strlen(newobname)) { if (strlen(newobname)) {
obpile_t *op; obpile_t *op;
op = flask->pile; op = flask->pile;
@ -11835,6 +11850,10 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
if (!notenough) { if (!notenough) {
notenough = oo; notenough = oo;
} }
} else if ((fillflag->val[1] != NA) && (o->amt < fillflag->val[1])) {
if (!notenough) {
notenough = oo;
}
} else { } else {
flag_t *rf; flag_t *rf;
int ok = B_FALSE; int ok = B_FALSE;
@ -14459,7 +14478,7 @@ int sethiddenname(objecttype_t *ot, char *text) {
addknowledge(ot->id, text, B_UNKNOWN); addknowledge(ot->id, text, B_UNKNOWN);
} }
// some descriptions confer other effecst too... // some descriptions confer other effects too...
if (strstr(text, "glowing")) { if (strstr(text, "glowing")) {
addflag(ot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL); addflag(ot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
} else if (strstr(text, "flourescent")) { } else if (strstr(text, "flourescent")) {
@ -16596,10 +16615,12 @@ void timeeffectsob(object_t *o) {
if ((getmaterialstate(o->type->material->id) == MS_LIQUID) || (o->type->id == OT_SPLASHWATER)) { if ((getmaterialstate(o->type->material->id) == MS_LIQUID) || (o->type->id == OT_SPLASHWATER)) {
if (location->type->absorbent && !hasflag(o->flags, F_NOABSORB)) { if (location->type->absorbent && !hasflag(o->flags, F_NOABSORB)) {
if (getoption(OPT_ABSORBNOTIFY)) {
if (haslos(player, location)) { if (haslos(player, location)) {
msg("%s %s absorbed into the %s.", obname, msg("%s %s absorbed into the %s.", obname,
OB1(o,"is","are"), location->type->name); OB1(o,"is","are"), location->type->name);
} }
}
removeob(o, ALL); removeob(o, ALL);
return; return;
} }