commit | author | age
|
ee0765
|
1 |
|
S |
2 |
minetest.register_craft({ |
|
3 |
output = 'technic:wind_mill_frame 5', |
|
4 |
recipe = { |
|
5 |
{'default:steel_ingot', '', 'default:steel_ingot'}, |
|
6 |
{'', 'default:steel_ingot', ''}, |
|
7 |
{'default:steel_ingot', '', 'default:steel_ingot'}, |
|
8 |
} |
|
9 |
}) |
|
10 |
|
|
11 |
minetest.register_craft({ |
|
12 |
output = 'technic:wind_mill', |
|
13 |
recipe = { |
|
14 |
{'', 'default:steel_ingot', ''}, |
|
15 |
{'default:steel_ingot', 'technic:motor', 'default:steel_ingot'}, |
|
16 |
{'', 'default:steelblock', ''}, |
|
17 |
} |
|
18 |
}) |
|
19 |
|
|
20 |
minetest.register_node("technic:wind_mill_frame", { |
|
21 |
description = "Wind Mill Frame", |
|
22 |
drawtype = "glasslike_framed", |
|
23 |
tiles = {"default_steel_block.png", "default_glass.png"}, |
|
24 |
sunlight_propagates = true, |
|
25 |
groups = {cracky=3}, |
|
26 |
sounds = default.node_sound_stone_defaults(), |
|
27 |
paramtype = "light", |
|
28 |
}) |
|
29 |
|
|
30 |
minetest.register_node("technic:wind_mill", { |
|
31 |
description = "Wind Mill", |
|
32 |
tiles = {"default_steel_block.png"}, |
|
33 |
paramtype2 = "facedir", |
|
34 |
groups = {cracky=1}, |
|
35 |
sounds = default.node_sound_stone_defaults(), |
|
36 |
drawtype = "nodebox", |
|
37 |
paramtype = "light", |
|
38 |
node_box = { |
|
39 |
type = "fixed", |
|
40 |
fixed = { |
|
41 |
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Main box |
|
42 |
{-0.1, -0.1, -0.5, 0.1, 0.1, -0.6}, -- Shaft |
|
43 |
{-0.1, -1, -0.6, 0.1, 1, -0.7}, -- Vertical blades |
|
44 |
{-1, -0.1, -0.6, 1, 0.1, -0.7}, -- Horizontal blades |
|
45 |
} |
|
46 |
}, |
|
47 |
on_construct = function(pos) |
|
48 |
local meta = minetest.get_meta(pos) |
|
49 |
meta:set_string("infotext", "Wind Mill") |
|
50 |
meta:set_int("MV_EU_supply", 0) |
|
51 |
end, |
|
52 |
}) |
|
53 |
|
|
54 |
local function check_wind_mill(pos) |
|
55 |
if pos.y < 30 then |
|
56 |
return false |
|
57 |
end |
|
58 |
for i = 1, 20 do |
|
59 |
local node = minetest.get_node({x=pos.x, y=pos.y-i, z=pos.z}) |
|
60 |
if node.name ~= "technic:wind_mill_frame" then |
|
61 |
return false |
|
62 |
end |
|
63 |
end |
|
64 |
return true |
|
65 |
end |
|
66 |
|
|
67 |
minetest.register_abm({ |
|
68 |
nodenames = {"technic:wind_mill"}, |
|
69 |
interval = 1, |
|
70 |
chance = 1, |
|
71 |
action = function(pos, node, active_object_count, active_object_count_wider) |
|
72 |
local meta = minetest.get_meta(pos) |
|
73 |
local power = math.min(pos.y * 100, 5000) |
|
74 |
|
|
75 |
if not check_wind_mill(pos) then |
|
76 |
meta:set_int("MV_EU_supply", 0) |
|
77 |
meta:set_string("infotext", "Wind Mill Inproperly Placed") |
|
78 |
return |
|
79 |
else |
|
80 |
meta:set_int("MV_EU_supply", power) |
|
81 |
end |
|
82 |
|
|
83 |
meta:set_string("infotext", "Wind Mill ("..power.."EU)") |
|
84 |
end |
|
85 |
}) |
|
86 |
|
|
87 |
technic.register_machine("MV", "technic:wind_mill", technic.producer) |
|
88 |
|