more PR #1051, take II
I realized that the previous attempt was misusing the item's locked state when attempting to create the chest that the item would go into, which was absurd. I hadn't realized that I was also misspelling "olocked" as "locked". This fix was already in progress before the mail about the previous commit. I did try switching to 'lckd = nil' for the attempt to retain the chest's random locked/unlocked state but that resulted in all the chests being created locked. Using separate box=... expressions does work as intended. Doing something with totable() doesn't seem to be necessary. The indentation seems to be messed up compared to the rest of the file (initial indent of 5 with increments of 4 rather than 3 and 3); I have't done anything to try to fix it.
This commit is contained in:
@@ -645,14 +645,15 @@ xx|.....|xx
|
||||
};
|
||||
local itm = obj.new(escape_items[math.random(#escape_items)]);
|
||||
local itmcls = itm:class()
|
||||
local lckd;
|
||||
local box
|
||||
if itmcls[ "material" ] == 19 then -- GLASS==19
|
||||
lckd = false; -- for glass item, force box to be unlocked
|
||||
-- item is made of glass so explicitly force chest to be unlocked
|
||||
box = des.object({ id = "chest", coord = chest_spots[1],
|
||||
olocked = "no" });
|
||||
else
|
||||
lckd = itm.locked; -- else keep random lock state from box's creation
|
||||
-- item isn't made of glass; accept random locked/unlocked state
|
||||
box = des.object({ id = "chest", coord = chest_spots[1] });
|
||||
end;
|
||||
local box = des.object({ id = "chest", coord = chest_spots[1],
|
||||
locked = lckd });
|
||||
box:addcontent(itm);
|
||||
|
||||
for i = 2, #chest_spots do
|
||||
|
||||
Reference in New Issue
Block a user