add levelling MESE tools and prepare diamonds for their own custom functions

This commit is contained in:
Jordach 2017-11-15 23:41:13 +00:00
parent aba1397ff5
commit 2c7ef72091
54 changed files with 740 additions and 135 deletions

View File

@ -350,4 +350,7 @@ minetest.after(1, atmos.sync_skybox)
minetest.after(60+math.random(1,59)*math.random(1,5), atmos.weatherchange)
minetest.after(2, atmos.thunderstrike)
lightning.light_level = atmos.weather_light_level
lightning.light_level = atmos.weather_light_level
-- abm to remove fires when it's raining, snowing or hailing?

View File

@ -26,7 +26,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"core:grass"},
interval = 120,
interval = 1,
chance = 2,
action = function(pos)
pos.y = pos.y + 1
@ -34,7 +34,7 @@ minetest.register_abm({
return
end
if minetest.get_node_light(pos) < 1 then
if minetest.get_node_light(pos) < 1 and minetest.get_item_group(minetest.get_node(pos).name, "nodec") ~= 1 then
pos.y = pos.y - 1
minetest.add_node(pos,{name="core:dirt"})
end
@ -81,7 +81,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"core:birch_sapling"},
interval = 2, --90
interval = 90, --90
chance = 3,
action = function(pos, node)
@ -99,7 +99,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"core:cherry_sapling"},
interval = 2, --80
interval = 85, --80
chance = 3,
action = function(pos, node)

View File

@ -388,7 +388,7 @@ minetest.register_node("core:pine_log_grassy", {
tiles = {"core_pine_log_top.png", "core_pine_log_top.png", "core_pine_log.png^core_long_grass_1.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1, choppy=3, flammable=2, solid=1},
groups = {tree=1, choppy=3, flammable=2, solid=1, nodec=1},
on_place = minetest.rotate_node
--sounds = {todo},
})
@ -469,7 +469,7 @@ minetest.register_node("core:oak_log_grassy", {
tiles = {"core_oak_log_top.png", "core_oak_log_top.png", "core_oak_log.png^core_long_grass_1.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1, choppy=3, flammable=2, solid=1},
groups = {tree=1, choppy=3, flammable=2, solid=1, nodec=1},
on_place = minetest.rotate_node
--sounds = {todo},
})
@ -524,7 +524,7 @@ minetest.register_node("core:cherry_log_grassy", {
tiles = {"core_cherry_log_top.png", "core_cherry_log_top.png", "core_cherry_log.png^core_long_grass_1.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1, choppy=3, flammable=2, solid=1},
groups = {tree=1, choppy=3, flammable=2, solid=1, nodec=1},
on_place = minetest.rotate_node
--sounds = {todo},
})
@ -596,7 +596,7 @@ minetest.register_node("core:birch_log_grassy", {
tiles = {"core_birch_log_top.png", "core_birch_log_top.png", "core_birch_log.png^core_long_grass_1.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1, choppy=3, flammable=2, solid=1},
groups = {tree=1, choppy=3, flammable=2, solid=1, nodec=1},
on_place = minetest.rotate_node,
--sounds = {todo},
})

View File

@ -158,7 +158,7 @@ minetest.register_craft({
-- mese tier;
minetest.register_craft({
output = "core:mese_pickaxe",
output = "core:mese_pickaxe_1 1 65535",
recipe = {
{"core:mese_crystal", "core:mese_crystal", "core:mese_crystal"},
{"", "group:stick", ""},
@ -167,7 +167,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = "core:mese_shovel",
output = "core:mese_shovel_1 1 65535",
recipe = {
{"", "core:mese_crystal", ""},
{"", "group:stick", ""},
@ -176,7 +176,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = "core:mese_axe",
output = "core:mese_axe_1 1 65535",
recipe = {
{"core:mese_crystal", "core:mese_crystal", ""},
{"core:mese_crystal", "group:stick", ""},
@ -185,7 +185,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = "core:mese_sword",
output = "core:mese_sword_1 1 65535",
recipe = {
{"", "core:mese_crystal", ""},
{"", "core:mese_crystal", ""},

View File

@ -56,7 +56,7 @@ minetest.register_node("core:mg_oak_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
--tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
@ -64,7 +64,7 @@ minetest.register_node("core:mg_pine_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
--tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
@ -72,7 +72,7 @@ minetest.register_node("core:mg_pine_snowy_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
--tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
@ -80,7 +80,7 @@ minetest.register_node("core:mg_birch_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
--tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
@ -88,7 +88,7 @@ minetest.register_node("core:mg_cherry_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
--tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
@ -399,7 +399,7 @@ function mcore.grow_tree(pos, is_apple_tree, trunk_node, leaves_node, fallen_lea
end
local x, y, z = pos.x, pos.y, pos.z
local height = random(4, 6)
local height = random(4, 7)
local c_tree = minetest.get_content_id(trunk_node)
local c_leaves = minetest.get_content_id(leaves_node)
local log_grass = minetest.get_content_id(trunk_node .. "_grassy")
@ -660,7 +660,7 @@ minetest.register_decoration({
place_on = "core:grass",
decoration = {"core:mg_birch_sapling"},
sidelen = 8,
fill_ratio = 0.006,
fill_ratio = 0.003,
biomes = {"plains_forest"},
height = 1,
})
@ -680,7 +680,7 @@ minetest.register_decoration({
place_on = "core:grass",
decoration = {"core:mg_birch_sapling"},
sidelen = 4,
fill_ratio = 0.002,
fill_ratio = 0.001,
biomes = {"plains"},
height = 1,
})
@ -690,7 +690,7 @@ minetest.register_decoration({
place_on = "core:grass",
decoration = {"core:mg_cherry_sapling"},
sidelen = 4,
fill_ratio = 0.0005,
fill_ratio = 0.0001,
biomes = {"plains"},
height = 1,
})
@ -700,7 +700,7 @@ minetest.register_decoration({
place_on = "core:grass",
decoration = {"core:mg_oak_sapling"},
sidelen = 4,
fill_ratio = 0.0005,
fill_ratio = 0.0003,
biomes = {"plains"},
height = 1,
})

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View File

@ -1,9 +1,183 @@
-- functions
mcore.mese_wear_level = {}
mcore.mese_wear_level[1] = 2 --2048
mcore.mese_wear_level[2] = 4 --4096
mcore.mese_wear_level[3] = 6 -- 8192
mcore.mese_wear_level[4] = 8 -- 16384
mcore.mese_wear_level[5] = 0 -- no change
mcore.mese_dig_spd_pick = {}
mcore.mese_dig_spd_pick[1] = { cracky = {times={[1]=9.00, [2]=4.00, [3]=1.50}, uses=mcore.mese_wear_level[1], maxlevel=0} }
mcore.mese_dig_spd_pick[2] = { cracky = {times={[1]=6.00, [2]=2.00, [3]=0.75}, uses=mcore.mese_wear_level[2], maxlevel=0} }
mcore.mese_dig_spd_pick[3] = { cracky = {times={[1]=3.00, [2]=1.00, [3]=0.50}, uses=mcore.mese_wear_level[3], maxlevel=0} }
mcore.mese_dig_spd_pick[4] = { cracky = {times={[1]=1.50, [2]=0.50, [3]=0.25}, uses=mcore.mese_wear_level[4], maxlevel=0} }
mcore.mese_dig_spd_pick[5] = { cracky = {times={[1]=1.00, [2]=0.25, [3]=0.12}, uses=mcore.mese_wear_level[5], maxlevel=0} }
mcore.mese_dig_spd_shovel = {}
mcore.mese_dig_spd_shovel[1] = { crumbly = {times={[1]=4.00, [2]=2.00, [3]=1.00}, uses=mcore.mese_wear_level[1], maxlevel=0} }
mcore.mese_dig_spd_shovel[2] = { crumbly = {times={[1]=2.00, [2]=1.00, [3]=0.50}, uses=mcore.mese_wear_level[2], maxlevel=0} }
mcore.mese_dig_spd_shovel[3] = { crumbly = {times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=mcore.mese_wear_level[3], maxlevel=0} }
mcore.mese_dig_spd_shovel[4] = { crumbly = {times={[1]=0.50, [2]=0.25, [3]=0.25}, uses=mcore.mese_wear_level[4], maxlevel=0} }
mcore.mese_dig_spd_shovel[5] = { crumbly = {times={[1]=0.25, [2]=0.25, [3]=0.12}, uses=mcore.mese_wear_level[5], maxlevel=0} }
mcore.mese_dig_spd_axe = {}
mcore.mese_dig_spd_axe[1] = {
choppy = {times={[1]=4.00, [2]=2.00, [3]=1.00}, uses=mcore.mese_wear_level[1], maxlevel=0},
snappy = {times={[1]=4.00, [2]=2.00, [3]=1.00}, uses=mcore.mese_wear_level[1], maxlevel=0},
}
mcore.mese_dig_spd_axe[2] = {
choppy = {times={[1]=2.00, [2]=1.00, [3]=0.50}, uses=mcore.mese_wear_level[2], maxlevel=0},
snappy = {times={[1]=2.00, [2]=1.00, [3]=0.50}, uses=mcore.mese_wear_level[2], maxlevel=0},
}
mcore.mese_dig_spd_axe[3] = {
choppy = {times={[1]=1.00, [2]=0.50, [3]=0.50}, uses=mcore.mese_wear_level[3], maxlevel=0},
snappy = {times={[1]=1.00, [2]=0.50, [3]=0.50}, uses=mcore.mese_wear_level[3], maxlevel=0},
}
mcore.mese_dig_spd_axe[4] = {
choppy = {times={[1]=0.50, [2]=0.25, [3]=1.00}, uses=mcore.mese_wear_level[4], maxlevel=0},
snappy = {times={[1]=0.25, [2]=0.12, [3]=0.12}, uses=mcore.mese_wear_level[4], maxlevel=0},
}
mcore.mese_dig_spd_axe[5] = {
choppy = {times={[1]=0.25, [2]=0.25, [3]=0.25}, uses=mcore.mese_wear_level[5], maxlevel=0},
snappy = {times={[1]=0.25, [2]=0.12, [3]=0.12}, uses=mcore.mese_wear_level[5], maxlevel=0},
}
mcore.mese_dig_spd_sword = {}
mcore.mese_dig_spd_sword[1] = { snappy = {times={[1]=4.00, [2]=2.00, [3]=1.00}, uses=mcore.mese_wear_level[1], maxlevel=0} }
mcore.mese_dig_spd_sword[2] = { snappy = {times={[1]=2.00, [2]=1.00, [3]=0.50}, uses=mcore.mese_wear_level[2], maxlevel=0} }
mcore.mese_dig_spd_sword[3] = { snappy = {times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=mcore.mese_wear_level[3], maxlevel=0} }
mcore.mese_dig_spd_sword[4] = { snappy = {times={[1]=0.25, [2]=0.12, [3]=0.12}, uses=mcore.mese_wear_level[4], maxlevel=0} }
mcore.mese_dig_spd_sword[5] = { snappy = {times={[1]=0.25, [2]=0.12, [3]=0.12}, uses=mcore.mese_wear_level[5], maxlevel=0} }
-- calculating damage (for mese only);
-- pickaxe = sword damage / 2
-- shovel = sword damage / 2 - 2
-- axe = sword damage - 2
mcore.mese_dmg_sword = {}
mcore.mese_dmg_sword[1] = 4
mcore.mese_dmg_sword[2] = 4
mcore.mese_dmg_sword[3] = 6
mcore.mese_dmg_sword[4] = 8
mcore.mese_dmg_sword[5] = 10
-- calculating swing speeds (for mese only);
-- pickaxe = sword speed + 0.75
-- shovel = sword speed + 1.5
-- axe = sword speed + 0.5
mcore.mese_swing_speed = {}
mcore.mese_swing_speed[1] = 1.75
mcore.mese_swing_speed[2] = 1.25
mcore.mese_swing_speed[3] = 1.0
mcore.mese_swing_speed[4] = 0.75
mcore.mese_swing_speed[5] = 0.375
function mcore.give_mese_exp(itemstack, user, node, digparams)
if itemstack:get_name() == "core:mese_pickaxe_5" or itemstack:get_name() == "core:mese_shovel_5" or itemstack:get_name() == "core:mese_axe_5" or itemstack:get_name() == "core:mese_sword_5" then
itemstack:add_wear(digparams.wear)
return itemstack
end
for i=1, 4 do
if itemstack:get_name() == "core:mese_pickaxe_" .. i and itemstack:get_wear() == 0 then
itemstack:set_name("core:mese_pickaxe_" .. i+1)
if i ~= 4 then
itemstack:set_wear(65535)
minetest.sound_play("core_tool_levelling", {
to_player = user:get_player_name(),
gain = 6.0,
})
else
--......
end
return itemstack
elseif itemstack:get_name() == "core:mese_pickaxe_" .. i then
local add_to = -65535 / mcore.mese_wear_level[i]
itemstack:add_wear(add_to)
return itemstack
end
end
end
function mcore.diamonds_are_forever(itemstack, user, node, digparams)
print("meme")
end
local function register_mese_toolsets()
for i=1, 5 do
minetest.register_tool("core:mese_pickaxe_" .. i, {
description = "MESE Pickaxe (Level " .. i .. ")",
inventory_image = "core_mese_pickaxe_".. i .. ".png",
tool_capabilities = {
full_punch_interval = mcore.mese_swing_speed[i] + 0.75,
max_drop_level = 0,
groupcaps = mcore.mese_dig_spd_pick[i],
damage_groups = mcore.mese_dmg_sword[i] / 2,
},
after_use = function(itemstack, user, node, digparams)
mcore.give_mese_exp(itemstack, user, node, digparams)
end,
})
end
end
register_mese_toolsets()
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=3,z=4},
tool_capabilities = {
full_punch_interval = 0.9,
full_punch_interval = 0.25,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[1]=6.00, [2]=3.00, [3]=1.50}, uses=0, maxlevel=1},
@ -13,6 +187,7 @@ minetest.register_item(":", {
},
damage_groups = {fleshy=1},
}
})
-- items
@ -31,9 +206,7 @@ minetest.register_tool("core:wooden_pickaxe", {
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 0,
groupcaps = {
cracky = {times={[1]=9.00, [2]=4.00, [3]=1.50}, uses=0, maxlevel=1}
},
damage_groups = {fleshy=1},
}
})
@ -257,65 +430,6 @@ minetest.register_tool("core:ironze_sword", {
})
-- mese tier;
minetest.register_tool("core:mese_pickaxe", {
description = "MESE Pickaxe",
inventory_image = "core_mese_pickaxe.png",
tool_capabilities = {
full_punch_interval = 3.0,
max_drop_level = 0,
groupcaps = {
cracky = {times={[1]=1.50, [2]=0.50, [3]=0.25}, uses=2048, maxlevel=0},
},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("core:mese_shovel", {
description = "MESE Shovel",
inventory_image = "core_mese_shovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 4.0,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=2048, maxlevel=0},
},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("core:mese_axe", {
description = "MESE Axe",
inventory_image = "core_mese_axe.png",
tool_capabilities = {
full_punch_interval = 2.0,
max_drop_level = 0,
groupcaps = {
choppy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=2048, maxlevel=0},
snappy = {times={[1]=0.25, [2]=0.12, [3]=0.06}, uses=2048*2, maxlevel=0},
},
damage_groups = {fleshy=5},
},
})
minetest.register_tool("core:mese_sword", {
description = "MESE Sword",
inventory_image = "core_mese_sword.png",
tool_capabilities = {
full_punch_interval = 2.5,
max_drop_level = 0,
groupcaps = {
snappy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=2048, maxlevel=0},
},
damage_groups = {fleshy=8},
},
})
-- diamond tier
minetest.register_tool("core:diamond_pickaxe", {
@ -325,7 +439,7 @@ minetest.register_tool("core:diamond_pickaxe", {
full_punch_interval = 3.0,
max_drop_level = 0,
groupcaps = {
cracky = {times={[1]=1.50, [2]=0.50, [3]=0.25}, uses=4096, maxlevel=0},
cracky = {times={[1]=1.50, [2]=0.50, [3]=0.25}, uses=8192, maxlevel=0},
},
damage_groups = {fleshy=4},
},
@ -339,7 +453,7 @@ minetest.register_tool("core:diamond_shovel", {
full_punch_interval = 4.0,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=4096, maxlevel=0},
crumbly = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=8192, maxlevel=0},
},
damage_groups = {fleshy=3},
},
@ -353,8 +467,8 @@ minetest.register_tool("core:diamond_axe", {
full_punch_interval = 2.0,
max_drop_level = 0,
groupcaps = {
choppy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=4096, maxlevel=0},
snappy = {times={[1]=0.25, [2]=0.12, [3]=0.06}, uses=4096*2, maxlevel=0},
choppy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=8192, maxlevel=0},
snappy = {times={[1]=0.25, [2]=0.12, [3]=0.06}, uses=8192*2, maxlevel=0},
},
damage_groups = {fleshy=5},
},
@ -368,7 +482,7 @@ minetest.register_tool("core:diamond_sword", {
full_punch_interval = 2.5,
max_drop_level = 0,
groupcaps = {
snappy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=4096, maxlevel=0},
snappy = {times={[1]=0.50, [2]=0.25, [3]=0.12}, uses=8192, maxlevel=0},
},
damage_groups = {fleshy=8},
},

View File

@ -816,42 +816,34 @@ function doors.register_fencegate(name, def)
})
end
doors.register_fencegate("doors:gate_wood", {
description = "Wooden Fence Gate",
texture = "default_wood.png",
material = "default:wood",
doors.register_fencegate("doors:gate_oak", {
description = "Oak Fence Gate",
texture = "core_oak_planks.png",
material = "core:oak_planks",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
doors.register_fencegate("doors:gate_acacia_wood", {
description = "Acacia Fence Gate",
texture = "default_acacia_wood.png",
material = "default:acacia_wood",
doors.register_fencegate("doors:gate_birch", {
description = "Birch Fence Gate",
texture = "core_birch_planks.png",
material = "core:birch_planks",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
doors.register_fencegate("doors:gate_junglewood", {
description = "Junglewood Fence Gate",
texture = "default_junglewood.png",
material = "default:junglewood",
doors.register_fencegate("doors:gate_cherry", {
description = "Cherry Fence Gate",
texture = "core_cherry_planks.png",
material = "core:cherry_planks",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
doors.register_fencegate("doors:gate_pine_wood", {
description = "Pine Fence Gate",
texture = "default_pine_wood.png",
material = "default:pine_wood",
texture = "core_pine_planks.png",
material = "core:pine_planks",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
doors.register_fencegate("doors:gate_aspen_wood", {
description = "Aspen Fence Gate",
texture = "default_aspen_wood.png",
material = "default:aspen_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
----fuels----
minetest.register_craft({

35
mods/fire/README.txt Normal file
View File

@ -0,0 +1,35 @@
Minetest Game mod: fire
=======================
See license.txt for license information.
Authors of source code
----------------------
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (LGPL 2.1)
Various Minetest developers and contributors (LGPL 2.1)
Authors of media (textures and sounds)
--------------------------------------
Everything not listed in here:
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com> (CC BY-SA 3.0)
Muadtralk (CC BY-SA 3.0)
fire_basic_flame_animated.png
Gambit (CC BY-SA 3.0)
fire_flint_steel.png
dobroide (CC BY 3.0)
http://www.freesound.org/people/dobroide/sounds/4211/
fire_small.ogg
Dynamicell (CC BY 3.0)
http://www.freesound.org/people/Dynamicell/sounds/17548/
fire_large.ogg
fire_fire.*.ogg
fire_small.ogg and fire_large.ogg are unused but kept temporarily to not break
other mods that may use them.
Benboncan (CC BY 3.0)
https://www.freesound.org/people/Benboncan/sounds/66457/
fire_flint_and_steel.ogg

0
mods/fire/depends.txt Normal file
View File

349
mods/fire/init.lua Normal file
View File

@ -0,0 +1,349 @@
-- Global namespace for functions
fire = {}
--
-- Items
--
-- Flame nodes
minetest.register_node("fire:basic_flame", {
drawtype = "firelike",
tiles = {
{
name = "fire_basic_flame_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 13,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1},
on_timer = function(pos)
local f = minetest.find_node_near(pos, 1, {"group:flammable"})
if not f then
minetest.remove_node(pos)
return
end
-- Restart timer
return true
end,
drop = "",
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(30, 60))
end,
})
minetest.register_node("fire:permanent_flame", {
description = "Permanent Flame",
drawtype = "firelike",
tiles = {
{
name = "fire_basic_flame_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 13,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3},
drop = "",
})
-- Flint and steel
minetest.register_tool("fire:flint_and_steel", {
description = "Flint and Steel",
inventory_image = "fire_flint_steel.png",
--sound = {breaks = "default_tool_breaks"},
on_use = function(itemstack, user, pointed_thing)
local sound_pos = pointed_thing.above or user:get_pos()
minetest.sound_play(
"fire_flint_and_steel",
{pos = sound_pos, gain = 0.5, max_hear_distance = 8}
)
local player_name = user:get_player_name()
if pointed_thing.type == "node" then
local node_under = minetest.get_node(pointed_thing.under).name
local nodedef = minetest.registered_nodes[node_under]
if not nodedef then
return
end
if minetest.is_protected(pointed_thing.under, player_name) then
minetest.chat_send_player(player_name, "This area is protected")
return
end
if nodedef.on_ignite then
nodedef.on_ignite(pointed_thing.under, user)
elseif minetest.get_item_group(node_under, "flammable") >= 1
and minetest.get_node(pointed_thing.above).name == "air" then
minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"})
end
end
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
-- Wear tool
local wdef = itemstack:get_definition()
itemstack:add_wear(1000)
-- Tool break sound
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5})
end
return itemstack
end
end
})
--minetest.register_craft({
--output = "fire:flint_and_steel",
--recipe = {
--{"default:flint", "default:steel_ingot"}
--}
--})
-- Override coalblock to enable permanent flame above
-- Coalblock is non-flammable to avoid unwanted basic_flame nodes
--
-- Sound
--
local flame_sound = minetest.settings:get_bool("flame_sound")
if flame_sound == nil then
-- Enable if no setting present
flame_sound = true
end
if flame_sound then
local handles = {}
local timer = 0
-- Parameters
local radius = 8 -- Flame node search radius around player
local cycle = 3 -- Cycle time for sound updates
-- Update sound for player
function fire.update_player_sound(player)
local player_name = player:get_player_name()
-- Search for flame nodes in radius around player
local ppos = player:getpos()
local areamin = vector.subtract(ppos, radius)
local areamax = vector.add(ppos, radius)
local fpos, num = minetest.find_nodes_in_area(
areamin,
areamax,
{"fire:basic_flame", "fire:permanent_flame"}
)
-- Total number of flames in radius
local flames = (num["fire:basic_flame"] or 0) +
(num["fire:permanent_flame"] or 0)
-- Stop previous sound
if handles[player_name] then
minetest.sound_stop(handles[player_name])
handles[player_name] = nil
end
-- If flames
if flames > 0 then
-- Find centre of flame positions
local fposmid = fpos[1]
-- If more than 1 flame
if #fpos > 1 then
local fposmin = areamax
local fposmax = areamin
for i = 1, #fpos do
local fposi = fpos[i]
if fposi.x > fposmax.x then
fposmax.x = fposi.x
end
if fposi.y > fposmax.y then
fposmax.y = fposi.y
end
if fposi.z > fposmax.z then
fposmax.z = fposi.z
end
if fposi.x < fposmin.x then
fposmin.x = fposi.x
end
if fposi.y < fposmin.y then
fposmin.y = fposi.y
end
if fposi.z < fposmin.z then
fposmin.z = fposi.z
end
end
fposmid = vector.divide(vector.add(fposmin, fposmax), 2)
end
-- Play sound
local handle = minetest.sound_play(
"fire_fire",
{
pos = fposmid,
to_player = player_name,
gain = math.min(0.06 * (1 + flames * 0.125), 0.18),
max_hear_distance = 32,
loop = true, -- In case of lag
}
)
-- Store sound handle for this player
if handle then
handles[player_name] = handle
end
end
end
-- Cycle for updating players sounds
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer < cycle then
return
end
timer = 0
local players = minetest.get_connected_players()
for n = 1, #players do
fire.update_player_sound(players[n])
end
end)
-- Stop sound and clear handle on player leave
minetest.register_on_leaveplayer(function(player)
local player_name = player:get_player_name()
if handles[player_name] then
minetest.sound_stop(handles[player_name])
handles[player_name] = nil
end
end)
end
-- Deprecated function kept temporarily to avoid crashes if mod fire nodes call it
function fire.update_sounds_around(pos)
end
--
-- ABMs
--
-- Extinguish all flames quickly with water, snow, ice
minetest.register_abm({
label = "Extinguish flame",
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
neighbors = {"group:puts_out_fire"},
interval = 3,
chance = 1,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame",
{pos = pos, max_hear_distance = 16, gain = 0.15})
end,
})
-- Enable the following ABMs according to 'enable fire' setting
local fire_enabled = minetest.settings:get_bool("enable_fire")
if fire_enabled == nil then
-- enable_fire setting not specified, check for disable_fire
local fire_disabled = minetest.settings:get_bool("disable_fire")
if fire_disabled == nil then
-- Neither setting specified, check whether singleplayer
fire_enabled = minetest.is_singleplayer()
else
fire_enabled = not fire_disabled
end
end
if not fire_enabled then
-- Remove basic flames only if fire disabled
minetest.register_abm({
label = "Remove disabled fire",
nodenames = {"fire:basic_flame"},
interval = 7,
chance = 1,
catch_up = false,
action = minetest.remove_node,
})
else -- Fire enabled
-- Ignite neighboring nodes, add basic flames
minetest.register_abm({
label = "Ignite flame",
nodenames = {"group:flammable"},
neighbors = {"group:igniter"},
interval = 7,
chance = 12,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
-- If there is water or stuff like that around node, don't ignite
if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then
return
end
local p = minetest.find_node_near(pos, 1, {"air"})
if p then
minetest.set_node(p, {name = "fire:basic_flame"})
end
end,
})
-- Remove flammable nodes around basic flame
minetest.register_abm({
label = "Remove flammable nodes",
nodenames = {"fire:basic_flame"},
neighbors = "group:flammable",
interval = 5,
chance = 18,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
local p = minetest.find_node_near(pos, 1, {"group:flammable"})
if p then
local flammable_node = minetest.get_node(p)
local def = minetest.registered_nodes[flammable_node.name]
if def.on_burn then
def.on_burn(p)
else
minetest.remove_node(p)
minetest.check_for_falling(p)
end
end
end,
})
end

84
mods/fire/license.txt Normal file
View File

@ -0,0 +1,84 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2012-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2012-2016 Various Minetest developers and contributors
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
Licenses of media (textures and sounds)
---------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
Copyright (C) 2012-2016 Muadtralk
Copyright (C) 2013-2016 Gambit
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/
-----------------------
Attribution 3.0 Unported (CC BY 3.0)
Copyright (C) 2005 dobroide
Copyright (C) 2006 Dynamicell
Copyright (C) 2009 Benboncan
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by/3.0/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

View File

@ -52,7 +52,8 @@ if dump(minetest.hud_replace_builtin) ~= "nil" then
end
HUD_TICK = 0.25
HUD_HUNGER_TICK = 300
HUD_HUNGER_TICK = 180
HUD_HEAL_TICK = 8
HUD_ENABLE_HUNGER = minetest.setting_getbool("hud_hunger_enable")
if HUD_ENABLE_HUNGER == nil then
@ -264,30 +265,46 @@ function hud.update_cycle()
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
-- only proceed if damage is enabled
if minetest.setting_getbool("enable_damage") then
local h = tonumber(hud.hunger[name])
local hp = player:get_hp()
if HUD_ENABLE_HUNGER then
-- heal player by 1 hp if not dead and saturation is > 15 (of 30)
if h > 15 and hp > 0 and hud.air[name] > 0 then
player:set_hp(hp+1)
-- or damage player by 1 hp if saturation is < 2 (of 30)
elseif h <= 1 and minetest.setting_getbool("enable_damage") then
if hp-1 >= 0 then player:set_hp(hp-1) end
end
end
-- update all hud elements
update_hud(player)
end
end
minetest.after(HUD_TICK, hud.update_cycle)
end
function hud.healing()
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local h = tonumber(hud.hunger[name])
local hp = player:get_hp()
-- heal player by 1 hp if not dead and saturation is > 15 (of 30)
if h > 15 and hp > 0 and hud.air[name] > 0 then
player:set_hp(hp+1)
update_hud(player)
-- or damage player by 1 hp if saturation is < 2 (of 30)
elseif h <= 1 and minetest.setting_getbool("enable_damage") then
if hp-1 >= 0 then
player:set_hp(hp-1)
update_hud(player)
end
end
end
minetest.after(HUD_HEAL_TICK, hud.healing)
end
function hud.change_hunger()
for _,player in ipairs(minetest.get_connected_players()) do
@ -295,19 +312,21 @@ function hud.change_hunger()
local h = tonumber(hud.hunger[name])
local hp = player:get_hp()
-- lower saturation by 1 point after xx seconds
if HUD_ENABLE_HUNGER then
if h > 0 then
h = h-1
hud.hunger[name] = h
hud.set_hunger(player)
update_hud(player)
end
update_hud(player)
end
end
minetest.after(HUD_HUNGER_TICK, hud.change_hunger)
end
minetest.after(1, hud.update_cycle)
minetest.after(2, hud.change_hunger)
minetest.after(0.1, hud.update_cycle)
minetest.after(HUD_HUNGER_TICK, hud.change_hunger)
minetest.after(HUD_HEAL_TICK, hud.healing)

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -118,7 +118,14 @@ minetest.register_on_joinplayer(function(player)
end)
function hudclock.display_bg(player)
player:hud_add({
hud_elem_type = "image",
position = {x=0.5, y=0.5},
scale = {x=-100, y=-100},
text = "hud_vignette.png"
})
player:hud_add({
hud_elem_type = "image",
position = {x=positionx, y=positiony},

View File

@ -106,6 +106,7 @@ function intro.teleport_on_sneak(player)
end
function intro.hud_bg(player)
player:hud_add({
hud_elem_type = "image",
position = {x=0.5, y=1},
@ -114,6 +115,7 @@ function intro.hud_bg(player)
text = "hud_stat_bg.png",
})
player:hud_add({
hud_elem_type = "image",
position = {x=0.5, y=1},
@ -210,7 +212,7 @@ minetest.register_on_joinplayer(function(player)
if player:get_attribute("intro_completed") == "true" then
minetest.after(1, function()
minetest.after(0.1, function()
intro.reset_hud(player)
end)
return

View File

@ -170,7 +170,7 @@ lightning.strike = function(pos)
end
-- very rarely, potentially cause a fire
if fire and rng:next(1,1000) == 1 then
--minetest.set_node(pos2, {name = "fire:basic_flame"})
minetest.set_node(pos2, {name = "fire:basic_flame"})
else
minetest.set_node(pos2, {name = "lightning:dying_flame"})
end