minetest_game API
======================
-GitHub Repo: https://github.com/BlockMen/minetest_game
+GitHub Repo: https://github.com/minetest/minetest_game
Introduction
------------
---------
The doors mod allows modders to register custom doors.
- doors:register_door(name, def)
- ^ Notice the ":" instaed of "."!
+ doors.register_door(name, def)
^ name: "Door name"
^ def: See [#Door definition]
last_v = 0,
}
-function boat:on_rightclick(clicker)
+function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
end
end
-function boat:on_activate(staticdata, dtime_s)
+function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
self.last_v = self.v
end
-function boat:get_staticdata()
+function boat.get_staticdata()
return tostring(v)
end
-function boat:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
+function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
puncher:set_detach()
self.object:remove()
if puncher and puncher:is_player() and not minetest.setting_getbool("creative_mode") then
end
end
-function boat:on_step(dtime)
+function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
end
end
-function doors:register_door(name, def)
+function doors.register_door(name, def)
def.groups.not_in_creative_inventory = 1
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
end
-doors:register_door("doors:door_wood", {
+doors.register_door("doors:door_wood", {
description = "Wooden Door",
inventory_image = "door_wood.png",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
}
})
-doors:register_door("doors:door_steel", {
+doors.register_door("doors:door_steel", {
description = "Steel Door",
inventory_image = "door_steel.png",
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
}
})
-doors:register_door("doors:door_glass", {
+doors.register_door("doors:door_glass", {
description = "Glass Door",
inventory_image = "door_glass.png",
groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1},
}
})
-doors:register_door("doors:door_obsidian_glass", {
+doors.register_door("doors:door_obsidian_glass", {
description = "Obsidian Glass Door",
inventory_image = "door_obsidian_glass.png",
groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1},