freeminer update.
got rid of trail, worldtime. wonder what latter is gonna cause. included new groups introduced in freeminer.master
Before Width: | Height: | Size: 9.8 MiB |
After Width: | Height: | Size: 629 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 212 B |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 622 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 723 B |
|
@ -1,14 +0,0 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,155 +0,0 @@
|
|||
minetest.register_node("concrete:concrete_source", {
|
||||
description = "Concrete Source",
|
||||
inventory_image = minetest.inventorycube("concrete_wet.png"),
|
||||
tiles = {
|
||||
{name="concrete_flowing.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
{name="concrete_wet.png", backface_culling=false},
|
||||
},
|
||||
drawtype = "liquid",
|
||||
alpha = 250,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "concrete:concrete_flowing",
|
||||
liquid_alternative_source = "concrete:concrete_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = true,
|
||||
post_effect_color = {a=250, r=50, g=50, b=50},
|
||||
groups = {liquid=3, puts_out_fire=1},
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("concrete:concrete_flowing", {
|
||||
description = "Flowing Concrete",
|
||||
inventory_image = minetest.inventorycube("concrete_wet.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"concrete_wet.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="concrete_flowing.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
},
|
||||
{
|
||||
image="concrete_flowing.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
},
|
||||
},
|
||||
alpha = 250,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "concrete:concrete_flowing",
|
||||
liquid_alternative_source = "concrete:concrete_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = true,
|
||||
post_effect_color = {a=250, r=50, g=50, b=50},
|
||||
groups = {liquid=3, puts_out_fire=1},
|
||||
})
|
||||
|
||||
minetest.register_node("concrete:concrete_drying", {
|
||||
description = "Drying Concrete",
|
||||
tiles = {"concrete_wet.png"},
|
||||
is_ground_content = true,
|
||||
groups = {snappy=7,choppy=7,oddly_breakable_by_hand=7,cracky=7},
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"concrete:concrete_flowing", "concrete:concrete_source"},
|
||||
interval = 300,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:set_node(pos, {name = "concrete:concrete_drying"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"concrete:concrete_flowing", "concrete:concrete_source"},
|
||||
neighbors = {"concrete:concrete_drying"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:set_node(pos, {name = "concrete:concrete_drying"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"concrete:concrete_drying"},
|
||||
interval = 300,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if minetest.env:find_node_near(pos, 4, "default:steelblock") then
|
||||
minetest.env:set_node(pos, {name = "concrete:reinforced_concrete"})
|
||||
else
|
||||
minetest.env:set_node(pos, {name = "concrete:concrete"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("concrete:concrete", {
|
||||
description = "Concrete",
|
||||
tiles = {"concrete_concrete.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=2},
|
||||
})
|
||||
|
||||
minetest.register_node("concrete:reinforced_concrete", {
|
||||
description = "Reinforced Concerte",
|
||||
tiles = {"concrete_concrete.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1},
|
||||
})
|
||||
|
||||
minetest.register_node("concrete:lime", {
|
||||
description = "Lime",
|
||||
tiles = {"concrete_lime.png"},
|
||||
groups = {snappy=7,choppy=7,oddly_breakable_by_hand=7,cracky=7},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("concrete:cement", {
|
||||
description = "Cement",
|
||||
inventory_image = "concrete_cement.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "concrete:concrete_source",
|
||||
recipe = {"concrete:cement", "bucket:bucket_water", "default:gravel"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'default:gravel 2',
|
||||
recipe = {
|
||||
"default:desert_sand",
|
||||
"default:cobble",
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "concrete:lime",
|
||||
recipe = "default:desert_stone",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "concrete:cement",
|
||||
recipe = "concrete:lime",
|
||||
})
|
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 8.3 KiB |
|
@ -0,0 +1,225 @@
|
|||
|
||||
minetest.register_biome({
|
||||
name = "Ocean",
|
||||
|
||||
node_top = "default:sand",
|
||||
depth_top = 3,
|
||||
node_filler = "default:stone",
|
||||
depth_filler = 0,
|
||||
|
||||
height_min = -31000,
|
||||
height_max = 0,
|
||||
heat_point = 40.0,
|
||||
humidity_point = 40.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Gravel Ocean",
|
||||
|
||||
node_top = "default:gravel",
|
||||
depth_top = 3,
|
||||
node_filler = "default:stone",
|
||||
depth_filler = 0,
|
||||
|
||||
node_dust_water = "default:ice",
|
||||
|
||||
height_min = -31000,
|
||||
height_max = 0,
|
||||
heat_point = -10.0,
|
||||
humidity_point = 60.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Beach",
|
||||
|
||||
node_top = "default:sand",
|
||||
depth_top = 3,
|
||||
node_filler = "default:sandstone",
|
||||
depth_filler = 3,
|
||||
|
||||
height_min = 1,
|
||||
height_max = 3,
|
||||
heat_point = 50.0,
|
||||
humidity_point = 10.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Gravel Beach",
|
||||
|
||||
node_top = "default:gravel",
|
||||
depth_top = 2,
|
||||
node_filler = "default:stone",
|
||||
depth_filler = 0,
|
||||
|
||||
node_dust = "default:snow",
|
||||
node_dust_water = "default:ice",
|
||||
|
||||
height_min = 1,
|
||||
height_max = 3,
|
||||
heat_point = -10.0,
|
||||
humidity_point = 60.0
|
||||
})
|
||||
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Snow Plains",
|
||||
|
||||
node_dust = "default:snow",
|
||||
node_dust_water = "default:ice",
|
||||
|
||||
height_min = 1,
|
||||
height_max = 20,
|
||||
heat_point = -10.0,
|
||||
humidity_point = 50.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Plains",
|
||||
|
||||
height_min = 1,
|
||||
height_max = 20,
|
||||
heat_point = 40.0,
|
||||
humidity_point = 50.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Hills",
|
||||
|
||||
height_min = 21,
|
||||
height_max = 40,
|
||||
heat_point = 40.0,
|
||||
humidity_point = 50.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Snow Hills",
|
||||
|
||||
node_dust = "default:snow",
|
||||
node_dust_water = "default:ice",
|
||||
|
||||
height_min = 21,
|
||||
height_max = 300,
|
||||
heat_point = -10.0,
|
||||
humidity_point = 50.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Extreme Hills",
|
||||
|
||||
height_min = 41,
|
||||
height_max = 300,
|
||||
heat_point = 40.0,
|
||||
humidity_point = 50.0
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Desert",
|
||||
|
||||
node_top = "default:desert_sand",
|
||||
depth_top = 3,
|
||||
node_filler = "default:desert_stone",
|
||||
depth_filler = 10,
|
||||
|
||||
height_min = 3,
|
||||
height_max = 15,
|
||||
heat_point = 90.0,
|
||||
humidity_point = 0.0
|
||||
})
|
||||
|
||||
|
||||
--trees
|
||||
--[[ TODO
|
||||
minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = "default:dirt_with_grass",
|
||||
sidelen = 8,
|
||||
schematic = "treewprob.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
noise_params = {
|
||||
offset = 1/120,
|
||||
scale = 0.04,
|
||||
spread = {x=125, y=125, z=125},
|
||||
seed = 2,
|
||||
octaves = 4,
|
||||
persist = 0.66
|
||||
}
|
||||
})
|
||||
]]
|
||||
|
||||
--papyrus
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_grass",
|
||||
sidelen = 8,
|
||||
decoration = "default:papyrus",
|
||||
height = 2,
|
||||
height_max = 4,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 0.3,
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 354,
|
||||
octaves = 3,
|
||||
persist = 0.7
|
||||
},
|
||||
spawn_by = "default:water_source",
|
||||
num_spawn_by = 1
|
||||
})
|
||||
|
||||
--cactuses
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:desert_sand",
|
||||
sidelen = 4,
|
||||
decoration = "default:cactus",
|
||||
height = 3,
|
||||
height_max = 4,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 1 / 25,
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 230,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
}
|
||||
})
|
||||
|
||||
--grass
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_grass",
|
||||
sidelen = 4,
|
||||
decoration = {
|
||||
"default:grass_1",
|
||||
"default:grass_2",
|
||||
"default:grass_3",
|
||||
"default:grass_4",
|
||||
"default:grass_5"
|
||||
},
|
||||
height = 1,
|
||||
noise_params = {
|
||||
offset = 1 / 4,
|
||||
scale = 1 / 6, -- originally ^3 as well...
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 329,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
}
|
||||
})
|
||||
|
||||
--desert shrubs
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:desert_sand",
|
||||
sidelen = 4,
|
||||
decoration = "default:dry_shrub",
|
||||
height = 1,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 1 / 12, -- originally ^3 as well...
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 329,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
}
|
||||
})
|
|
@ -19,6 +19,8 @@ function default.node_sound_stone_defaults(table)
|
|||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_hard_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_hard_footstep", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -28,7 +30,7 @@ function default.node_sound_dirt_defaults(table)
|
|||
table.footstep = table.footstep or
|
||||
{name="default_dirt_footstep", gain=1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dug_node_soil", gain=1.5}
|
||||
{name="default_dirt_footstep", gain=1.5}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
|
@ -40,7 +42,7 @@ function default.node_sound_sand_defaults(table)
|
|||
table.footstep = table.footstep or
|
||||
{name="default_sand_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_dug_node_sand", gain=1.0}
|
||||
{name="default_sand_footstep", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
|
@ -51,6 +53,8 @@ function default.node_sound_wood_defaults(table)
|
|||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_wood_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_wood_footstep", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -59,10 +63,10 @@ function default.node_sound_leaves_defaults(table)
|
|||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_grass_footstep", gain=0.35}
|
||||
table.dug = table.dug or
|
||||
{name="default_grass_footstep", gain=0.85}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
table.dug = table.dug or
|
||||
{name="default_grass_footstep", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
|
@ -122,16 +126,71 @@ function on_punchnode(p, node)
|
|||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
|
||||
--
|
||||
-- Grow trees
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:sapling"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if weather and minetest.get_heat(pos) < 5 then return end
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
local data = vm:get_data()
|
||||
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(data)
|
||||
vm:update_map()
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if weather and minetest.get_heat(pos) < 15 then return end
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
local data = vm:get_data()
|
||||
default.grow_jungletree(data, a, pos, math.random(1,100000))
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(data)
|
||||
vm:update_map()
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
default.cool_lava_source = function(pos)
|
||||
minetest.set_node(pos, {name="default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end
|
||||
|
||||
default.cool_lava_flowing = function(pos)
|
||||
minetest.set_node(pos, {name="default:stone"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -307,3 +366,4 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ dofile(minetest.get_modpath("default").."/tools.lua")
|
|||
dofile(minetest.get_modpath("default").."/craftitems.lua")
|
||||
dofile(minetest.get_modpath("default").."/crafting.lua")
|
||||
dofile(minetest.get_modpath("default").."/snow.lua")
|
||||
dofile(minetest.get_modpath("default").."/trees.lua")
|
||||
dofile(minetest.get_modpath("default").."/biomes.lua")
|
||||
|
||||
--
|
||||
-- Tool definition
|
||||
--
|
||||
|
|
|
@ -20,12 +20,15 @@ minetest.register_alias("mapgen_lava_source", "default:lava_source")
|
|||
minetest.register_alias("mapgen_cobble", "default:cobble")
|
||||
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
|
||||
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
|
||||
minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow")
|
||||
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
|
||||
minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
|
||||
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||
minetest.register_alias("mapgen_mese", "default:mese")
|
||||
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
|
||||
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
|
||||
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
||||
minetest.register_alias("mapgen_ice", "default:ice")
|
||||
|
||||
--
|
||||
-- Ore generation
|
||||
|
@ -51,6 +54,7 @@ minetest.register_ore({
|
|||
clust_size = 6,
|
||||
height_min = -31000,
|
||||
height_max = 0,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -84,6 +88,7 @@ minetest.register_ore({
|
|||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -95,6 +100,7 @@ minetest.register_ore({
|
|||
clust_size = 6,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -106,6 +112,7 @@ minetest.register_ore({
|
|||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -117,6 +124,7 @@ minetest.register_ore({
|
|||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -128,6 +136,7 @@ minetest.register_ore({
|
|||
clust_size = 2,
|
||||
height_min = -31000,
|
||||
height_max = -1024,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -139,6 +148,7 @@ minetest.register_ore({
|
|||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -172,8 +182,9 @@ minetest.register_ore({
|
|||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
if minetest.setting_get("mg_name") == "indev" then
|
||||
--if minetest.setting_get("mg_name") == "indev" then
|
||||
-- Floatlands and high mountains springs
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
|
@ -234,7 +245,17 @@ if minetest.setting_get("mg_name") == "indev" then
|
|||
height_min = -31000,
|
||||
height_max = -100,
|
||||
})
|
||||
end
|
||||
--end
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:clay",
|
||||
wherein = "default:sand",
|
||||
clust_scarcity = 15*15*15,
|
||||
clust_num_ores = 64,
|
||||
clust_size = 5,
|
||||
height_max = 0,
|
||||
height_min = -10,
|
||||
})
|
||||
function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
||||
minetest.log('action', "WARNING: default.generate_ore is deprecated")
|
||||
|
||||
|
@ -315,7 +336,7 @@ function default.make_nyancat(pos, facedir, length)
|
|||
elseif facedir == 3 then
|
||||
tailvec.x = -1
|
||||
else
|
||||
print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
|
||||
--print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
|
||||
facedir = 0
|
||||
tailvec.z = 1
|
||||
end
|
||||
|
@ -324,7 +345,7 @@ function default.make_nyancat(pos, facedir, length)
|
|||
for i=1,length do
|
||||
p.x = p.x + tailvec.x
|
||||
p.z = p.z + tailvec.z
|
||||
minetest.set_node(p, {name="default:nyancat_rainbow"})
|
||||
minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -352,41 +373,6 @@ end
|
|||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate clay
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 4
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0+1,divs-1-1 do
|
||||
for divz=0+1,divs-1-1 do
|
||||
local cx = minp.x + math.floor((divx+0.5)*divlen)
|
||||
local cz = minp.z + math.floor((divz+0.5)*divlen)
|
||||
if minetest.get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
|
||||
minetest.get_node({x=cx,y=0,z=cz}).name == "default:sand" then
|
||||
local is_shallow = true
|
||||
local num_water_around = 0
|
||||
if minetest.get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if num_water_around >= 2 then
|
||||
is_shallow = false
|
||||
end
|
||||
if is_shallow then
|
||||
for x1=-divlen,divlen do
|
||||
for z1=-divlen,divlen do
|
||||
if minetest.get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
|
||||
minetest.set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate papyrus
|
||||
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
-- mods/default/nodes.lua
|
||||
|
||||
local weather = minetest.setting_getbool("weather")
|
||||
minetest.register_node("default:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=6, stone=1},
|
||||
groups = {cracky=6, stone=1, melt=3000},
|
||||
freezemelt = "default:lava_source",
|
||||
drop = 'default:cobble',
|
||||
legacy_mineral = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
|
@ -12,7 +16,8 @@ minetest.register_node("default:desert_stone", {
|
|||
description = "Desert Stone",
|
||||
tiles = {"default_desert_stone.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=6, stone=1},
|
||||
groups = {cracky=6, stone=1, melt=3000},
|
||||
freezemelt = "default:lava_source",
|
||||
drop = 'default:desert_stone',
|
||||
legacy_mineral = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
|
@ -87,15 +92,80 @@ minetest.register_node("default:dirt", {
|
|||
description = "Dirt",
|
||||
tiles = {"default_dirt.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=6, soil=1},
|
||||
groups = {crumbly=6, soil=1, melt=800, liquid_flow=1},
|
||||
leveled = 1,
|
||||
liquidtype = "flowing",
|
||||
paramtype2 = "leveled",
|
||||
freezemelt = "default:sand",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt"},
|
||||
interval = 2,
|
||||
chance = 200,
|
||||
action = function(pos, node)
|
||||
local above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if (name == "ignore" or not nodedef) then return end
|
||||
if ( not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") and nodedef.liquidtype == "none")) then return end
|
||||
if (weather and minetest.get_heat(pos) < -10) or name == "default:snow" or
|
||||
name == "default:snowblock" or name == "default:ice"
|
||||
then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
elseif (not weather or minetest.get_heat(pos) > 5) and nodedef and
|
||||
(minetest.get_node_light(above) or 0) >= 13
|
||||
then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_grass"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
local above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if (name == "ignore" or not nodedef) then return end
|
||||
if ( not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none")) or (weather
|
||||
and (minetest.get_heat(pos) < -5 or minetest.get_heat(pos) > 50))
|
||||
or name == "default:snow" or name == "default:snowblock" or name == "default:ice"
|
||||
then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_snow"},
|
||||
interval = 2,
|
||||
chance = 200,
|
||||
action = function(pos, node)
|
||||
local above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if (name == "ignore" or not nodedef) then return end
|
||||
if (not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none") or
|
||||
(weather and minetest.get_heat(pos) > 3 and name ~= "default:snow" and name ~= "default:snowblock" and name ~= "default:ice"))
|
||||
then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_node("default:sand", {
|
||||
description = "Sand",
|
||||
tiles = {"default_sand.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=6, falling_node=1, sand=1},
|
||||
leveled = 1,
|
||||
liquidtype = "flowing",
|
||||
paramtype2 = "leveled",
|
||||
groups = {crumbly=6, falling_node=1, sand=1, liquid_flow=1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
|
@ -103,7 +173,10 @@ minetest.register_node("default:desert_sand", {
|
|||
description = "Desert Sand",
|
||||
tiles = {"default_desert_sand.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=6, falling_node=1, sand=1},
|
||||
leveled = 1,
|
||||
liquidtype = "flowing",
|
||||
paramtype2 = "leveled",
|
||||
groups = {crumbly=6, falling_node=1, sand=1, liquid_flow=1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
|
@ -111,7 +184,10 @@ minetest.register_node("default:gravel", {
|
|||
description = "Gravel",
|
||||
tiles = {"default_gravel.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=5, falling_node=1},
|
||||
groups = {crumbly=5, falling_node=1, liquid_flow=1},
|
||||
leveled = 1,
|
||||
liquidtype = "flowing",
|
||||
paramtype2 = "leveled",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.45},
|
||||
}),
|
||||
|
@ -131,9 +207,8 @@ minetest.register_node("default:clay", {
|
|||
is_ground_content = true,
|
||||
groups = {crumbly=5},
|
||||
drop = 'default:clay_lump 4',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = "",
|
||||
}),
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("default:brick", {
|
||||
|
@ -146,15 +221,19 @@ minetest.register_node("default:brick", {
|
|||
minetest.register_node("default:tree", {
|
||||
description = "Tree",
|
||||
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {tree=1,choppy=5,oddly_breakable_by_hand=4,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("default:jungletree", {
|
||||
description = "Birch Tree",
|
||||
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {tree=1,choppy=5,oddly_breakable_by_hand=4,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("default:junglewood", {
|
||||
|
@ -220,7 +299,7 @@ minetest.register_node("default:junglegrass", {
|
|||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
groups = {snappy=7,flammable=2,attached_node=1},
|
||||
groups = {snappy=7,flammable=2,attached_node=1,flora=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
|
@ -263,6 +342,7 @@ minetest.register_node("default:leaves", {
|
|||
minetest.register_node("default:cactus", {
|
||||
description = "Cactus",
|
||||
tiles = {"dplus_cactus_top.png", "dplus_cactus_top.png", "dplus_cactus_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {choppy=5,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
@ -279,6 +359,7 @@ minetest.register_node("default:cactus", {
|
|||
fixed = {-7/16, -0.5, -7/16, 7/16, 0.5, 7/16},
|
||||
|
||||
},
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("default:papyrus", {
|
||||
|
@ -338,7 +419,8 @@ minetest.register_node("default:glass", {
|
|||
inventory_image = minetest.inventorycube("default_glass.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {oddly_breakable_by_hand=7},
|
||||
groups = {oddly_breakable_by_hand=7, melt=1500},
|
||||
freezemelt = "default:sandstone",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
@ -437,17 +519,20 @@ minetest.register_node("default:water_flowing", {
|
|||
},
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "default:water_flowing",
|
||||
liquid_alternative_source = "default:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
freezemelt = "default:snow",
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freeze=-5},
|
||||
})
|
||||
|
||||
minetest.register_node("default:water_source", {
|
||||
|
@ -472,12 +557,14 @@ minetest.register_node("default:water_source", {
|
|||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "default:water_flowing",
|
||||
liquid_alternative_source = "default:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
freezemelt = "default:ice",
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, freeze=-1},
|
||||
})
|
||||
|
||||
|
||||
|
@ -499,12 +586,15 @@ minetest.register_node("default:lava_flowing", {
|
|||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "leveled",
|
||||
leveled = 4,
|
||||
light_source = LIGHT_MAX - 1,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "default:lava_flowing",
|
||||
liquid_alternative_source = "default:lava_source",
|
||||
|
@ -512,7 +602,7 @@ minetest.register_node("default:lava_flowing", {
|
|||
liquid_renewable = false,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
|
||||
groups = {lava=3, liquid=2, hot=700, igniter=1, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("default:lava_source", {
|
||||
|
@ -537,14 +627,16 @@ minetest.register_node("default:lava_source", {
|
|||
diggable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "default:lava_flowing",
|
||||
liquid_alternative_source = "default:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
leveled = 4,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
groups = {lava=3, liquid=2, hot=3, igniter=1},
|
||||
groups = {lava=3, liquid=2, hot=1200, igniter=1},
|
||||
})
|
||||
|
||||
minetest.register_node("default:sign_wall", {
|
||||
|
@ -576,13 +668,27 @@ minetest.register_node("default:sign_wall", {
|
|||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or ""
|
||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos))
|
||||
meta:set_string("text", fields.text)
|
||||
meta:set_string("infotext", '"'..fields.text..'"')
|
||||
end,
|
||||
})
|
||||
|
||||
default.chest_formspec =
|
||||
"size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
function default.get_locked_chest_formspec(pos)
|
||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
minetest.register_node("default:chest", {
|
||||
description = "Chest",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
|
@ -593,10 +699,7 @@ minetest.register_node("default:chest", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]")
|
||||
meta:set_string("formspec",default.chest_formspec)
|
||||
meta:set_string("infotext", "Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
|
@ -660,7 +763,7 @@ minetest.register_node("default:chest_locked", {
|
|||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -710,15 +813,29 @@ minetest.register_node("default:chest_locked", {
|
|||
on_rightclick = function(pos, node, clicker)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if has_locked_chest_privilege(meta, clicker) then
|
||||
local pos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||
minetest.show_formspec(clicker:get_player_name(), "default:chest_locked",
|
||||
"size[8,9]"..
|
||||
"list[nodemeta:".. pos .. ";main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]")
|
||||
|
||||
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
default.get_locked_chest_formspec(pos)
|
||||
)
|
||||
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function default.get_furnace_active_formspec(pos, percent)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
default.furnace_inactive_formspec =
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png]"..
|
||||
|
@ -802,7 +919,7 @@ minetest.register_node("default:furnace_active", {
|
|||
paramtype2 = "facedir",
|
||||
light_source = 8,
|
||||
drop = "default:furnace",
|
||||
groups = {cracky=6, not_in_creative_inventory=1},
|
||||
groups = {cracky=6, not_in_creative_inventory=1, hot=60},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -895,7 +1012,19 @@ minetest.register_abm({
|
|||
meta:set_float(name, 0.0)
|
||||
end
|
||||
end
|
||||
local gt = minetest.get_gametime()
|
||||
if meta:get_string("game_time") == "" then
|
||||
meta:set_int("game_time", gt-1)
|
||||
end
|
||||
for i = 1, math.min(1200, gt-meta:get_int("game_time")) do
|
||||
default.furnace_step(pos, node, meta)
|
||||
end
|
||||
hacky_swap_node(pos, node.name)
|
||||
meta:set_int("game_time", gt)
|
||||
end,
|
||||
})
|
||||
|
||||
function default.furnace_step(pos, node, meta)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local srclist = inv:get_list("src")
|
||||
|
@ -930,15 +1059,9 @@ minetest.register_abm({
|
|||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Furnace active: "..percent.."%")
|
||||
hacky_swap_node(pos,"default:furnace_active")
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]")
|
||||
node.name = "default:furnace_active"
|
||||
meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -975,14 +1098,14 @@ minetest.register_abm({
|
|||
meta:set_string("fuel_time", 0)
|
||||
|
||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("default:cobble", {
|
||||
description = "Cobblestone",
|
||||
tiles = {"default_cobble.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=6, stone=2},
|
||||
freezemelt = "default:lava_source",
|
||||
groups = {cracky=6, stone=2, melt=2900},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
@ -1133,7 +1256,9 @@ minetest.register_node("default:nyancat", {
|
|||
|
||||
minetest.register_node("default:nyancat_rainbow", {
|
||||
description = "Nyan Cat Rainbow",
|
||||
tiles = {"default_nc_rb.png"},
|
||||
tiles = {"default_nc_rb.png^[transformR90", "default_nc_rb.png^[transformR90",
|
||||
"default_nc_rb.png", "default_nc_rb.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
@ -1152,7 +1277,7 @@ minetest.register_node("default:sapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=7,dig_immediate=3,flammable=2,attached_node=1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:apple", {
|
||||
|
@ -1168,9 +1293,14 @@ minetest.register_node("default:apple", {
|
|||
type = "fixed",
|
||||
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||
},
|
||||
groups = {oddly_breakable_by_hand=7,fleshy=3,dig_immediate=3,flammable=2,attached_node=1},
|
||||
on_use = minetest.item_eat(4),
|
||||
sounds = default.node_sound_defaults(),
|
||||
groups = {oddly_breakable_by_hand=7,fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
||||
on_use = minetest.item_eat(2),
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
if placer:is_player() then
|
||||
minetest.set_node(pos, {name="default:apple", param2=1})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:dry_shrub", {
|
||||
|
|
|
@ -1,132 +1,190 @@
|
|||
-- Minetest 0.4 mod: player
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
--
|
||||
-- Start of configuration area:
|
||||
--
|
||||
--[[
|
||||
|
||||
-- Player animation speed
|
||||
animation_speed = 30
|
||||
API
|
||||
---
|
||||
|
||||
default.player_register_model(name, def)
|
||||
^ Register a new model to be used by players.
|
||||
^ <name> is the model filename such as "character.x", "foo.b3d", etc.
|
||||
^ See Model Definition below for format of <def>.
|
||||
|
||||
default.registered_player_models[name]
|
||||
^ See Model Definition below for format.
|
||||
|
||||
default.player_set_model(player, model_name)
|
||||
^ <player> is a PlayerRef.
|
||||
^ <model_name> is a model registered with player_register_model.
|
||||
|
||||
default.player_set_animation(player, anim_name [, speed])
|
||||
^ <player> is a PlayerRef.
|
||||
^ <anim_name> is the name of the animation.
|
||||
^ <speed> is in frames per second. If nil, default from the model is used
|
||||
|
||||
default.player_set_textures(player, textures)
|
||||
^ <player> is a PlayerRef.
|
||||
^ <textures> is an array of textures
|
||||
^ If <textures> is nil, the default textures from the model def are used
|
||||
|
||||
default.player_get_animation(player)
|
||||
^ <player> is a PlayerRef.
|
||||
^ Returns a table containing fields "model", "textures" and "animation".
|
||||
^ Any of the fields of the returned table may be nil.
|
||||
|
||||
Model Definition
|
||||
----------------
|
||||
|
||||
model_def = {
|
||||
animation_speed = 30, -- Default animation speed, in FPS.
|
||||
textures = {"character.png", }, -- Default array of textures.
|
||||
visual_size = {x=1, y=1,}, -- Used to scale the model.
|
||||
animations = {
|
||||
-- <anim_name> = { x=<start_frame>, y=<end_frame>, },
|
||||
foo = { x= 0, y=19, },
|
||||
bar = { x=20, y=39, },
|
||||
-- ...
|
||||
},
|
||||
}
|
||||
|
||||
]]
|
||||
|
||||
-- Player animation blending
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
animation_blend = 0
|
||||
local animation_blend = 0
|
||||
|
||||
-- Default player appearance
|
||||
default_model = "character.x"
|
||||
default_textures = {"character.png", }
|
||||
default.registered_player_models = { }
|
||||
|
||||
-- Frame ranges for each player model
|
||||
function player_get_animations(model)
|
||||
if model == "character.x" then
|
||||
return {
|
||||
stand_START = 0,
|
||||
stand_END = 79,
|
||||
sit_START = 81,
|
||||
sit_END = 160,
|
||||
lay_START = 162,
|
||||
lay_END = 166,
|
||||
walk_START = 168,
|
||||
walk_END = 187,
|
||||
mine_START = 189,
|
||||
mine_END = 198,
|
||||
walk_mine_START = 200,
|
||||
walk_mine_END = 219
|
||||
}
|
||||
end
|
||||
-- Local for speed.
|
||||
local models = default.registered_player_models
|
||||
|
||||
function default.player_register_model(name, def)
|
||||
models[name] = def
|
||||
end
|
||||
|
||||
--
|
||||
-- End of configuration area.
|
||||
--
|
||||
-- Default player appearance
|
||||
default.player_register_model("character.x", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
-- Standard animations.
|
||||
stand = { x= 0, y= 79, },
|
||||
lay = { x=162, y=166, },
|
||||
walk = { x=168, y=187, },
|
||||
mine = { x=189, y=198, },
|
||||
walk_mine = { x=200, y=219, },
|
||||
-- Extra animations (not currently used by the game).
|
||||
sit = { x= 81, y=160, },
|
||||
},
|
||||
})
|
||||
|
||||
-- Player stats and animations
|
||||
local player_model = {}
|
||||
local player_textures = {}
|
||||
local player_anim = {}
|
||||
local player_sneak = {}
|
||||
local ANIM_STAND = 1
|
||||
local ANIM_SIT = 2
|
||||
local ANIM_LAY = 3
|
||||
local ANIM_WALK = 4
|
||||
local ANIM_WALK_MINE = 5
|
||||
local ANIM_MINE = 6
|
||||
|
||||
function default.player_get_animation(player)
|
||||
local name = player:get_player_name()
|
||||
return {
|
||||
model = player_model[name],
|
||||
textures = player_textures[name],
|
||||
animation = player_anim[name],
|
||||
}
|
||||
end
|
||||
|
||||
-- Called when a player's appearance needs to be updated
|
||||
function player_update_visuals(pl)
|
||||
local name = pl:get_player_name()
|
||||
function default.player_set_model(player, model_name)
|
||||
local name = player:get_player_name()
|
||||
local model = models[model_name]
|
||||
if model then
|
||||
if player_model[name] == model_name then
|
||||
return
|
||||
end
|
||||
player:set_properties({
|
||||
mesh = model_name,
|
||||
textures = player_textures[name] or model.textures,
|
||||
visual = "mesh",
|
||||
visual_size = model.visual_size or {x=1, y=1},
|
||||
})
|
||||
default.player_set_animation(player, "stand")
|
||||
else
|
||||
player:set_properties({
|
||||
textures = { "player.png", "player_back.png", },
|
||||
visual = "upright_sprite",
|
||||
})
|
||||
end
|
||||
player_model[name] = model_name
|
||||
end
|
||||
|
||||
player_model[name] = default_model
|
||||
player_anim[name] = 0 -- Animation will be set further below immediately
|
||||
player_sneak[name] = false
|
||||
prop = {
|
||||
mesh = default_model,
|
||||
textures = default_textures,
|
||||
visual = "mesh",
|
||||
visual_size = {x=1, y=1},
|
||||
}
|
||||
pl:set_properties(prop)
|
||||
function default.player_set_textures(player, textures)
|
||||
local name = player:get_player_name()
|
||||
player_textures[name] = textures
|
||||
player:set_properties({textures = textures,})
|
||||
end
|
||||
|
||||
function default.player_set_animation(player, anim_name, speed)
|
||||
local name = player:get_player_name()
|
||||
if player_anim[name] == anim_name then
|
||||
return
|
||||
end
|
||||
local model = player_model[name] and models[player_model[name]]
|
||||
if not (model and model.animations[anim_name]) then
|
||||
return
|
||||
end
|
||||
local anim = model.animations[anim_name]
|
||||
player_anim[name] = anim_name
|
||||
player:set_animation(anim, speed or model.animation_speed, animation_blend)
|
||||
end
|
||||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(player_update_visuals)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_set_model(player, "character.x")
|
||||
end)
|
||||
|
||||
-- Localize for better performance.
|
||||
local player_set_animation = default.player_set_animation
|
||||
|
||||
-- Check each player and apply animations
|
||||
function player_step(dtime)
|
||||
for _, pl in pairs(minetest.get_connected_players()) do
|
||||
local name = pl:get_player_name()
|
||||
local anim = player_get_animations(player_model[name])
|
||||
local controls = pl:get_player_control()
|
||||
local walking = false
|
||||
local animation_speed_mod = animation_speed
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local model_name = player_model[name]
|
||||
local model = model_name and models[model_name]
|
||||
if model then
|
||||
local controls = player:get_player_control()
|
||||
local walking = false
|
||||
local animation_speed_mod = model.animation_speed or 30
|
||||
|
||||
-- Determine if the player is walking
|
||||
if controls.up or controls.down or controls.left or controls.right then
|
||||
walking = true
|
||||
end
|
||||
-- Determine if the player is walking
|
||||
if controls.up or controls.down or controls.left or controls.right then
|
||||
walking = true
|
||||
end
|
||||
|
||||
-- Determine if the player is sneaking, and reduce animation speed if so
|
||||
if controls.sneak and pl:get_hp() ~= 0 and (walking or controls.LMB) then
|
||||
animation_speed_mod = animation_speed_mod / 2
|
||||
-- Refresh player animation below if sneak state changed
|
||||
if not player_sneak[name] then
|
||||
player_anim[name] = 0
|
||||
player_sneak[name] = true
|
||||
-- Determine if the player is sneaking, and reduce animation speed if so
|
||||
if controls.sneak then
|
||||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
else
|
||||
-- Refresh player animation below if sneak state changed
|
||||
if player_sneak[name] then
|
||||
player_anim[name] = 0
|
||||
player_sneak[name] = false
|
||||
end
|
||||
end
|
||||
|
||||
-- Apply animations based on what the player is doing
|
||||
if pl:get_hp() == 0 then
|
||||
if player_anim[name] ~= ANIM_LAY then
|
||||
pl:set_animation({x=anim.lay_START, y=anim.lay_END}, animation_speed_mod, animation_blend)
|
||||
player_anim[name] = ANIM_LAY
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
player_set_animation(player, "lay")
|
||||
elseif walking then
|
||||
if player_sneak[name] ~= controls.sneak then
|
||||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB then
|
||||
player_set_animation(player, "mine")
|
||||
else
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
end
|
||||
elseif walking and controls.LMB then
|
||||
if player_anim[name] ~= ANIM_WALK_MINE then
|
||||
pl:set_animation({x=anim.walk_mine_START, y=anim.walk_mine_END}, animation_speed_mod, animation_blend)
|
||||
player_anim[name] = ANIM_WALK_MINE
|
||||
end
|
||||
elseif walking then
|
||||
if player_anim[name] ~= ANIM_WALK then
|
||||
pl:set_animation({x=anim.walk_START, y=anim.walk_END}, animation_speed_mod, animation_blend)
|
||||
player_anim[name] = ANIM_WALK
|
||||
end
|
||||
elseif controls.LMB then
|
||||
if player_anim[name] ~= ANIM_MINE then
|
||||
pl:set_animation({x=anim.mine_START, y=anim.mine_END}, animation_speed_mod, animation_blend)
|
||||
player_anim[name] = ANIM_MINE
|
||||
end
|
||||
elseif player_anim[name] ~= ANIM_STAND then
|
||||
pl:set_animation({x=anim.stand_START, y=anim.stand_END}, animation_speed_mod, animation_blend)
|
||||
player_anim[name] = ANIM_STAND
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_globalstep(player_step)
|
||||
|
||||
-- END
|
||||
end)
|
||||
|
|
|
@ -332,30 +332,6 @@ minetest.register_node("default:snow_block", {
|
|||
end,
|
||||
})
|
||||
|
||||
--Snow brick.
|
||||
minetest.register_node("default:snow_brick", {
|
||||
description = "Snow Brick",
|
||||
tiles = {"snow_snow_brick.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=5,melts=2},
|
||||
drop = 'default:snow_brick',
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
--Ice.
|
||||
minetest.register_node("default:ice", {
|
||||
description = "Ice",
|
||||
tiles = {"snow_ice.png"},
|
||||
is_ground_content = true,
|
||||
use_texture_alpha = true,
|
||||
drawtype = "glasslike",
|
||||
groups = {snappy=5,cracky=5,melts=1},
|
||||
drop = 'default:ice',
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
--Moss.
|
||||
minetest.register_node("default:moss", {
|
||||
description = "Moss",
|
||||
|
@ -605,3 +581,32 @@ minetest.register_alias("snow:snowball", "default:snowball")
|
|||
minetest.register_alias("snow:needles", "default:needles")
|
||||
minetest.register_alias("snow:snow_brick", "default:snow_brick")
|
||||
|
||||
minetest.register_node("default:snow_brick", {
|
||||
description = "Snow Brick",
|
||||
tiles = {"snow_snow_brick.png"},
|
||||
is_ground_content = true,
|
||||
freezemelt = "default:water_source",
|
||||
groups = {crumbly=5,melt=2},
|
||||
drop = 'default:snow_brick',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
dug = {name="default_snow_footstep", gain=0.75},
|
||||
}),
|
||||
})
|
||||
|
||||
--Ice.
|
||||
minetest.register_node("default:ice", {
|
||||
description = "Ice",
|
||||
tiles = {"snow_ice.png"},
|
||||
is_ground_content = true,
|
||||
use_texture_alpha = true,
|
||||
drawtype = "glasslike",
|
||||
groups = {snappy=5,cracky=5,melt=3},
|
||||
drop = 'default:ice',
|
||||
paramtype = "light",
|
||||
freezemelt = "default:water_source",
|
||||
groups = {snappy=5,cracky=5,melt=3, slippery=1},
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_leaves = minetest.get_content_id("default:leaves")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
|
||||
function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local pr = PseudoRandom(seed)
|
||||
local th = pr:next(4, 5)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
for yy = y, y+th-1 do
|
||||
local vi = a:index(x, yy, z)
|
||||
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||
data[vi] = c_tree
|
||||
end
|
||||
end
|
||||
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||
local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
|
||||
local leaves_buffer = {}
|
||||
|
||||
-- Force leaves near the trunk
|
||||
local d = 1
|
||||
for xi = -d, d do
|
||||
for yi = -d, d do
|
||||
for zi = -d, d do
|
||||
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add leaves randomly
|
||||
for iii = 1, 8 do
|
||||
local d = 1
|
||||
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||
|
||||
for xi = 0, d do
|
||||
for yi = 0, d do
|
||||
for zi = 0, d do
|
||||
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the leaves
|
||||
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||
if a:contains(x+xi, y+yi, z+zi) then
|
||||
local vi = a:index(x+xi, y+yi, z+zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||
if is_apple_tree and pr:next(1, 100) <= 10 then
|
||||
data[vi] = c_apple
|
||||
else
|
||||
data[vi] = c_leaves
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||
|
||||
function default.grow_jungletree(data, a, pos, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local pr = PseudoRandom(seed)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
for xi = -1, 1 do
|
||||
for zi = -1, 1 do
|
||||
if pr:next(1, 3) >= 2 then
|
||||
local vi1 = a:index(x+xi, y, z+zi)
|
||||
local vi2 = a:index(x+xi, y-1, z+zi)
|
||||
if a:contains(x+xi, y-1, z+zi) and data[vi2] == c_air then
|
||||
data[vi2] = c_jungletree
|
||||
elseif a:contains(x+xi, y, z+zi) and data[vi1] == c_air then
|
||||
data[vi1] = c_jungletree
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local th = pr:next(8, 12)
|
||||
for yy = y, y+th-1 do
|
||||
local vi = a:index(x, yy, z)
|
||||
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||
data[vi] = c_jungletree
|
||||
end
|
||||
end
|
||||
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||
local leaves_a = VoxelArea:new{MinEdge={x=-3, y=-2, z=-3}, MaxEdge={x=3, y=2, z=3}}
|
||||
local leaves_buffer = {}
|
||||
|
||||
-- Force leaves near the trunk
|
||||
local d = 1
|
||||
for xi = -d, d do
|
||||
for yi = -d, d do
|
||||
for zi = -d, d do
|
||||
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add leaves randomly
|
||||
for iii = 1, 30 do
|
||||
local d = 1
|
||||
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||
|
||||
for xi = 0, d do
|
||||
for yi = 0, d do
|
||||
for zi = 0, d do
|
||||
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the leaves
|
||||
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||
if a:contains(x+xi, y+yi, z+zi) then
|
||||
local vi = a:index(x+xi, y+yi, z+zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||
data[vi] = c_jungleleaves
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -158,7 +158,7 @@ minetest.register_node("torch:torch", {
|
|||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, 0.2, 0.1},
|
||||
wall_side = {-0.5, -0.3, -0.1, -0.3, 0.3, 0.1},
|
||||
},
|
||||
groups = {tree=1,snappy=1,choppy=7,oddly_breakable_by_hand=7,attached_node=1},
|
||||
groups = {tree=1,snappy=1,choppy=7,oddly_breakable_by_hand=7,attached_node=1, hot=150},
|
||||
})
|
||||
|
||||
--[[check if the torch is actually on a walkable node
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
-- This is a fork of paths mod by Casimir (https://forum.minetest.net/viewtopic.php?id=3390).
|
||||
-- Trail mod 0.1.0 by paramat.
|
||||
-- For latest stable Minetest and back to 0.4.4.
|
||||
-- Licenses: Code CC BY-SA. Textures CC BY-SA. Textures are edited default Minetest textures.
|
||||
-- The water sounds are from the ambience mod by Neuromancer,
|
||||
-- and are by Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/, license CC BY-NC.
|
||||
|
||||
Version 0.1.0
|
||||
-------------
|
||||
* Creates a trail of footprints in grass, dirt, sand, desert sand, gravel and the snow and snow block of snow biomes mod.
|
||||
* Repeated walking of grass will wear it to dirt.
|
||||
* Temporary trail of bubbles on water surface with a bubbly swimming / underwater sound.
|
||||
* Trail creation can be disabled (while retaining footprint nodes) by editing parameter: FOO = false.
|
||||
* Lightweight mod that runs the footprint function on average every 1 in 2 globalsteps, this is still enough to detect almost every node walked.
|
||||
* Additionally parameter FOOCHA can be reduced for less per-node chance of a footprint, this works by randomly skipping the processing of certain players, therefore making the mod even more lightweight, useful for multiplayer situations.
|
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,205 +0,0 @@
|
|||
-- This is a fork of paths mod by Casimir (https://forum.minetest.net/viewtopic.php?id=3390).
|
||||
-- Trail mod 0.1.0 by paramat.
|
||||
-- For latest stable Minetest and back to 0.4.4.
|
||||
-- Licenses: Code CC BY-SA. Textures CC BY-SA. Textures are edited default Minetest textures.
|
||||
-- The water sounds are from the ambience mod by Neuromancer,
|
||||
-- and are by Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/, license CC BY-NC.
|
||||
|
||||
-- Parameters
|
||||
|
||||
local FOO = true -- (true/false) Enable footprints.
|
||||
local WORCHA = 0.05 -- % chance grass is worn to dirt.
|
||||
local FOOCHA = 1 -- % chance of footprints.
|
||||
|
||||
-- Stuff
|
||||
|
||||
trail = {}
|
||||
|
||||
-- PLayer positions
|
||||
|
||||
local player_pos = {}
|
||||
local player_pos_previous = {}
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_pos_previous[player:get_player_name()] = {x=0,y=0,z=0}
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
player_pos_previous[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
-- Nodes
|
||||
|
||||
minetest.register_node("trail:dirt_with_grass_walked", {
|
||||
tiles = {"default_grass.png^trail_grass_footprint.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
|
||||
groups = {crumbly=6, not_in_creative_inventory=1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("trail:dirt_walked", {
|
||||
tiles = {"default_dirt.png^trail_dirt_footprint.png", "default_dirt.png"},
|
||||
groups = {crumbly=6, not_in_creative_inventory=1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("trail:sand_walked", {
|
||||
tiles = {"default_sand.png^trail_sand_footprint.png", "default_sand.png"},
|
||||
groups = {crumbly=6, falling_node=1, not_in_creative_inventory=1},
|
||||
drop = "default:sand",
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("trail:desert_sand_walked", {
|
||||
tiles = {"default_desert_sand.png^trail_desert_sand_footprint.png", "default_desert_sand.png"},
|
||||
groups = {sand=1, crumbly=6, falling_node=1, not_in_creative_inventory=1},
|
||||
drop = "default:desert_sand",
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("trail:gravel_walked", {
|
||||
tiles = {"default_gravel.png^trail_gravel_footprint.png", "default_gravel.png"},
|
||||
groups = {crumbly=5, falling_node=1, not_in_creative_inventory=1},
|
||||
drop = "default:gravel",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.45},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("trail:water_source_swam", {
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="trail_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
|
||||
},
|
||||
alpha = WATER_ALPHA,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "default:water_flowing",
|
||||
liquid_alternative_source = "default:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_renewable = false,
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
on_construct = function(pos)
|
||||
if math.random(1, 2) == 1 then
|
||||
minetest.sound_play("trail_water_bubbles", {gain = 0.2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("trail:snow_walked", {
|
||||
tiles = {"trail_snow_footprint.png", "snow_snow.png"},
|
||||
drawtype = "nodebox",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
param2 = nil,
|
||||
groups = {crumbly=6, melts=3, not_in_creative_inventory=1},
|
||||
buildable_to = true,
|
||||
drop = "snow:snowball",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.35, 0.5}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.35, 0.5}
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.3},
|
||||
}),
|
||||
after_destruct = function(pos, node, digger)
|
||||
if node.param2 == 1 then
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
if nodename == "air" or nodename == "default:water_flowing" or nodename == "default:water_source" then
|
||||
minetest.env:add_node(pos,{name="snow:moss",param2=1})
|
||||
end
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
if minetest.env:get_node(pos).name == "snow:dirt_with_snow" then
|
||||
minetest.env:add_node(pos,{name="default:dirt_with_grass"})
|
||||
end
|
||||
end,
|
||||
on_construct = function(pos, newnode)
|
||||
pos.y = pos.y - 1
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
if nodename == "default:dirt_with_grass" or nodename == "trail:dirt_with_grass_walked"
|
||||
or nodename == "default:dirt" or nodename == "trail:dirt_walked" then
|
||||
minetest.env:add_node(pos,{name="snow:dirt_with_snow"})
|
||||
elseif nodename == "air" then
|
||||
pos.y = pos.y + 1
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("trail:snow_block_walked", {
|
||||
tiles = {"trail_snow_footprint.png", "snow_snow.png"},
|
||||
groups = {crumbly=6, melts=2, falling_node=1, not_in_creative_inventory=1},
|
||||
drop = "snow:snow_block",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.3},
|
||||
}),
|
||||
})
|
||||
|
||||
-- Globalstep function
|
||||
|
||||
if FOO then
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if math.random() < 0.5 then
|
||||
local env = minetest.env
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if math.random() <= FOOCHA then
|
||||
local pos = player:getpos()
|
||||
player_pos[player:get_player_name()] = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+0.2),z=math.floor(pos.z+0.5)}
|
||||
local p_ground = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+0.4),z=math.floor(pos.z+0.5)}
|
||||
local n_ground = env:get_node(p_ground).name
|
||||
local p_groundpl = {x=math.floor(pos.x+0.5),y=math.floor(pos.y-0.5),z=math.floor(pos.z+0.5)}
|
||||
local p_snow = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+1.2),z=math.floor(pos.z+0.5)}
|
||||
local n_snow = env:get_node(p_snow).name
|
||||
local p_snowpl = {x=math.floor(pos.x+0.5),y=math.floor(pos.y+0.5),z=math.floor(pos.z+0.5)}
|
||||
local n_snowpl = env:get_node(p_snowpl).name
|
||||
if player_pos_previous[player:get_player_name()] == nil then break end
|
||||
if player_pos[player:get_player_name()].x ~= player_pos_previous[player:get_player_name()].x
|
||||
or player_pos[player:get_player_name()].y < player_pos_previous[player:get_player_name()].y
|
||||
or player_pos[player:get_player_name()].z ~= player_pos_previous[player:get_player_name()].z then
|
||||
if n_ground == "default:dirt_with_grass" then
|
||||
env:add_node(p_groundpl,{name="trail:dirt_with_grass_walked"})
|
||||
elseif n_ground == "trail:dirt_with_grass_walked" then
|
||||
if math.random() <= WORCHA then
|
||||
env:add_node(p_groundpl,{name="trail:dirt_walked"})
|
||||
end
|
||||
elseif n_ground == "default:dirt" then
|
||||
env:add_node(p_groundpl,{name="trail:dirt_walked"})
|
||||
elseif n_ground == "default:sand" then
|
||||
env:add_node(p_groundpl,{name="trail:sand_walked"})
|
||||
elseif n_ground == "default:desert_sand" then
|
||||
env:add_node(p_groundpl,{name="trail:desert_sand_walked"})
|
||||
elseif n_ground == "default:gravel" then
|
||||
minetest.env:add_node(p_groundpl,{name="trail:gravel_walked"})
|
||||
elseif n_snowpl == "default:water_source" then
|
||||
env:add_node(p_snowpl,{name="trail:water_source_swam"})
|
||||
elseif n_snow == "snow:snow" then
|
||||
env:add_node(p_snowpl,{name="trail:snow_walked"})
|
||||
elseif n_ground == "snow:snow_block" then
|
||||
env:add_node(p_groundpl,{name="trail:snow_block_walked"})
|
||||
end
|
||||
end
|
||||
player_pos_previous[player:get_player_name()] = {
|
||||
x=player_pos[player:get_player_name()].x,
|
||||
y=player_pos[player:get_player_name()].y,
|
||||
z=player_pos[player:get_player_name()].z
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
Before Width: | Height: | Size: 609 B |
Before Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 6.0 KiB |
|
@ -0,0 +1,24 @@
|
|||
-- Wielded Item Transformations - http://dev.minetest.net/texture
|
||||
|
||||
wieldview.transform = {
|
||||
["default:torch"]="R270",
|
||||
["default:sapling"]="R270",
|
||||
["flowers:dandelion_white"]="R270",
|
||||
["flowers:dandelion_yellow"]="R270",
|
||||
["flowers:geranium"]="R270",
|
||||
["flowers:rose"]="R270",
|
||||
["flowers:tulip"]="R270",
|
||||
["flowers:viola"]="R270",
|
||||
["bucket:bucket_empty"]="R270",
|
||||
["bucket:bucket_water"]="R270",
|
||||
["bucket:bucket_lava"]="R270",
|
||||
["screwdriver:screwdriver"]="R270",
|
||||
["screwdriver:screwdriver1"]="R270",
|
||||
["screwdriver:screwdriver2"]="R270",
|
||||
["screwdriver:screwdriver3"]="R270",
|
||||
["screwdriver:screwdriver4"]="R270",
|
||||
["vessels:glass_bottle"]="R270",
|
||||
["vessels:drinking_glass"]="R270",
|
||||
["vessels:steel_bottle"]="R270",
|
||||
}
|
||||
|
|
@ -22,23 +22,10 @@
|
|||
|
||||
|
||||
--set inventory_craft_small=1 in minetest.conf to limit inventory craft to 2x2
|
||||
--[[if minetest.setting_getbool("inventory_craft_small")
|
||||
and not minetest.setting_getbool("creative_mode")
|
||||
and not minetest.get_modpath("inventory_plus") then
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:get_inventory():set_width("craft", 2)
|
||||
player:get_inventory():set_size("craft", 2*2)
|
||||
player:set_inventory_formspec("size[8,7.5]"
|
||||
.."list[current_player;main;0,3.5;8,4;]"
|
||||
.."list[current_player;craft;3,0.5;2,2;]"
|
||||
.."list[current_player;craftpreview;6,1;1,1;]")
|
||||
end)
|
||||
else
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:get_inventory():set_width("craft", 3)
|
||||
player:get_inventory():set_size("craft", 3*3)
|
||||
end)
|
||||
end--]]
|
||||
|
||||
-- expose api
|
||||
workbench = {}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
--worldtime configuration file
|
||||
--Copyright (C) 2012 Bad_Command
|
||||
--
|
||||
--This library 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 General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public
|
||||
--License along with this library; if not, write to the Free Software
|
||||
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
---
|
||||
|
||||
-- World time persistence interval (default: write time to disk every 10 seconds)
|
||||
-- Decrease this is the server frequently loses time
|
||||
worldtime.persist_time_interval=10
|
||||
-- World time save file name
|
||||
worldtime.save_file_name="worldtime.dat"
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
--worldtime 1.01
|
||||
--Copyright (C) 2012 Bad_Command
|
||||
--
|
||||
--This library 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 General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public
|
||||
--License along with this library; if not, write to the Free Software
|
||||
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
---
|
||||
|
||||
---
|
||||
-- To use worldtime, call this method in your mod:
|
||||
-- worldtime.get()
|
||||
---
|
||||
|
||||
worldtime={}
|
||||
worldtime.version = 1.01
|
||||
|
||||
-- config.lua contains configuration parameters
|
||||
dofile(minetest.get_modpath("worldtime").."/config.lua")
|
||||
-- worldtime.lua contains the code
|
||||
dofile(minetest.get_modpath("worldtime").."/worldtime.lua")
|
||||
|
||||
worldtime.intialize()
|
||||
worldtime.persist()
|
||||
minetest.register_globalstep(worldtime.timechange)
|
|
@ -1,502 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library 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 library 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.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -1,101 +0,0 @@
|
|||
---
|
||||
--worldtime
|
||||
--Copyright (C) 2012 Bad_Command
|
||||
--
|
||||
--This library 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 General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public
|
||||
--License along with this library; if not, write to the Free Software
|
||||
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
----
|
||||
|
||||
-- Call this function to get the world time
|
||||
worldtime.get = function()
|
||||
return worldtime.worldtime + worldtime.worldtime_subsec
|
||||
end
|
||||
-- Obsolete function to get world time. Use worldtime.get().
|
||||
function worldtime_get()
|
||||
return worldtime.get()
|
||||
end
|
||||
|
||||
worldtime.worldtime = 0
|
||||
worldtime.worldtime_subsec = 0
|
||||
|
||||
worldtime.get_filename = function()
|
||||
return minetest.get_worldpath(modname) .. "/" .. worldtime.save_file_name
|
||||
end
|
||||
|
||||
worldtime.read_time = function()
|
||||
local file
|
||||
local err
|
||||
file,err = io.open( worldtime.get_filename(), "r" )
|
||||
if err then
|
||||
minetest.log("error", "worldtime: Could not open file: " .. err)
|
||||
return false
|
||||
end
|
||||
local text = file:read("*all")
|
||||
local time = string.match(text, "^(%d+%.?%d*)$")
|
||||
if time == nil or string.match(time, "^%d+%.$") then
|
||||
minetest.log("error", "worldtime: Could not parse text when reading worldtime: " .. text)
|
||||
return false
|
||||
end
|
||||
time = time + 0.0
|
||||
worldtime.worldtime = math.floor(time)
|
||||
worldtime.worldtime_subsec = time - worldtime.worldtime
|
||||
return true
|
||||
end
|
||||
|
||||
worldtime.write_time = function()
|
||||
local file
|
||||
local err
|
||||
file,err = io.open( worldtime.get_filename(), "w" )
|
||||
if err then
|
||||
return false
|
||||
end
|
||||
file:write(worldtime.worldtime)
|
||||
file:close()
|
||||
return true
|
||||
end
|
||||
|
||||
worldtime.intialize = function()
|
||||
if not worldtime.read_time() then
|
||||
minetest.log('error',
|
||||
"WARNING: worldtime: Could not read time from "..
|
||||
worldtime.get_filename() )
|
||||
|
||||
else
|
||||
minetest.log('trace',
|
||||
"worldtime: Read current time ("..worldtime.worldtime..") from "..
|
||||
worldtime.get_filename() )
|
||||
end
|
||||
end
|
||||
|
||||
worldtime.persist = function()
|
||||
minetest.after(worldtime.persist_time_interval,worldtime.persist);
|
||||
if not worldtime.write_time() then
|
||||
minetest.log('error',
|
||||
"WARNING: worldtime: Could not save time to "..
|
||||
worldtime.get_filename() )
|
||||
else
|
||||
minetest.log('trace',
|
||||
"worldtime: Saved current time ("..worldtime.worldtime..") to "..
|
||||
worldtime.get_filename() )
|
||||
end
|
||||
end
|
||||
|
||||
worldtime.timechange = function(dtime)
|
||||
worldtime.worldtime_subsec = worldtime.worldtime_subsec + dtime
|
||||
if ( worldtime.worldtime_subsec > 1.0 ) then
|
||||
worldtime.worldtime_subsec = worldtime.worldtime_subsec - 1.0
|
||||
worldtime.worldtime = worldtime.worldtime + 1
|
||||
end
|
||||
end
|
||||
|