mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
added an alias for set_vehicle_name
This commit is contained in:
parent
2da331dd2a
commit
844a677684
1 changed files with 38 additions and 28 deletions
66
init.lua
66
init.lua
|
@ -594,7 +594,7 @@ minetest.register_chatcommand("eject_from_plane", {
|
||||||
minetest.register_chatcommand("ground_effect", {
|
minetest.register_chatcommand("ground_effect", {
|
||||||
params = "<on/off>",
|
params = "<on/off>",
|
||||||
description = S("Enables/disables the ground effect (for debug purposes)"),
|
description = S("Enables/disables the ground effect (for debug purposes)"),
|
||||||
privs = {interact=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
if minetest.check_player_privs(name, {server=true}) then
|
if minetest.check_player_privs(name, {server=true}) then
|
||||||
|
@ -614,7 +614,7 @@ minetest.register_chatcommand("ground_effect", {
|
||||||
minetest.register_chatcommand("show_lift", {
|
minetest.register_chatcommand("show_lift", {
|
||||||
params = "<on/off>",
|
params = "<on/off>",
|
||||||
description = S("Enables/disables the lift printing (for debug purposes)"),
|
description = S("Enables/disables the lift printing (for debug purposes)"),
|
||||||
privs = {interact=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
if minetest.check_player_privs(name, {server=true}) then
|
if minetest.check_player_privs(name, {server=true}) then
|
||||||
|
@ -632,36 +632,46 @@ minetest.register_chatcommand("show_lift", {
|
||||||
})
|
})
|
||||||
|
|
||||||
if airutils._use_signs_api then
|
if airutils._use_signs_api then
|
||||||
minetest.register_chatcommand("set_vehicle_name", {
|
local function prefix_change(name, param)
|
||||||
params = "<name>",
|
local colorstring = core.colorize('#ff0000', S(" >>> you are not inside a vehicle"))
|
||||||
description = S("Sets the vehicle name (when supported by the vehicle)"),
|
local player = minetest.get_player_by_name(name)
|
||||||
privs = {interact = true},
|
if not player then return end
|
||||||
func = function(name, param)
|
local attached_to = player:get_attach()
|
||||||
local colorstring = core.colorize('#ff0000', S(" >>> you are not inside a vehicle"))
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local attached_to = player:get_attach()
|
|
||||||
|
|
||||||
if attached_to ~= nil then
|
if attached_to ~= nil then
|
||||||
local seat = attached_to:get_attach()
|
local seat = attached_to:get_attach()
|
||||||
if seat ~= nil then
|
if seat ~= nil then
|
||||||
local entity = seat:get_luaentity()
|
local entity = seat:get_luaentity()
|
||||||
if entity then
|
if entity then
|
||||||
if entity.owner == name or minetest.check_player_privs(name, {protection_bypass=true}) then
|
if entity.owner == name or minetest.check_player_privs(name, {protection_bypass=true}) then
|
||||||
if param then
|
if param then
|
||||||
entity._ship_name = string.sub(param, 1, 40)
|
entity._ship_name = string.sub(param, 1, 40)
|
||||||
else
|
|
||||||
entity._ship_name = ""
|
|
||||||
end
|
|
||||||
airutils._set_name(entity)
|
|
||||||
minetest.chat_send_player(name,core.colorize('#00ff00', S(" >>> the vehicle name was changed")))
|
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name,core.colorize('#ff0000', S(" >>> only the owner or moderators can name this vehicle")))
|
entity._ship_name = ""
|
||||||
end
|
end
|
||||||
|
airutils._set_name(entity)
|
||||||
|
minetest.chat_send_player(name,core.colorize('#00ff00', S(" >>> the vehicle name was changed")))
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,core.colorize('#ff0000', S(" >>> only the owner or moderators can name this vehicle")))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
end
|
||||||
minetest.chat_send_player(name,colorstring)
|
else
|
||||||
end
|
minetest.chat_send_player(name,colorstring)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("set_vehicle_name", {
|
||||||
|
params = "<name>",
|
||||||
|
description = S("this command is an aliasfor /set_prefix"),
|
||||||
|
privs = {interact = true},
|
||||||
|
func = prefix_change,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("set_prefix", {
|
||||||
|
params = "<name>",
|
||||||
|
description = S("Sets the vehicle prefix"),
|
||||||
|
privs = {interact = true},
|
||||||
|
func = prefix_change,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue