mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-03 00:03:46 +01:00
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2
commit
4fe944445b
@ -1,4 +1,4 @@
|
|||||||
local modpath = minetest.get_modpath("mcl_weather");
|
local modpath = minetest.get_modpath("mcl_weather")
|
||||||
|
|
||||||
mcl_weather = {}
|
mcl_weather = {}
|
||||||
|
|
||||||
|
@ -24,11 +24,8 @@ end
|
|||||||
local timer = 0
|
local timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
if timer >= 0.7 then
|
if timer < 0.7 then return end
|
||||||
timer = 0
|
timer = 0
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
if not mcl_worlds.has_dust(player:get_pos()) then
|
||||||
|
@ -92,6 +92,5 @@ if mcl_weather.reg_weathers.snow == nil then
|
|||||||
[80] = "rain",
|
[80] = "rain",
|
||||||
[100] = "thunder",
|
[100] = "thunder",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ mcl_weather.state = "none"
|
|||||||
-- player list for saving player meta info
|
-- player list for saving player meta info
|
||||||
mcl_weather.players = {}
|
mcl_weather.players = {}
|
||||||
|
|
||||||
-- default weather recalculation interval
|
-- default weather check interval for global step
|
||||||
mcl_weather.check_interval = 300
|
mcl_weather.check_interval = 5
|
||||||
|
|
||||||
-- weather min duration
|
-- weather min duration
|
||||||
mcl_weather.min_duration = 600
|
mcl_weather.min_duration = 600
|
||||||
@ -47,9 +47,9 @@ minetest.register_on_shutdown(save_weather)
|
|||||||
mcl_weather.get_rand_end_time = function(min_duration, max_duration)
|
mcl_weather.get_rand_end_time = function(min_duration, max_duration)
|
||||||
local r
|
local r
|
||||||
if min_duration ~= nil and max_duration ~= nil then
|
if min_duration ~= nil and max_duration ~= nil then
|
||||||
r = math.random(min_duration, max_duration);
|
r = math.random(min_duration, max_duration)
|
||||||
else
|
else
|
||||||
r = math.random(mcl_weather.min_duration, mcl_weather.max_duration);
|
r = math.random(mcl_weather.min_duration, mcl_weather.max_duration)
|
||||||
end
|
end
|
||||||
return minetest.get_gametime() + r
|
return minetest.get_gametime() + r
|
||||||
end
|
end
|
||||||
@ -121,7 +121,12 @@ mcl_weather.get_random_pos_by_player_look_dir = function(player)
|
|||||||
return random_pos_x, random_pos_y, random_pos_z
|
return random_pos_x, random_pos_y, random_pos_z
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local t, wci = 0, mcl_weather.check_interval
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
t = t + dtime
|
||||||
|
if t < wci then return end
|
||||||
|
t = 0
|
||||||
|
|
||||||
if mcl_weather.end_time == nil then
|
if mcl_weather.end_time == nil then
|
||||||
mcl_weather.end_time = mcl_weather.get_rand_end_time()
|
mcl_weather.end_time = mcl_weather.get_rand_end_time()
|
||||||
end
|
end
|
||||||
@ -141,7 +146,7 @@ end)
|
|||||||
|
|
||||||
-- Sets random weather (which could be 'none' (no weather)).
|
-- Sets random weather (which could be 'none' (no weather)).
|
||||||
mcl_weather.set_random_weather = function(weather_name, weather_meta)
|
mcl_weather.set_random_weather = function(weather_name, weather_meta)
|
||||||
if (weather_meta ~= nil) then
|
if weather_meta == nil then return end
|
||||||
local transitions = weather_meta.transitions
|
local transitions = weather_meta.transitions
|
||||||
local random_roll = math.random(0,100)
|
local random_roll = math.random(0,100)
|
||||||
local new_weather
|
local new_weather
|
||||||
@ -154,18 +159,32 @@ mcl_weather.set_random_weather = function(weather_name, weather_meta)
|
|||||||
if new_weather then
|
if new_weather then
|
||||||
mcl_weather.change_weather(new_weather)
|
mcl_weather.change_weather(new_weather)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Change weather to new_weather.
|
-- Change weather to new_weather.
|
||||||
-- * explicit_end_time is OPTIONAL. If specified, explicitly set the
|
-- * explicit_end_time is OPTIONAL. If specified, explicitly set the
|
||||||
-- gametime (minetest.get_gametime) in which the weather ends.
|
-- gametime (minetest.get_gametime) in which the weather ends.
|
||||||
mcl_weather.change_weather = function(new_weather, explicit_end_time)
|
-- * changer is OPTIONAL, for logging purposes.
|
||||||
|
mcl_weather.change_weather = function(new_weather, explicit_end_time, changer_name)
|
||||||
|
local changer_name = changer_name or debug.getinfo(2).name.."()"
|
||||||
|
|
||||||
if (mcl_weather.reg_weathers ~= nil and mcl_weather.reg_weathers[new_weather] ~= nil) then
|
if (mcl_weather.reg_weathers ~= nil and mcl_weather.reg_weathers[new_weather] ~= nil) then
|
||||||
if (mcl_weather.state ~= nil and mcl_weather.reg_weathers[mcl_weather.state] ~= nil) then
|
if (mcl_weather.state ~= nil and mcl_weather.reg_weathers[mcl_weather.state] ~= nil) then
|
||||||
mcl_weather.reg_weathers[mcl_weather.state].clear()
|
mcl_weather.reg_weathers[mcl_weather.state].clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local old_weather = mcl_weather.state
|
||||||
|
|
||||||
mcl_weather.state = new_weather
|
mcl_weather.state = new_weather
|
||||||
|
|
||||||
|
if old_weather == "none" then
|
||||||
|
old_weather = "clear"
|
||||||
|
end
|
||||||
|
if new_weather == "none" then
|
||||||
|
new_weather = "clear"
|
||||||
|
end
|
||||||
|
minetest.log("action", "[mcl_weather] " .. changer_name .. " changed the weather from " .. old_weather .. " to " .. new_weather)
|
||||||
|
|
||||||
local weather_meta = mcl_weather.reg_weathers[mcl_weather.state]
|
local weather_meta = mcl_weather.reg_weathers[mcl_weather.state]
|
||||||
if explicit_end_time then
|
if explicit_end_time then
|
||||||
mcl_weather.end_time = explicit_end_time
|
mcl_weather.end_time = explicit_end_time
|
||||||
@ -218,7 +237,7 @@ minetest.register_chatcommand("weather", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local success = mcl_weather.change_weather(new_weather, end_time)
|
local success = mcl_weather.change_weather(new_weather, end_time, name)
|
||||||
if success then
|
if success then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@ -234,13 +253,13 @@ minetest.register_chatcommand("toggledownfall", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
-- Currently rain/thunder/snow: Set weather to clear
|
-- Currently rain/thunder/snow: Set weather to clear
|
||||||
if mcl_weather.state ~= "none" then
|
if mcl_weather.state ~= "none" then
|
||||||
return mcl_weather.change_weather("none")
|
return mcl_weather.change_weather("none", nil, name)
|
||||||
|
|
||||||
-- Currently clear: Set weather randomly to rain/thunder/snow
|
-- Currently clear: Set weather randomly to rain/thunder/snow
|
||||||
else
|
else
|
||||||
local new = { "rain", "thunder", "snow" }
|
local new = { "rain", "thunder", "snow" }
|
||||||
local r = math.random(1, #new)
|
local r = math.random(1, #new)
|
||||||
return mcl_weather.change_weather(new[r])
|
return mcl_weather.change_weather(new[r], nil, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -54,12 +54,13 @@ schem_path = settlements.modpath.."/schematics/"
|
|||||||
--
|
--
|
||||||
schematic_table = {
|
schematic_table = {
|
||||||
{name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08, rplc = "n"},
|
{name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08, rplc = "n"},
|
||||||
{name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.050, rplc = "n"},
|
{name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.055, rplc = "n"},
|
||||||
|
{name = "butcher", mts = schem_path.."butcher.mts", hwidth = 11, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03, rplc = "n"},
|
||||||
{name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04, rplc = "n"},
|
{name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04, rplc = "n"},
|
||||||
{name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1, rplc = "n"},
|
{name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1, rplc = "n"},
|
||||||
{name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"},
|
{name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"},
|
||||||
{name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04, rplc = "n"},
|
{name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04, rplc = "n"},
|
||||||
{name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.09, rplc = "n"},
|
{name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08, rplc = "n"},
|
||||||
{name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7, rplc = "n"},
|
{name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7, rplc = "n"},
|
||||||
{name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = "n"},
|
{name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = "n"},
|
||||||
{name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = "n"},
|
{name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = "n"},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
mcl_core
|
mcl_core
|
||||||
|
mcl_loot
|
||||||
mcl_farming?
|
mcl_farming?
|
||||||
mobs_mc?
|
mobs_mc?
|
||||||
|
@ -162,7 +162,7 @@ minetest.register_craftitem("mcl_villages:tool", {
|
|||||||
-- build ssettlement
|
-- build ssettlement
|
||||||
--
|
--
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local pr = PseudoRandom(math.rand(0,32767))
|
local pr = PseudoRandom(math.random(0,32767))
|
||||||
-- enable debug routines
|
-- enable debug routines
|
||||||
local center_surface = pointed_thing.under
|
local center_surface = pointed_thing.under
|
||||||
if center_surface then
|
if center_surface then
|
||||||
@ -213,10 +213,10 @@ minetest.register_craftitem("mcl_villages:tool", {
|
|||||||
--
|
--
|
||||||
if settlements.lvm == true then
|
if settlements.lvm == true then
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
settlements.place_schematics_lvm(pr)
|
settlements.place_schematics_lvm(settlement_info, pr)
|
||||||
vm:write_to_map(true)
|
vm:write_to_map(true)
|
||||||
else
|
else
|
||||||
settlements.place_schematics()
|
settlements.place_schematics(settlement_info, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
|
Binary file not shown.
BIN
mods/MAPGEN/mcl_villages/schematics/butcher.mts
Normal file
BIN
mods/MAPGEN/mcl_villages/schematics/butcher.mts
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.0 MiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 MiB |
@ -1,3 +1,5 @@
|
|||||||
|
mcl_villages = {}
|
||||||
|
|
||||||
local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass")
|
local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass")
|
||||||
local c_dirt_with_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
|
local c_dirt_with_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
|
||||||
--local c_dirt_with_dry_grass = minetest.get_content_id("mcl_core:dirt_with_dry_grass")
|
--local c_dirt_with_dry_grass = minetest.get_content_id("mcl_core:dirt_with_dry_grass")
|
||||||
@ -235,33 +237,38 @@ function settlements.fill_chest(pos, pr)
|
|||||||
end
|
end
|
||||||
-- fill chest
|
-- fill chest
|
||||||
local inv = minetest.get_inventory( {type="node", pos=chestpos} )
|
local inv = minetest.get_inventory( {type="node", pos=chestpos} )
|
||||||
-- always
|
function mcl_villages.get_treasures(pr)
|
||||||
inv:add_item("main", "mcl_core:apple "..pr:next(1,3))
|
local loottable = {
|
||||||
-- low value items
|
{
|
||||||
if pr:next(0,1) < 1 then
|
stacks_min = 3,
|
||||||
inv:add_item("main", "mcl_farming:bread "..pr:next(0,3))
|
stacks_max = 8,
|
||||||
inv:add_item("main", "mcl_core:iron_ingot "..pr:next(0,3))
|
items = {
|
||||||
inv:add_item("main", "mcl_farming:melon_item "..pr:next(0,3))
|
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 },
|
||||||
inv:add_item("main", "mcl_farming:carrot_item "..pr:next(0,3))
|
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 5 },
|
||||||
--[[
|
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 3 },
|
||||||
-- additional fillings when farmin mod enabled
|
{ itemstring = "mcl_farming:bread", weight = 15, amount_min = 1, amount_max = 3 },
|
||||||
if minetest.get_modpath("farming") ~= nil and farming.mod == "redo" then
|
{ itemstring = "mcl_core:apple", weight = 15, amount_min = 1, amount_max = 3 },
|
||||||
if pr:next(0,1) < 1 then
|
{ itemstring = "mcl_tools:pick_iron", weight = 5 },
|
||||||
inv:add_item("main", "mcl_farming:melon_item "..pr:next(0,3))
|
{ itemstring = "mcl_tools:sword_iron", weight = 5 },
|
||||||
inv:add_item("main", "mcl_farming:carrot_item "..pr:next(0,3))
|
{ itemstring = "mcl_armor:chestplate_iron", weight = 5 },
|
||||||
inv:add_item("main", "farming:corn "..pr:next(0,3))
|
{ itemstring = "mcl_armor:helmet_iron", weight = 5 },
|
||||||
end
|
{ itemstring = "mcl_armor:leggings_iron", weight = 5 },
|
||||||
end
|
{ itemstring = "mcl_armor:boots_iron", weight = 5 },
|
||||||
--]]
|
{ itemstring = "mcl_core:obsidian", weight = 5, amount_min = 3, amount_max = 7 },
|
||||||
end
|
{ itemstring = "mcl_core:sapling", weight = 5, amount_min = 3, amount_max = 7 },
|
||||||
-- medium value items
|
{ itemstring = "mcl_mobitems:saddle", weight = 3 },
|
||||||
if pr:next(0,3) < 1 then
|
{ itemstring = "mobs_mc:iron_horse_armor", weight = 1 },
|
||||||
inv:add_item("main", "mcl_tools:pick_iron "..pr:next(0,1))
|
{ itemstring = "mobs_mc:gold_horse_armor", weight = 1 },
|
||||||
inv:add_item("main", "mcl_tools:pick_stone "..pr:next(0,1))
|
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 1 },
|
||||||
inv:add_item("main", "mcl_fire:flint_and_steel "..pr:next(0,1))
|
}
|
||||||
inv:add_item("main", "mcl_buckets:bucket_empty "..pr:next(0,1))
|
},
|
||||||
inv:add_item("main", "mcl_tools:sword_iron "..pr:next(0,1))
|
}
|
||||||
|
local items = mcl_loot.get_multi_loot(loottable, pr)
|
||||||
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local items = mcl_villages.get_treasures(pr)
|
||||||
|
mcl_loot.fill_inventory(inv, "main", items)
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user