aboutsummaryrefslogtreecommitdiff
path: root/advtrains_line_automation
diff options
context:
space:
mode:
authorBlockhead <jbis1337@hotmail.com>2021-03-22 11:00:37 +0100
committerorwell96 <orwell@bleipb.de>2021-03-22 11:02:10 +0100
commit5b4f5491d26ae42419ecb036f79fa0040ce45975 (patch)
tree65cbc73ea064b8949c4838bfdf0d90ed88f86078 /advtrains_line_automation
parent7e94650b8db63d5bbb93a539657337d323c98e3c (diff)
downloadadvtrains-5b4f5491d26ae42419ecb036f79fa0040ce45975.tar.gz
advtrains-5b4f5491d26ae42419ecb036f79fa0040ce45975.tar.bz2
advtrains-5b4f5491d26ae42419ecb036f79fa0040ce45975.zip
Do not return early after setting station info on stop rail
Solves Hemiptera#171
Diffstat (limited to 'advtrains_line_automation')
-rw-r--r--advtrains_line_automation/stoprail.lua25
1 files changed, 11 insertions, 14 deletions
diff --git a/advtrains_line_automation/stoprail.lua b/advtrains_line_automation/stoprail.lua
index 9c1470a..0a66eee 100644
--- a/advtrains_line_automation/stoprail.lua
+++ b/advtrains_line_automation/stoprail.lua
@@ -89,23 +89,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
tmp_checkboxes[pe].reverse = (fields.reverse == "true")
end
if fields.save then
- if fields.stn and stdata.stn ~= fields.stn then
- if fields.stn ~= "" then
- local stn = advtrains.lines.stations[fields.stn]
- if stn then
- if (stn.owner == pname or minetest.check_player_privs(pname, "train_admin")) then
- stdata.stn = fields.stn
- else
- minetest.chat_send_player(pname, "Station code '"..fields.stn.."' does already exist and is owned by "..stn.owner)
- end
- else
- advtrains.lines.stations[fields.stn] = {name = fields.stnname, owner = pname}
+ if fields.stn and stdata.stn ~= fields.stn and fields.stn ~= "" then
+ local stn = advtrains.lines.stations[fields.stn]
+ if stn then
+ if (stn.owner == pname or minetest.check_player_privs(pname, "train_admin")) then
stdata.stn = fields.stn
+ else
+ minetest.chat_send_player(pname, "Station code '"..fields.stn.."' does already exist and is owned by "..stn.owner)
+ show_stoprailform(pos,player)
+ return
end
+ else
+ advtrains.lines.stations[fields.stn] = {name = fields.stnname, owner = pname}
+ stdata.stn = fields.stn
end
- updatemeta(pos)
- show_stoprailform(pos, player)
- return
end
local stn = advtrains.lines.stations[stdata.stn]
if stn and fields.stnname and fields.stnname ~= stn.name then