Changes domove() code to allow displacing peaceful monsters. Specifically, is_safepet() now returns true if the monster is peaceful. Peacefuls are slightly pickier than pets about whether they consent to being displaced: they will not displace if a goodpos() check fails for the displaced space, or if there is a trap on the displaced space, or if they are your quest leader. is_safepet should probably be renamed to something else. In the process of doing this, some other changes were made: the code now checks whether the player and monster should be swapping places at all first (previously it ran some code for displacing pets out of traps first, which was a little weird if the displacement didn't actually happen.) In the original commit for this, I needed to guard the spoteffects() call made in domove with a clause testing whether the player actually moved; it was previously possible to fail to displace a monster and then re-trigger a trap on the space you were still standing on. However, the devteam has apparently put in an if (u.umoved) clause in the same place and serving the same purpose.
19 KiB
19 KiB