aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-04-25 21:53:41 +0200
committerorwell96 <orwell@bleipb.de>2021-04-25 21:54:51 +0200
commit112e3ff2555f1380a5125a9b09ef0a7fc81b053a (patch)
tree40a757346fa5ac19dc10e3ccf27cfc9b6da131dd
parente04c21be78f6c915537f7dc8fdbf8110d7eadcd0 (diff)
Fix undeclared globals warnings (#176)
Reported by Vanessa Dannenberg
-rw-r--r--advtrains/couple.lua1
-rw-r--r--advtrains/trackplacer.lua1
-rw-r--r--advtrains/tracks.lua4
-rw-r--r--advtrains/trainlogic.lua9
-rw-r--r--advtrains/wagons.lua1
-rw-r--r--advtrains_luaautomation/init.lua8
6 files changed, 12 insertions, 12 deletions
diff --git a/advtrains/couple.lua b/advtrains/couple.lua
index a38ca69..3dc336f 100644
--- a/advtrains/couple.lua
+++ b/advtrains/couple.lua
@@ -149,7 +149,6 @@ minetest.register_entity("advtrains:couple", {
end
self.position_set=true
end
- atprintbm("couple step", t)
advtrains.atprint_context_tid=nil
end,
})
diff --git a/advtrains/trackplacer.lua b/advtrains/trackplacer.lua
index 356df15..fe76290 100644
--- a/advtrains/trackplacer.lua
+++ b/advtrains/trackplacer.lua
@@ -286,6 +286,7 @@ function tp.register_track_placer(nnprefix, imgprefix, dispname, def)
return itemstack, false
end
if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
+ local s
if def.suitable_substrate then
s = def.suitable_substrate(upos)
else
diff --git a/advtrains/tracks.lua b/advtrains/tracks.lua
index 33a7999..261818e 100644
--- a/advtrains/tracks.lua
+++ b/advtrains/tracks.lua
@@ -524,7 +524,7 @@ function advtrains.register_tracks(tracktype, def, preset)
end
ndef.on_rightclick = function(pos, node, player)
if advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
- advtrains.setstate(pos, newstate, node)
+ advtrains.setstate(pos, nil, node)
advtrains.log("Switch", player:get_player_name(), pos)
end
end
@@ -667,7 +667,7 @@ function sl.create_slopeplacer_on_place(def, preset)
local yaw=player.get_look_horizontal and player:get_look_horizontal() or (player:get_look_yaw() - math.pi/2)
--rounding unit vectors is a nice way for selecting 1 of 8 directions since sin(30°) is 0.5.
- dirvec={x=math.floor(math.sin(-yaw)+0.5), y=0, z=math.floor(math.cos(-yaw)+0.5)}
+ local dirvec={x=math.floor(math.sin(-yaw)+0.5), y=0, z=math.floor(math.cos(-yaw)+0.5)}
--translate to direction to look up inside the preset table
local param2, rot45=({
[-1]={
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index c9c7e76..c812ff7 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -139,9 +139,12 @@ minetest.register_on_joinplayer(function(player)
advtrains.hhud[player:get_player_name()] = nil
--independent of this, cause all wagons of the train which are loaded to reattach their players
--needed because already loaded wagons won't call reattach_all()
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.train_id==id then
- wagon:reattach_all()
+ local id=advtrains.player_to_train_mapping[pname]
+ if id then
+ for _,wagon in pairs(minetest.luaentities) do
+ if wagon.is_wagon and wagon.initialized and wagon.train_id==id then
+ wagon:reattach_all()
+ end
end
end
end)
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index f918571..e9b6d7a 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -934,6 +934,7 @@ function wagon:show_bordcom(pname)
if not self:train() then return end
local train = self:train()
local data = advtrains.wagons[self.id]
+ local linhei
local form = "size[11,9]label[0.5,0;AdvTrains Boardcom v0.1]"
form=form.."textarea[0.5,1.5;7,1;text_outside;"..attrans("Text displayed outside on train")..";"..(minetest.formspec_escape(train.text_outside or "")).."]"
diff --git a/advtrains_luaautomation/init.lua b/advtrains_luaautomation/init.lua
index b6fe464..ab625b1 100644
--- a/advtrains_luaautomation/init.lua
+++ b/advtrains_luaautomation/init.lua
@@ -2,12 +2,8 @@
-- Lua automation features for advtrains
-- Uses global table 'atlatc' (AdvTrains_LuaATC)
--- Boilerplate to support localized strings if intllib mod is installed.
-if intllib then
- atltrans = intllib.Getter()
-else
- atltrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
-end
+--TODO: re-add localization (if merging localization, discard this hunk please)
+atltrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
--Privilege
--Only trusted players should be enabled to build stuff which can break the server.
368'>368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434