Page 1 of 1

Issues with pits

Posted: Wed Nov 21, 2007 3:32 am
by Sophia
I've changed the way the base code deals with pits.
If you're making a custom pit, this may be useful to you.

The locking code is now:

Code: Select all

-- Set all bit flags but actuators
local pit_lock = 65534
dsb_lock_game(pit_lock)

dsb_delay_func(5, function()
 local lev, xc, yc, face = dsb_party_coords()
    dsb_unlock_game(pit_lock)
	dsb_party_place(lev+1, xc, yc, face)
	pit_damage(20)
end)
I had been meaning to rewrite this with the locking flags introduced a few versions ago but I never got around to it. :)

This version is less hackish (and much safer), because it doesn't rely on dsb_delay_func, except when the game has already been locked.

The reason actuators must stay unlocked is because otherwise objects lying on the same tile as the party when a pit opens underneath them wouldn't fall through-- the game would already be locked.