Fix TA4 pusher and flycontroller bugs

This commit is contained in:
Joachim Stolberg 2022-09-13 21:13:09 +02:00
parent 3ce0af9a3d
commit 79cf2ba7af
5 changed files with 25 additions and 5 deletions

View File

@ -128,7 +128,17 @@ local function pushing(pos, crd, meta, nvm)
local num = nvm.item_count or nvm.num_items or crd.num_items
num = push(pos, crd, meta, nvm, pull_dir, push_dir, num)
if num > 0 then
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
if nvm.item_count then
nvm.item_count = nvm.item_count - num
if nvm.item_count <= 0 then
crd.State:stop(pos, nvm)
nvm.item_count = nil
else
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
end
end
else
crd.State:stop(pos, nvm)
end
elseif nvm.num_items < nvm.limit then
local num = math.min(crd.num_items, nvm.limit - nvm.num_items)

View File

@ -102,7 +102,7 @@ function flylib.to_path(s, max_dist)
tPath = tPath or {}
tPath[#tPath + 1] = v
else
return tPath, S("Error: Max. length of the flight route exceeded !!")
return tPath, S("Error: Max. length of the flight route exceeded by @1 blocks !!", dist - max_dist)
end
else
return tPath, S("Error: Invalid path !!")

View File

@ -446,7 +446,7 @@ Firebox=Feuerkasten
### fly_lib.lua ###
Destination position is protected=Zielposition ist geschützt
Error: Max. length of the flight route exceeded !!=Fehler: Max. Flugstreckenlänge überschritten !!
Error: Max. length of the flight route exceeded by @1 blocks !!=Fehler: max. Länge der Flugstrecke um @1 Blöcke überschritten !!
No valid destination position=Keine gültige Zielposition
No valid node at the start position=Kein gültiger Block an der Startposition
Start position is protected=Startposition ist geschützt
@ -1484,3 +1484,8 @@ Remove detector=Entferne Detektor
TA4 Collider Detector Worker=TA4 Collider Detektor Worker
[TA4] Detector is being built!=[TA4] Detektor wird gebaut!
[TA4] Detector is being removed!=[TA4] Detektor wird entfernt!
##### not used anymore #####
Error: Max. length of the flight route exceeded !!=Fehler: Max. Flugstreckenlänge überschritten !!

View File

@ -446,7 +446,7 @@ Firebox=
### fly_lib.lua ###
Destination position is protected=
Error: Max. length of the flight route exceeded !!=
Error: Max. length of the flight route exceeded by @1 blocks !!=
No valid destination position=
No valid node at the start position=
Start position is protected=

View File

@ -46,7 +46,8 @@ local WRENCH_MENU = {
local function formspec(nvm, meta)
local status = meta:get_string("status")
local path = meta:contains("path") and meta:get_string("path") or "0,3,0"
local path = meta:contains("fs_path") and meta:get_string("fs_path") or
meta:contains("path") and meta:get_string("path") or "0,3,0"
return "size[8,6.7]" ..
"style_type[textarea;font=mono;textcolor=#FFFFFF;border=true]" ..
"box[0,-0.1;7.2,0.5;#c6e8ff]" ..
@ -107,6 +108,7 @@ minetest.register_node("techage:ta5_flycontroller", {
local pos_list = mark.get_poslist(name)
local _, err = fly.to_path(fields.path, MAX_DIST)
if not err then
meta:set_string("fs_path", fields.path)
meta:set_string("path", fields.path)
end
nvm.running = nil
@ -120,8 +122,11 @@ minetest.register_node("techage:ta5_flycontroller", {
local _, err = fly.to_path(fields.path, MAX_DIST)
if not err then
meta:set_string("path", fields.path)
meta:set_string("fs_path", fields.path)
meta:set_string("status", S("Stored"))
else
meta:set_string("path", "0,0,0")
meta:set_string("fs_path", fields.path)
meta:set_string("status", err)
end
meta:set_string("formspec", formspec(nvm, meta))