Enable statue traps with specific statues of monsters#991
Open
copperwater wants to merge 2 commits intoNetHack:NetHack-3.7from
Open
Enable statue traps with specific statues of monsters#991copperwater wants to merge 2 commits intoNetHack:NetHack-3.7from
copperwater wants to merge 2 commits intoNetHack:NetHack-3.7from
Conversation
Contributor
|
Couple problems: 1) Some special levels use des.trap("statue") - those should be fixed. 2) Generating a trapped statue object in random location may put it on top of existing trap. |
Previously, attempting to specify a statue trap would have it
unconditionally create a statue of a random monster in maketrap() on top
of the trap, which is no good if one wants a certain type of monster to
be the statue trap. (A poor workaround would be to add another statue of
the desired monster on the same space since statue traps animate the
topmost statue, but since this would create a pile of statues, it would
be readily apparent.)
This commit lets the level designer create a statue trap by specifying
the "trapped" field on a statue created with des.object. Instead of
setting otrapped on the statue, it will create a statue trap on the
floor underneath it.
A des.trap('statue') will still always create a statue of a random
monster. I originally implemented an extra flag to pass into des.trap
that would disable this behavior, but then figured that a statueless
statue trap still needs a des.object('statue') statement to make the
statue, which could just be specified as trapped in the first place. So
it wouldn't really add anything.
Internally, this moves the statue creation out of maketrap(), so that a
trapped statue can call maketrap(STATUE_TRAP) without side effects. This
means that responsibility for making a statue now falls to the caller of
maketrap, which is only relevant in 3 places (generic mktrap(), wizard
mode trap wishing, and adding random traps to a maze).
Pointed out by paxed in the pull request. While I tried to find ways to make the statue trap generate elsewhere, it would have to clunkily try to rerandomize coordinates in the middle of create_object after the object has already been placed on the floor in that specific spot. The simpler solution is just to delete the trap.
15fedf7 to
3daffac
Compare
Contributor
Author
The initial commit accounted for this - as I said above, "A des.trap('statue') will still always create a statue of a random monster." I've made sure the levels that use statues of random monsters in random locations, like Arc-loca, work as expected. Is there something else you meant? I've addressed your second point by deleting a trap that a statue trap happens to generate on top of. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, attempting to specify a statue trap would have it unconditionally create a statue of a random monster in maketrap() on top of the trap, which is no good if one wants a certain type of monster to be the statue trap. (A poor workaround would be to add another statue of the desired monster on the same space since statue traps animate the topmost statue, but since this would create a pile of statues, it would be readily apparent.)
This commit lets the level designer create a statue trap by specifying the "trapped" field on a statue created with des.object. Instead of setting otrapped on the statue, it will create a statue trap on the floor underneath it.
A des.trap('statue') will still always create a statue of a random monster. I originally implemented an extra flag to pass into des.trap that would disable this behavior, but then figured that a statueless statue trap still needs a des.object('statue') statement to make the statue, which could just be specified as trapped in the first place. So it wouldn't really add anything.
Internally, this moves the statue creation out of maketrap(), so that a trapped statue can call maketrap(STATUE_TRAP) without side effects. This means that responsibility for making a statue now falls to the caller of maketrap, which is only relevant in 3 places (generic mktrap(), wizard mode trap wishing, and adding random traps to a maze).