|
142 | 142 | passwallable T |
143 | 143 | wand-destructible T)) |
144 | 144 |
|
| 145 | +(defclass TargetedScenery [Scenery] |
| 146 | +
|
| 147 | + (setv |
| 148 | + field-defaults (dict |
| 149 | + :target None) |
| 150 | + fields #("target")) |
| 151 | +
|
| 152 | + (defmeth [classmethod] read-tile-extras [mk-pos v1 v2] |
| 153 | + (dict :target (mk-pos #(v1 v2)))) |
| 154 | +
|
| 155 | + (defmeth suffix-dict [] |
| 156 | + (dict :target @target))) |
| 157 | +
|
145 | 158 | ;; -------------------------------------------------------------- |
146 | 159 | ;; * Basic scenery |
147 | 160 | ;; -------------------------------------------------------------- |
|
285 | 298 |
|
286 | 299 | :flavor "This massive slab of steel will certainly not be opened with a sad little bargain-basement skeleton key. Your best bet is looking for a remote switch of some kind.") |
287 | 300 |
|
288 | | -(deftile "+|" "a metal-door control" Scenery |
| 301 | +(deftile "+|" "a metal-door control" TargetedScenery |
289 | 302 | :iq-ix 168 |
290 | | - :field-defaults (dict |
291 | | - :target None) |
292 | | - :fields #("target") |
293 | 303 |
|
294 | 304 | :blocks-move T |
295 | 305 |
|
296 | | - :read-tile-extras (classmethod (fn [cls mk-pos v1 v2] |
297 | | - (dict :target (mk-pos #(v1 v2))))) |
298 | | - :suffix-dict (meth [] |
299 | | - (dict :target @target)) |
300 | | - |
301 | 306 | :hook-player-bump (meth [origin] |
302 | 307 | (doc f"If there's a metal door at {@target}, it's destroyed. Otherwise, everything on the square is destroyed and a metal door is created there.") |
303 | 308 | (for [t (list (at @target)) :if (= t.stem "metal door")] |
|
640 | 645 | ;; ** Gates |
641 | 646 | ;; -------------------------------------------------------------- |
642 | 647 |
|
643 | | -(defclass Gate [Scenery] |
644 | | - (setv field-defaults (dict |
645 | | - :target None)) |
646 | | - (setv fields #("target")) |
647 | | - |
| 648 | +(defclass Gate [TargetedScenery] |
648 | 649 | (setv blocks-monster T) |
649 | 650 | (setv one-shot? F) |
650 | 651 |
|
651 | | - (defn [classmethod] read-tile-extras [cls mk-pos v1 v2] |
652 | | - (dict :target (mk-pos #(v1 v2)))) |
653 | | - |
654 | | - (defmeth suffix-dict [] |
655 | | - (dict :dest @target)) |
656 | 652 | (defmeth hook-player-walked-into [] |
657 | 653 | (doc (+ |
658 | 654 | f"Teleports you to {@target}. Anything already there is unaffected." |
|
0 commit comments