Reason: Segmentation Fault
Stack Dump:
DSBmain
DSBgameloop
dungeon_move
party_moveto
to_tile(on_trigger)
lua_call.member_func
lua.stairsdown.on_trigger
lua.dsb_ai_boss
monster_groupup
Oddly, the stairsdown.on_trigger I have doesn't call dsb_ai_boss, so I'm guessing theres a missing function in the stack?
Code: Select all
stairsdown.on_trigger=ksm.stairs_base
Code: Select all
function ksm.stairs_base(self, id, what)
if (is_opby(id, what, 0)) then
got_triggered(id, what)
end
if (what) then
local arch = dsb_find_arch(what)
if (arch.type == "MONSTER") then
ksm.mon_use_stairs(self,id,what)
end
if (arch.type == "THING") then
local fly = dsb_get_flystate(what)
if (not fly) then
local lev, xc, yc, landpos = dsb_get_coords(what)
local back_out_dir = open_facing(lev, xc, yc, landpos)
-- If the stairs go up, just bump into the stairs and drop
if (self.stairs_dir < 0) then
local dx, dy = dsb_forward(back_out_dir)
dsb_move(what, lev, xc+dx, yc+dy, dsb_tileshift(landpos, back_out_dir))
else
local levchg = self.stairs_dir
if (exvar[id]) then
if (exvar[id].x) then
xc = exvar[id].x
levchg = 0
end
if (exvar[id].y) then
yc = exvar[id].y
levchg = 0
end
if (exvar[id].lev) then
lev = exvar[id].lev
levchg = 0
end
end
local out_dir = open_facing(lev+levchg, xc, yc, landpos)
local dx, dy = dsb_forward(out_dir)
local flip_side = false
if (back_out_dir == landpos) then
flip_side = true
end
local newpos = dsb_tileshift(out_dir, out_dir)
if (flip_side) then
newpos = dsb_tileshift(newpos, ((out_dir+1)%4))
end
-- In actual DM, this check doesn't exist. If you throw something down
-- the stairs, it lands at the bottom... if there is a wall down there,
-- the item will be stuck in the wall. This is, in my opinion, a bug.
-- The simplest fix is to just not let it go down the stairs.
if (dsb_get_cell(lev+levchg, xc+dx, yc+dy)) then
local bdx, bdy = dsb_forward(back_out_dir)
dsb_move(what, lev, xc+bdx, yc+bdy, dsb_tileshift(landpos, back_out_dir))
else
dsb_move(what, lev+levchg, xc+dx, yc+dy, newpos)
end
end
end
end
else
ksm.use_stairs(self, id)
end
end
Code: Select all
function ksm.use_stairs(stairs_arch, id)
if (exvar[id] and exvar[id].temp_disabled) then
return false
end
if (exvar[id].ksm_targstair) then
exvar[exvar[id].ksm_targstair].temp_disabled = true
dsb_delay_func(END_OF_FRAME, function()
exvar[exvar[id].ksm_targstair].temp_disabled = nil
end)
end
-- Any monsters tracking the party should head for the stairway
local pz,px,py,pf = dsb_party_coords()
for monid in dsb_insts() do
local arch = dsb_find_arch(monid)
if (arch.type == "MONSTER" and
dsb_ai_boss(monid) == monid) then
end
if (arch.type == "MONSTER" and
dsb_ai_boss(monid) == monid and
dsb_ai(monid,AI_SEE_PARTY,QUERY) and
(not dsb_ai(monid, AI_FEAR, QUERY))) then
add_monster_target(monid,15,px,py)
end
end
if (exvar[id].sound) then
dsb_sound(snd[exvar[id].sound])
end
dsb_party_place(exvar[id].lev, exvar[id].x, exvar[id].y, exvar[id].ksm_otherdir)
return true
end