1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
local freezing_rules = {
["default:water_source"] = "default:ice",
["default:water_flowing"] = "default:snowblock",
["default:river_water_source"] = "default:ice",
["default:river_water_flowing"] = "default:snowblock",
["default:lava_source"] = "default:obsidian",
["default:lava_flowing"] = "default:stone",
["fire:basic_flame"] = "air",
["default:dirt"] = "default:dirt_with_snow",
}
minetest.register_craftitem(":technic:lox", {
description = S("Liquid Oxygen"),
drawtype = "plantlike",
tiles = {"technic_lox.png"},
inventory_image = "technic_lox.png",
wield_image = "technic_lox.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_defaults(),
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, user:get_player_name())
return
end
local pos = pointed_thing.under
local loc = {}
local wrk = false
for y=0,2,1 do
for x=-2,2,1 do
for z = -2,2,1 do
loc = {x = pos.x - x, y = pos.y - y, z = pos.z - z}
if freezing_rules[minetest.get_node(loc).name] then
wrk = true
minetest.swap_node(loc, {name = freezing_rules[minetest.get_node(loc).name]})
end
if math.random(1,5) == 5 then
if minetest.get_node({x = loc.x, y = loc.y+1, z = loc.z}).name == "air"
and minetest.get_node(loc).name ~= "air"
and minetest.get_node(loc).name ~= "stairs:slab_snowblock" then
minetest.set_node({x = loc.x, y = loc.y+1, z = loc.z}, {name = "stairs:slab_snowblock"})
end
end
end
end
end
if wrk then
minetest.sound_play("default_cool_lava", {gain = 1, pos = pos})
end
itemstack:take_item()
local uinv = user:get_inventory()
if uinv:room_for_item("main", "vessels:steel_bottle 1") then
uinv:add_item("main", "vessels:steel_bottle 1")
else
minetest.item_drop(ItemStack("vessels:steel_bottle 1"), user, user:getpos())
end
user:set_hp(user:get_hp() - 1)
return itemstack
end
})
|