mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2
This commit is contained in:
commit
4fe944445b
@ -1,4 +1,4 @@
|
||||
local modpath = minetest.get_modpath("mcl_weather");
|
||||
local modpath = minetest.get_modpath("mcl_weather")
|
||||
|
||||
mcl_weather = {}
|
||||
|
||||
|
@ -24,11 +24,8 @@ end
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer >= 0.7 then
|
||||
if timer < 0.7 then return end
|
||||
timer = 0
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
||||
|
@ -94,4 +94,3 @@ if mcl_weather.reg_weathers.snow == nil then
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -6,8 +6,8 @@ mcl_weather.state = "none"
|
||||
-- player list for saving player meta info
|
||||
mcl_weather.players = {}
|
||||
|
||||
-- default weather recalculation interval
|
||||
mcl_weather.check_interval = 300
|
||||
-- default weather check interval for global step
|
||||
mcl_weather.check_interval = 5
|
||||
|
||||
-- weather min duration
|
||||
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)
|
||||
local r
|
||||
if min_duration ~= nil and max_duration ~= nil then
|
||||
r = math.random(min_duration, max_duration);
|
||||
r = math.random(min_duration, max_duration)
|
||||
else
|
||||
r = math.random(mcl_weather.min_duration, mcl_weather.max_duration);
|
||||
r = math.random(mcl_weather.min_duration, mcl_weather.max_duration)
|
||||
end
|
||||
return minetest.get_gametime() + r
|
||||
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
|
||||
end
|
||||
|
||||
local t, wci = 0, mcl_weather.check_interval
|
||||
minetest.register_globalstep(function(dtime)
|
||||
t = t + dtime
|
||||
if t < wci then return end
|
||||
t = 0
|
||||
|
||||
if mcl_weather.end_time == nil then
|
||||
mcl_weather.end_time = mcl_weather.get_rand_end_time()
|
||||
end
|
||||
@ -141,7 +146,7 @@ end)
|
||||
|
||||
-- Sets random weather (which could be 'none' (no weather)).
|
||||
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 random_roll = math.random(0,100)
|
||||
local new_weather
|
||||
@ -155,17 +160,31 @@ mcl_weather.set_random_weather = function(weather_name, weather_meta)
|
||||
mcl_weather.change_weather(new_weather)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Change weather to new_weather.
|
||||
-- * explicit_end_time is OPTIONAL. If specified, explicitly set the
|
||||
-- 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.state ~= nil and mcl_weather.reg_weathers[mcl_weather.state] ~= nil) then
|
||||
mcl_weather.reg_weathers[mcl_weather.state].clear()
|
||||
end
|
||||
|
||||
local old_weather = mcl_weather.state
|
||||
|
||||
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]
|
||||
if explicit_end_time then
|
||||
mcl_weather.end_time = explicit_end_time
|
||||
@ -218,7 +237,7 @@ minetest.register_chatcommand("weather", {
|
||||
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
|
||||
return true
|
||||
else
|
||||
@ -234,13 +253,13 @@ minetest.register_chatcommand("toggledownfall", {
|
||||
func = function(name, param)
|
||||
-- Currently rain/thunder/snow: Set weather to clear
|
||||
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
|
||||
else
|
||||
local new = { "rain", "thunder", "snow" }
|
||||
local r = math.random(1, #new)
|
||||
return mcl_weather.change_weather(new[r])
|
||||
return mcl_weather.change_weather(new[r], nil, name)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -54,12 +54,13 @@ schem_path = settlements.modpath.."/schematics/"
|
||||
--
|
||||
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 = "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 = "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 = "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 = "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"},
|
||||
|
@ -1,3 +1,4 @@
|
||||
mcl_core
|
||||
mcl_loot
|
||||
mcl_farming?
|
||||
mobs_mc?
|
||||
|
@ -162,7 +162,7 @@ minetest.register_craftitem("mcl_villages:tool", {
|
||||
-- build ssettlement
|
||||
--
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pr = PseudoRandom(math.rand(0,32767))
|
||||
local pr = PseudoRandom(math.random(0,32767))
|
||||
-- enable debug routines
|
||||
local center_surface = pointed_thing.under
|
||||
if center_surface then
|
||||
@ -213,10 +213,10 @@ minetest.register_craftitem("mcl_villages:tool", {
|
||||
--
|
||||
if settlements.lvm == true then
|
||||
vm:set_data(data)
|
||||
settlements.place_schematics_lvm(pr)
|
||||
settlements.place_schematics_lvm(settlement_info, pr)
|
||||
vm:write_to_map(true)
|
||||
else
|
||||
settlements.place_schematics()
|
||||
settlements.place_schematics(settlement_info, pr)
|
||||
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_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")
|
||||
@ -235,33 +237,38 @@ function settlements.fill_chest(pos, pr)
|
||||
end
|
||||
-- fill chest
|
||||
local inv = minetest.get_inventory( {type="node", pos=chestpos} )
|
||||
-- always
|
||||
inv:add_item("main", "mcl_core:apple "..pr:next(1,3))
|
||||
-- low value items
|
||||
if pr:next(0,1) < 1 then
|
||||
inv:add_item("main", "mcl_farming:bread "..pr:next(0,3))
|
||||
inv:add_item("main", "mcl_core:iron_ingot "..pr:next(0,3))
|
||||
inv:add_item("main", "mcl_farming:melon_item "..pr:next(0,3))
|
||||
inv:add_item("main", "mcl_farming:carrot_item "..pr:next(0,3))
|
||||
--[[
|
||||
-- additional fillings when farmin mod enabled
|
||||
if minetest.get_modpath("farming") ~= nil and farming.mod == "redo" then
|
||||
if pr:next(0,1) < 1 then
|
||||
inv:add_item("main", "mcl_farming:melon_item "..pr:next(0,3))
|
||||
inv:add_item("main", "mcl_farming:carrot_item "..pr:next(0,3))
|
||||
inv:add_item("main", "farming:corn "..pr:next(0,3))
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
-- medium value items
|
||||
if pr:next(0,3) < 1 then
|
||||
inv:add_item("main", "mcl_tools:pick_iron "..pr:next(0,1))
|
||||
inv:add_item("main", "mcl_tools:pick_stone "..pr:next(0,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))
|
||||
function mcl_villages.get_treasures(pr)
|
||||
local loottable = {
|
||||
{
|
||||
stacks_min = 3,
|
||||
stacks_max = 8,
|
||||
items = {
|
||||
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 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 },
|
||||
{ itemstring = "mcl_farming:bread", weight = 15, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_core:apple", weight = 15, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_tools:pick_iron", weight = 5 },
|
||||
{ itemstring = "mcl_tools:sword_iron", weight = 5 },
|
||||
{ itemstring = "mcl_armor:chestplate_iron", weight = 5 },
|
||||
{ itemstring = "mcl_armor:helmet_iron", weight = 5 },
|
||||
{ itemstring = "mcl_armor:leggings_iron", weight = 5 },
|
||||
{ itemstring = "mcl_armor:boots_iron", weight = 5 },
|
||||
{ itemstring = "mcl_core:obsidian", weight = 5, amount_min = 3, amount_max = 7 },
|
||||
{ itemstring = "mcl_core:sapling", weight = 5, amount_min = 3, amount_max = 7 },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 3 },
|
||||
{ itemstring = "mobs_mc:iron_horse_armor", weight = 1 },
|
||||
{ itemstring = "mobs_mc:gold_horse_armor", weight = 1 },
|
||||
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 1 },
|
||||
}
|
||||
},
|
||||
}
|
||||
local items = mcl_loot.get_multi_loot(loottable, pr)
|
||||
return items
|
||||
end
|
||||
|
||||
local items = mcl_villages.get_treasures(pr)
|
||||
mcl_loot.fill_inventory(inv, "main", items)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user