1 ;; mimic.scm -- define a mechanism which looks like a chest, but when opened it
2 ;; spawns a hostile mimic npc
4 ;; Spawn a mimic npc where the mimic mechanism is and remove the mechanism.
5 (define (mimic-open kobj kchar)
6 (kern-obj-put-at (mk-npc 'mimic (calc-level))
7 (kern-obj-get-location kobj))
11 ;; The trap detection handlers are nops
12 (define (mimic-get-traps kobj) nil)
13 (define (mimic-rm-traps kobj) nil)
15 ;; Emulate the container-ifc, including the trap detection signal handlers,
16 ;; otherwise An Sanct will give the mimic away.
19 (method 'open mimic-open)
20 (method 'get-traps mimic-get-traps)
21 (method 'rm-traps mimic-rm-traps)
24 (mk-obj-type 't_mimic "chest" s_chest layer-mechanism mimic-ifc)
27 (kern-mk-obj t_mimic 1))