Code: Select all
local ws_name = dsb_get_alt_wallset(lev, x, y, tile)
Moderator: Sophia
Code: Select all
local ws_name = dsb_get_alt_wallset(lev, x, y, tile)
Code: Select all
xmin = gui_info.openchest.x
xmax = gui_info.openchest.x + gui_info.openchest.w
ymin = gui_info.openchest.y
ymax = gui_info.openchest.y + gui_info.openchest.h
[.. SOME FIND ARCH CODE ..]
if (arch.name == "CHEST") then
use_exvar(v)
if exvar[v].open then
local gap = 2
local chest_contents = dsb_fetch(IN_OBJ, v, -1, TABLE)
-- Draw the 8 slots
for x=1, 8 do
local r = x-1
local rx = 34*(r % 4) + gap
local ry = 34*(math.floor(r / 4)) + gap
dsb_bitmap_rect(bmp, rx, ry, rx+31, ry+31, color.black, true)
end
-- If there are contents, draw the icons and respond to
-- mouseclicks at the correct coordinates
if (chest_contents) then
for x=1, #(chest_contents) do
local item = chest_contents[x]
local r = x-1
local rx = 34*((r) % 4) + gap
local ry = 34*(math.floor((r) / 4)) + gap
if (mx > rx+xmin and mx < rx+xmin+31 and my > ymin+ry and my < ymin+ry+31) then
if (leftclick) then
local mouse_obj = dsb_fetch(MOUSE_HAND, 0, 0, 0)
if (mouse_obj) then
-- TODO some clever stuff here :-)
else
dsb_push_mouse(item)
end
end
end
local arch = dsb_find_arch(item)
dsb_bitmap_draw(arch.icon, bmp, rx, ry, false)
end
end
end
end
So if opening the immobile chest makes it somehow look like opening an ordinary one would (i.e. forcing open character inventory) everything should be fine? Would be a bit weird I guess, but if nothing else works that might be a solution (if it's even possible that way, of course)Sophia wrote: ↑Mon Nov 23, 2020 8:14 pm Anyway, beyond the technical problems, to me the main gameplay issue with an immobile chest is that it's basically moving inventory interaction to the main view, which creates some UX problems because that is not where it usually happens. You can't directly pull items from the inventory and put them into the chest, like you can on the inventory view, and you also can't really pull items of the chest and put them into the inventory, except into the hands or the automatic "put away" sorting you get by clicking on the character.
In my solution, I'm only drawing a tiny area just above the chest, to display 8 icons max. There aren't multiple UI elements, it's all very discrete. The only reason it doesn't fully work is that I can't put items back into an immobile chest that's a Thing, because the on_click handler for the thing obviously doesn't respond to clicks when something is already in the mouse hand. I can display and interact with the 8 items inside the chest no problem (although everything rearranges each time an item is removed, which is a bit weird). Yes, there's no simple way to then get the items into the backpack, the player still needs to pop open an inventory, but rightclick as a shortcut for that makes it fairly painless IMO.Sophia wrote: ↑Mon Nov 23, 2020 8:14 pm The other problem is DSB isn't really designed to handle overlaying UI elements over each other and you have multiple UI elements all overlaying the viewport. The click only goes to the first one in the list. Though it won't entirely fix your issues, I'd recommend simplifying this all down to one viewport overlay anyway, as the net effect is the same and it will make rendering a bit faster.
Maybe, maybe not. I think all these different approaches are valid, depending on the gameplay style required.
Cool, thanks. Basically I was looking at a gameplay variation: "No hoarding" - players can get things from chests, but shouldn't be able to carry the chests themselves, or lift them, or throw them. The no-fit-inventory arch property was initially adequate for preventing backpack carrying, but the player can still walk around with the chest in hand or in the mouse cursor, so it's not a full solution... which leads nicely into....
I had thought the same thing -- if there's a sane way of opening inventory view when clicking on an immobile chest (as a Thing), that might work? Otherwise, what other things could be done to prevent the player from placing the chest in hand or the cursor, and still look inside it to get at the contents?Prince of Elves wrote: So if opening the immobile chest makes it somehow look like opening an ordinary one would (i.e. forcing open character inventory) everything should be fine? Would be a bit weird I guess, but if nothing else works that might be a solution (if it's even possible that way, of course)
I was talking specifically about objzones, and how you have gui_info.stats, gui_info.inventory, gui_info.poisoned, and gui_info.dungeon_overlay all defined and taking up the same space on the screen. Only one of these will receive clicks via the clickzone system, and if your objzone is in the "wrong" one, it won't ever work.
You're using dsb_fetch to grab the chest contents, right? The table returned by dsb_fetch leaves out empty spaces.
This seems odd too. I'd be curious to see a screenshot of what the clickzone actually looked like (using debug mode as mentioned above), I recall RTC has a bug where the clickzones were getting "offset" and maybe DSB is doing something similar...
This would be a bit messy, because DSB is sort of hardcoded to expect anything you're basing a subrenderer on (like a chest) to be in hand, while if you're clicking on an immobile chest, then it isn't going to be in a character's inventory at all. There are ways around it, of course, but it involves hijacking the system renderers and it's just not going to be a whole lot of fun. So... perhaps not a sane way.
Yep, this was one of my first solutions. It just felt a bit inelegant though and I was looking for something a bit more slick, but I seem to have gone down a rabbit hole of much too complexity...!Sophia wrote:What I'd recommend doing is just making the chest extremely heavy, combined with making it not allowed to go into the inventory. You can pick it up and look at it, using the limitations of the DM UI, but trying to carry it around will make it almost impossible to move and of course you can't throw it. This does mean you can move it, slowly, but a big heavy chest could be shoved around, so maybe that's not that big of a deal. It would certainly make it impractical to carry a backpack full of chests.
Sonja or Azizi always seemed quick enough to me!Gambit37 wrote:heavy chests do impact the leader's walking speed
Oooh, awesome. Please don't go out of your way on it though, it's just a nice-to-have.
I really wasn't, but now I can't not!
Code: Select all
function sys_render_other(bmp, gui_name, frozen)
if (gui_name == "myobjzone_bmp") then
local draw_objzones = -- figure out if objzones should be drawn --
if (draw_objzones) then
dsb_objzone(--whatever--)
return true
end
end
end
Was this ever implemented?