The party mode is set up the handle a sound table, which will crash if an inst goes through the teleporter.
Also, the only-one-sound-per-teleport function doesn't take the party into account, which can result in overlapping sound if a teleporter activates with the party standing on items.
Code: Select all
dsb_text2map(0, 5, 5, 100, 1, {
"10100",
"10110",
"11110",
"00110",
"00100"} )
dsb_level_wallset(0, wallset.default)
dsb_add_champion(1, "asdf", "port_mophus", "ASDF", "", 1000, 1000, 1000, 400, 400, 400, 400, 400, 400, 400, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0})
dsb_add_champion(2, "xgnsdgf", "port_mophus", "XGNSDGF", "", 1000, 1000, 1000, 400, 400, 400, 400, 400, 400, 400, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0})
ch_exvar = {
}
dsb_spawnburst_begin(26)
dsb_spawn(3, "stairsup", 0, 2, 0, 4)
dsb_spawn(25, "rock", 0, 3, 1, 0)
dsb_spawn(23, "rock", 0, 3, 1, 1)
dsb_spawn(24, "rock", 0, 3, 1, 1)
dsb_spawn(22, "rock", 0, 3, 1, 2)
dsb_spawn(26, "rock", 0, 3, 1, 2)
dsb_spawn(21, "rock", 0, 3, 1, 3)
dsb_spawn(5, "teleporter", 0, 3, 1, 4)
dsb_objset(5, false, true, 0, 0, 0, 0, 0)
dsb_spawn(20, "bluehaze", 0, 3, 1, 4)
dsb_objset(20, false, true, 0, 0, 0, 0, 0)
dsb_spawn(2, "lever_up", 0, 4, 1, 3)
dsb_spawn(4, "button_blue", 0, 4, 3, 3)
dsb_spawn(1, "stairsdown", 0, 2, 4, 4)
exvar = {
[1] = { y = 0,
x = 2,
silent = true },
[2] = { target = { 5, 20 },
msg = 100002 },
[3] = { y = 4,
x = 2,
silent = true },
[4] = { target = { 5, 20 },
msg = 100002 },
[5] = { y = 3,
x = 3,
sound = "ooftbl",
opby_monster = true,
opby_thing = true,
opby_party = true },
}
dsb_spawnburst_end()
EDITOR_FLAGS = 255
dsb_champion_toparty(0, 1)
dsb_party_place(0, 0, 0, 2)
(Or dump this in a startup.lua for testing)
Code: Select all
-- The function that controls teleporters and spinners
function base_teleporter(self, id, what)
local lev, xc, yc, face
local tface
local tele_sound = nil
local teleporter_user
if (not is_opby(id, what, "teleporter")) then
return false
end
if (what) then
lev, xc, yc, face = dsb_get_coords(what)
tface = face
teleporter_user = what
else
lev, xc, yc, face = dsb_party_coords()
teleporter_user = -1
end
if (not exvar[id].teleporter_users) then
dsb_msg(END_OF_FRAME, id, M_ALT_NEXTTICK, 0)
exvar[id].teleporter_users = { }
end
if (not exvar[id].teleporter_users[teleporter_user]) then
exvar[id].teleporter_users[teleporter_user] = 0
end
exvar[id].teleporter_users[teleporter_user] = exvar[id].teleporter_users[teleporter_user] + 1
if (exvar[id].teleporter_users[teleporter_user] > 3) then
return false
end
if (exvar[id].x) then xc = exvar[id].x end
if (exvar[id].y) then yc = exvar[id].y end
if (exvar[id].lev) then lev = exvar[id].lev end
if (exvar[id].face) then
face = exvar[id].face
if (what) then
dsb_set_facedir(what, face)
end
end
if (exvar[id].spin) then
face = (face + exvar[id].spin) % 4
if (what) then
dsb_set_facedir(what, (dsb_get_facedir(what) + exvar[id].spin) % 4)
end
end
if (exvar[id].sound) then
tele_sound = select_sound(snd[exvar[id].sound])
end
if (tele_sound == nil) then tele_sound = snd.buzz end
if (what) then
local arch = dsb_find_arch(what)
if (tface == CENTER) then
face = CENTER
end
local queued = false
if (arch.type == "MONSTER") then
local clev, cx, cy = dsb_get_coords(id)
-- Only bother trying to queue if we're going to a different tile
if (clev ~= lev or cx ~= xc or cy ~= yc) then
queued = teleport_needs_queue(what, lev, xc, yc, face)
end
end
-- Only make noise once per tick
if (not exvar[id].silent and not self.default_silent) then
if (not exvar[id].temporary_silence) then
dsb_3dsound(select_sound(tele_sound), lev, xc, yc)
exvar[id].temporary_silence = true
dsb_msg(1, id, M_NEXTTICK, 0)
end
end
if (queued) then
local controller = dsb_spawn("function_caller", LIMBO, 0, 0, 0)
exvar[controller] = { m_a = "finish_queued_teleport", inst = what,
lev = lev, x = xc, y = yc, tries = 0 }
dsb_msg(2, controller, M_ACTIVATE, 0)
if (face ~= CENTER) then
use_exvar(what)
exvar[what].teleport_tile_pos = face
end
dsb_move(what, LIMBO, 0, 0, 0)
else
dsb_move(what, lev, xc, yc, face)
if (arch.on_teleport) then
arch:on_teleport(what, lev, xc, yc, face)
end
end
if (dsb_get_cell(lev, xc, yc)) then
dsb_set_flystate(what, 0)
end
else
dsb_party_place(lev, xc, yc, face)
if (not exvar[id].silent and not self.default_silent) then
if (not exvar[id].temporary_silence) then
if (dsb_party_viewing() == dsb_party_affecting()) then
dsb_sound(tele_sound)
else
dsb_3dsound(tele_sound, lev, xc, yc)
end
exvar[id].temporary_silence = true
dsb_msg(1, id, M_NEXTTICK, 0)
end
end
end
end