Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@copperwater
Copy link
Contributor

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).

@paxed
Copy link
Contributor

paxed commented Mar 1, 2023

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.
@copperwater copperwater force-pushed the specific-statue-trap branch from 15fedf7 to 3daffac Compare May 29, 2023 20:50
@copperwater
Copy link
Contributor Author

Some special levels use des.trap("statue") - those should be fixed.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.