Time |
Nick |
Message |
00:21 |
ShadowNinja |
rawget(minetest.registered_items[name], "tool_capabilities") will get the real tool_capabilities, without redirecting to the hand's capabilities. |
00:46 |
|
Taoki joined #minetest-mods |
01:26 |
|
Miner_48er joined #minetest-mods |
01:49 |
|
GrimKriegor joined #minetest-mods |
02:12 |
|
petrusd987 joined #minetest-mods |
02:53 |
|
phantombeta joined #minetest-mods |
06:43 |
|
Miner_48er joined #minetest-mods |
09:10 |
|
jin_xi joined #minetest-mods |
09:33 |
|
rubenwardy joined #minetest-mods |
10:33 |
|
Someguy123 joined #minetest-mods |
11:15 |
|
rubenwardy joined #minetest-mods |
11:49 |
|
GrimKriegor joined #minetest-mods |
12:29 |
|
Animetrom joined #minetest-mods |
12:32 |
|
Animetrom joined #minetest-mods |
13:09 |
|
rubenwardy joined #minetest-mods |
13:24 |
|
rubenwardy joined #minetest-mods |
13:29 |
|
rubenwardy joined #minetest-mods |
13:51 |
|
rubenwardy joined #minetest-mods |
14:13 |
|
Wuzzy joined #minetest-mods |
14:43 |
|
Miner_48er joined #minetest-mods |
15:20 |
|
petrusd987 joined #minetest-mods |
16:10 |
Taoki |
Hello. I'm trying to get pathfinding to work for my mob system, but something isn't working. I posted the Lua code and issue description here, please look at it if anyone wishes to: https://forum.minetest.net/viewtopic.php?f=9&t=10022&p=155985#p155985 |
17:53 |
|
DuDraig joined #minetest-mods |
18:37 |
|
petrusd987 joined #minetest-mods |
21:14 |
|
petrusd987 joined #minetest-mods |
21:22 |
|
Wuzzy2 joined #minetest-mods |
22:48 |
|
zatherz joined #minetest-mods |
22:49 |
zatherz |
hello |
22:49 |
zatherz |
I just wanted to ask, is there any way to execute commands as some player using the Lua API? |
22:49 |
zatherz |
I've searched everywhere and could not find it |
22:53 |
zatherz |
? |
22:56 |
zatherz |
anyone? |
22:58 |
jin_xi |
i dont know, but you should try asking in #minetest |
22:58 |
Zefram_Fysh |
where lua code is executing, there's no concept of which player is executing the code |
22:58 |
Zefram_Fysh |
every API for which there is a concept of an actor takes the actor as an explicit parameter |
23:00 |
zatherz |
hmmm... |
23:00 |
Zefram_Fysh |
what specific kind of command do you have in mind? |
23:01 |
zatherz |
actually, I can just use the functions to imitate running server commands |
23:01 |
zatherz |
I think that would be even better |
23:01 |
zatherz |
but then |
23:01 |
zatherz |
it will not work with mods I don't implement |
23:02 |
zatherz |
well |
23:02 |
zatherz |
is there a way to execute a command with no actor? |
23:02 |
Zefram_Fysh |
do you mean chat commands? |
23:03 |
zatherz |
yes |
23:03 |
Zefram_Fysh |
you can execute them by pulling the definition from the minetest.chatcommands table |
23:03 |
Zefram_Fysh |
the action function takes the actor as an explicit parameter |
23:03 |
zatherz |
oh |
23:04 |
zatherz |
didn't know about that |
23:04 |
zatherz |
will definitely look, thank you very much |
23:04 |
Zefram_Fysh |
see the command block from mesecons for a model of how to do it |
23:06 |
zatherz |
now THAT is easy |
23:06 |
zatherz |
really, really thank you |
23:06 |
zatherz |
I just did not think that the commands could be saved in some kind of a table |
23:10 |
zatherz |
oh, also, another question |
23:11 |
zatherz |
is there a way to run a "daemon" on the server? |
23:11 |
zatherz |
I mean, so that it runs in background |
23:11 |
Zefram_Fysh |
not a persistently-running process, but you can use timers to get regular callbacks |
23:12 |
zatherz |
you mean ABMs? |
23:12 |
Zefram_Fysh |
usually you don't want that, though. usually an ABM will do |
23:12 |
Zefram_Fysh |
what are you trying to achieve? |
23:13 |
zatherz |
let's say I have a file with chat commands |
23:13 |
zatherz |
or, rather, I want this file to work like a pipe |
23:13 |
zatherz |
so, whenever something gets written to it |
23:13 |
zatherz |
a chat command I mean |
23:13 |
zatherz |
it gets executed on the server |
23:14 |
Zefram_Fysh |
file in the server host filesystem? |
23:14 |
zatherz |
yes |
23:14 |
zatherz |
it's not supposed to be large |
23:14 |
Zefram_Fysh |
silly interface |
23:14 |
zatherz |
and is there any other method to pipe commands to Minetest from a C++ program |
23:14 |
zatherz |
? |
23:14 |
zatherz |
I think not |
23:15 |
Zefram_Fysh |
you can connect as a client and just, you know, issue the chat command through the game protocol |
23:15 |
zatherz |
by game protocol you mean what? |
23:16 |
Zefram_Fysh |
if you absolutely can't do it as a regular client, it would still be better to use a local socket or something rather than a regular file |
23:16 |
Zefram_Fysh |
game protocol = the protocol used between the server and regular player clients |
23:17 |
zatherz |
and I can connect from an external application as a client to Minetest and execute commands? |
23:17 |
zatherz |
*to a Minetest server |
23:18 |
Zefram_Fysh |
in principle, sure. it would be nice for someone to develop a Unix-command-line client that will just connect and issue one chat command |
23:20 |
zatherz |
well, I don't think "in principle" is enough |
23:21 |
Zefram_Fysh |
no one's actually written that client afaik. you'd have to put the pieces together yourself |
23:23 |
zatherz |
huh, I don't even think Minetest supports this, does it? |
23:23 |
zatherz |
well |
23:23 |
zatherz |
I actually *can* execute commands on Linux |
23:24 |
zatherz |
I can use xdotool to focus on a Minetest window |
23:24 |
zatherz |
send "t" keypress |
23:24 |
zatherz |
then send whatever command I want as text |
23:24 |
Zefram_Fysh |
there's a protocol, which includes a specific feature for issuing chat commands. what more would you need to count as "support"? |
23:24 |
zatherz |
and send enter |
23:24 |
zatherz |
hmm... |
23:24 |
zatherz |
wait |
23:25 |
zatherz |
you mean this? https://www.google.pl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCAQFjAA&url=http%3A%2F%2Fdev.minetest.net%2FNetwork_Protocol&ei=xZgoVLTgLePMygPxnoGwBg&usg=AFQjCNEhOSeukJaMd0UQ_XP6APNWDx7-cQ&sig2=cEA2JCADz-lBylDPj4E-4A&bvm=bv.76247554,d.bGQ |
23:25 |
zatherz |
oops |
23:25 |
zatherz |
sorry |
23:25 |
zatherz |
http://dev.minetest.net/Network_Protocol |
23:25 |
Zefram_Fysh |
that's the lower layer. there's a layer on top of that for the actual game content |
23:26 |
Zefram_Fysh |
you'll probably want to share code with the game engine |
23:26 |
Taoki |
Does anyone know if minetest.line_of_sight is a costly function? I'm adding it to my creatures mod, and thinking of not even including a setting for it unless necessary. |
23:27 |
Zefram_Fysh |
cost will depend on the step size |
23:27 |
Taoki |
I use the default of 1 |
23:27 |
Zefram_Fysh |
I would not expect it to be an extravagant cost if it's based on stepping along the line |
23:28 |
Taoki |
In my case it will execute several times in a loop, the loop itself executed every 0.25 seconds or so normally |
23:28 |
Zefram_Fysh |
the cost will be linear in the length of the potential line of sight |
23:28 |
Zefram_Fysh |
executing at that sort of rate won't be a problem |
23:29 |
Taoki |
ok. I won't add a setting for it then, hopefully the mod remains as lightweight |
23:29 |
zatherz |
huh |
23:31 |
zatherz |
the protocol seems a bit unnecessary to just execute one command at a time |
23:32 |
Zefram_Fysh |
that's the way to issue a command to the server |
23:32 |
zatherz |
I know |
23:33 |
zatherz |
wait, I don't think if we're talking about the same APIs |
23:33 |
zatherz |
is that: http://dev.minetest.net/Core_Architecture#Network_protocol what you were talking about |
23:33 |
zatherz |
? |
23:35 |
|
Miner_48er joined #minetest-mods |
23:36 |
Zefram_Fysh |
yes. there are two layers of Minetest-specific protocol layered above UDP. that page mentions both layers. the page you pointed at earlier explains the lower of the two layers specifically |
23:36 |
zatherz |
I don't see anything specific to chat commands on this page |
23:37 |
Zefram_Fysh |
that's because that page is only giving you a taste of the protocol, not details |
23:38 |
Zefram_Fysh |
src/clientserver.h in the engine code lists all the game message types |
23:38 |
Zefram_Fysh |
including TOCLIENT_CHAT_MESSAGE |
23:38 |
zatherz |
and it can connect to local games too? or is it only for servers? |
23:39 |
Zefram_Fysh |
er, what? |
23:39 |
zatherz |
huh |
23:39 |
Zefram_Fysh |
it's a protocol, and hence inherently used between the two parties |
23:40 |
zatherz |
oh, and I've been looking @ src/clientserver.h before |
23:42 |
zatherz |
the ultimate question arises |
23:42 |
zatherz |
how can I actually connect to the server |
23:43 |
zatherz |
ok never said that |
23:43 |
Zefram_Fysh |
that involves the lower protocol layer and UDP |
23:43 |
Zefram_Fysh |
the UDP layer is connectionless |
23:43 |
zatherz |
I see void Client::connect(Address address) in src/client.cpp |
23:44 |
Zefram_Fysh |
oh, duh, TOSERVER_CHAT_MESSAGE is the one you want of course, not TOCLIENT_CHAT_MESSAGE |
23:45 |
zatherz |
oh |
23:45 |
zatherz |
so I will have to incorprorate clientserver.h, client.cpp and server.cpp to my program |
23:45 |
zatherz |
include clientserver.h |
23:46 |
zatherz |
then use the methods from server.cpp |
23:46 |
zatherz |
to host a server |
23:46 |
zatherz |
then I could run Minetest form the app |
23:46 |
zatherz |
*from |
23:46 |
zatherz |
and use commandline arguments to connect |
23:46 |
Zefram_Fysh |
you should share code, yes. "host a server" doesn't make sense though |
23:46 |
zatherz |
I mean |
23:46 |
zatherz |
start a local server |
23:47 |
Zefram_Fysh |
your objective is to have a special-purpose client that connects to your already-existing standard server |
23:48 |
zatherz |
I want to start a local server I can control from my application code, start Minetest directly connecting to that server and execute commands from the application |
23:49 |
zatherz |
I see that Server::start is the correct way |
23:49 |
zatherz |
to start the server |
23:50 |
Zefram_Fysh |
if the Minetest server is functionally part of your application, then you could customise the server code to do whatever the application requires |
23:50 |
zatherz |
let's just say |
23:51 |
zatherz |
I want to create a commandline Minetest server |
23:51 |
zatherz |
that can be controlled |
23:51 |
zatherz |
by writing chat commands |
23:51 |
zatherz |
to the terminal |
23:52 |
zatherz |
that server should stay vanilla at the core |
23:52 |
zatherz |
with mods being the only non-vanilla thing |
23:52 |
Zefram_Fysh |
the standard server code can already be told from the command line to run a particular world. accepting chat commands from stdin would be only a small addition to the server code |
23:53 |
zatherz |
but how one would send input *while* the server is running |
23:53 |
Taoki |
https://forum.minetest.net/viewtopic.php?f=11&t=9240&p=156045#p156045 Creatures mod now has experimental pathfinding and line of sight usage! If anyone is interested, please test and let me know how to improve the path finding code. |
23:53 |
Zefram_Fysh |
you already specified that |
23:54 |
zatherz |
but then |
23:54 |
zatherz |
what I'm doing |
23:54 |
zatherz |
is piping the commands |
23:55 |
zatherz |
and that I wanted to do at the beginning, except using a file instead of stdin |
23:55 |
Zefram_Fysh |
a regular file is not a pipe |
23:56 |
zatherz |
but a FIFO is |
23:56 |
zatherz |
and well |
23:56 |
zatherz |
that's what I can add to the server code |
23:57 |
Zefram_Fysh |
you didn't initially make clear how much control you had over the server. the complete control that you're describing here makes it feasible to properly handle stdin or a named pipe |
23:58 |
zatherz |
oh, sorry for that then |
23:58 |
zatherz |
yes, I have complete control over the server |
23:59 |
zatherz |
so... |