aboutsummaryrefslogtreecommitdiff
path: root/advtrains/protection.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/protection.lua')
-rw-r--r--advtrains/protection.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/advtrains/protection.lua b/advtrains/protection.lua
index ac1cd66..6bb1ccb 100644
--- a/advtrains/protection.lua
+++ b/advtrains/protection.lua
@@ -1,27 +1,29 @@
-- advtrains
-- protection.lua: privileges and rail protection, and some helpers
+-- Get current translator
+local S = advtrains.translate
-- Privileges to control TRAIN DRIVING/COUPLING
minetest.register_privilege("train_operator", {
- description = attrans("Can place, remove and operate trains"),
+ description = S("Can place, remove and operate trains"),
give_to_singleplayer= true,
});
minetest.register_privilege("train_admin", {
- description = attrans("Can place, remove and operate any train, regardless of owner, whitelist, or protection"),
+ description = S("Can place, remove and operate any train, regardless of owner, whitelist, or protection"),
give_to_singleplayer= true,
});
-- Privileges to control TRACK BUILDING
minetest.register_privilege("track_builder", {
- description = attrans("Can place and dig tracks in unprotected areas"),
+ description = S("Can place and dig tracks in unprotected areas"),
give_to_singleplayer= true,
});
-- Privileges to control OPERATING TURNOUTS/SIGNALS
minetest.register_privilege("railway_operator", {
- description = attrans("Can operate turnouts and signals in unprotected areas"),
+ description = S("Can operate turnouts and signals in unprotected areas"),
give_to_singleplayer= true,
});
@@ -145,12 +147,12 @@ function advtrains.check_track_protection(pos, pname, near, prot_p)
--atdebug("CTP: ",pos,pname,near,prot_p,"priv=",priv,"prot=",prot,"dprot=",dprot)
if not priv and (not boo or prot or not dprot) then
- minetest.chat_send_player(pname, near and attrans("You are not allowed to build near tracks without the track_builder privilege.") or attrans("You are not allowed to build tracks without the track_builder privilege."))
+ minetest.chat_send_player(pname, near and S("You are not allowed to build near tracks without the track_builder privilege.") or S("You are not allowed to build tracks without the track_builder privilege."))
minetest.log("action", pname.." tried to modify terrain "..nears.."track at "..minetest.pos_to_string(apos).." but is not permitted to (no privilege)")
return false
end
if prot then
- minetest.chat_send_player(pname, near and attrans("You are not allowed to build near tracks at this protected position.") or attrans("You are not allowed to build tracks at this protected position."))
+ minetest.chat_send_player(pname, near and S("You are not allowed to build near tracks at this protected position.") or S("You are not allowed to build tracks at this protected position."))
minetest.record_protection_violation(pos, pname)
minetest.log("action", pname.." tried to modify "..nears.."track at "..minetest.pos_to_string(apos).." but position is protected!")
return false
@@ -181,7 +183,7 @@ function advtrains.check_turnout_signal_protection(pos, pname)
nocheck=false
return true
else
- minetest.chat_send_player(pname, attrans("You are not allowed to operate turnouts and signals without the railway_operator privilege."))
+ minetest.chat_send_player(pname, S("You are not allowed to operate turnouts and signals without the railway_operator privilege."))
minetest.log("action", pname.." tried to operate turnout/signal at "..minetest.pos_to_string(pos).." but does not have railway_operator")
nocheck=false
return false