mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Merge branch 'master' into biome_skycolor_otherworlds
This commit is contained in:
commit
f84bdbd777
14 changed files with 141 additions and 111 deletions
|
@ -155,7 +155,6 @@ end, true)
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||||
if not damage_enabled then return 0 end
|
if not damage_enabled then return 0 end
|
||||||
if player:get_hp() > 0 then
|
if player:get_hp() > 0 then
|
||||||
mt_reason.approved = true
|
|
||||||
if hp_change < 0 then
|
if hp_change < 0 then
|
||||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||||
end
|
end
|
||||||
|
@ -163,9 +162,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player, mt_reason)
|
minetest.register_on_dieplayer(function(player, mt_reason)
|
||||||
if mt_reason.approved then
|
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
||||||
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
|
||||||
end
|
|
||||||
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
|
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -335,24 +335,27 @@ function mob_class:on_step(dtime)
|
||||||
|
|
||||||
if self:check_despawn(pos, dtime) then return true end
|
if self:check_despawn(pos, dtime) then return true end
|
||||||
|
|
||||||
self:slow_mob()
|
if self:check_death_and_slow_mob() then
|
||||||
|
--minetest.log("action", "Mob is dying: ".. tostring(self.name))
|
||||||
|
-- Do we abandon out of here now?
|
||||||
|
end
|
||||||
|
|
||||||
if self:falling(pos) then return end
|
if self:falling(pos) then return end
|
||||||
self:check_suspend()
|
self:check_suspend()
|
||||||
|
|
||||||
self:check_water_flow()
|
|
||||||
|
|
||||||
self:env_danger_movement_checks (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
|
-- mcl_burning.tick may remove object immediately
|
||||||
if not self.object:get_pos() then return end
|
if not self.object:get_pos() then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
if mobs_debug then self:update_tag() end
|
|
||||||
|
|
||||||
if self.state == "die" then return end
|
if self.state == "die" then return end
|
||||||
|
|
||||||
|
self:check_water_flow()
|
||||||
|
self:env_danger_movement_checks (dtime)
|
||||||
|
|
||||||
|
if mobs_debug then self:update_tag() end
|
||||||
|
|
||||||
self:follow_flop() -- Mob following code.
|
self:follow_flop() -- Mob following code.
|
||||||
|
|
||||||
self:set_animation_speed() -- set animation speed relitive to velocity
|
self:set_animation_speed() -- set animation speed relitive to velocity
|
||||||
|
|
|
@ -746,7 +746,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
|
|
||||||
local name = hitter:get_player_name() or ""
|
local name = hitter:get_player_name() or ""
|
||||||
|
|
||||||
-- attack puncher and call other mobs for help
|
-- attack puncher
|
||||||
if self.passive == false
|
if self.passive == false
|
||||||
and self.state ~= "flop"
|
and self.state ~= "flop"
|
||||||
and (self.child == false or self.type == "monster")
|
and (self.child == false or self.type == "monster")
|
||||||
|
@ -758,37 +758,37 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
self:do_attack(hitter)
|
self:do_attack(hitter)
|
||||||
self._aggro= true
|
self._aggro= true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- alert others to the attack
|
-- alert others to the attack
|
||||||
local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range)
|
local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range)
|
||||||
local obj = nil
|
local obj = nil
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
|
|
||||||
obj = objs[n]:get_luaentity()
|
obj = objs[n]:get_luaentity()
|
||||||
|
|
||||||
if obj then
|
if obj then
|
||||||
-- only alert members of same mob or friends
|
-- only alert members of same mob or friends
|
||||||
if obj.group_attack
|
if obj.group_attack
|
||||||
and obj.state ~= "attack"
|
and obj.state ~= "attack"
|
||||||
and obj.owner ~= name then
|
and obj.owner ~= name then
|
||||||
if obj.name == self.name then
|
if obj.name == self.name then
|
||||||
obj:do_attack(hitter)
|
obj:do_attack(hitter)
|
||||||
elseif type(obj.group_attack) == "table" then
|
elseif type(obj.group_attack) == "table" then
|
||||||
for i=1, #obj.group_attack do
|
for i=1, #obj.group_attack do
|
||||||
if obj.name == obj.group_attack[i] then
|
if obj.group_attack[i] == self.name then
|
||||||
obj._aggro = true
|
obj._aggro = true
|
||||||
obj:do_attack(hitter)
|
obj:do_attack(hitter)
|
||||||
break
|
break
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- have owned mobs attack player threat
|
-- have owned mobs attack player threat
|
||||||
if obj.owner == name and obj.owner_loyal then
|
if obj.owner == name and obj.owner_loyal then
|
||||||
obj:do_attack(self.object)
|
obj:do_attack(self.object)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -279,6 +279,7 @@ function mob_class:env_danger_movement_checks(dtime)
|
||||||
yaw = self:set_yaw( yaw, 8)
|
yaw = self:set_yaw( yaw, 8)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- This code should probably be moved to movement code
|
||||||
if self.move_in_group ~= false then
|
if self.move_in_group ~= false then
|
||||||
self:check_herd(dtime)
|
self:check_herd(dtime)
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,8 @@ end
|
||||||
|
|
||||||
function mob_class:player_in_active_range()
|
function mob_class:player_in_active_range()
|
||||||
for _,p in pairs(minetest.get_connected_players()) do
|
for _,p in pairs(minetest.get_connected_players()) do
|
||||||
if vector.distance(self.object:get_pos(),p:get_pos()) <= mob_active_range then return true end
|
local pos = self.object:get_pos()
|
||||||
|
if pos and vector.distance(pos, p:get_pos()) <= mob_active_range then return true end
|
||||||
-- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning.
|
-- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -182,15 +183,17 @@ function mob_class:collision()
|
||||||
return({x,z})
|
return({x,z})
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob_class:slow_mob()
|
function mob_class:check_death_and_slow_mob()
|
||||||
local d = 0.85
|
local d = 0.85
|
||||||
if self:check_dying() then d = 0.92 end
|
local dying = self:check_dying()
|
||||||
|
if dying then d = 0.92 end
|
||||||
|
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
if v then
|
if v then
|
||||||
--diffuse object velocity
|
--diffuse object velocity
|
||||||
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
||||||
end
|
end
|
||||||
|
return dying
|
||||||
end
|
end
|
||||||
|
|
||||||
-- move mob in facing direction
|
-- move mob in facing direction
|
||||||
|
@ -519,17 +522,16 @@ function mob_class:check_for_death(cause, cmi_cause)
|
||||||
|
|
||||||
self:set_velocity(0)
|
self:set_velocity(0)
|
||||||
local acc = self.object:get_acceleration()
|
local acc = self.object:get_acceleration()
|
||||||
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
|
if acc then
|
||||||
self.object:set_acceleration(acc)
|
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
|
||||||
|
self.object:set_acceleration(acc)
|
||||||
|
end
|
||||||
|
|
||||||
local length
|
local length
|
||||||
-- default death function and die animation (if defined)
|
-- default death function and die animation (if defined)
|
||||||
if self.instant_death then
|
if self.instant_death then
|
||||||
length = 0
|
length = 0
|
||||||
elseif self.animation
|
elseif self.animation and self.animation.die_start and self.animation.die_end then
|
||||||
and self.animation.die_start
|
|
||||||
and self.animation.die_end then
|
|
||||||
|
|
||||||
local frames = self.animation.die_end - self.animation.die_start
|
local frames = self.animation.die_end - self.animation.die_start
|
||||||
local speed = self.animation.die_speed or 15
|
local speed = self.animation.die_speed or 15
|
||||||
length = math.max(frames / speed, 0) + DEATH_DELAY
|
length = math.max(frames / speed, 0) + DEATH_DELAY
|
||||||
|
@ -545,7 +547,6 @@ function mob_class:check_for_death(cause, cmi_cause)
|
||||||
if not self.object:get_luaentity() then
|
if not self.object:get_luaentity() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
death_handle(self)
|
death_handle(self)
|
||||||
local dpos = self.object:get_pos()
|
local dpos = self.object:get_pos()
|
||||||
local cbox = self.collisionbox
|
local cbox = self.collisionbox
|
||||||
|
@ -554,6 +555,7 @@ function mob_class:check_for_death(cause, cmi_cause)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
||||||
end
|
end
|
||||||
|
|
||||||
if length <= 0 then
|
if length <= 0 then
|
||||||
kill(self)
|
kill(self)
|
||||||
else
|
else
|
||||||
|
@ -870,33 +872,32 @@ function mob_class:falling(pos)
|
||||||
|
|
||||||
-- floating in water (or falling)
|
-- floating in water (or falling)
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
|
if v then
|
||||||
|
if v.y > 0 then
|
||||||
|
-- apply gravity when moving up
|
||||||
|
self.object:set_acceleration({
|
||||||
|
x = 0,
|
||||||
|
y = DEFAULT_FALL_SPEED,
|
||||||
|
z = 0
|
||||||
|
})
|
||||||
|
|
||||||
if v.y > 0 then
|
elseif v.y <= 0 and v.y > self.fall_speed then
|
||||||
|
-- fall downwards at set speed
|
||||||
-- apply gravity when moving up
|
self.object:set_acceleration({
|
||||||
self.object:set_acceleration({
|
x = 0,
|
||||||
x = 0,
|
y = self.fall_speed,
|
||||||
y = DEFAULT_FALL_SPEED,
|
z = 0
|
||||||
z = 0
|
})
|
||||||
})
|
else
|
||||||
|
-- stop accelerating once max fall speed hit
|
||||||
elseif v.y <= 0 and v.y > self.fall_speed then
|
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
||||||
|
end
|
||||||
-- fall downwards at set speed
|
|
||||||
self.object:set_acceleration({
|
|
||||||
x = 0,
|
|
||||||
y = self.fall_speed,
|
|
||||||
z = 0
|
|
||||||
})
|
|
||||||
else
|
|
||||||
-- stop accelerating once max fall speed hit
|
|
||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local acc = self.object:get_acceleration()
|
||||||
|
|
||||||
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
|
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
|
||||||
|
if acc and self.floats_on_lava == 1 then
|
||||||
if self.floats_on_lava == 1 then
|
|
||||||
|
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
||||||
|
@ -907,9 +908,7 @@ function mob_class:falling(pos)
|
||||||
|
|
||||||
-- in water then float up
|
-- in water then float up
|
||||||
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
||||||
|
if acc and self.floats == 1 then
|
||||||
if self.floats == 1 then
|
|
||||||
|
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
||||||
|
@ -917,10 +916,8 @@ function mob_class:falling(pos)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
-- fall damage onto solid ground
|
-- fall damage onto solid ground
|
||||||
if self.fall_damage == 1
|
if self.fall_damage == 1 and self.object:get_velocity().y == 0 then
|
||||||
and self.object:get_velocity().y == 0 then
|
|
||||||
local n = node_ok(vector.offset(pos,0,-1,0)).name
|
local n = node_ok(vector.offset(pos,0,-1,0)).name
|
||||||
local d = (self.old_y or 0) - self.object:get_pos().y
|
local d = (self.old_y or 0) - self.object:get_pos().y
|
||||||
|
|
||||||
|
@ -981,24 +978,31 @@ end
|
||||||
function mob_class:check_dying()
|
function mob_class:check_dying()
|
||||||
if ((self.state and self.state=="die") or self:check_for_death()) and not self.animation.die_end then
|
if ((self.state and self.state=="die") or self:check_for_death()) and not self.animation.die_end then
|
||||||
local rot = self.object:get_rotation()
|
local rot = self.object:get_rotation()
|
||||||
rot.z = ((math.pi/2-rot.z)*.2)+rot.z
|
if rot then
|
||||||
self.object:set_rotation(rot)
|
rot.z = ((math.pi/2-rot.z)*.2)+rot.z
|
||||||
|
self.object:set_rotation(rot)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob_class:check_suspend()
|
function mob_class:check_suspend()
|
||||||
if not self:player_in_active_range() then
|
local pos = self.object:get_pos()
|
||||||
local pos = self.object:get_pos()
|
|
||||||
|
if pos and not self:player_in_active_range() then
|
||||||
local node_under = node_ok(vector.offset(pos,0,-1,0)).name
|
local node_under = node_ok(vector.offset(pos,0,-1,0)).name
|
||||||
local acc = self.object:get_acceleration()
|
|
||||||
self:set_animation( "stand", true)
|
self:set_animation( "stand", true)
|
||||||
if acc.y > 0 or node_under ~= "air" then
|
|
||||||
self.object:set_acceleration(vector.new(0,0,0))
|
local acc = self.object:get_acceleration()
|
||||||
self.object:set_velocity(vector.new(0,0,0))
|
if acc then
|
||||||
end
|
if acc.y > 0 or node_under ~= "air" then
|
||||||
if acc.y == 0 and node_under == "air" then
|
self.object:set_acceleration(vector.new(0,0,0))
|
||||||
self:falling(pos)
|
self.object:set_velocity(vector.new(0,0,0))
|
||||||
|
end
|
||||||
|
if acc.y == 0 and node_under == "air" then
|
||||||
|
self:falling(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
||||||
description = S("Iron Golem"),
|
description = S("Iron Golem"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
passive = true,
|
passive = false,
|
||||||
hp_min = 100,
|
hp_min = 100,
|
||||||
hp_max = 100,
|
hp_max = 100,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
|
@ -42,7 +42,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
||||||
damage = 14,
|
damage = 14,
|
||||||
knock_back = false,
|
knock_back = false,
|
||||||
reach = 3,
|
reach = 3,
|
||||||
group_attack = true,
|
group_attack = { "mobs_mc:villager" },
|
||||||
attacks_monsters = true,
|
attacks_monsters = true,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
_got_poppy = false,
|
_got_poppy = false,
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 969 B |
|
@ -1,5 +1,7 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local ASSIST_TIMEOUT_SEC = 5
|
||||||
|
|
||||||
mcl_death_messages = {
|
mcl_death_messages = {
|
||||||
assist = {},
|
assist = {},
|
||||||
messages = {
|
messages = {
|
||||||
|
@ -181,8 +183,10 @@ local function get_killer_message(obj, messages, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_assist_message(obj, messages, reason)
|
local function get_assist_message(obj, messages, reason)
|
||||||
if messages.assist and mcl_death_messages.assist[obj] then
|
-- Avoid a timing issue if the assist passes its timeout.
|
||||||
return messages._translator(messages.assist, mcl_util.get_object_name(obj), mcl_death_messages.assist[obj].name)
|
local assist_details = mcl_death_messages.assist[obj]
|
||||||
|
if messages.assist and assist_details then
|
||||||
|
return messages._translator(messages.assist, mcl_util.get_object_name(obj), assist_details.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -232,20 +236,17 @@ mcl_damage.register_on_death(function(obj, reason)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
mcl_damage.register_on_damage(function(obj, damage, reason)
|
mcl_damage.register_on_damage(function(obj, damage, reason)
|
||||||
if obj:get_hp() - damage > 0 then
|
if (obj:get_hp() - damage > 0) and reason.source and
|
||||||
if reason.source then
|
(reason.source:is_player() or obj:get_luaentity()) then
|
||||||
mcl_death_messages.assist[obj] = {name = mcl_util.get_object_name(reason.source), timeout = 5}
|
-- To avoid timing issues we cancel the previous job before adding a new one.
|
||||||
else
|
if mcl_death_messages.assist[obj] then
|
||||||
mcl_death_messages.assist[obj] = nil
|
mcl_death_messages.assist[obj].job:cancel()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
-- Add a new assist object with a timeout job.
|
||||||
for obj, tbl in pairs(mcl_death_messages.assist) do
|
local new_job = minetest.after(ASSIST_TIMEOUT_SEC, function()
|
||||||
tbl.timeout = tbl.timeout - dtime
|
|
||||||
if not obj:is_player() and not obj:get_luaentity() or tbl.timeout > 0 then
|
|
||||||
mcl_death_messages.assist[obj] = nil
|
mcl_death_messages.assist[obj] = nil
|
||||||
end
|
end)
|
||||||
|
mcl_death_messages.assist[obj] = {name = mcl_util.get_object_name(reason.source), job = new_job}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -809,7 +809,7 @@ function mcl_core.get_grass_palette_index(pos)
|
||||||
local biome_name = minetest.get_biome_name(biome)
|
local biome_name = minetest.get_biome_name(biome)
|
||||||
local reg_biome = minetest.registered_biomes[biome_name]
|
local reg_biome = minetest.registered_biomes[biome_name]
|
||||||
if reg_biome then
|
if reg_biome then
|
||||||
index = reg_biome._mcl_palette_index
|
index = reg_biome._mcl_grass_palette_index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return index
|
return index
|
||||||
|
@ -939,7 +939,7 @@ minetest.register_lbm({
|
||||||
else
|
else
|
||||||
node.name = "mcl_core:dirt_with_grass"
|
node.name = "mcl_core:dirt_with_grass"
|
||||||
end
|
end
|
||||||
node.param2 = reg_biome._mcl_palette_index
|
node.param2 = reg_biome._mcl_grass_palette_index
|
||||||
-- Fall back to savanna palette index
|
-- Fall back to savanna palette index
|
||||||
if not node.param2 then
|
if not node.param2 then
|
||||||
node.param2 = SAVANNA_INDEX
|
node.param2 = SAVANNA_INDEX
|
||||||
|
|
|
@ -373,7 +373,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
|
||||||
overlay_tiles = {"mcl_core_grass_block_top.png", "", {name="mcl_core_grass_block_side_overlay.png", tileable_vertical=false}},
|
overlay_tiles = {"mcl_core_grass_block_top.png", "", {name="mcl_core_grass_block_side_overlay.png", tileable_vertical=false}},
|
||||||
palette = "mcl_core_palette_grass.png",
|
palette = "mcl_core_palette_grass.png",
|
||||||
palette_index = 0,
|
palette_index = 0,
|
||||||
color = "#8EB971",
|
color = "#7CBD6B",
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {
|
groups = {
|
||||||
|
|
|
@ -35,7 +35,14 @@ function mcl_core.update_leaves(pos, oldnode)
|
||||||
-- manually placed leaf nodes have param2
|
-- manually placed leaf nodes have param2
|
||||||
-- set and will never decay automatically
|
-- set and will never decay automatically
|
||||||
if lnode.param2 == 0 then
|
if lnode.param2 == 0 then
|
||||||
minetest.swap_node(lpos, {name = lnode.name .. "_orphan"})
|
local orphan_name = lnode.name .. "_orphan"
|
||||||
|
local def = minetest.registered_nodes[orphan_name]
|
||||||
|
if def then
|
||||||
|
--minetest.log("Registered: ".. orphan_name)
|
||||||
|
minetest.swap_node(lpos, {name = orphan_name})
|
||||||
|
else
|
||||||
|
--minetest.log("Not registered: ".. orphan_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -107,7 +107,7 @@ local function berry_damage_check(obj)
|
||||||
if not p then return end
|
if not p then return end
|
||||||
if not minetest.find_node_near(p,0.4,{"group:sweet_berry_thorny"},true) then return end
|
if not minetest.find_node_near(p,0.4,{"group:sweet_berry_thorny"},true) then return end
|
||||||
local v = obj:get_velocity()
|
local v = obj:get_velocity()
|
||||||
if v.x < 0.1 and v.y < 0.1 and v.z < 0.1 then return end
|
if math.abs(v.x) < 0.1 and math.abs(v.y) < 0.1 and math.abs(v.z) < 0.1 then return end
|
||||||
|
|
||||||
mcl_util.deal_damage(obj, 0.5, {type = "sweet_berry"})
|
mcl_util.deal_damage(obj, 0.5, {type = "sweet_berry"})
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ local get_palette_color_from_pos = function(pos)
|
||||||
local biome_name = minetest.get_biome_name(biome)
|
local biome_name = minetest.get_biome_name(biome)
|
||||||
local reg_biome = minetest.registered_biomes[biome_name]
|
local reg_biome = minetest.registered_biomes[biome_name]
|
||||||
if reg_biome then
|
if reg_biome then
|
||||||
index = reg_biome._mcl_palette_index
|
index = reg_biome._mcl_grass_palette_index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return index
|
return index
|
||||||
|
|
|
@ -280,8 +280,8 @@ local function set_palette(minp,maxp,data2,area,biomemap,nodes)
|
||||||
local bn = minetest.get_biome_name(biomemap[b_pos])
|
local bn = minetest.get_biome_name(biomemap[b_pos])
|
||||||
if bn then
|
if bn then
|
||||||
local biome = minetest.registered_biomes[bn]
|
local biome = minetest.registered_biomes[bn]
|
||||||
if biome and biome._mcl_biome_type then
|
if biome and biome._mcl_biome_type and biome._mcl_grass_palette_index then
|
||||||
data2[p_pos] = biome._mcl_palette_index
|
data2[p_pos] = biome._mcl_grass_palette_index
|
||||||
lvm_used = true
|
lvm_used = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -349,8 +349,8 @@ local function block_fixes(vm, data, data2, emin, emax, area, minp, maxp, blocks
|
||||||
local lvm_used = false
|
local lvm_used = false
|
||||||
local pr = PseudoRandom(blockseed)
|
local pr = PseudoRandom(blockseed)
|
||||||
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
|
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
|
||||||
-- Set param2 (=color) of sugar cane and grass
|
-- Set param2 (=color) of nodes which use the grass colour palette.
|
||||||
lvm_used = set_palette(minp,maxp,data2,area,biomemap,{"mcl_core:reeds","mcl_core:dirt_with_grass"})
|
lvm_used = set_palette(minp,maxp,data2,area,biomemap,{"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"})
|
||||||
end
|
end
|
||||||
return lvm_used
|
return lvm_used
|
||||||
end
|
end
|
||||||
|
@ -417,3 +417,20 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks
|
||||||
end
|
end
|
||||||
return false, false, false
|
return false, false, false
|
||||||
end, 100, true)
|
end, 100, true)
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "Fix grass palette indexes",
|
||||||
|
name = "mcl_mapgen_core:fix_grass_palette_indexes",
|
||||||
|
nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
local biome_data = minetest.get_biome_data(pos)
|
||||||
|
local biome = biome_data.biome
|
||||||
|
local biome_name = minetest.get_biome_name(biome)
|
||||||
|
local reg_biome = minetest.registered_biomes[biome_name]
|
||||||
|
if node.param2 ~= reg_biome._mcl_grass_palette_index then
|
||||||
|
node.param2 = reg_biome._mcl_grass_palette_index
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue