MCPcopy Create free account
hub / github.com/NetHack/NetHack / pickup_checks

Function pickup_checks

src/hack.c:3787–3872  ·  view source on GitHub ↗

returns 1 = cannot pickup, time taken 0 = cannot pickup, no time taken -1 = do normal pickup -2 = loot the monster */

Source from the content-addressed store, hash-verified

3785 -1 = do normal pickup
3786 -2 = loot the monster */
3787staticfn int
3788pickup_checks(void)
3789{
3790 struct trap *traphere;
3791
3792 /* uswallow case added by GAN 01/29/87 */
3793 if (u.uswallow) {
3794 if (!u.ustuck->minvent) {
3795 if (digests(u.ustuck->data)) {
3796 You("pick up %s tongue.", s_suffix(mon_nam(u.ustuck)));
3797 pline("But it's kind of slimy, so you drop it.");
3798 } else
3799 You("don't %s anything in here to pick up.",
3800 Blind ? "feel" : "see");
3801 return 1;
3802 } else {
3803 return -2; /* loot the monster inventory */
3804 }
3805 }
3806 if (is_pool(u.ux, u.uy)) {
3807 if (Wwalking || is_floater(gy.youmonst.data)
3808 || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
3809 You("cannot dive into the %s to pick things up.",
3810 hliquid("water"));
3811 return 0;
3812 } else if (!Underwater) {
3813 You_cant("even see the bottom, let alone pick up %s.", something);
3814 return 0;
3815 }
3816 }
3817 if (is_lava(u.ux, u.uy)) {
3818 if (Wwalking || is_floater(gy.youmonst.data)
3819 || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
3820 You_cant("reach the bottom to pick things up.");
3821 return 0;
3822 } else if (!likes_lava(gy.youmonst.data)) {
3823 You("would burn to a crisp trying to pick things up.");
3824 return 0;
3825 }
3826 }
3827 if (!OBJ_AT(u.ux, u.uy)) {
3828 struct rm *lev = &levl[u.ux][u.uy];
3829
3830 if (IS_THRONE(lev->typ))
3831 pline("It must weigh%s a ton!", lev->looted ? " almost" : "");
3832 else if (IS_SINK(lev->typ))
3833 pline_The("plumbing connects it to the floor.");
3834 else if (IS_GRAVE(lev->typ))
3835 You("don't need a gravestone. Yet.");
3836 else if (IS_FOUNTAIN(lev->typ))
3837 You("could drink the %s...", hliquid("water"));
3838 else if (IS_DOOR(lev->typ) && (lev->doormask & D_ISOPEN))
3839 pline("It won't come off the hinges.");
3840 else if (IS_ALTAR(lev->typ))
3841 pline("Moving the altar would be a very bad idea.");
3842 else if (lev->typ == STAIRS)
3843 pline_The("stairs are solidly affixed.");
3844 else

Callers 1

dopickupFunction · 0.85

Calls 15

YouFunction · 0.85
s_suffixFunction · 0.85
mon_namFunction · 0.85
is_poolFunction · 0.85
hliquidFunction · 0.85
You_cantFunction · 0.85
is_lavaFunction · 0.85
pline_TheFunction · 0.85
ThereFunction · 0.85
t_atFunction · 0.85
can_reach_floorFunction · 0.85
uteetering_at_seen_pitFunction · 0.85

Tested by

no test coverage detected