<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://olddev.minetest.org/index.php?action=history&amp;feed=atom&amp;title=Player-World_Interaction</id>
	<title>Player-World Interaction - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://olddev.minetest.org/index.php?action=history&amp;feed=atom&amp;title=Player-World_Interaction"/>
	<link rel="alternate" type="text/html" href="https://olddev.minetest.org/index.php?title=Player-World_Interaction&amp;action=history"/>
	<updated>2026-04-15T16:13:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.7</generator>
	<entry>
		<id>https://olddev.minetest.org/index.php?title=Player-World_Interaction&amp;diff=137&amp;oldid=prev</id>
		<title>&gt;ROllerozxa: remove randomly interspersed broken wikilinks</title>
		<link rel="alternate" type="text/html" href="https://olddev.minetest.org/index.php?title=Player-World_Interaction&amp;diff=137&amp;oldid=prev"/>
		<updated>2023-01-25T19:08:21Z</updated>

		<summary type="html">&lt;p&gt;remove randomly interspersed broken wikilinks&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Incomplete}}&lt;br /&gt;
&lt;br /&gt;
== Digging a node ==&lt;br /&gt;
&lt;br /&gt;
Preconditions are a node somewhere in the map.&amp;lt;br/&amp;gt;&lt;br /&gt;
This node is pointable, has a selection box and can be dug by the hand or the tool the player is wielding.&amp;lt;br/&amp;gt;&lt;br /&gt;
The player has interact priv and the tool has a tool range that the node can be pointed.&amp;lt;br/&amp;gt;&lt;br /&gt;
The node is not stuck somewhere the player can't point it.&lt;br /&gt;
&lt;br /&gt;
* First look at the node, it becomes pointed_thing.&lt;br /&gt;
: Note that on android the node is pointed without looking (referring to the cross position) at it.&lt;br /&gt;
* Then LMB is pressed down while holding an item which does not have on_use.&lt;br /&gt;
: If LMB wasn't released before, a click happens, which causes a punch event.&lt;br /&gt;
:: The client send a punch event (client-&amp;gt;interact(4, pointed), see game.cpp:3657 (28.02.2017)).&lt;br /&gt;
:: On server side the punch event is passed to mods, see on_punch and the deprecated register_on_punchnode.&lt;br /&gt;
: Then the client sends the digging start event to the server (interact(0, pointed), game.cpp:3948).&lt;br /&gt;
:: The server uses this information for anticheat measurements.&lt;br /&gt;
* Now continue looking at the node, i.e. keep pointing it, and hold down LMB.&lt;br /&gt;
: Periodically client-side: Crack animation is updated, digging particles are spawned (if not disabled in the settings) and the node dig sound is played.&lt;br /&gt;
:: The dig sound is either the &amp;quot;dig&amp;quot; field in the &amp;quot;sounds&amp;quot; table in the nodedef&lt;br /&gt;
:: or, if it's not present, the client uses the sound &amp;quot;default_dig_${groupname}&amp;quot; (file name extension omitted here), where $groupname is one of the groups the node has, see (game.cpp:4001), and gain is set to 0.5.&lt;br /&gt;
:: The default_dig_ thing should be banned from source code in my opinion.&lt;br /&gt;
* Some time later, when the digging time elapsed,&lt;br /&gt;
: the client sends a digging completion event to the server (interact(2, pointed), game.cpp:4018),&lt;br /&gt;
: the node disappears client-side,&lt;br /&gt;
: more particles are spawned (if enabled) and&lt;br /&gt;
: the dug sound is played.&lt;br /&gt;
* Now the server recieves the digging completion event.&lt;br /&gt;
: Anticheat probably, e.g due to lag, thinks the player dug the node too fast.&lt;br /&gt;
:: dug_too_fast cheat is passed to mods, see register_on_cheat, and digging aborts.&lt;br /&gt;
: If the nodedef has a can_dig function, it's executed and probably stops the digging.&lt;br /&gt;
: The on_dig function in the nodedef is called now.&lt;br /&gt;
:: The default on_dig function problably removes the node:&lt;br /&gt;
::: The on_destruct is executed, air is set and after_destruct is executed.&lt;br /&gt;
:: And probably (the same probably as before) it then calls the after_dig_node function in the nodedef if present.&lt;br /&gt;
&lt;br /&gt;
[[Category:Core Engine]]&lt;/div&gt;</summary>
		<author><name>&gt;ROllerozxa</name></author>
	</entry>
</feed>