Difference between revisions of "User:Xyz/stress"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "<code>_()</code>! http://irc.minetest.ru/minetest/2013-02-17#i_2877771 == Types == === position === Same as position. === stressedNode === Created via <code>_(position)...")
 
Line 33: Line 33:
 
An example of code in ''stress'':
 
An example of code in ''stress'':
 
<source>
 
<source>
_("default:dirt"):on("place", function(me)  
+
_("default:dirt"):on("place", function(pos)  
     me:value("default:dirt_with_grass")
+
     _(pos):value("default:dirt_with_grass")
 
end)
 
end)
 
</source>
 
</source>

Revision as of 19:26, 17 February 2013

_()!

http://irc.minetest.ru/minetest/2013-02-17#i_2877771

Types

position

Same as position.

stressedNode

Created via _(position)

Implements:

  • :value() — get node name
  • :value("string") — set node name (like minetest.env:set_node())
  • something with meta?

stressedNodeDef (what a weird name! better think of another one)

Created via _("name"), i.e. _("default:dirt")

  • :on("event", function()) — registers event, possible ones:
    • dig
    • place
    • punch
    • rightclick

Global functions

  • _.on("event", function())
    • generated
    • shutdown

Something

An example of code in stress:

_("default:dirt"):on("place", function(pos) 
    _(pos):value("default:dirt_with_grass")
end)

same without stress

minetest.register_on_placenode(function(pos, newnode)
    if newnode.name == "default:dirt" then
        minetest.env:set_node(pos, {name="default:dirt_with_grass"})
    end
end)