Compare commits

...

6 Commits

Author SHA1 Message Date
Schmappie Eldress a4187aa951 lua client API: Fix crash in get_server_info()
When running on a local machine in Docker, calling
`minetest.get_server_info()` in lua can throw an exception, resulting
in client shutdown.

    ERROR[Main]: ModError: Failed to load and run mod "tchat":
    ERROR[Main]: No address for peer found!
    ERROR[Main]: stack traceback:
    ERROR[Main]: 	[C]: in function 'get_server_info'
    ERROR[Main]: 	tchat:init.lua:118: in main chunk
    ERROR[Main]: Check debug.txt for details.
2021-08-20 01:14:35 -05:00
Schmappie Eldress 1c1eac07f3 Fix crash in autofly mod
From clean `~/.minetest` directory:
- Start waspsaliva
- Create a waypoint ".wah"
- Cheat menu -> autofly -> waypoints
- Click the new waypoint
- Click SHOW button

2021-08-19 22:24:46: ERROR[Main]: ModError: Runtime error from mod 'autoeat' in callback on_formspec_input(): *builtin*:common/vector.lua:67: attempt to index local 'pos2' (a nil value)
2021-08-19 22:24:46: ERROR[Main]: stack traceback:
2021-08-19 22:24:46: ERROR[Main]: 	*builtin*:common/vector.lua:67: in function 'direction'
2021-08-19 22:24:46: ERROR[Main]: 	*builtin*:client/wasplib.lua:503: in function 'aim'
2021-08-19 22:24:46: ERROR[Main]: 	autofly:init.lua:301: in function 'display_waypoint'
2021-08-19 22:24:46: ERROR[Main]: 	autofly:/wpforms.lua:102: in function <autofly:/wpforms.lua:77>
2021-08-19 22:24:46: ERROR[Main]: 	*builtin*:client/register.lua:26: in function <*builtin*:client/register.lua:14>
2021-08-19 22:24:46: ERROR[Main]: Check debug.txt for details.
2021-08-19 17:40:41 -05:00
Schmappie Eldress f7c543bc1b Silence "register same mod storage twice" error
2021-08-19 22:15:43: ERROR[Main]: Unable to register same mod storage twice. Storage name: autofly
2021-08-19 17:40:41 -05:00
Schmappie Eldress 76db810cca Silence various undeclared variable warnings
scaffold:

    2021-08-18 22:42:54: WARNING[Main]: Assignment to undeclared global "sdir" inside a function at scaffold:/railscaffold.lua:151.

incrementaltp:  Fix this by adding `optional_depends` to `mod.conf`

2021-08-18 22:52:39: WARNING[Main]: Undeclared global variable "autofly" accessed at incrementaltp:init.lua:85
2021-08-18 22:52:39: WARNING[Main]: Undeclared global variable "autofly" accessed at incrementaltp:init.lua:87

dte:

2021-08-18 22:59:26: WARNING[Main]: Assignment to undeclared global "_" inside a function at dte:init.lua:375.

tchat:  Use `get_modpath('wisp')` to fix this

2021-08-18 23:21:20: WARNING[Main]: Undeclared global variable "wisp" accessed at tchat:init.lua:537
2021-08-19 17:40:41 -05:00
Schmappie Eldress 4669d8bc95 clientmods/mods.conf: Silence client announcement by default
Silence the embarrassing announcement:

    <schmappie>: Hey guys. I'm using a hacked client. https://repo.or.cz/waspsaliva.git.

...and the embarrassing followup:

    BOT — Today at 9:10 PM
    Thingamabobber Joined
    <Thingamabobber>: hey, schmapa
    <Thingamabobber>: I saw that youre using waspsaliva.
    <Thingamabobber>: In contents, in the game's main menu, turn off haxnotify to stop the message from showing up.
    <Thingamabobber>: Also, I can tell you the necessary cmake options to hide the fact that you're using a hacked client from other servers.
    <Thingamabobber>: In the waspsaliva directory, there is a file called cmakelists.txt
    <Thingamabobber>: near the top, there are a few options.

    xay — Today at 9:13 PM
    wow its p nice of u to share this stuff :) (with others ;) ) how are you today?
2021-08-19 17:40:41 -05:00
Schmappie Eldress 4059b0909f scaffold CSM: Fix crash from indexing undefined variable
debug.txt:2021-08-18 02:17:31: WARNING[Main]: Undeclared global variable "storage" accessed at scaffold:/railscaffold.lua:151
    debug.txt:2021-08-18 02:17:31: ERROR[Main]: Access denied. Reason: Client environment_step: Runtime error from mod 'scaffold' in callback environment_step(): scaffold:/railscaffold.lua:151: attempt to index global 'storage' (a nil value)
    debug.txt:2021-08-18 02:17:31: ERROR[Main]: 	scaffold:/railscaffold.lua:151: in function 'func'
2021-08-19 17:40:41 -05:00
10 changed files with 42 additions and 19 deletions

View File

@ -296,7 +296,7 @@ function autofly.display_waypoint(name)
local pos=name
if type(name) ~= 'table' then pos=autofly.get_waypoint(name) end
autofly.last_name = name
--autofly.last_coords = pos
autofly.last_coords = pos
autofly.set_hud_info(name)
autofly.aim(autofly.last_coords)
autofly.display(pos,name)

View File

@ -6,7 +6,6 @@
local formspec_list = {}
local selected_name = false
local storage = minetest.get_mod_storage()
local wpr=false;
local twpname=nil
local info=minetest.get_server_info()

View File

@ -372,6 +372,7 @@ end
local function load_UI(name) -- open/create a ui file
current_ui_file = name
modstorage:set_string("_GUI_editor_selected_file", current_ui_file)
local _
_, widgets = pcall(loadstring("return "..modstorage:get_string("_GUI_editor_file_"..current_ui_file)))
if widgets == nil then
widgets = {{type="Display", name="", width=5, height=5, width_param=false, height_param=false, left=0.5, top=0.5,

View File

@ -0,0 +1,4 @@
name = incrementaltp
author = cora
description = Teleport to a destination in increments
optional_depends = autofly

View File

@ -43,7 +43,7 @@ load_mod_combat = true
load_mod_waterbot = true
load_mod_bookbot = true
load_mod_invrefill = true
load_mod_haxnotify = true
load_mod_haxnotify = false
load_mod_incrementaltp = true
load_mod_test = true
load_mod_dodgebot = false

View File

@ -10,8 +10,6 @@ scaffold.constrain1 = false
scaffold.constrain2 = false
local hwps={}
local storage=minetest.get_mod_storage()
scaffold.wason = {}
local nextact = {}

View File

@ -4,7 +4,7 @@
--west:-x,1.5,-5
--east:-x,1.5,5
-- north 5,1.5(3096:2.5,25025:1.5),z
--#local storage = minetest.get_mod_storage()
local storage = minetest.get_mod_storage()
local ground = {
"mesecons_torch:redstoneblock"
}
@ -148,7 +148,7 @@ end,function() --stopfunc
end,{'afly_axissnap','continuous_forward','autorefill'}) --'scaffold_ltbm'
ws.on_connect(function()
sdir=storage:get_string('BOTDIR')
local sdir=storage:get_string('BOTDIR')
if sdir ~= "" then
ws.set_dir(sdir)
else

View File

@ -130,6 +130,9 @@ local message_to = minetest.settings:get("tchat_prefix_send")
local team_mode = minetest.settings:get_bool("tchat_team_mode")
local use_wisp = minetest.settings:get_bool("tchat_use_wisp")
if minetest.get_modpath('wisp') == nil then
use_wisp = false
end
local hide_sent = minetest.settings:get_bool("tchat_hide_sent")
local blacklist = string.split(minetest.settings:get("tchat_blacklist"))
@ -320,7 +323,7 @@ end
local function dm(player, message)
if wisp == nil or not use_wisp then
if not use_wisp then
minetest.send_chat_message("/msg " .. player .." " .. message)
else
wisp.send(player, message, true)
@ -534,7 +537,7 @@ table.insert(minetest.registered_on_receiving_chat_message, 1, function(message)
end
end)
if wisp ~= nil then
if use_wisp then
wisp.register_on_receive_split(function(player, message)
if message:find(message_prefix) then
tchat.chat_append("E " .. player .. ": " .. clean_message(message))

View File

@ -1,3 +1,4 @@
name = tchat
author = cora, system32
description = Adds a team chat and prevents accidental sending of coordinates. Supports Wisp for encrypting messages.
optional_depends = wisp

View File

@ -322,16 +322,33 @@ int ModApiClient::l_sound_fade(lua_State *L)
int ModApiClient::l_get_server_info(lua_State *L)
{
Client *client = getClient(L);
Address serverAddress = client->getServerAddress();
lua_newtable(L);
lua_pushstring(L, client->getAddressName().c_str());
lua_setfield(L, -2, "address");
lua_pushstring(L, serverAddress.serializeString().c_str());
lua_setfield(L, -2, "ip");
lua_pushinteger(L, serverAddress.getPort());
lua_setfield(L, -2, "port");
lua_pushinteger(L, client->getProtoVersion());
lua_setfield(L, -2, "protocol_version");
lua_newtable(L);
try {
Address serverAddress = client->getServerAddress();
} catch (const con::PeerNotFoundException &) {
// Local connection?
lua_pushstring(L, "unknown");
lua_setfield(L, -2, "address");
lua_pushstring(L, "unknown");
lua_setfield(L, -2, "ip");
lua_pushinteger(L, 0);
lua_setfield(L, -2, "port");
lua_pushinteger(L, 0);
lua_setfield(L, -2, "port");
lua_pushinteger(L, 0);
lua_setfield(L, -2, "protocol_version");
return 1;
}
lua_pushstring(L, client->getAddressName().c_str());
lua_setfield(L, -2, "address");
lua_pushstring(L, serverAddress.serializeString().c_str());
lua_setfield(L, -2, "ip");
lua_pushinteger(L, serverAddress.getPort());
lua_setfield(L, -2, "port");
lua_pushinteger(L, client->getProtoVersion());
lua_setfield(L, -2, "protocol_version");
return 1;
}