mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
improve wieldview API (!)
to support transform registration without groups this will make detaching screwdriver from mcl more easy
This commit is contained in:
parent
84819bf9f5
commit
600e8bede2
@ -1,5 +1,7 @@
|
|||||||
local S = minetest.get_translator("screwdriver")
|
local S = minetest.get_translator("screwdriver")
|
||||||
|
|
||||||
|
local has_wieldview = minetest.get_modpath("wieldview")
|
||||||
|
|
||||||
screwdriver = {}
|
screwdriver = {}
|
||||||
|
|
||||||
screwdriver.ROTATE_FACE = 1
|
screwdriver.ROTATE_FACE = 1
|
||||||
@ -176,7 +178,7 @@ minetest.register_tool("screwdriver:screwdriver", {
|
|||||||
description = S("Screwdriver"),
|
description = S("Screwdriver"),
|
||||||
inventory_image = "screwdriver.png",
|
inventory_image = "screwdriver.png",
|
||||||
wield_image = "screwdriver.png^[transformFX",
|
wield_image = "screwdriver.png^[transformFX",
|
||||||
groups = { tool = 1, not_in_creative_inventory = 1 },
|
groups = { tool = 1 }, --not in creative inventory?
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200)
|
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200)
|
||||||
return itemstack
|
return itemstack
|
||||||
@ -197,7 +199,9 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("screwdriver:screwdriver1", "screwdriver:screwdriver")
|
for i = 1, 4 do
|
||||||
minetest.register_alias("screwdriver:screwdriver2", "screwdriver:screwdriver")
|
minetest.register_alias("screwdriver:screwdriver"..tostring(i), "screwdriver:screwdriver")
|
||||||
minetest.register_alias("screwdriver:screwdriver3", "screwdriver:screwdriver")
|
if has_wieldview then
|
||||||
minetest.register_alias("screwdriver:screwdriver4", "screwdriver:screwdriver")
|
wieldview.register_transform("screwdriver:screwdriver"..tostring(i), "R90")
|
||||||
|
end
|
||||||
|
end
|
@ -1,2 +1,3 @@
|
|||||||
name = screwdriver
|
name = screwdriver
|
||||||
depends = mcl_wip
|
depends = mcl_wip
|
||||||
|
optional_depends = wieldview
|
@ -1,10 +1,8 @@
|
|||||||
-- Wielded Item Transformations - http://dev.minetest.net/texture
|
-- Wielded Item Transformations - http://dev.minetest.net/texture
|
||||||
|
|
||||||
wieldview.transform = {
|
wieldview.register_transform = function(item, rotation)
|
||||||
["screwdriver:screwdriver"]="R90",
|
wieldview.transform[item] = rotation
|
||||||
["screwdriver:screwdriver1"]="R90",
|
end
|
||||||
["screwdriver:screwdriver2"]="R90",
|
|
||||||
["screwdriver:screwdriver3"]="R90",
|
wieldview.transform = {}
|
||||||
["screwdriver:screwdriver4"]="R90",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user