mirror of
https://git.0x7be.net/dirk/uniham.git
synced 2024-11-22 15:23:46 +01:00
use more descriptive function/file name
This commit is contained in:
parent
dbdf094855
commit
691790c8a6
4
init.lua
4
init.lua
@ -5,7 +5,7 @@ uniham.syspath = uniham.modpath..DIR_DELIM..'system'
|
|||||||
|
|
||||||
|
|
||||||
-- Load mod
|
-- Load mod
|
||||||
dofile(uniham.syspath..DIR_DELIM..'use_hammer.lua')
|
dofile(uniham.syspath..DIR_DELIM..'crush_nodes.lua')
|
||||||
dofile(uniham.syspath..DIR_DELIM..'register_hammer.lua')
|
dofile(uniham.syspath..DIR_DELIM..'register_hammer.lua')
|
||||||
dofile(uniham.syspath..DIR_DELIM..'registry.lua')
|
dofile(uniham.syspath..DIR_DELIM..'registry.lua')
|
||||||
|
|
||||||
@ -16,4 +16,4 @@ dofile(uniham.syspath..DIR_DELIM..'registry.lua')
|
|||||||
uniham.replacements = nil
|
uniham.replacements = nil
|
||||||
uniham.syspath = nil
|
uniham.syspath = nil
|
||||||
uniham.modpath = nil
|
uniham.modpath = nil
|
||||||
uniham.use_hammer = nil
|
uniham.crush_nodes = nil
|
||||||
|
@ -25,7 +25,7 @@ local replacements = {
|
|||||||
-- @param pointed_thing The `pointed_thing` as per on_use definition
|
-- @param pointed_thing The `pointed_thing` as per on_use definition
|
||||||
-- @see <https://dev.minetest.net/on_use#on_use>
|
-- @see <https://dev.minetest.net/on_use#on_use>
|
||||||
-- @return itemstack|void
|
-- @return itemstack|void
|
||||||
uniham.use_hammer = function (itemstack, player, pointed_thing)
|
uniham.crush_nodes = function (itemstack, player, pointed_thing)
|
||||||
if pointed_thing.type ~= 'node' then return end
|
if pointed_thing.type ~= 'node' then return end
|
||||||
local node_pos = minetest.get_pointed_thing_position(pointed_thing)
|
local node_pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
local node_name = minetest.get_node(node_pos).name
|
local node_name = minetest.get_node(node_pos).name
|
@ -1,5 +1,5 @@
|
|||||||
-- Localize
|
-- Localize
|
||||||
local use_hammer = uniham.use_hammer
|
local crush_nodes = uniham.crush_nodes
|
||||||
|
|
||||||
|
|
||||||
-- Register a new hammer
|
-- Register a new hammer
|
||||||
@ -41,7 +41,7 @@ local use_hammer = uniham.use_hammer
|
|||||||
-- modify and return the itemstack as needed.
|
-- modify and return the itemstack as needed.
|
||||||
--
|
--
|
||||||
-- If no function is provided the default function (replace nodes by the table
|
-- If no function is provided the default function (replace nodes by the table
|
||||||
-- provided as `uniham.use_hammer` in mod loading state).
|
-- provided as `uniham.crush_nodes` in mod loading state).
|
||||||
--
|
--
|
||||||
-- `uses` is added as `_uniham.uses` to the hammer’s item definition and can
|
-- `uses` is added as `_uniham.uses` to the hammer’s item definition and can
|
||||||
-- be used by the custom `on_use` function. The built-in function (replacing
|
-- be used by the custom `on_use` function. The built-in function (replacing
|
||||||
@ -53,7 +53,7 @@ local use_hammer = uniham.use_hammer
|
|||||||
-- @see <https://dev.minetest.net/minetest.register_craft>
|
-- @see <https://dev.minetest.net/minetest.register_craft>
|
||||||
-- @return void
|
-- @return void
|
||||||
uniham.register_hammer = function (short_id, definition)
|
uniham.register_hammer = function (short_id, definition)
|
||||||
local on_use = definition.on_use or use_hammer
|
local on_use = definition.on_use or crush_nodes
|
||||||
local autotexture = '([combine:16x16:-1,1=+s)^((+h^+m)^[makealpha:0,0,0)'
|
local autotexture = '([combine:16x16:-1,1=+s)^((+h^+m)^[makealpha:0,0,0)'
|
||||||
local hammer_id = minetest.get_current_modname()..':'..short_id
|
local hammer_id = minetest.get_current_modname()..':'..short_id
|
||||||
local texture = ''
|
local texture = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user