2024-01-27 02:33:14 +01:00
|
|
|
local S = trike.S
|
|
|
|
|
2023-09-03 21:03:59 -03:00
|
|
|
-- wing
|
|
|
|
minetest.register_craftitem("trike:wing",{
|
2024-01-27 02:33:14 +01:00
|
|
|
description = S("trike wing"),
|
2023-09-03 21:03:59 -03:00
|
|
|
inventory_image = "trike_wing_ico.png",
|
|
|
|
})
|
|
|
|
-- fuselage
|
|
|
|
minetest.register_craftitem("trike:fuselage",{
|
2024-01-27 02:33:14 +01:00
|
|
|
description = S("trike fuselage"),
|
2023-09-03 21:03:59 -03:00
|
|
|
inventory_image = "trike_body.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
-- trike
|
2024-06-30 11:40:40 -03:00
|
|
|
--[[minetest.register_craftitem("trike:trike", {
|
2024-01-27 02:33:14 +01:00
|
|
|
description = S("Ultralight Trike"),
|
2023-09-03 21:03:59 -03:00
|
|
|
inventory_image = "trike.png",
|
2024-06-30 11:40:40 -03:00
|
|
|
liquids_pointable = true,]]--
|
|
|
|
minetest.register_tool("trike:trike", {
|
|
|
|
description = S("Ultralight Trike"),
|
|
|
|
inventory_image = "trike.png",
|
|
|
|
liquids_pointable = false,
|
|
|
|
stack_max = 1,
|
2023-09-03 21:03:59 -03:00
|
|
|
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
if pointed_thing.type ~= "node" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2024-06-30 11:40:40 -03:00
|
|
|
local stack_meta = itemstack:get_meta()
|
|
|
|
local staticdata = stack_meta:get_string("staticdata")
|
|
|
|
|
2023-09-03 21:03:59 -03:00
|
|
|
local pointed_pos = pointed_thing.under
|
|
|
|
--local node_below = minetest.get_node(pointed_pos).name
|
|
|
|
--local nodedef = minetest.registered_nodes[node_below]
|
|
|
|
|
|
|
|
pointed_pos.y=pointed_pos.y+0.5
|
2024-06-30 11:40:40 -03:00
|
|
|
local trike = minetest.add_entity(pointed_pos, "trike:trike", staticdata)
|
2023-09-03 21:03:59 -03:00
|
|
|
if trike and placer then
|
|
|
|
local ent = trike:get_luaentity()
|
|
|
|
local owner = placer:get_player_name()
|
|
|
|
ent.owner = owner
|
|
|
|
trike:set_yaw(placer:get_look_horizontal())
|
|
|
|
itemstack:take_item()
|
2024-06-30 11:40:40 -03:00
|
|
|
|
|
|
|
--[[local properties = ent.object:get_properties()
|
|
|
|
properties.infotext = owner .. " nice trike"
|
|
|
|
ent.object:set_properties(properties)]]--
|
2023-09-03 21:03:59 -03:00
|
|
|
end
|
|
|
|
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
--
|
|
|
|
-- crafting
|
|
|
|
--
|
|
|
|
|
|
|
|
if not minetest.settings:get_bool('trike.disable_craftitems') and minetest.get_modpath("default") then
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "trike:wing",
|
|
|
|
recipe = {
|
|
|
|
{"", "wool:white", "" },
|
|
|
|
{"wool:white", "default:steel_ingot", "wool:white"},
|
|
|
|
{"farming:string", "wool:white", "farming:string"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "trike:fuselage",
|
|
|
|
recipe = {
|
|
|
|
{"", "default:diamondblock", ""},
|
|
|
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "default:mese_block", "default:steel_ingot"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "trike:trike",
|
|
|
|
recipe = {
|
|
|
|
{"", ""},
|
|
|
|
{"trike:fuselage", "trike:wing"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|