sforkowany z mtcontrib/minetest-mod-snow
Porównaj commity
4 Commity
db6bf1d1b2
...
master
| Autor | SHA1 | Data | |
|---|---|---|---|
|
|
ce0442fe25 | ||
|
|
58ac474139 | ||
|
|
9dc9ab3a39 | ||
| 4f4489fc93 |
11
.github/workflows/luacheck.yml
vendored
Normal file
11
.github/workflows/luacheck.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
on: [push, pull_request]
|
||||
name: luacheck
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: lint
|
||||
uses: Roang-zero1/factorio-mod-luacheck@master
|
||||
with:
|
||||
luacheckrc_url: ""
|
||||
11
.luacheckrc
11
.luacheckrc
@@ -1,5 +1,5 @@
|
||||
read_globals = {
|
||||
"dump", "vector", "minetest",
|
||||
"dump", "vector",
|
||||
"table", "math", "PseudoRandom", "VoxelArea",
|
||||
"stairs", "stairsplus", "skins", "treecapitator",
|
||||
default = {
|
||||
@@ -10,6 +10,15 @@ read_globals = {
|
||||
}
|
||||
},
|
||||
other_fields = true
|
||||
},
|
||||
minetest = {
|
||||
fields = {
|
||||
registered_nodes = {
|
||||
read_only = false,
|
||||
other_fields = true
|
||||
}
|
||||
},
|
||||
other_fields = true
|
||||
}
|
||||
}
|
||||
globals = {"snow"}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
default
|
||||
christmas_craft?
|
||||
flowers?
|
||||
stairs?
|
||||
moreblocks?
|
||||
|
||||
4
init.lua
4
init.lua
@@ -51,7 +51,7 @@ local load_time_start = minetest.get_us_time()
|
||||
|
||||
|
||||
-- Original init.lua File Broken into Smaller Files
|
||||
local srcpath = minetest.get_modpath("snow").."/src/"
|
||||
local srcpath = minetest.get_modpath"snow".."/src/"
|
||||
dofile(srcpath.."abms.lua")
|
||||
dofile(srcpath.."aliases.lua")
|
||||
dofile(srcpath.."crafting.lua")
|
||||
@@ -203,5 +203,5 @@ local msg = "[snow] loaded after ca. " .. time .. " seconds."
|
||||
if time > 0.01 then
|
||||
print(msg)
|
||||
else
|
||||
minetest.log("action", msg)
|
||||
minetest.log("info", msg)
|
||||
end
|
||||
|
||||
BIN
schematics/pine.mts
Normal file
BIN
schematics/pine.mts
Normal file
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
18
src/abms.lua
18
src/abms.lua
@@ -2,7 +2,7 @@
|
||||
-- light through (sunlight_propagates) or have a light paramtype and
|
||||
-- liquidtype combination. ~ LazyJ, 2014_03_08
|
||||
|
||||
--[[minetest.register_abm({
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_snow"},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
@@ -19,7 +19,7 @@
|
||||
end
|
||||
end
|
||||
})
|
||||
]]--
|
||||
|
||||
|
||||
|
||||
--Melting
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:melts"},
|
||||
neighbors = {"group:igniter", "default:torch", "default:torch_wall", "default:furnace_active", "group:hot"},
|
||||
neighbors = {"group:igniter", "default:torch", "default:furnace_active", "group:hot"},
|
||||
interval = 10,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
@@ -78,7 +78,6 @@ minetest.register_abm({
|
||||
|
||||
--Freezing
|
||||
--Water freezes when in contact with snow.
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:water_source"},
|
||||
-- Added "group:icemaker" and snowbrick. ~ LazyJ
|
||||
@@ -126,7 +125,7 @@ minetest.register_abm({
|
||||
end
|
||||
end,
|
||||
})
|
||||
]]--
|
||||
|
||||
|
||||
|
||||
--Spread moss to cobble.
|
||||
@@ -144,7 +143,7 @@ minetest.register_abm({
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
|
||||
--Grow Pine Saplings
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:sapling_pine"},
|
||||
@@ -167,7 +166,7 @@ minetest.register_abm({
|
||||
-- This finds the sapling under the grown tree. ~ LazyJ
|
||||
if minetest.get_node(pos).name == "snow:sapling_pine" then
|
||||
-- This switches the sapling to a tree trunk. ~ LazyJ
|
||||
minetest.set_node(pos, {name="default:pine_tree"})
|
||||
minetest.set_node(pos, {name="default:pinetree"})
|
||||
-- This is more for testing but it may be useful info to some admins when
|
||||
-- grepping the server logs too. ~ LazyJ
|
||||
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
@@ -177,6 +176,7 @@ minetest.register_abm({
|
||||
|
||||
|
||||
|
||||
|
||||
--Grow Christmas Tree Saplings
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:xmas_tree"},
|
||||
@@ -201,11 +201,10 @@ minetest.register_abm({
|
||||
end
|
||||
})
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
|
||||
--Backwards Compatability.
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
|
||||
interval = 1,
|
||||
@@ -215,4 +214,3 @@ minetest.register_abm({
|
||||
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
|
||||
end,
|
||||
})
|
||||
]]--
|
||||
|
||||
@@ -29,7 +29,6 @@ minetest.register_alias("cobblesnow", "snow:snow_cobble")
|
||||
|
||||
-- To clean up my first stairsplus attempt.
|
||||
-- Stair
|
||||
--[[
|
||||
minetest.register_alias(":default:stair_snowblock", "moreblocks:stair_snowblock")
|
||||
minetest.register_alias(":default:stair_snowblock_half", "moreblocks:stair_snowblock_half")
|
||||
minetest.register_alias(":default:stair_snowblock_right_half", "moreblocks:stair_snowblock_right_half")
|
||||
@@ -103,8 +102,3 @@ minetest.register_alias(":default:micro_ice_4", "moreblocks:micro_ice_4")
|
||||
minetest.register_alias(":default:micro_ice_12", "moreblocks:micro_ice_12")
|
||||
minetest.register_alias(":default:micro_ice_14", "moreblocks:micro_ice_14")
|
||||
minetest.register_alias(":default:micro_ice_15", "moreblocks:micro_ice_15")
|
||||
]]--
|
||||
-- If christmas_craft then override his star with this mod one.
|
||||
if minetest.get_modpath("christmas_craft") then
|
||||
minetest.register_alias_force("christmas_craft:christmas_star", "snow:star")
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ of snowblocks (and then use them to water-grief by melting the snow blocks).
|
||||
|
||||
~ LazyJ
|
||||
|
||||
]]--
|
||||
--]]
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
@@ -77,7 +77,7 @@ minetest.register_craft({
|
||||
"default:snowblock",
|
||||
"default:snowblock"
|
||||
}
|
||||
})]]--
|
||||
})]]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ if snow.enable_snowfall then
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = player:get_player_name()
|
||||
local pos_player = player:getpos()
|
||||
local pos_player = player:get_pos()
|
||||
local pposy = math.floor(pos_player.y) + 2 -- Precipitation when swimming
|
||||
if pposy >= YLIMIT - 2 then
|
||||
local pposx = math.floor(pos_player.x)
|
||||
@@ -107,9 +107,9 @@ if snow.enable_snowfall then
|
||||
local nobj_humid = minetest.get_perlin(np_humid)
|
||||
local nobj_prec = minetest.get_perlin(np_prec)
|
||||
|
||||
local nval_temp = nobj_temp:get2d({x = pposx, y = pposz})
|
||||
local nval_humid = nobj_humid:get2d({x = pposx, y = pposz})
|
||||
local nval_prec = nobj_prec:get2d({x = os.clock() / 60, y = 0})
|
||||
local nval_temp = nobj_temp:get_2d({x = pposx, y = pposz})
|
||||
local nval_humid = nobj_humid:get_2d({x = pposx, y = pposz})
|
||||
local nval_prec = nobj_prec:get_2d({x = os.clock() / 60, y = 0})
|
||||
|
||||
-- Biome system: Frozen biomes below heat 35,
|
||||
-- deserts below line 14 * t - 95 * h = -1496
|
||||
@@ -151,14 +151,13 @@ if snow.enable_snowfall then
|
||||
((time - 0.1875) / 0.0521) * difsval)
|
||||
end
|
||||
-- Set sky to overcast bluish-grey
|
||||
player:set_sky(
|
||||
{r = sval, g = sval, b = sval + 16, a = 255},
|
||||
"plain",
|
||||
{}
|
||||
)
|
||||
player:set_sky({
|
||||
base_color = {r = sval, g = sval, b = sval + 16, a = 255},
|
||||
type = "plain",
|
||||
})
|
||||
else
|
||||
-- Reset sky to normal
|
||||
player:set_sky({}, "regular", {})
|
||||
player:set_sky({type = "regular"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ saplings grow into trees. --]]
|
||||
|
||||
-- Part 1: To disable the mapgen, add the *starting* comment under this line.
|
||||
|
||||
--[[local perlin_scale, nosmooth_rarity
|
||||
local perlin_scale, nosmooth_rarity
|
||||
if not snow.disable_mapgen then
|
||||
print("[snow] Mapgen enabled!")
|
||||
|
||||
@@ -59,18 +59,18 @@ if not snow.disable_mapgen then
|
||||
|
||||
|
||||
--Identify the mapgen.
|
||||
local mgname = minetest.get_mapgen_setting("mg_name")
|
||||
local mgname = minetest.get_mapgen_setting"mg_name"
|
||||
if not mgname then
|
||||
minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!")
|
||||
end
|
||||
local path = minetest.get_modpath("snow")
|
||||
if mgname == "v6" then
|
||||
local path = minetest.get_modpath"snow"
|
||||
if mgname == "v7" then
|
||||
--Load mapgen_v7 compatibility.
|
||||
dofile(path.."/src/mapgen_v7.lua")
|
||||
else
|
||||
--Load mapgen_v6 compatibility.
|
||||
dofile(path.."/src/mapgen_v6.lua")
|
||||
else]]--
|
||||
--Load mapgen_v7 compatibility.
|
||||
dofile(minetest.get_modpath("snow").."/src/mapgen_v7.lua")
|
||||
--[[ end
|
||||
end
|
||||
end
|
||||
|
||||
-- To complete the commenting-out add the *closing* comment under this line.
|
||||
@@ -80,7 +80,7 @@ local pine_tree = {
|
||||
axiom="TABff",
|
||||
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||
trunk="default:pine_tree",
|
||||
trunk="default:pinetree",
|
||||
leaves="snow:needles",
|
||||
angle=90,
|
||||
iterations=1,
|
||||
@@ -95,7 +95,7 @@ local xmas_tree = {
|
||||
axiom="TABff",
|
||||
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||
trunk="default:pine_tree",
|
||||
trunk="default:pinetree",
|
||||
leaves="snow:needles_decorated",
|
||||
angle=90,
|
||||
iterations=1,
|
||||
@@ -137,7 +137,7 @@ function snow.make_pine(pos,snow,xmas)
|
||||
if xmas then
|
||||
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
|
||||
elseif snow
|
||||
and minetest.get_perlin(112,3, 0.5, perlin_scale):get2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||
and minetest.get_perlin(112,3, 0.5, perlin_scale):get_2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
|
||||
end
|
||||
end
|
||||
@@ -161,7 +161,7 @@ function snow.voxelmanip_pine(pos,a,data)
|
||||
data[a:index(x,pos.y+i,z)] = c_pine_needles
|
||||
if x ~= 0
|
||||
and z ~= 0
|
||||
and perlin1:get2d({x=x,y=z}) > nosmooth_rarity then
|
||||
and perlin1:get_2d({x=x,y=z}) > nosmooth_rarity then
|
||||
local abovenode = a:index(x,pos.y+i+1,z)
|
||||
data[abovenode] = c_snow
|
||||
end
|
||||
@@ -176,16 +176,16 @@ function snow.voxelmanip_pine(pos,a,data)
|
||||
data[a:index(x-1,y,z)] = c_pine_needles
|
||||
data[a:index(x,y,z+1)] = c_pine_needles
|
||||
data[a:index(x,y,z-1)] = c_pine_needles
|
||||
if perlin1:get2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||
if perlin1:get_2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||
data[a:index(x+1,y+1,z)] = c_snow
|
||||
end
|
||||
if perlin1:get2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||
if perlin1:get_2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||
data[a:index(x-1,y+1,z)] = c_snow
|
||||
end
|
||||
if perlin1:get2d({x=x,y=z+1}) > nosmooth_rarity then
|
||||
if perlin1:get_2d({x=x,y=z+1}) > nosmooth_rarity then
|
||||
data[a:index(x,y+1,z+1)] = c_snow
|
||||
end
|
||||
if perlin1:get2d({x=x,y=z-1}) > nosmooth_rarity then
|
||||
if perlin1:get_2d({x=x,y=z-1}) > nosmooth_rarity then
|
||||
data[a:index(x,y+1,z-1)] = c_snow
|
||||
end
|
||||
end
|
||||
@@ -194,13 +194,13 @@ function snow.voxelmanip_pine(pos,a,data)
|
||||
end
|
||||
data[a:index(pos.x,pos.y+5,pos.z)] = c_pine_needles
|
||||
data[a:index(pos.x,pos.y+6,pos.z)] = c_pine_needles
|
||||
if perlin1:get2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||
if perlin1:get_2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||
data[a:index(pos.x,pos.y+7,pos.z)] = c_snow
|
||||
end
|
||||
end
|
||||
]]--
|
||||
|
||||
-- treecapitator support
|
||||
if minetest.global_exists("treecapitator") then
|
||||
if minetest.global_exists"treecapitator" then
|
||||
treecapitator.register_tree{
|
||||
trees = {"default:pine_tree"},
|
||||
leaves = {"snow:needles"},
|
||||
|
||||
@@ -142,10 +142,10 @@ local function define_contents()
|
||||
end
|
||||
|
||||
local smooth = snow.smooth_biomes
|
||||
local smooth_rarity_max = mg.smooth_rarity_max or 0
|
||||
local smooth_rarity_min = mg.smooth_rarity_min or 0
|
||||
local smooth_rarity_dif = mg.smooth_rarity_dif or 0
|
||||
local nosmooth_rarity = mg.nosmooth_rarity or 0
|
||||
local smooth_rarity_max = mg.smooth_rarity_max
|
||||
local smooth_rarity_min = mg.smooth_rarity_min
|
||||
local smooth_rarity_dif = mg.smooth_rarity_dif
|
||||
local nosmooth_rarity = mg.nosmooth_rarity
|
||||
|
||||
snow.register_on_configuring(function(name, v)
|
||||
if name == "debug" then
|
||||
@@ -201,18 +201,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
define_contents()
|
||||
end
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local vm, emin, emax = minetest.get_mapgen_object"voxelmanip"
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local data = vm:get_data()
|
||||
local param2s = vm:get_param2_data()
|
||||
|
||||
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||
local heightmap = minetest.get_mapgen_object"heightmap"
|
||||
|
||||
local snow_tab,num = {},1
|
||||
local pines_tab,pnum = {},1
|
||||
|
||||
get_perlins(x1 - x0 + 1)
|
||||
local nvals_default = perlin_objs.default:get2dMap_flat({x=x0+150, y=z0+50}, nbuf_default)
|
||||
local nvals_default = perlin_objs.default:get_2dMap_flat({x=x0+150, y=z0+50}, nbuf_default)
|
||||
local nvals_cold, nvals_ice, ndia
|
||||
|
||||
-- Choose biomes
|
||||
@@ -239,7 +239,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local in_biome = false
|
||||
local test
|
||||
if nvals_default[ni] < 0.35 then
|
||||
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
||||
nvals_cold = nvals_cold or perlin_objs.cold:get_2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
||||
test = math.min(nvals_cold[ni], 1)
|
||||
if is_smooth then
|
||||
if test >= smooth_rarity_max
|
||||
@@ -291,7 +291,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
else
|
||||
if not nvals_ice then
|
||||
nvals_ice = perlin_objs.ice:get2dMap_flat({x=x0, y=z0}, nbuf_ice)
|
||||
nvals_ice = perlin_objs.ice:get_2dMap_flat({x=x0, y=z0}, nbuf_ice)
|
||||
|
||||
nodes_added = true
|
||||
write_to_map = true
|
||||
|
||||
@@ -1,77 +1,59 @@
|
||||
--[[minetest.register_biome({
|
||||
name = "snow_biome_default",
|
||||
node_dust = "default:snow",
|
||||
node_top = "default:dirt_with_snow",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 1,
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 5,
|
||||
y_max = 31000,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 40.0,
|
||||
})
|
||||
]]--
|
||||
minetest.register_biome({
|
||||
name = "snow_biome_forest",
|
||||
node_dust = "default:snow",
|
||||
name = "snow_biome_default",
|
||||
|
||||
node_top = "default:dirt_with_snow",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 2,
|
||||
y_max = 31000,
|
||||
heat_point = 20.0,
|
||||
humidity_point = 70.0,
|
||||
|
||||
height_min = snow.min_height,
|
||||
height_max = snow.min_height+60,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 40.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "pine_forest",
|
||||
node_top = "default:dirt_with_grass",
|
||||
name = "snow_biome_forest",
|
||||
|
||||
node_top = "default:dirt_with_snow",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 3,
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 60,
|
||||
y_max = 31000,
|
||||
heat_point = 40,
|
||||
humidity_point = 68,
|
||||
depth_filler = 2,
|
||||
|
||||
height_min = snow.min_height,
|
||||
height_max = snow.min_height+60,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 55.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "snow_biome_lush",
|
||||
node_dust = "default:snow",
|
||||
|
||||
node_top = "default:dirt_with_snow",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 2,
|
||||
y_max = 31000,
|
||||
|
||||
height_min = snow.min_height,
|
||||
height_max = snow.min_height+60,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 70.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "snow_biome_alpine",
|
||||
node_dust = "default:snow",
|
||||
node_top = "default:dirt_with_snow",
|
||||
|
||||
node_top = "default:stone",
|
||||
depth_top = 1,
|
||||
node_filler = "default:stone",
|
||||
node_riverbed = "default:gravel",
|
||||
depth_riverbed = 2,
|
||||
y_min = 60,
|
||||
y_max = 31000,
|
||||
|
||||
height_min = snow.min_height+60,
|
||||
height_max = 31000,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 40.0,
|
||||
})
|
||||
|
||||
--[[minetest.register_biome({
|
||||
minetest.register_biome({
|
||||
name = "snow_biome_sand",
|
||||
|
||||
node_top = "default:sand",
|
||||
@@ -79,51 +61,21 @@ minetest.register_biome({
|
||||
node_filler = "default:stone",
|
||||
depth_filler = 0,
|
||||
|
||||
y_min = -2,
|
||||
y_max = 31000,
|
||||
height_min = -31000,
|
||||
height_max = 2,
|
||||
heat_point = 10.0,
|
||||
humidity_point = 40.0,
|
||||
})
|
||||
]]--
|
||||
|
||||
|
||||
--Pine tree.
|
||||
minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt_with_snow", "default:dirt_with_grass", "default:dirt_with_coniferous_litter"},
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = -0.004,
|
||||
scale = 0.01,
|
||||
spread = {x = 100, y = 100, z = 100},
|
||||
seed = 4087,
|
||||
octaves = 3,
|
||||
persist = 0.7,
|
||||
},
|
||||
y_max = 31000,
|
||||
y_min = 4,
|
||||
biomes = {"snowy_grassland", "coniferous_forest", "taiga", "snow_biome_alpine"},
|
||||
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
--offset = 0.036,
|
||||
offset = 0.020,
|
||||
scale = 0.002,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2861,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
-- fill_ratio = 0.0005,
|
||||
y_max = 31000,
|
||||
y_min = 4,
|
||||
biomes = {"snow_biome_forest", "pine_forest"},
|
||||
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||
fill_ratio = 0.005,
|
||||
biomes = {"snow_biome_default"},
|
||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
})
|
||||
|
||||
@@ -132,46 +84,29 @@ minetest.register_decoration({
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.05,
|
||||
y_max = 31000,
|
||||
y_min = 4,
|
||||
biomes = {"snow_biome_forest"},
|
||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.1,
|
||||
biomes = {"snow_biome_lush"},
|
||||
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
})
|
||||
|
||||
--Dry shrubs.
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.001,
|
||||
y_max = 31000,
|
||||
y_min = 1,
|
||||
biomes = {"snowy_grassland"},
|
||||
decoration = "default:dry_shrub",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.01,
|
||||
y_max = 31000,
|
||||
y_min = 1,
|
||||
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||
decoration = "default:dry_shrub",
|
||||
})
|
||||
|
||||
--Snow shrubs.
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.005,
|
||||
y_max = 31000,
|
||||
y_min = 1,
|
||||
biomes = {"snowy_grassland"},
|
||||
decoration = "snow:shrub_covered",
|
||||
biomes = {"snow_biome_default"},
|
||||
decoration = "default:dry_shrub",
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
@@ -179,59 +114,25 @@ minetest.register_decoration({
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.05,
|
||||
y_max = 31000,
|
||||
y_min = 1,
|
||||
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||
decoration = "snow:shrub_covered",
|
||||
decoration = "default:dry_shrub",
|
||||
})
|
||||
|
||||
-- Snow Flowers
|
||||
local function register_flower(seed, name)
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_snow"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = -0.015,
|
||||
scale = 0.025,
|
||||
spread = {x = 200, y = 200, z = 200},
|
||||
seed = seed,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
biomes = {"snow_biome_lush", "snow_biome_forest", "taiga", "snowy_grassland", "tundra"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "snow:flower_"..name,
|
||||
})
|
||||
end
|
||||
|
||||
register_flower(436, "rose")
|
||||
register_flower(19822, "tulip")
|
||||
register_flower(1220999, "dandelion_yellow")
|
||||
register_flower(36662, "geranium")
|
||||
register_flower(1133, "viola")
|
||||
register_flower(73133, "dandelion_white")
|
||||
|
||||
--Snow.
|
||||
--minetest.register_decoration({
|
||||
-- deco_type = "simple",
|
||||
-- place_on = "default:dirt_with_snow",
|
||||
-- sidelen = 16,
|
||||
-- fill_ratio = 10,
|
||||
-- y_max = 31000,
|
||||
-- y_min = 1,
|
||||
-- biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||
-- decoration = "default:snow",
|
||||
--})
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:dirt_with_snow",
|
||||
sidelen = 16,
|
||||
fill_ratio = 10,
|
||||
biomes = {"snow_biome_default", "snow_biome_forest", "snow_biome_lush"},
|
||||
decoration = "default:snow",
|
||||
})
|
||||
|
||||
--minetest.register_decoration({
|
||||
-- deco_type = "simple",
|
||||
-- place_on = "default:stone",
|
||||
-- sidelen = 16,
|
||||
-- fill_ratio = 10,
|
||||
-- y_max = 31000,
|
||||
-- y_min = 1,
|
||||
-- biomes = {"snow_biome_alpine"},
|
||||
-- decoration = "default:snow",
|
||||
--})
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = "default:stone",
|
||||
sidelen = 16,
|
||||
fill_ratio = 10,
|
||||
biomes = {"snow_biome_alpine"},
|
||||
decoration = "default:snow",
|
||||
})
|
||||
|
||||
198
src/nodes.lua
198
src/nodes.lua
@@ -1,68 +1,16 @@
|
||||
-- NODES
|
||||
|
||||
-- Grow sapling
|
||||
|
||||
local function grow_pine_tree(pos)
|
||||
local path = minetest.get_modpath("snow").."/schematics/snow_pine_from_sapling.mts"
|
||||
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "0", nil, false)
|
||||
end
|
||||
|
||||
local function grow_snowy_pine_tree(pos)
|
||||
local path = minetest.get_modpath("snow").."/schematics/snowy_snow_pine_from_sapling.mts"
|
||||
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false)
|
||||
end
|
||||
|
||||
local function grow_xmas_tree(pos)
|
||||
local path = minetest.get_modpath("snow").."/schematics/snow_xmas_from_sapling.mts"
|
||||
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "0", nil, false)
|
||||
end
|
||||
|
||||
local function grow_snowy_xmas_tree(pos)
|
||||
local path = minetest.get_modpath("snow").."/schematics/snowy_snow_xmas_from_sapling.mts"
|
||||
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false)
|
||||
end
|
||||
|
||||
local function is_snow_nearby(pos)
|
||||
return minetest.find_node_near(pos, 1, {"group:snowy"})
|
||||
end
|
||||
|
||||
local function grow_sapling(pos)
|
||||
if not default.can_grow(pos) then
|
||||
-- try again 5 min later
|
||||
minetest.get_node_timer(pos):start(300)
|
||||
return
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "snow:sapling_pine" then
|
||||
minetest.log("action", "A Snow Pine sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
if is_snow_nearby(pos) then
|
||||
grow_snowy_pine_tree(pos)
|
||||
else
|
||||
grow_pine_tree(pos)
|
||||
end
|
||||
elseif node.name == "snow:xmas_tree" then
|
||||
minetest.log("action", "A Christmas sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
if is_snow_nearby(pos) then
|
||||
grow_snowy_xmas_tree(pos)
|
||||
else
|
||||
grow_xmas_tree(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_lbm({
|
||||
name = "snow:convert_saplings_to_node_timer",
|
||||
nodenames = {"snow:sapling_pine", "snow:xmas_tree"},
|
||||
action = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||
end
|
||||
})
|
||||
|
||||
-- Pine Needles
|
||||
local nodedef = table.copy(minetest.registered_nodes["default:pine_needles"])
|
||||
nodedef.description = "Snow Pine Needles"
|
||||
nodedef.drop = {
|
||||
local nodedef = {
|
||||
description = "Pine Needles",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"snow_needles.png"},
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
groups = {snappy=3},
|
||||
furnace_burntime = 1,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
@@ -74,6 +22,8 @@ nodedef.drop = {
|
||||
items = {'snow:needles'},
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
}
|
||||
|
||||
--[[
|
||||
@@ -82,7 +32,7 @@ If christmas_content is enabled, then this next part will override the pine need
|
||||
The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
|
||||
|
||||
~ LazyJ
|
||||
]]--
|
||||
]]
|
||||
if snow.christmas_content then
|
||||
table.insert(nodedef.drop.items, 1, {
|
||||
-- player will get xmas tree with 1/120 chance
|
||||
@@ -93,6 +43,12 @@ end
|
||||
|
||||
minetest.register_node("snow:needles", table.copy(nodedef))
|
||||
|
||||
default.register_leafdecay{
|
||||
trunks = {"default:pine_tree"},
|
||||
leaves = {"snow:needles"},
|
||||
radius = 2,
|
||||
}
|
||||
|
||||
snow.register_on_configuring(function(name, v)
|
||||
if name == "christmas_content" then
|
||||
local drop = minetest.registered_nodes["snow:needles"].drop
|
||||
@@ -108,7 +64,9 @@ snow.register_on_configuring(function(name, v)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Christmas egg
|
||||
|
||||
|
||||
-- Christmas egg
|
||||
if minetest.global_exists("skins") then
|
||||
skins.add("character_snow_man")
|
||||
end
|
||||
@@ -132,35 +90,24 @@ else
|
||||
end
|
||||
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
||||
|
||||
minetest.register_node("snow:needles_decorated", table.copy(nodedef))
|
||||
minetest.register_node("snow:needles_decorated", nodedef)
|
||||
|
||||
-- Leaf decay
|
||||
|
||||
default.register_leafdecay{
|
||||
trunks = {"default:pine_tree"},
|
||||
leaves = {"snow:needles", "default:pine_needles", "snow:needles_decorated"},
|
||||
radius = 2,
|
||||
}
|
||||
|
||||
-- Saplings
|
||||
|
||||
nodedef = table.copy(minetest.registered_nodes["default:pine_sapling"])
|
||||
nodedef.description = "Snow Pine Sapling"
|
||||
nodedef.tiles = {"snow_sapling_pine.png"}
|
||||
nodedef.inventory_image = "snow_sapling_pine.png"
|
||||
nodedef.wield_image = "snow_sapling_pine.png"
|
||||
nodedef.on_timer = grow_sapling
|
||||
nodedef.on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(
|
||||
itemstack,
|
||||
placer,
|
||||
pointed_thing,
|
||||
"snow:sapling_pine",
|
||||
{x = -2, y = 1, z = -2},
|
||||
{x = 2, y = 13, z = 2},
|
||||
4)
|
||||
return itemstack
|
||||
end
|
||||
nodedef = {
|
||||
description = "Pine Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"snow_sapling_pine.png"},
|
||||
inventory_image = "snow_sapling_pine.png",
|
||||
wield_image = "snow_sapling_pine.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {snappy=2,dig_immediate=3},
|
||||
furnace_burntime = 10,
|
||||
sounds = default.node_sound_defaults(),
|
||||
}
|
||||
|
||||
-- Pine Sapling
|
||||
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
||||
@@ -170,21 +117,10 @@ nodedef.description = "Christmas Tree"
|
||||
nodedef.tiles = {"snow_xmas_tree.png"}
|
||||
nodedef.inventory_image = "snow_xmas_tree.png"
|
||||
nodedef.wield_image = "snow_xmas_tree.png"
|
||||
nodedef.on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(
|
||||
itemstack,
|
||||
placer,
|
||||
pointed_thing,
|
||||
"snow:xmas_tree",
|
||||
{x= -2, y = 1, z = -2},
|
||||
{x = 2, y = 14, z = 2},
|
||||
4)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_node("snow:xmas_tree", nodedef)
|
||||
|
||||
-- Star
|
||||
|
||||
nodedef = {
|
||||
description = "Star",
|
||||
drawtype = "plantlike",
|
||||
@@ -300,7 +236,7 @@ if rawget(_G, "flowers") then
|
||||
end
|
||||
|
||||
-- Leaves
|
||||
--[[local leaves = minetest.registered_nodes["default:leaves"]
|
||||
local leaves = minetest.registered_nodes["default:leaves"]
|
||||
nodedef = {
|
||||
description = "Snow Leaves",
|
||||
tiles = {"snow_leaves.png"},
|
||||
@@ -341,10 +277,10 @@ if not snow.disable_mapgen then
|
||||
default.register_leafdecay{
|
||||
trunks = {"default:tree"},
|
||||
leaves = {"snow:apple", "snow:leaves"},
|
||||
radius = minetest.get_mapgen_setting("mg_name") == "v6" and 2 or 3,
|
||||
radius = minetest.get_mapgen_setting"mg_name" == "v6" and 2 or 3,
|
||||
}
|
||||
end
|
||||
]]--
|
||||
|
||||
-- TODO
|
||||
snow.known_plants[minetest.get_content_id("default:jungleleaves")] = minetest.get_content_id("default:jungleleaves")
|
||||
|
||||
@@ -355,8 +291,7 @@ local function snow_onto_dirt(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "default:dirt_with_grass"
|
||||
or node.name == "default:dirt" then
|
||||
node.name = "default:dirt_with_snow"
|
||||
minetest.set_node(pos, node)
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -376,14 +311,10 @@ nodedef = {
|
||||
-- by player position. ~ LazyJ
|
||||
-- I made this a little harder to dig than snow blocks because
|
||||
-- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ
|
||||
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1},
|
||||
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1,
|
||||
icemaker=1, cooks_into_ice=1, cools_lava = 1, snowy = 1},
|
||||
--Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
dig = {name="default_dig_crumbly", gain=0.4},
|
||||
dug = {name="default_snow_footstep", gain=0.75},
|
||||
place = {name="default_place_node", gain=1.0}
|
||||
}),
|
||||
sounds = default.node_sound_snow_defaults(),
|
||||
-- The "on_construct" part below, thinking in terms of layers,
|
||||
-- dirt_with_snow could also double as dirt_with_frost which adds subtlety
|
||||
-- to the winterscape. ~ LazyJ
|
||||
@@ -393,17 +324,14 @@ nodedef = {
|
||||
-- Snow Brick
|
||||
minetest.register_node("snow:snow_brick", table.copy(nodedef))
|
||||
|
||||
|
||||
-- hard Ice Brick, original texture from LazyJ
|
||||
local ibdef = table.copy(nodedef)
|
||||
ibdef.description = "Ice Brick"
|
||||
ibdef.tiles = {"snow_ice_brick.png"}
|
||||
ibdef.use_texture_alpha = true
|
||||
ibdef.use_texture_alpha = "blend"
|
||||
ibdef.drawtype = "glasslike"
|
||||
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1}
|
||||
ibdef.sounds = default.node_sound_glass_defaults({
|
||||
dug = {name="default_hard_footstep", gain=1}
|
||||
})
|
||||
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1, cools_lava = 1, slippery = 3}
|
||||
ibdef.sounds = default.node_sound_ice_defaults()
|
||||
|
||||
minetest.register_node("snow:ice_brick", ibdef)
|
||||
|
||||
@@ -415,44 +343,38 @@ nodedef.tiles = {"snow_snow_cobble.png"}
|
||||
|
||||
minetest.register_node("snow:snow_cobble", nodedef)
|
||||
|
||||
|
||||
|
||||
-- Override Default Nodes to Add Extra Functions
|
||||
|
||||
local groups = minetest.registered_nodes["default:ice"].groups
|
||||
groups["melt"] = 1
|
||||
minetest.override_item("default:ice", {
|
||||
use_texture_alpha = true,
|
||||
drawtype = "glasslike",
|
||||
use_texture_alpha = "blend",
|
||||
param2 = 0, --param2 is reserved for how much ice will freezeover.
|
||||
sunlight_propagates = true, -- necessary for dirt_with_grass/snow/just dirt ABMs
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_ice.png^[brighten"},
|
||||
tiles = {"snow_ice.png^[brighten"},
|
||||
liquidtype = "none",
|
||||
-- I made this a lot harder to dig than snow blocks because ice is much more dense
|
||||
-- and solid than fluffy snow. ~ LazyJ
|
||||
groups = {cracky=2, crumbly=1, choppy=1, --[[oddly_breakable_by_hand=1,]] melts=1},
|
||||
groups = groups,
|
||||
on_construct = snow_onto_dirt,
|
||||
liquids_pointable = true,
|
||||
--Make ice freeze over when placed by a maximum of 10 blocks.
|
||||
after_place_node = function(pos)
|
||||
minetest.set_node(pos, {name="default:ice", param2=math.random(0,10)})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
groups = minetest.registered_nodes["default:snowblock"].groups
|
||||
for g,v in pairs({melts=1, icemaker=1, cooks_into_ice=1, falling_node=1}) do
|
||||
groups[g] = v
|
||||
end
|
||||
minetest.override_item("default:snowblock", {
|
||||
-- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
||||
liquidtype = "none",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
||||
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=1,
|
||||
icemaker=1, cooks_into_ice=1, falling_node=1},
|
||||
--drop = "snow:snow_cobble",
|
||||
on_construct = snow_onto_dirt
|
||||
-- Thinking in terms of layers, dirt_with_snow could also double as
|
||||
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
|
||||
on_construct = snow_onto_dirt,
|
||||
groups = groups,
|
||||
})
|
||||
|
||||
|
||||
minetest.override_item("default:snow", {
|
||||
drop = {
|
||||
max_items = 2,
|
||||
|
||||
10
src/sled.lua
10
src/sled.lua
@@ -81,7 +81,7 @@ local sled = {
|
||||
|
||||
local players_sled = {}
|
||||
local function join_sled(self, player)
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
player:setpos(pos)
|
||||
local name = player:get_player_name()
|
||||
players_sled[name] = true
|
||||
@@ -89,7 +89,7 @@ local function join_sled(self, player)
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
self.driver = name
|
||||
self.object:set_attach(player, "", {x=0,y=-9,z=0}, {x=0,y=90,z=0})
|
||||
self.object:setyaw(player:get_look_yaw())-- - math.pi/2)
|
||||
self.object:set_yaw(player:get_look_yaw())-- - math.pi/2)
|
||||
end
|
||||
|
||||
local function leave_sled(self, player)
|
||||
@@ -156,7 +156,7 @@ end
|
||||
|
||||
function sled:on_activate(staticdata)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.object:set_acceleration({x=0, y=-10, z=0})
|
||||
if staticdata then
|
||||
self.v = tonumber(staticdata)
|
||||
end
|
||||
@@ -200,7 +200,7 @@ function sled:on_step(dtime)
|
||||
return
|
||||
end
|
||||
if player:get_player_control().sneak
|
||||
or not accelerating_possible(vector.round(self.object:getpos())) then
|
||||
or not accelerating_possible(vector.round(self.object:get_pos())) then
|
||||
leave_sled(self, player)
|
||||
end
|
||||
end
|
||||
@@ -220,7 +220,7 @@ minetest.register_craftitem("snow:sled", {
|
||||
if players_sled[placer:get_player_name()] then
|
||||
return
|
||||
end
|
||||
local pos = placer:getpos()
|
||||
local pos = placer:get_pos()
|
||||
if accelerating_possible(vector.round(pos)) then
|
||||
pos.y = pos.y+0.5
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
-- Quite a bit of trial-and-error learning here and it boiled down to a
|
||||
-- small handful of code lines making the difference. ~ LazyJ
|
||||
|
||||
local creative_mode = minetest.settings:get_bool("creative_mode")
|
||||
local creative_mode = minetest.settings:get_bool"creative_mode"
|
||||
|
||||
|
||||
local snowball_velocity, entity_attack_delay
|
||||
local function update_snowball_vel(v)
|
||||
snowball_velocity = v
|
||||
local walkspeed = tonumber(minetest.settings:get("movement_speed_walk")) or 4
|
||||
local walkspeed = tonumber(minetest.settings:get"movement_speed_walk") or 4
|
||||
entity_attack_delay = (walkspeed+1)/v
|
||||
end
|
||||
update_snowball_vel(snow.snowball_velocity)
|
||||
@@ -27,11 +27,11 @@ snow.register_on_configuring(function(name, v)
|
||||
end)
|
||||
|
||||
local function get_gravity()
|
||||
local grav = tonumber(minetest.settings:get("movement_gravity")) or 9.81
|
||||
local grav = tonumber(minetest.settings:get"movement_gravity") or 9.81
|
||||
return grav*snowball_gravity
|
||||
end
|
||||
|
||||
local someone_throwing, just_activated
|
||||
local someone_throwing, just_acitvated
|
||||
|
||||
--Shoot snowball
|
||||
function snow.shoot_snowball(item, player)
|
||||
@@ -40,15 +40,15 @@ function snow.shoot_snowball(item, player)
|
||||
local dif = 2*math.sqrt(dir.z*dir.z+dir.x*dir.x)
|
||||
addp.x = dir.z/dif -- + (math.random()-0.5)/5
|
||||
addp.z = -dir.x/dif -- + (math.random()-0.5)/5
|
||||
local pos = vector.add(player:getpos(), addp)
|
||||
local pos = vector.add(player:get_pos(), addp)
|
||||
local obj = minetest.add_entity(pos, "snow:snowball_entity")
|
||||
obj:setvelocity(vector.multiply(dir, snowball_velocity))
|
||||
obj:setacceleration({x=dir.x*-3, y=-get_gravity(), z=dir.z*-3})
|
||||
obj:set_velocity(vector.multiply(dir, snowball_velocity))
|
||||
obj:set_acceleration({x=dir.x*-3, y=-get_gravity(), z=dir.z*-3})
|
||||
obj:get_luaentity().thrower = player:get_player_name()
|
||||
if creative_mode then
|
||||
if not someone_throwing then
|
||||
someone_throwing = true
|
||||
just_activated = true
|
||||
just_acitvated = true
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -82,12 +82,12 @@ if creative_mode then
|
||||
local timer
|
||||
-- only if one holds left click
|
||||
if someone_throwing
|
||||
and not just_activated then
|
||||
and not just_acitvated then
|
||||
update_step()
|
||||
timer = 0.006
|
||||
else
|
||||
timer = 0.5
|
||||
just_activated = false
|
||||
just_acitvated = false
|
||||
end
|
||||
minetest.after(timer, do_step)
|
||||
end
|
||||
@@ -103,13 +103,13 @@ local snow_snowball_ENTITY = {
|
||||
|
||||
function snow_snowball_ENTITY.on_activate(self)
|
||||
self.object:set_properties({textures = {"default_snowball.png^[transform"..math.random(0,7)}})
|
||||
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||
self.lastpos = self.object:getpos()
|
||||
self.object:set_acceleration({x=0, y=-get_gravity(), z=0})
|
||||
self.lastpos = self.object:get_pos()
|
||||
minetest.after(0.1, function(obj)
|
||||
if not obj then
|
||||
return
|
||||
end
|
||||
local vel = obj:getvelocity()
|
||||
local vel = obj:get_velocity()
|
||||
if vel
|
||||
and vel.y ~= 0 then
|
||||
return
|
||||
@@ -118,7 +118,7 @@ function snow_snowball_ENTITY.on_activate(self)
|
||||
if not object then
|
||||
return
|
||||
end
|
||||
local vel_obj = object:getvelocity()
|
||||
local vel_obj = object:get_velocity()
|
||||
if not vel_obj
|
||||
or vel_obj.y == 0 then
|
||||
object:remove()
|
||||
@@ -137,7 +137,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
||||
end
|
||||
|
||||
if self.physical then
|
||||
local vel = self.object:getvelocity()
|
||||
local vel = self.object:get_velocity()
|
||||
local fell = vel.y == 0
|
||||
if not fell then
|
||||
if self.probably_stuck then
|
||||
@@ -155,7 +155,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
||||
self.probably_stuck = nil
|
||||
return
|
||||
end
|
||||
local pos = vector.round(self.object:getpos())
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
pos.y = pos.y-1
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
@@ -171,16 +171,16 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
||||
return
|
||||
end
|
||||
|
||||
local pos = vector.round(self.object:getpos())
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
if vector.equals(pos, self.lastpos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||
--self.object:setvelocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=-get_gravity(), z=0})
|
||||
--self.object:set_velocity({x=0, y=0, z=0})
|
||||
pos = self.lastpos
|
||||
self.object:setpos(pos)
|
||||
minetest.sound_play("default_snow_footstep", {pos=pos, gain=vector.length(self.object:getvelocity())/30})
|
||||
minetest.sound_play("default_snow_footstep", {pos=pos, gain=vector.length(self.object:get_velocity())/30})
|
||||
self.object:set_properties({physical = true})
|
||||
self.physical = true
|
||||
return
|
||||
@@ -199,8 +199,8 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
||||
or (entity_name ~= "snow:snowball_entity"
|
||||
and entity_name ~= "__builtin:item"
|
||||
and entity_name ~= "gauges:hp_bar") then
|
||||
local vvel = v:getvelocity() or v:get_player_velocity()
|
||||
local veldif = self.object:getvelocity()
|
||||
local vvel = v:get_velocity() or v:get_player_velocity()
|
||||
local veldif = self.object:get_velocity()
|
||||
if vvel then
|
||||
veldif = vector.subtract(veldif, vvel)
|
||||
end
|
||||
|
||||
@@ -32,8 +32,8 @@ if minetest.get_modpath("moreblocks") and
|
||||
ice_brick = false,
|
||||
snow_brick = true,
|
||||
snow_cobble = true,
|
||||
ice = false,
|
||||
snowblock = false,
|
||||
ice = true,
|
||||
snowblock = true,
|
||||
}
|
||||
|
||||
for mod, nodes in pairs(snow_nodes) do
|
||||
@@ -45,7 +45,11 @@ if minetest.get_modpath("moreblocks") and
|
||||
ndef.groups.icemaker = nil
|
||||
ndef.groups.cooks_into_ice = nil
|
||||
ndef.after_place_node = nil
|
||||
|
||||
if string.find(name, "ice") then
|
||||
ndef.use_texture_alpha = "blend"
|
||||
else
|
||||
ndef.use_texture_alpha = "opaque"
|
||||
end
|
||||
stairsplus:register_all(mod, name, nodename, ndef)
|
||||
|
||||
if was_in_stairs[name] then
|
||||
|
||||
@@ -3,7 +3,7 @@ snow = {
|
||||
snowball_gravity = tonumber(minetest.settings:get("snow_snowball_gravity")) or 0.91,
|
||||
snowball_velocity = tonumber(minetest.settings:get("snow_snowball_velocity")) or 19,
|
||||
sleds = minetest.settings:get_bool("snow_sleds", true),
|
||||
enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", false),
|
||||
enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", true),
|
||||
lighter_snowfall = minetest.settings:get_bool("snow_lighter_snowfall", false),
|
||||
debug = minetest.settings:get_bool("snow_debug", false),
|
||||
smooth_biomes = minetest.settings:get_bool("snow_smooth_biomes", true),
|
||||
@@ -12,7 +12,7 @@ snow = {
|
||||
min_height = tonumber(minetest.settings:get("snow_min_height")) or 3,
|
||||
mapgen_rarity = tonumber(minetest.settings:get("snow_mapgen_rarity")) or 18,
|
||||
mapgen_size = tonumber(minetest.settings:get("snow_mapgen_size")) or 210,
|
||||
disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", false),
|
||||
disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", true),
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Przed Szerokość: | Wysokość: | Rozmiar: 643 B Po Szerokość: | Wysokość: | Rozmiar: 643 B |
|
Przed Szerokość: | Wysokość: | Rozmiar: 606 B Po Szerokość: | Wysokość: | Rozmiar: 606 B |
Reference in New Issue
Block a user