Force testing requirement on all boxes.

Boxes need to be tested. Untested boxes can not be submitted.
For small edits, re-testing isn't required (<150sec). Lots of
messaging to the builder as well to make sure it doesn't go
unnoticed.
This commit is contained in:
Auke Kok 2019-11-05 09:28:23 -08:00
parent d5aebb5e9d
commit 3be634fa58
2 changed files with 26 additions and 0 deletions

View File

@ -171,7 +171,15 @@ function boxes.player_success(player)
bmeta.meta.num_completed_players = db.box_get_num_completed_players(id)
if bmeta.meta.builder == name then
if not bmeta.meta.tested then
bmeta.meta.tested = 1
minetest.chat_send_player(name, S("Box @1 is marked as tested. You may now submit it.", tostring(id)))
end
end
db.box_set_meta(id, bmeta)
for _, p in ipairs(box.signs_to_update) do
local node = minetest.get_node(p)
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_exit_update then
@ -907,6 +915,7 @@ function boxes.make_new(player, size)
box_name = "(No name)",
builder = player:get_player_name(),
build_time = 0,
tested = 0,
skybox = 0,
digit_pos = digit_pos,
}
@ -1135,6 +1144,12 @@ function boxes.save_edit(player, id)
bmeta.meta.skybox = box.skybox
local t = minetest.get_gametime()
if name == bmeta.meta.builder then -- Do not count admin edit times
if bmeta.meta.tested then
-- reset tested flag if significant edits were made
if t - box.start_edit_time > 150 then
bmeta.meta.tested = 0
end
end
bmeta.meta.build_time = bmeta.meta.build_time + t - box.start_edit_time
box.start_edit_time = t
end
@ -1142,6 +1157,9 @@ function boxes.save_edit(player, id)
minetest.log("action", name .. " saved box " .. id)
minetest.chat_send_player(name, S("Box @1 saved successfully.", id))
if name == bmeta.meta.builder and not bmeta.meta.tested then
minetest.chat_send_player(name, S("Remember, You must test your box once before you can submit it."))
end
end
function boxes.stop_edit(player)

View File

@ -839,6 +839,14 @@ function callback.boxes_create(player, fields, context)
elseif fields.submit and context.box then
local id = context.box.id
if is_admin or (box_get_status(id) == db.STATUS_EDITING and is_builder(id)) then
if not meta then
meta = db.box_get_meta(id)
end
if meta.meta.builder == name and not meta.meta.tested then
minetest.chat_send_player(name, S("Box @1 was not tested yet.\n" ..
"You need to play through this box once before you are allowed to submit it.", tostring(id)))
return true
end
minetest.chat_send_player(name, S("Submitting box @1", tostring(id)))
announce.all(name .. " submits box " .. tostring(id))
announce.admins(name .. " submits box " .. tostring(id))