Issues with pits

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Issues with pits

Post 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.
Post Reply