Merge remote-tracking branch 'origin/master' into heads_16_direction

This commit is contained in:
iliekprogrammar 2022-08-11 18:12:19 +08:00
commit efd1a023f0
No known key found for this signature in database
GPG Key ID: 8E7B20514DBCFBFA
21 changed files with 109 additions and 16 deletions

View File

@ -337,7 +337,6 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
if not obj:is_player() then if not obj:is_player() then
return return
end end
mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source}) mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
obj:add_velocity(vector.multiply(punch_dir, impact * 20)) obj:add_velocity(vector.multiply(punch_dir, impact * 20))

View File

@ -24,6 +24,10 @@ local function is_ice(pos)
return is_group(pos, "ice") return is_group(pos, "ice")
end end
local function is_fire(pos)
return is_group(pos, "set_on_fire")
end
local function get_sign(i) local function get_sign(i)
if i == 0 then if i == 0 then
return 0 return 0
@ -202,6 +206,8 @@ end
function boat.on_step(self, dtime, moveresult) function boat.on_step(self, dtime, moveresult)
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
-- mcl_burning.tick may remove object immediately
if not self.object:get_pos() then return end
self._v = get_v(self.object:get_velocity()) * get_sign(self._v) self._v = get_v(self.object:get_velocity()) * get_sign(self._v)
local v_factor = 1 local v_factor = 1
@ -216,6 +222,10 @@ function boat.on_step(self, dtime, moveresult)
on_water = false on_water = false
if not in_water and is_ice(waterp) then if not in_water and is_ice(waterp) then
on_ice = true on_ice = true
elseif is_fire({x=p.x, y=p.y-boat_y_offset, z=p.z}) then
boat.on_death(self, nil)
self.object:remove()
return
else else
v_slowdown = 0.04 v_slowdown = 0.04
v_factor = 0.5 v_factor = 0.5

View File

@ -3618,6 +3618,8 @@ local mob_step = function(self, dtime)
check_aggro(self,dtime) check_aggro(self,dtime)
if not self.fire_resistant then if not self.fire_resistant then
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
-- mcl_burning.tick may remove object immediately
if not self.object:get_pos() then return end
end end
local pos = self.object:get_pos() local pos = self.object:get_pos()

View File

@ -120,9 +120,10 @@ function lightning.strike(pos)
if not pos then if not pos then
return false return false
end end
local objects = get_objects_inside_radius(pos2, 3.5)
if lightning.on_strike_functions then if lightning.on_strike_functions then
for _, func in pairs(lightning.on_strike_functions) do for _, func in pairs(lightning.on_strike_functions) do
-- allow on_strike callbacks to destroy entities by re-obtaining objects for each callback
local objects = get_objects_inside_radius(pos2, 3.5)
func(pos, pos2, objects) func(pos, pos2, objects)
end end
end end
@ -174,6 +175,7 @@ lightning.register_on_strike(function(pos, pos2, objects)
elseif lua and lua.name == "mobs_mc:creeper" then elseif lua and lua.name == "mobs_mc:creeper" then
mcl_util.replace_mob(obj, "mobs_mc:creeper_charged") mcl_util.replace_mob(obj, "mobs_mc:creeper_charged")
else else
-- WARNING: unsafe entity handling. object may be removed immediately
mcl_util.deal_damage(obj, 5, { type = "lightning_bolt" }) mcl_util.deal_damage(obj, 5, { type = "lightning_bolt" })
end end
end end
@ -182,8 +184,9 @@ lightning.register_on_strike(function(pos, pos2, objects)
for i = 1, #playerlist do for i = 1, #playerlist do
local player = playerlist[i] local player = playerlist[i]
local sky = {} local sky = {}
local sky_table = player:get_sky(true)
sky.bgcolor, sky.type, sky.textures = player:get_sky() sky.bgcolor, sky.type, sky.textures = sky_table.base_color, sky_table.type, sky_table.textures
local name = player:get_player_name() local name = player:get_player_name()
if ps[name] == nil then if ps[name] == nil then

View File

@ -2,6 +2,7 @@ local PARTICLES_COUNT_RAIN = tonumber(minetest.settings:get("mcl_weather_rain_pa
local PARTICLES_COUNT_THUNDER = tonumber(minetest.settings:get("mcl_weather_thunder_particles")) or 900 local PARTICLES_COUNT_THUNDER = tonumber(minetest.settings:get("mcl_weather_thunder_particles")) or 900
local get_connected_players = minetest.get_connected_players local get_connected_players = minetest.get_connected_players
local mgname = minetest.get_mapgen_setting("mg_name")
mcl_weather.rain = { mcl_weather.rain = {
-- max rain particles created at time -- max rain particles created at time
@ -91,7 +92,7 @@ end
function mcl_weather.rain.add_player(player) function mcl_weather.rain.add_player(player)
if mcl_weather.players[player:get_player_name()] == nil then if mcl_weather.players[player:get_player_name()] == nil then
local player_meta = {} local player_meta = {}
player_meta.origin_sky = {player:get_sky()} player_meta.origin_sky = {player:get_sky(true)}
mcl_weather.players[player:get_player_name()] = player_meta mcl_weather.players[player:get_player_name()] = player_meta
update_sound[player:get_player_name()]=true update_sound[player:get_player_name()]=true
end end

View File

@ -246,7 +246,7 @@ mcl_weather.skycolor = {
get_current_bg_color = function() get_current_bg_color = function()
local players = mcl_weather.skycolor.utils.get_players(nil) local players = mcl_weather.skycolor.utils.get_players(nil)
if players[1] then if players[1] then
return players[1]:get_sky() return players[1]:get_sky(true).sky_color
end end
return nil return nil
end end

View File

@ -106,7 +106,7 @@ local function info()
end end
after(refresh_interval, info) after(refresh_interval, info)
end end
info() minetest.after(0,info)
minetest.register_on_leaveplayer(function(p) minetest.register_on_leaveplayer(function(p)
local name = p:get_player_name() local name = p:get_player_name()

View File

@ -261,7 +261,7 @@ local dispenserdef = {
local item_entity = minetest.add_item(droppos, dropitem) local item_entity = minetest.add_item(droppos, dropitem)
local drop_vel = vector.subtract(droppos, pos) local drop_vel = vector.subtract(droppos, pos)
local speed = 3 local speed = 3
item_entity:set_velocity(drop_vel * speed) item_entity:set_velocity(vector.multiply(drop_vel,speed))
end end
else else
stack:take_item() stack:take_item()
@ -278,7 +278,7 @@ local dispenserdef = {
local item_entity = minetest.add_item(droppos, dropitem) local item_entity = minetest.add_item(droppos, dropitem)
local drop_vel = vector.subtract(droppos, pos) local drop_vel = vector.subtract(droppos, pos)
local speed = 3 local speed = 3
item_entity:set_velocity(drop_vel * speed) item_entity:set_velocity(vector.multiply(drop_vel,speed))
stack:take_item() stack:take_item()
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end end

View File

@ -143,7 +143,7 @@ local dropperdef = {
local item_entity = minetest.add_item(droppos, dropitem) local item_entity = minetest.add_item(droppos, dropitem)
local drop_vel = vector.subtract(droppos, pos) local drop_vel = vector.subtract(droppos, pos)
local speed = 3 local speed = 3
item_entity:set_velocity(drop_vel * speed) item_entity:set_velocity(vector.multiply(drop_vel,speed))
stack:take_item() stack:take_item()
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end end

View File

@ -90,6 +90,8 @@ mcl_damage.register_modifier(function(obj, damage, reason)
if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then
mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj}) mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj})
-- mcl_util.deal_damage may remove object immediately
if not reason.source:get_pos() then return end
local thorns_item = thorns_pieces[math.random(#thorns_pieces)] local thorns_item = thorns_pieces[math.random(#thorns_pieces)]

View File

@ -98,7 +98,7 @@ minetest.register_node("mcl_beacons:beacon_beam", {
} }
}, },
pointable= false, pointable= false,
light_source = 15, light_source = 14,
walkable = false, walkable = false,
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
_mcl_blast_resistance = 1200, _mcl_blast_resistance = 1200,
@ -226,6 +226,7 @@ minetest.register_node("mcl_beacons:beacon", {
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
mesh = "mcl_beacon.b3d", mesh = "mcl_beacon.b3d",
tiles = {"beacon_UV.png"}, tiles = {"beacon_UV.png"},
use_texture_alpha = "clip",
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -333,7 +334,7 @@ minetest.register_node("mcl_beacons:beacon", {
end end
end end
end, end,
light_source = 15, light_source = 14,
groups = {handy=1}, groups = {handy=1},
drop = "mcl_beacons:beacon", drop = "mcl_beacons:beacon",
sounds = mcl_sounds.node_sound_glass_defaults(), sounds = mcl_sounds.node_sound_glass_defaults(),

View File

@ -1,2 +1,3 @@
name = mcl_beacons
author=chmodsayshello author=chmodsayshello
depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems, mcl_nether depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems, mcl_nether

View File

@ -115,6 +115,8 @@ end
function ARROW_ENTITY.on_step(self, dtime) function ARROW_ENTITY.on_step(self, dtime)
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
-- mcl_burning.tick may remove object immediately
if not self.object:get_pos() then return end
self._time_in_air = self._time_in_air + .001 self._time_in_air = self._time_in_air + .001

View File

@ -313,6 +313,8 @@ end
function ARROW_ENTITY.on_step(self, dtime) function ARROW_ENTITY.on_step(self, dtime)
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
-- mcl_burning.tick may remove object immediately
if not self.object:get_pos() then return end
self._time_in_air = self._time_in_air + .001 self._time_in_air = self._time_in_air + .001

View File

@ -11,7 +11,7 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local campfires = { local campfires = {
{ name = "Campfire", lightlevel = 15, techname = "campfire", damage = 1, drops = "mcl_core:charcoal_lump 2" }, { name = "Campfire", lightlevel = 14, techname = "campfire", damage = 1, drops = "mcl_core:charcoal_lump 2" },
{ name = "Soul Campfire", lightlevel = 10, techname = "soul_campfire", damage = 2, drops = "mcl_blackstone:soul_soil" }, { name = "Soul Campfire", lightlevel = 10, techname = "soul_campfire", damage = 2, drops = "mcl_blackstone:soul_soil" },
} }
@ -25,6 +25,7 @@ for _, campfire in pairs(campfires) do
drawtype = "mesh", drawtype = "mesh",
mesh = "mcl_campfires_campfire.obj", mesh = "mcl_campfires_campfire.obj",
tiles = {{name="mcl_campfires_log.png"},}, tiles = {{name="mcl_campfires_log.png"},},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, }, groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -73,6 +74,7 @@ for _, campfire in pairs(campfires) do
length=2.0 length=2.0
}} }}
}, },
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 }, groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",

View File

@ -1053,7 +1053,7 @@ for i=1,8 do
mcl_core.clear_snow_dirt(npos, node) mcl_core.clear_snow_dirt(npos, node)
end, end,
node_box = node_box, node_box = node_box,
groups = {shovely=1, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i}, groups = {shovely=2, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i},
sounds = mcl_sounds.node_sound_snow_defaults(), sounds = mcl_sounds.node_sound_snow_defaults(),
on_construct = mcl_core.on_snow_construct, on_construct = mcl_core.on_snow_construct,
on_place = on_place, on_place = on_place,
@ -1072,7 +1072,7 @@ minetest.register_node("mcl_core:snowblock", {
tiles = {"default_snow.png"}, tiles = {"default_snow.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {shovely=1, building_block=1, snow_cover=1}, groups = {shovely=2, building_block=1, snow_cover=1},
sounds = mcl_sounds.node_sound_snow_defaults(), sounds = mcl_sounds.node_sound_snow_defaults(),
on_construct = mcl_core.on_snow_construct, on_construct = mcl_core.on_snow_construct,
after_destruct = mcl_core.after_snow_destruct, after_destruct = mcl_core.after_snow_destruct,

View File

@ -31,6 +31,7 @@ minetest.register_node("mcl_stonecutter:stonecutter", {
length=1 length=1
}} }}
}, },
use_texture_alpha = "clip",
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",

View File

@ -288,7 +288,7 @@ minetest.register_tool("mcl_tools:shovel_wood", {
_repair_material = "group:wood", _repair_material = "group:wood",
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
_mcl_diggroups = { _mcl_diggroups = {
shovely = { speed = 2, level = 1, uses = 60 } shovely = { speed = 2, level = 2, uses = 60 }
}, },
}) })
minetest.register_tool("mcl_tools:shovel_stone", { minetest.register_tool("mcl_tools:shovel_stone", {

View File

@ -246,7 +246,7 @@ dofile(modpath.."/igloo.lua")
dofile(modpath.."/woodland_mansion.lua") dofile(modpath.."/woodland_mansion.lua")
dofile(modpath.."/ruined_portal.lua") dofile(modpath.."/ruined_portal.lua")
dofile(modpath.."/geode.lua") dofile(modpath.."/geode.lua")
dofile(modpath.."/pillager_outpost.lua")
mcl_structures.register_structure("desert_well",{ mcl_structures.register_structure("desert_well",{

View File

@ -0,0 +1,67 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("pillager_outpost",{
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"},
fill_ratio = 0.01,
flags = "place_center_x, place_center_z",
solid_ground = true,
make_foundation = true,
sidelen = 18,
y_offset = 0,
chunk_probability = 600,
y_max = mcl_vars.mg_overworld_max,
y_min = 1,
biomes = { "Desert", "Plains", "Savanna", "IcePlains", "Taiga" },
filenames = { modpath.."/schematics/mcl_structures_pillager_outpost.mts" },
loot = {
["mcl_chests:chest_small" ] ={
{
stacks_min = 2,
stacks_max = 3,
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 3, amount_max=5 },
{ itemstring = "mcl_farming:carrot_item", weight = 5, amount_min = 3, amount_max=5 },
{ itemstring = "mcl_farming:potato_item", weight = 5, amount_min = 2, amount_max=5 },
}
},
{
stacks_min = 1,
stacks_max = 2,
items = {
{ itemstring = "mcl_experience:bottle", weight = 6, amount_min = 0, amount_max=1 },
{ itemstring = "mcl_bows:arrow", weight = 4, amount_min = 2, amount_max=7 },
{ itemstring = "mcl_mobitems:string", weight = 4, amount_min = 1, amount_max=6 },
{ itemstring = "mcl_core:iron_ingot", weight = 3, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
}
},
{
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_core:darktree", amount_min = 2, amount_max=3 },
}
},
{
stacks_min = 1,
stacks_max = 1,
items = {
{ itemstring = "mcl_bows:crossbow" },
}
}}
},
after_place = function(p,def,pr)
local p1 = vector.offset(p,-7,0,-7)
local p2 = vector.offset(p,7,14,7)
for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do
local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")]
if def and def.on_construct then
def.on_construct(n)
end
end
end
})