Skip to content

Commit

Permalink
cleanup / deferred digiline event
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 29, 2021
1 parent 6f18026 commit 8aff0cc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions digiline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,17 @@ jumpdrive.digiline_effector = function(pos, _, channel, msg)
elseif msg.command == "jump" then
local success, timeormsg = jumpdrive.execute_jump(pos)

local send_pos = pos
if success then
-- send new message in target pos
send_pos = targetPos
digilines.receptor_send(send_pos, jumpdrive.digiline_rules, set_channel, {
success = success,
time = timeormsg
})
-- defer sending to allow the environment to "settle" first
minetest.after(0.5, function()
digilines.receptor_send(targetPos, jumpdrive.digiline_rules, set_channel, {
success = success,
time = timeormsg
})
end)
else
digilines.receptor_send(send_pos, jumpdrive.digiline_rules, set_channel, {
digilines.receptor_send(pos, jumpdrive.digiline_rules, set_channel, {
success = success,
msg = timeormsg
})
Expand Down

0 comments on commit 8aff0cc

Please sign in to comment.