File: compat.des

package info (click to toggle)
crawl 2%3A0.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 100,188 kB
  • sloc: cpp: 363,709; ansic: 27,765; javascript: 9,516; python: 8,463; perl: 3,293; java: 3,132; xml: 2,380; makefile: 1,835; sh: 611; objc: 250; cs: 15; sed: 9; lisp: 3
file content (381 lines) | stat: -rw-r--r-- 12,916 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# DES-related lua only needed for save compatibility.
# Please remove the code in this file when the next line is false.
# TAG_MAJOR_VERSION == 34
{{
function callback.grunt_victim_ignite(data, triggerable, triggerer, marker, ev)
  -- the victims don't spawn before; do nothing
end

function callback.ldierk_statue_collapse(data, triggerable, triggerer, marker, ev)
  -- wall_hit events removed; do nothing
end

function callback.wall_jericho_stepped(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.wall_jericho_tick(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.fedhas_growing_garden_grow(data, triggerable,
                                             triggerer, marker, ev)
  -- do nothing
end

function callback.monster_doors_stepped(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.cloud_trap_stepped(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.dk_crumbling_pickup(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.dk_crumbling_turn(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.cathedral_bats (data, triggerable, triggerer, marker, ev)
  -- do nothing
end

-- I'm keeping the code here in case someone is unfortunate enough to
-- have this vault present in the game; connectivity might be broken
-- otherwise.
-- -- Grunt
function callback.grunt_zot_stairs_roulette_spawn_doors(data, triggerable,
                                                        triggerer, marker, ev)
  if data.triggered then
    return
  end

  data.triggered = true

  dgn.persist.grunt_zot_stairs_roulette_doors_spawned = true

  for p in iter.replica_iterator("hidden_door", 1) do
    dgn.terrain_changed(p.x, p.y, "clear_stone_wall", false)
  end
end

function callback.grunt_zot_stairs_roulette_door_open(data, triggerable,
                                                      triggerer, marker, ev)
  if data.triggered then
    return
  end

  if dgn.persist.grunt_zot_stairs_roulette_doors_spawned == false then
    return
  end

  data.triggered = true

  crawl.mpr("Several panes of glass retract into the floor.")
  for p in iter.replica_iterator("hidden_door", 1) do
    dgn.terrain_changed(p.x, p.y, "floor", false)
  end
end

function callback.grunt_zot_stairs_roulette_teleport(data, triggerable,
                                                     triggerer, marker, ev)
  replica = dgn.find_marker_positions_by_prop("dest", data.dest)
  if you.teleport_to(replica[1].x, replica[1].y) then
      crawl.mpr("Your surroundings suddenly seem different.")
  else
      crawl.mpr("There is a strange hissing noise.")
  end
end

function teleporter_serial_action_fn
                      (data, triggerable, triggerer, marker, ev)
  local position = dgn.point(marker:pos())
  my_replicas = dgn.find_marker_positions_by_prop("teleport_spot",
                                                  data.teleport_spot)

  -- third parameter is whether to teleport whatever is on the receiving pad
  if you.teleport_to(my_replicas[1].x, my_replicas[1].y, false) then
    crawl.mpr("Your surroundings suddenly seem different!")
  else
    crawl.mpr("There is a strange hissing noise.")
  end
end

function callback.xom_trap_step(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.xom_item_pickup(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.amethyst_srp_altar(data, triggerable, triggerer, marker, ev)
  local replicas = dgn.find_marker_positions_by_prop("teleport_spot",
                                                     data.teleport_spot)
  you.teleport_to(replicas[1].x, replicas[1].y)
  crawl.mpr("Your surroundings suddenly seem different.")
end

-- Allow people with the ancient champion vault to still clear it.
function callback.ancient_champions_mu_skele_death(data, triggerable,
                                                    triggerer, marker, ev)
  data.skele_number = data.skele_number + 1

  -- Only 7 skeles!
  if data.skele_number > 7 then
    return
  end

  local function get_replica (replicanum)
    local myreplicas = dgn.find_marker_positions_by_prop("skele_replica", replicanum)
    return myreplicas[1]
  end

  local wall_pos = get_replica(data.skele_number)
  if wall_pos == nil then
    crawl.mpr("Couldn't find a replica!")
  end

  dgn.terrain_changed(wall_pos.x, wall_pos.y, "floor", false)

  if you.see_cell(wall_pos.x, wall_pos.y) then
    crawl.mpr("As the champion is destroyed, a metal wall slides away!")
  else
    crawl.mpr("As the champion is destroyed, you hear a distant grinding noise.")
  end
end

function tukima_machine (data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function wizlab_eringya_grow(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.spiders_nest_cobweb_light(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

function callback.spiders_nest_web_lair(data, triggerable, triggerer, marker, ev)
  -- do nothing
end

-- let this vault still function if it already exists
function callback.beogh_warn_stepped(data, triggerable, triggerer, marker, ev)
  local x, y = marker:pos()

  if you.god() == "Beogh" or you.god() == "No God" then
     crawl.god_speaks("Beogh" , "Your presence is welcomed at the altar of Beogh.")
     dgn.grid(x, y, "floor")
  end
end

function callback.beogh_trap_stepped(data, triggerable, triggerer, marker, ev)
  local x, y = marker:pos()
-- This enacts the changes. First it checks to see if the player is a Beogh
-- worshipper or godless (a potential worshipper). If the player is one of
-- these things nothing happens. Otherwise the trap is sprung.
  if monster_step == true then
    return
  elseif you.god() == "Beogh" or you.god() == "No God" then
    dgn.grid(x, y, "floor")
  else
    crawl.god_speaks("Beogh", "Beogh's servants are called upon to defend the altar!")
    for replica in iter.replica_iterator("bridge", 1) do
      dgn.terrain_changed(replica.x, replica.y, "floor", false)
    end
    dgn.grid(x, y, "floor")
  end
end

function callback.boulder_grate_trap_stepped(data, triggerable, triggerer,
                                             marker, ev)
  -- do nothing
end

function callback.grate_trap_stepped(data, triggerable, triggerer,
                                             marker, ev)
  -- do nothing
end

callback.grunt_nemelex_gamble_announce = callback.nemelex_gamble_announce

function callback.grunt_nemelex_gamble_start(data,triggerable,triggerer,marker,ev)
    if dgn.persist.grunt_nemelex_gamble_triggered then
        return
    end
    dgn.persist.grunt_nemelex_gamble_triggered = true
    replica = dgn.find_marker_positions_by_prop("start_tele", 1)
    dgn.terrain_changed(replica[1].x, replica[1].y, "floor", false)
    if crawl.coinflip() then
        replica = dgn.find_marker_positions_by_prop("prize", 1)
        you.teleport_to(replica[1].x, replica[1].y)
        crawl.god_speaks("Nemelex Xobeh", "Nemelex Xobeh says, \"You win!\"")
    else
        replica = dgn.find_marker_positions_by_prop("peril", 1)
        you.teleport_to(replica[1].x, replica[1].y)
        crawl.god_speaks("Nemelex Xobeh", "Nemelex Xobeh says, \"You lose!\"")
    end
    crawl.mpr("Your surroundings suddenly seem different.")
end

function callback.grunt_nemelex_gamble_finish1(data,triggerable,triggerer,marker,ev)
    replica = dgn.find_marker_positions_by_prop("exit", 1)
    you.teleport_to(replica[1].x, replica[1].y)
    crawl.mpr("Your surroundings suddenly seem different.")
end

function callback.grunt_nemelex_gamble_finish2(data,triggerable,triggerer,marker,ev)
    replica = dgn.find_marker_positions_by_prop("exit", 1)
    you.teleport_to(replica[1].x, replica[1].y)
    crawl.mpr("Your surroundings suddenly seem different.")
end

function callback.grunt_nemelex_gamble_expire(data,triggerable,triggerer,marker,ev)
    if dgn.persist.grunt_nemelex_gamble_triggered then
        return
    end
    if not dgn.persist.grunt_nemelex_gamble_announced then
        return
    end
    data.dur = data.dur - ev:ticks()
    if data.dur > 0 then
        return
    end
    dgn.persist.grunt_nemelex_gamble_triggered = true
    replica = dgn.find_marker_positions_by_prop("start_tele", 1)
    dgn.terrain_changed(replica[1].x, replica[1].y, "floor", false)
    if (you.see_cell(replica[1].x, replica[1].y)) then
        crawl.mpr("<white>The teleporter glows with a rainbow of weird colours and disappears.</white>")
    end
end

-- Find the replica of the teleporter and move to it.
function teleporter_vault_action_fn(data, triggerable, triggerer, marker, ev)
    local position = dgn.point(marker:pos())
    my_replicas = dgn.find_marker_positions_by_prop("teleport_spot",
                                                    data.teleport_spot)

    if you.teleport_to(my_replicas[1].x, my_replicas[1].y, true) then
        crawl.mpr("Your surroundings suddenly seem different!")
    else
        crawl.mpr("There is a strange hissing noise.")
    end
end

-- Find the replica of the teleporter and move to it.
function callback.ice_cave_statue_garden_teleporter(data, triggerable,
                                                     triggerer, marker, ev)
  local position = dgn.point(marker:pos())
  my_replicas = dgn.find_marker_positions_by_prop("teleport_spot",
    data.teleport_spot)

  you.teleport_to(my_replicas[1].x, my_replicas[1].y)
  crawl.mpr("Your surroundings suddenly seem different!")
end

function teleporter_golubria_switch_fn(data, triggerable, triggerer, marker, ev)
  local position = dgn.point(marker:pos())
  my_replicas = dgn.find_marker_positions_by_prop("teleport_spot",
                                                data.teleport_spot)

  if you.teleport_to(my_replicas[1].x, my_replicas[1].y, true) then
    crawl.mpr("Your surroundings suddenly seem different!")
  else
    crawl.mpr("There is a strange hissing noise.")
  end
end

function callback.spider_trap_stepped(data, triggerable, triggerer, marker, ev)
  data.mons="generate_awake redback"
  data.msg="A basket of spiders falls from above!"
  data.max=8
  callback.drop_trap_stepped(data, triggerable, triggerer, marker, ev)
end

-- Save compat for gammafunk_pakellas_* vaults, formerly in
-- pakellas_experiments.des.
function make_dummy_trigger_func()
  return function (data, triggerable, triggerer, marker, ev)
    -- do nothing.
   end
end

callback.pakellas_cloud_experiment_begin = make_dummy_trigger_func()
callback.pakellas_cloud_experiment_end = make_dummy_trigger_func()
callback.pakellas_cloud_cloud_cycle = make_dummy_trigger_func()
cycle_cloud_type = callback.pakellas_cloud_cycle
callback.pakellas_statue_experiment_begin = make_dummy_trigger_func()
callback.pakellas_statue_experiment_end = make_dummy_trigger_func()
callback.pakellas_its_alive_clouds = make_dummy_trigger_func()
callback.pakellas_its_alive_begin = make_dummy_trigger_func()
callback.pakellas_its_alive_end = make_dummy_trigger_func()
callback.grunt_zot_stairs_overgrown_start = make_dummy_trigger_func()
callback.grunt_zot_stairs_overgrown_oklobify = make_dummy_trigger_func()

-- save compat for grunt_zot_stairs_overgrown
-- let this vault still work if it exists
function callback.grunt_zot_stairs_overgrown_start(data, triggerable,
                                                   triggerer, marker, ev)
  if data.triggered == true then
    return
  end

  crawl.mpr("You have a sense of imminent foreboding.", "warning")
  dgn.persist.grunt_zot_stairs_overgrown_started = true
end

function callback.grunt_zot_stairs_overgrown_oklobify(data, triggerable,
                                                      triggerer, marker, ev)
  if triggerer.type ~= "turn" or triggerer.sub_type ~= "countdown" then
    return
  end

  if dgn.persist.grunt_zot_stairs_overgrown_started == nil then
    return
  end

  if data.count >= 10 then
    dgn.persist.grunt_zot_stairs_overgrown_started = nil
    return
  end

  local possible = {}
  local targets = dgn.find_marker_positions_by_prop("oklobify", 1)
  for _, pos in ipairs(targets) do
    local mons = dgn.mons_at(pos.x, pos.y)
    if mons ~= nil and
       (mons.name == "plant" or mons.name == "fungus"
        or mons.name == "bush") then
      possible[#possible + 1] = pos
    end
  end

  if #possible == 0 then
    dgn.persist.grunt_zot_stairs_overgrown_started = nil
    return
  end

  data.count = data.count + 1

  local pos = possible[crawl.random2(#possible) + 1]
  local mons = dgn.mons_at(pos.x, pos.y)
  mons.dismiss()

  dgn.create_monster(pos.x, pos.y, "oklob plant")

  if not you.see_cell(pos.x, pos.y) then return end

  if not data.warned then
    data.warned = true
    crawl.mpr("One of the plants suddenly grows acid sacs!", "warning")
  else
    crawl.mpr("Another plant grows acid sacs!", "warning")
  end
end

}}