1
0
mirror of https://github.com/tacigar/maidroid.git synced 2024-11-10 12:10:28 +01:00
maidroid/maidroid_tool/core_writer.lua

93 lines
2.7 KiB
Lua
Raw Normal View History

2016-09-14 02:35:28 +02:00
------------------------------------------------------------
-- Copyright (c) 2016 tacigar. All rights reserved.
-- https://github.com/tacigar/maidroid
------------------------------------------------------------
-- register a definition of a core writer.
2016-09-14 04:23:27 +02:00
(function()
local node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.25, -0.4375, 0.4375, 0.1875, 0.4375},
{ 0.1875, 0.3125, 0.0625, 0.4375, 0.375, 0.125},
{ -0.375, 0.1875, -0.375, 0.375, 0.25, 0.375},
{-0.0625, -0.5, -0.0625, 0.0625, 0.375, 0.0625},
{ 0.375, 0.1875, 0.0625, 0.4375, 0.375, 0.125},
{ -0.375, -0.5, -0.375, 0.375, -0.25, 0.375},
},
}
2016-09-14 02:35:28 +02:00
2016-09-14 04:23:27 +02:00
local tiles = {
"maidroid_tool_core_writer_top.png",
"maidroid_tool_core_writer_bottom.png",
"maidroid_tool_core_writer_right.png",
"maidroid_tool_core_writer_right.png^[transformFX",
"maidroid_tool_core_writer_front.png^[transformFX",
"maidroid_tool_core_writer_front.png",
}
minetest.register_node("maidroid_tool:core_writer", {
description = "maidroid tool : core writer",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2},
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
node_box = node_box,
tiles = tiles,
})
2016-09-14 05:33:23 +02:00
end) ();
2016-09-14 04:23:27 +02:00
-- register a definition of a core entity.
(function()
2016-09-14 10:34:16 +02:00
local node_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.125, 0.5, -0.4375, 0.125},
{ -0.125, -0.5, -0.5, 0.125, -0.4375, 0.5},
{ -0.25, -0.5, -0.4375, 0.25, -0.4375, 0.4375},
{ -0.375, -0.5, -0.375, 0.375, -0.4375, 0.375},
{-0.4375, -0.5, -0.25, 0.4375, -0.4375, 0.25},
},
}
2016-09-14 05:33:23 +02:00
2016-09-14 10:34:16 +02:00
local tiles = {
"maidroid_tool_core_top.png",
"maidroid_tool_core_top.png",
"maidroid_tool_core_right.png",
"maidroid_tool_core_right.png",
"maidroid_tool_core_right.png",
"maidroid_tool_core_right.png",
}
2016-09-14 05:33:23 +02:00
2016-09-14 10:34:16 +02:00
minetest.register_node("maidroid_tool:core_node", {
drawtype = "nodebox",
tiles = tiles,
node_box = node_box,
paramtype = "light",
paramtype2 = "facedir",
})
2016-09-14 05:33:23 +02:00
minetest.register_entity("maidroid_tool:core_entity", {
2016-09-14 10:34:16 +02:00
physical = false,
visual = "wielditem",
visual_size = {x = 0.5, y = 0.5},
collisionbox = {0, 0, 0, 0, 0, 0},
2016-09-14 05:33:23 +02:00
on_activate = function(self, staticdata)
self.object:set_properties{textures = {"maidroid_tool:core_node"}}
end,
2016-09-14 10:34:16 +02:00
on_step = function(self, dtime)
local yaw = self.object:getyaw()
self.object:setyaw(yaw + 0.1)
end,
2016-09-14 05:33:23 +02:00
})
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
minetest.add_entity(pointed_thing.above, "maidroid_tool:core_entity")
end)
2016-09-14 04:23:27 +02:00
end) ()