Compare commits
11 Commits
master
...
fix-weathe
Author | SHA1 | Date |
---|---|---|
cora | 9db099fe6d | |
cora | 22c49ea605 | |
cora | 85304ae8a3 | |
cora | 4281165c6c | |
cora | d079493056 | |
cora | 62afe49987 | |
cora | 98eb0a1860 | |
cora | a35c5b66cb | |
cora | 9b42b0d5c7 | |
cora | 1adcdc1dbb | |
cora | a78fe52970 |
|
@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
|
||||||
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
||||||
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
||||||
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
||||||
* `shearsy_wool=1`: Diggable by shears, and this node is wool
|
* `shearsy=wool=1`: Diggable by shears, and this node is wool
|
||||||
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
||||||
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# mcl_colors
|
|
||||||
Mod providing global table containing legacy minecraft colors to be used in mods.
|
|
||||||
|
|
||||||
## mcl_colors.*
|
|
||||||
Colors by upper name, in hex value.
|
|
||||||
|
|
||||||
## mcl_colors.background.*
|
|
||||||
Background colors by upper name, in hex value.
|
|
|
@ -1,36 +0,0 @@
|
||||||
mcl_colors = {
|
|
||||||
BLACK = "#000000",
|
|
||||||
DARK_BLUE = "#0000AA",
|
|
||||||
DARK_GREEN = "#00AA00",
|
|
||||||
DARK_AQUA = "#00AAAA",
|
|
||||||
DARK_RED = "#AA0000",
|
|
||||||
DARK_PURPLE = "#AA00AA",
|
|
||||||
GOLD = "#FFAA00",
|
|
||||||
GRAY = "#AAAAAA",
|
|
||||||
DARK_GRAY = "#555555",
|
|
||||||
BLUE = "#5555FF",
|
|
||||||
GREEN = "#55FF55",
|
|
||||||
AQUA = "#55FFFF",
|
|
||||||
RED = "#FF5555",
|
|
||||||
LIGHT_PURPLE = "#FF55FF",
|
|
||||||
YELLOW = "#FFFF55",
|
|
||||||
WHITE = "#FFFFFF",
|
|
||||||
background = {
|
|
||||||
BLACK = "#000000",
|
|
||||||
DARK_BLUE = "#00002A",
|
|
||||||
DARK_GREEN = "#002A00",
|
|
||||||
DARK_AQUA = "#002A2A",
|
|
||||||
DARK_RED = "#2A0000",
|
|
||||||
DARK_PURPLE = "#2A002A",
|
|
||||||
GOLD = "#2A2A00",
|
|
||||||
GRAY = "#2A2A2A",
|
|
||||||
DARK_GRAY = "#151515",
|
|
||||||
BLUE = "#15153F",
|
|
||||||
GREEN = "#153F15",
|
|
||||||
AQUA = "#153F3F",
|
|
||||||
RED = "#3F1515",
|
|
||||||
LIGHT_PURPLE = "#3F153F",
|
|
||||||
YELLOW = "#3F3F15",
|
|
||||||
WHITE = "#373501",
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_colors
|
|
||||||
author = Fleckenstein
|
|
||||||
description = The HTML sequences for the minecraft colors
|
|
|
@ -1 +0,0 @@
|
||||||
name = walkover
|
|
|
@ -260,7 +260,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local yaw = self.object:get_yaw()
|
local yaw = self.object:get_yaw()
|
||||||
if ctrl and ctrl.up then
|
if ctrl.up then
|
||||||
-- Forwards
|
-- Forwards
|
||||||
self._v = self._v + 0.1 * v_factor
|
self._v = self._v + 0.1 * v_factor
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
self.object:set_animation({x=0, y=40}, paddling_speed, 0, true)
|
self.object:set_animation({x=0, y=40}, paddling_speed, 0, true)
|
||||||
self._animation = 1
|
self._animation = 1
|
||||||
end
|
end
|
||||||
elseif ctrl and ctrl.down then
|
elseif ctrl.down then
|
||||||
-- Backwards
|
-- Backwards
|
||||||
self._v = self._v - 0.1 * v_factor
|
self._v = self._v - 0.1 * v_factor
|
||||||
|
|
||||||
|
|
|
@ -155,16 +155,6 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local already_burning = mcl_burning.is_burning(obj)
|
|
||||||
|
|
||||||
|
|
||||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
|
||||||
mcl_burning.set(obj, "string", "reason", reason)
|
|
||||||
|
|
||||||
if already_burning then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local hud_id
|
local hud_id
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
hud_id = mcl_burning.get(obj, "int", "hud_id")
|
hud_id = mcl_burning.get(obj, "int", "hud_id")
|
||||||
|
@ -178,7 +168,8 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||||
|
mcl_burning.set(obj, "string", "reason", reason)
|
||||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||||
|
|
||||||
|
@ -294,7 +285,7 @@ function mcl_burning.fire_entity_step(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
local animation_timer = self.animation_timer + dtime
|
local animation_timer = self.animation_timer + dtime
|
||||||
if animation_timer >= ( 1 / mcl_burning.animation_fps ) then
|
if animation_timer >= 0.015 then
|
||||||
animation_timer = 0
|
animation_timer = 0
|
||||||
local animation_frame = self.animation_frame + 1
|
local animation_frame = self.animation_frame + 1
|
||||||
if animation_frame > mcl_burning.animation_frames - 1 then
|
if animation_frame > mcl_burning.animation_frames - 1 then
|
||||||
|
@ -305,48 +296,3 @@ function mcl_burning.fire_entity_step(self, dtime)
|
||||||
end
|
end
|
||||||
self.animation_timer = animation_timer
|
self.animation_timer = animation_timer
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_chatcommand("burn", {
|
|
||||||
params = S("<playername> <duration> <reason>"),
|
|
||||||
description = S("Sets a player on fire for the given amount of seconds with the given reason."),
|
|
||||||
privs = { debug = true },
|
|
||||||
func = function(name, params)
|
|
||||||
local playername, duration, reason = params:match("^(.+) (.+) (.+)$")
|
|
||||||
if not (playername and duration and reason) then
|
|
||||||
return false, S("Error: Parameter missing.")
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(playername)
|
|
||||||
if not player then
|
|
||||||
return false, S(
|
|
||||||
"Error: Player “@1” not found.",
|
|
||||||
playername
|
|
||||||
)
|
|
||||||
end
|
|
||||||
local duration_number = tonumber(duration)
|
|
||||||
-- Lua numbers are truthy
|
|
||||||
-- NaN is not equal to NaN
|
|
||||||
if not duration_number or (duration_number ~= duration_number) then
|
|
||||||
return false, S(
|
|
||||||
"Error: Duration “@1” is not a number.",
|
|
||||||
duration
|
|
||||||
)
|
|
||||||
end
|
|
||||||
if duration_number < 0 then
|
|
||||||
return false, S(
|
|
||||||
"Error: Duration “@1” is negative.",
|
|
||||||
duration
|
|
||||||
)
|
|
||||||
end
|
|
||||||
mcl_burning.set_on_fire(
|
|
||||||
player,
|
|
||||||
duration_number,
|
|
||||||
reason
|
|
||||||
)
|
|
||||||
return true, S(
|
|
||||||
"Set @1 on fire for @2s for the following reason: @3",
|
|
||||||
playername,
|
|
||||||
duration,
|
|
||||||
reason
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ local S = minetest.get_translator("mcl_burning")
|
||||||
local modpath = minetest.get_modpath("mcl_burning")
|
local modpath = minetest.get_modpath("mcl_burning")
|
||||||
|
|
||||||
mcl_burning = {
|
mcl_burning = {
|
||||||
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8,
|
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8
|
||||||
animation_fps = tonumber(minetest.settings:get("fire_animation_fps")) or 30
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dofile(modpath .. "/api.lua")
|
dofile(modpath .. "/api.lua")
|
||||||
|
|
|
@ -14,8 +14,6 @@ local DEFAULT_FALL_SPEED = -10
|
||||||
local FLOP_HEIGHT = 5.0
|
local FLOP_HEIGHT = 5.0
|
||||||
local FLOP_HOR_SPEED = 1.5
|
local FLOP_HOR_SPEED = 1.5
|
||||||
|
|
||||||
local LIGHT_SUN = minetest.LIGHT_MAX + 1
|
|
||||||
|
|
||||||
local MOB_CAP = {}
|
local MOB_CAP = {}
|
||||||
MOB_CAP.hostile = 70
|
MOB_CAP.hostile = 70
|
||||||
MOB_CAP.passive = 10
|
MOB_CAP.passive = 10
|
||||||
|
@ -1059,7 +1057,7 @@ local do_env_damage = function(self)
|
||||||
if mod_worlds then
|
if mod_worlds then
|
||||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
_, dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
end
|
end
|
||||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) == LIGHT_SUN and dim == "overworld" then
|
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||||
if self.ignited_by_sunlight then
|
if self.ignited_by_sunlight then
|
||||||
mcl_burning.set_on_fire(self.object, 10)
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
else
|
else
|
||||||
|
|
|
@ -123,10 +123,6 @@ mobs:register_mob("mobs_mc:snowman", {
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
|
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
|
||||||
|
|
||||||
if minetest.registered_items["mcl_farming:pumpkin_face"] then
|
|
||||||
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "mcl_farming:pumpkin_face")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Wear out
|
-- Wear out
|
||||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:add_wear(mobs_mc.misc.shears_wear)
|
item:add_wear(mobs_mc.misc.shears_wear)
|
||||||
|
|
|
@ -74,7 +74,7 @@ local professions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
{ { "mcl_farming:pumpkin", 8, 13 }, E1 },
|
{ { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
|
||||||
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
|
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,70 @@
|
||||||
mcl_weather.nether_dust = {}
|
mcl_weather.nether_dust = {}
|
||||||
mcl_weather.nether_dust.particles_count = 99
|
mcl_weather.nether_dust.particlespawners = {}
|
||||||
|
|
||||||
-- calculates coordinates and draw particles for Nether dust
|
local psdef= {
|
||||||
mcl_weather.nether_dust.add_dust_particles = function(player)
|
amount = 99,
|
||||||
for i=mcl_weather.nether_dust.particles_count, 1,-1 do
|
time = 0,
|
||||||
local rpx, rpy, rpz = mcl_weather.get_random_pos_by_player_look_dir(player)
|
minpos = vector.new(-25,0,-25),
|
||||||
minetest.add_particle({
|
maxpos =vector.new(25,15,25),
|
||||||
pos = {x = rpx, y = rpy - math.random(6, 18), z = rpz},
|
minvel = vector.new(-0.3,-0.15,-1),
|
||||||
velocity = {x = math.random(-30,30)*0.01, y = math.random(-15,15)*0.01, z = math.random(-30,30)*0.01},
|
maxvel = vector.new(0.3,0.15,0.3),
|
||||||
acceleration = {x = math.random(-50,50)*0.02, y = math.random(-20,20)*0.02, z = math.random(-50,50)*0.02},
|
minacc = vector.new(-1,-0.4,-1),
|
||||||
expirationtime = 3,
|
maxacc = vector.new(1,0.4,1),
|
||||||
size = math.random(6,20)*0.01,
|
minexptime = 1,
|
||||||
collisiondetection = false,
|
maxexptime = 1,
|
||||||
object_collision = false,
|
minsize = mins,
|
||||||
vertical = false,
|
maxsize = maxs,
|
||||||
glow = math.random(0,minetest.LIGHT_MAX),
|
collisiondetection = false,
|
||||||
texture = "mcl_particles_nether_dust"..tostring(i%3+1)..".png",
|
collision_removal = false,
|
||||||
playername = player:get_player_name()
|
object_collision = false,
|
||||||
})
|
vertical = false,
|
||||||
|
glow = math.random(0,minetest.LIGHT_MAX)
|
||||||
|
}
|
||||||
|
|
||||||
|
local function check_player(player)
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
mcl_weather.nether_dust.add_particlespawners = function(player)
|
||||||
minetest.register_globalstep(function(dtime)
|
if not check_player(player) then return end
|
||||||
timer = timer + dtime
|
local name=player:get_player_name(name)
|
||||||
if timer < 0.7 then return end
|
mcl_weather.nether_dust.particlespawners[name]={}
|
||||||
timer = 0
|
psdef.playername = name
|
||||||
|
psdef.attached = player
|
||||||
|
for i=1,3 do
|
||||||
|
psdef.texture="mcl_particles_nether_dust"..i..".png"
|
||||||
|
mcl_weather.nether_dust.particlespawners[name][i]=minetest.add_particlespawner(psdef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
mcl_weather.nether_dust.delete_particlespawners = function(player)
|
||||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
local name=player:get_player_name(name)
|
||||||
return false
|
if mcl_weather.nether_dust.particlespawners[name] then
|
||||||
|
for i=1,3 do
|
||||||
|
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
||||||
end
|
end
|
||||||
mcl_weather.nether_dust.add_dust_particles(player)
|
mcl_weather.nether_dust.particlespawners[name]=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||||
|
if dimension == "nether" then
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.nether_dust.add_particlespawners(player)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.nether_dust.add_particlespawners(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||||
|
end)
|
|
@ -1,5 +1,7 @@
|
||||||
local PARTICLES_COUNT_RAIN = 30
|
local PARTICLES_COUNT_RAIN = 800
|
||||||
local PARTICLES_COUNT_THUNDER = 45
|
local PARTICLES_COUNT_THUNDER = 1200
|
||||||
|
local PARTICLES_SPEED_RAIN = 10
|
||||||
|
local PARTICLES_SPEED_THUNDER = 15
|
||||||
|
|
||||||
mcl_weather.rain = {
|
mcl_weather.rain = {
|
||||||
-- max rain particles created at time
|
-- max rain particles created at time
|
||||||
|
@ -8,6 +10,9 @@ mcl_weather.rain = {
|
||||||
-- flag to turn on/off extinguish fire for rain
|
-- flag to turn on/off extinguish fire for rain
|
||||||
extinguish_fire = true,
|
extinguish_fire = true,
|
||||||
|
|
||||||
|
-- falling speed of the raindrops
|
||||||
|
falling_speed = PARTICLES_SPEED_RAIN,
|
||||||
|
|
||||||
-- flag useful when mixing weathers
|
-- flag useful when mixing weathers
|
||||||
raining = false,
|
raining = false,
|
||||||
|
|
||||||
|
@ -16,6 +21,8 @@ mcl_weather.rain = {
|
||||||
sky_last_update = -1,
|
sky_last_update = -1,
|
||||||
|
|
||||||
init_done = false,
|
init_done = false,
|
||||||
|
|
||||||
|
ps = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcl_weather.rain.sound_handler = function(player)
|
mcl_weather.rain.sound_handler = function(player)
|
||||||
|
@ -42,29 +49,55 @@ mcl_weather.rain.set_sky_box = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- creating manually parctiles instead of particles spawner because of easier to control
|
-- ~~creating manually parctiles instead of particles spawner because of easier to control spawn position~~.
|
||||||
-- spawn position.
|
-- why, mcl2, WHY???
|
||||||
mcl_weather.rain.add_rain_particles = function(player)
|
-- use particle spawner to not send .. you know hundreds of packets per second for each f*ing rain particle
|
||||||
|
local function get_spawnerdef(dtype)
|
||||||
|
local textures = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindrop_2.png", "weather_pack_rain_raindrop_1.png"}
|
||||||
|
local rt = {
|
||||||
|
amount = 800,
|
||||||
|
time = 0,
|
||||||
|
minpos = vector.new(-15,5,-15),
|
||||||
|
maxpos = vector.new(15,10,15),
|
||||||
|
minvel = vector.new(0, -5,0),
|
||||||
|
maxvel = vector.new(0,-15,0),
|
||||||
|
minacc = vector.new(0,-10,0),
|
||||||
|
maxacc = vector.new(0,-30,0),
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 1,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 5,
|
||||||
|
collisiondetection = true,
|
||||||
|
collision_removal = true,
|
||||||
|
object_collision = true,
|
||||||
|
vertical = true,
|
||||||
|
texture = mcl_weather.rain.get_texture(),
|
||||||
|
-- animation = {Tile Animation definition},
|
||||||
|
glow = 0
|
||||||
|
-- node = {name = "ignore", param2 = 0},
|
||||||
|
--node_tile = 0,
|
||||||
|
}
|
||||||
|
return rt
|
||||||
|
end
|
||||||
|
mcl_weather.rain.add_rain_particlespawner = function(name,def)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if not player then return end
|
||||||
|
|
||||||
mcl_weather.rain.last_rp_count = 0
|
mcl_weather.rain.last_rp_count = 0
|
||||||
for i=mcl_weather.rain.particles_count, 1,-1 do
|
for i=mcl_weather.rain.particles_count, 1,-1 do
|
||||||
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
||||||
if mcl_weather.is_outdoor({x=random_pos_x, y=random_pos_y, z=random_pos_z}) then
|
if mcl_weather.is_outdoor({x=random_pos_x, y=random_pos_y, z=random_pos_z}) then
|
||||||
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
||||||
minetest.add_particle({
|
|
||||||
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
|
|
||||||
velocity = {x=0, y=-10, z=0},
|
|
||||||
acceleration = {x=0, y=-30, z=0},
|
|
||||||
expirationtime = 1.0,
|
|
||||||
size = math.random(0.5, 3),
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
vertical = true,
|
|
||||||
texture = mcl_weather.rain.get_texture(),
|
|
||||||
playername = player:get_player_name()
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local name=player:get_player_name()
|
||||||
|
if mcl_weather.is_outdoor(player:get_pos()) then
|
||||||
|
if mcl_weather.state ~= "thunder" then def.amount=PARTICLES_COUNT_THUNDER end
|
||||||
|
def.player = name
|
||||||
|
def.attached = player
|
||||||
|
mcl_weather.rain.ps[name] = minetest.add_particlespawner(def)
|
||||||
|
end
|
||||||
|
mcl_weather.rain.init_done = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple random texture getter
|
-- Simple random texture getter
|
||||||
|
@ -88,15 +121,33 @@ mcl_weather.rain.add_player = function(player)
|
||||||
local player_meta = {}
|
local player_meta = {}
|
||||||
player_meta.origin_sky = {player:get_sky()}
|
player_meta.origin_sky = {player:get_sky()}
|
||||||
mcl_weather.players[player:get_player_name()] = player_meta
|
mcl_weather.players[player:get_player_name()] = player_meta
|
||||||
|
mcl_weather.rain.add_rain_particlespawner(player:get_player_name(),get_spawnerdef("rain"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
if mcl_weather.rain.raining then
|
||||||
|
mcl_weather.rain.add_player(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
if mcl_weather.rain.raining then
|
||||||
|
mcl_weather.rain.remove_player(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
-- remove player from player list effected by rain.
|
-- remove player from player list effected by rain.
|
||||||
-- be sure to remove sound before removing player otherwise soundhandler reference will be lost.
|
-- be sure to remove sound before removing player otherwise soundhandler reference will be lost.
|
||||||
mcl_weather.rain.remove_player = function(player)
|
mcl_weather.rain.remove_player = function(player)
|
||||||
local player_meta = mcl_weather.players[player:get_player_name()]
|
local name = player:get_player_name()
|
||||||
|
local player_meta = mcl_weather.players[name]
|
||||||
|
local ps = mcl_weather.rain.ps[name]
|
||||||
|
if ps then
|
||||||
|
minetest.delete_particlespawner(ps,name)
|
||||||
|
end
|
||||||
|
mcl_weather.rain.ps[name]=nil
|
||||||
if player_meta ~= nil and player_meta.origin_sky ~= nil then
|
if player_meta ~= nil and player_meta.origin_sky ~= nil then
|
||||||
player:set_clouds({color="#FFF0F0E5"})
|
player:set_clouds({color="#FFF0F0E5"})
|
||||||
|
mcl_weather.rain.remove_sound(player)
|
||||||
mcl_weather.players[player:get_player_name()] = nil
|
mcl_weather.players[player:get_player_name()] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -155,7 +206,6 @@ mcl_weather.rain.clear = function()
|
||||||
mcl_weather.rain.set_particles_mode("rain")
|
mcl_weather.rain.set_particles_mode("rain")
|
||||||
mcl_weather.skycolor.remove_layer("weather-pack-rain-sky")
|
mcl_weather.skycolor.remove_layer("weather-pack-rain-sky")
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
mcl_weather.rain.remove_sound(player)
|
|
||||||
mcl_weather.rain.remove_player(player)
|
mcl_weather.rain.remove_player(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -173,16 +223,16 @@ mcl_weather.rain.make_weather = function()
|
||||||
mcl_weather.rain.raining = true
|
mcl_weather.rain.raining = true
|
||||||
mcl_weather.rain.set_sky_box()
|
mcl_weather.rain.set_sky_box()
|
||||||
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
||||||
mcl_weather.rain.init_done = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
if mcl_weather.players[player:get_player_name()] == nil then
|
||||||
|
mcl_weather.rain.add_player(player)
|
||||||
|
end
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
mcl_weather.rain.add_player(player)
|
|
||||||
mcl_weather.rain.add_rain_particles(player)
|
|
||||||
mcl_weather.rain.update_sound(player)
|
mcl_weather.rain.update_sound(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -191,8 +241,10 @@ end
|
||||||
mcl_weather.rain.set_particles_mode = function(mode)
|
mcl_weather.rain.set_particles_mode = function(mode)
|
||||||
if mode == "thunder" then
|
if mode == "thunder" then
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
||||||
|
mcl_weather.rain.falling_speed = PARTICLES_SPEED_THUNDER
|
||||||
else
|
else
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
||||||
|
mcl_weather.rain.falling_speed = PARTICLES_SPEED_RAIN
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,58 @@
|
||||||
mcl_weather.snow = {}
|
mcl_weather.snow = {}
|
||||||
|
mcl_weather.snow.particlespawners = {}
|
||||||
|
|
||||||
mcl_weather.snow.particles_count = 15
|
local psdef= {
|
||||||
mcl_weather.snow.init_done = false
|
amount = 30,
|
||||||
|
time = 0,
|
||||||
|
minpos = vector.new(-15,5,-15),
|
||||||
|
maxpos =vector.new(15,10,15),
|
||||||
|
minvel = vector.new(0,-1,0),
|
||||||
|
maxvel = vector.new(0,-4,0),
|
||||||
|
minacc = vector.new(0,-1,0),
|
||||||
|
maxacc = vector.new(0,-4,0),
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 1,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 5,
|
||||||
|
collisiondetection = true,
|
||||||
|
collision_removal = true,
|
||||||
|
object_collision = true,
|
||||||
|
vertical = true,
|
||||||
|
glow = 1
|
||||||
|
}
|
||||||
|
|
||||||
-- calculates coordinates and draw particles for snow weather
|
local function check_player(player)
|
||||||
mcl_weather.snow.add_snow_particles = function(player)
|
if mcl_weather.state ~= "snow" then return false end
|
||||||
mcl_weather.rain.last_rp_count = 0
|
local name=player:get_player_name(name)
|
||||||
for i=mcl_weather.snow.particles_count, 1,-1 do
|
if mcl_worlds.has_weather(player:get_pos()) and not mcl_weather.snow.particlespawners[name] then
|
||||||
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
return true
|
||||||
random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7)
|
end
|
||||||
if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then
|
return false
|
||||||
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
end
|
||||||
minetest.add_particle({
|
|
||||||
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
|
mcl_weather.snow.add_particlespawners = function(player)
|
||||||
velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001},
|
if not check_player(player) then
|
||||||
acceleration = {x = 0, y=0, z = 0},
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
expirationtime = 8.0,
|
return
|
||||||
size = 1,
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
object_collision = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = mcl_weather.snow.get_texture(),
|
|
||||||
playername = player:get_player_name()
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
mcl_weather.snow.particlespawners[name]={}
|
||||||
|
psdef.playername = name
|
||||||
|
psdef.attached = player
|
||||||
|
for i=1,2 do
|
||||||
|
psdef.texture="weather_pack_snow_snowflake"..i..".png"
|
||||||
|
mcl_weather.snow.particlespawners[name][i]=minetest.add_particlespawner(psdef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.delete_particlespawners = function(player)
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
if mcl_weather.snow.particlespawners[name] then
|
||||||
|
for i=1,2 do
|
||||||
|
minetest.delete_particlespawner(mcl_weather.snow.particlespawners[name][i])
|
||||||
|
end
|
||||||
|
mcl_weather.snow.particlespawners[name]=nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_weather.snow.set_sky_box = function()
|
mcl_weather.snow.set_sky_box = function()
|
||||||
|
@ -38,47 +65,70 @@ mcl_weather.snow.set_sky_box = function()
|
||||||
{r=0, g=0, b=0}})
|
{r=0, g=0, b=0}})
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
player:set_clouds({color="#ADADADE8"})
|
|
||||||
end
|
end
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
mcl_weather.snow.start_player = function(player)
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.snow.add_particlespawners(player)
|
||||||
|
player:set_clouds({color="#ADADADE8"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.clear_player = function(player)
|
||||||
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.start = function()
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
mcl_weather.snow.start_player(player)
|
||||||
|
end
|
||||||
|
mcl_weather.snow.set_sky_box()
|
||||||
|
mcl_weather.snow.init_done = true
|
||||||
|
end
|
||||||
|
|
||||||
mcl_weather.snow.clear = function()
|
mcl_weather.snow.clear = function()
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
mcl_weather.snow.clear_player(player)
|
||||||
|
end
|
||||||
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
|
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
|
||||||
mcl_weather.snow.init_done = false
|
mcl_weather.snow.init_done = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple random texture getter
|
|
||||||
mcl_weather.snow.get_texture = function()
|
|
||||||
return "weather_pack_snow_snowflake"..math.random(1,2)..".png"
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
if mcl_weather.state ~= "snow" then
|
if mcl_weather.state ~= "snow" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
timer = timer + dtime;
|
if mcl_weather.rain.init_done == false then
|
||||||
if timer >= 0.5 then
|
mcl_weather.snow.start()
|
||||||
timer = 0
|
mcl_weather.rain.set_sky_box()
|
||||||
else
|
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
||||||
return
|
elseif mcl_weather.state ~= "snow" then
|
||||||
end
|
mcl_weather.snow.clear()
|
||||||
|
end
|
||||||
if mcl_weather.snow.init_done == false then
|
|
||||||
mcl_weather.snow.set_sky_box()
|
|
||||||
mcl_weather.snow.init_done = true
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
mcl_weather.snow.add_snow_particles(player)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
mcl_weather.snow.start_player(player)
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
mcl_weather.snow.clear_player(player)
|
||||||
|
end)
|
||||||
|
|
||||||
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||||
|
if dimension == "overworld" then
|
||||||
|
mcl_weather.snow.add_particlespawners(player)
|
||||||
|
else
|
||||||
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- register snow weather
|
-- register snow weather
|
||||||
if mcl_weather.reg_weathers.snow == nil then
|
if mcl_weather.reg_weathers.snow == nil then
|
||||||
mcl_weather.reg_weathers.snow = {
|
mcl_weather.reg_weathers.snow = {
|
||||||
|
|
|
@ -3,106 +3,13 @@ local N = function(s) return s end
|
||||||
|
|
||||||
local function get_tool_name(item)
|
local function get_tool_name(item)
|
||||||
local name = item:get_meta():get_string("name")
|
local name = item:get_meta():get_string("name")
|
||||||
if name == "" then
|
if name ~= "" then
|
||||||
local def = item:get_definition()
|
return name
|
||||||
name=def._tt_original_description or def.description
|
|
||||||
end
|
end
|
||||||
local sanitized_name, substitution_count = name:gsub("[\r\n]"," ")
|
local def = item:get_definition()
|
||||||
return sanitized_name
|
return def._tt_original_description or def.description
|
||||||
end
|
end
|
||||||
|
|
||||||
local test_tool_1a = {
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return "foo 1a"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_1a) == "foo 1a" )
|
|
||||||
|
|
||||||
local test_tool_1b = {
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return "bar\rbaz\n1b"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_1b) == "bar baz 1b" )
|
|
||||||
|
|
||||||
local test_tool_2a = {
|
|
||||||
get_definition = function()
|
|
||||||
return {
|
|
||||||
_tt_original_description = "foo 2a"
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_2a) == "foo 2a" )
|
|
||||||
|
|
||||||
local test_tool_2b = {
|
|
||||||
get_definition = function()
|
|
||||||
return {
|
|
||||||
_tt_original_description = "bar\rbaz\n2b"
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_2b) == "bar baz 2b" )
|
|
||||||
|
|
||||||
local test_tool_3a = {
|
|
||||||
get_definition = function()
|
|
||||||
return {
|
|
||||||
description = "foo 3a"
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_3a) == "foo 3a" )
|
|
||||||
|
|
||||||
local test_tool_3b = {
|
|
||||||
get_definition = function()
|
|
||||||
return {
|
|
||||||
description = "bar\rbaz\n3b"
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
get_meta = function()
|
|
||||||
return {
|
|
||||||
get_string = function()
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( get_tool_name(test_tool_3b) == "bar baz 3b" )
|
|
||||||
|
|
||||||
mcl_death_messages = {}
|
mcl_death_messages = {}
|
||||||
|
|
||||||
-- Death messages
|
-- Death messages
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
name = mcl_experience
|
|
|
@ -1,2 +1 @@
|
||||||
name = mcl_formspec
|
|
||||||
description = Helper mod to simplify creation of formspecs a little bit
|
description = Helper mod to simplify creation of formspecs a little bit
|
||||||
|
|
|
@ -117,7 +117,7 @@ local function filter_item(name, description, lang, filter)
|
||||||
else
|
else
|
||||||
desc = string.lower(minetest.get_translated_string(lang, description))
|
desc = string.lower(minetest.get_translated_string(lang, description))
|
||||||
end
|
end
|
||||||
return string.find(name, filter, nil, true) or string.find(desc, filter, nil, true)
|
return string.find(name, filter) or string.find(desc, filter)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_inv_search(filter, player)
|
local function set_inv_search(filter, player)
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
mcl_tmp_message = {
|
mcl_tmp_message = {}
|
||||||
hud_hide_timeout = tonumber(
|
|
||||||
minetest.settings:get("mcl_tmp_message_hud_hide_timeout")
|
|
||||||
) or 10
|
|
||||||
}
|
|
||||||
|
|
||||||
local huds = {}
|
local huds = {}
|
||||||
local hud_hide_timeouts = {}
|
local hud_hide_timeouts = {}
|
||||||
|
@ -10,7 +6,7 @@ local hud_hide_timeouts = {}
|
||||||
function mcl_tmp_message.message(player, message)
|
function mcl_tmp_message.message(player, message)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
player:hud_change(huds[name], "text", message)
|
player:hud_change(huds[name], "text", message)
|
||||||
hud_hide_timeouts[name] = mcl_tmp_message.hud_hide_timeout
|
hud_hide_timeouts[name] = 3
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
name = mcl_tmp_message
|
|
|
@ -43,20 +43,14 @@ end
|
||||||
|
|
||||||
local comparator_activate = function(pos, node)
|
local comparator_activate = function(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
local onstate = def.comparator_onstate
|
minetest.swap_node(pos, { name = def.comparator_onstate, param2 = node.param2 })
|
||||||
if onstate then
|
|
||||||
minetest.swap_node(pos, { name = onstate, param2 = node.param2 })
|
|
||||||
end
|
|
||||||
minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
|
minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local comparator_deactivate = function(pos, node)
|
local comparator_deactivate = function(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
local offstate = def.comparator_offstate
|
minetest.swap_node(pos, { name = def.comparator_offstate, param2 = node.param2 })
|
||||||
if offstate then
|
|
||||||
minetest.swap_node(pos, { name = offstate, param2 = node.param2 })
|
|
||||||
end
|
|
||||||
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
|
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,8 @@ armor.set_player_armor = function(self, player)
|
||||||
if level then
|
if level then
|
||||||
local texture = def.texture or item:gsub("%:", "_")
|
local texture = def.texture or item:gsub("%:", "_")
|
||||||
local enchanted_addition = (mcl_enchanting.is_enchanted(item) and mcl_enchanting.overlay or "")
|
local enchanted_addition = (mcl_enchanting.is_enchanted(item) and mcl_enchanting.overlay or "")
|
||||||
table.insert(textures, texture..".png"..enchanted_addition)
|
table.insert(textures, "("..texture..".png"..enchanted_addition..")")
|
||||||
preview = "player.png^[opacity:0^"..texture.."_preview.png"..enchanted_addition..""..(preview and "^"..preview or "")
|
preview = "(player.png^[opacity:0^"..texture.."_preview.png"..enchanted_addition..")"..(preview and "^"..preview or "")
|
||||||
armor_level = armor_level + level
|
armor_level = armor_level + level
|
||||||
items = items + 1
|
items = items + 1
|
||||||
mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0)
|
mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0)
|
||||||
|
|
|
@ -387,15 +387,13 @@ for colorid, colortab in pairs(mcl_banners.colors) do
|
||||||
-- redraw the pattern textures as low-resolution pixel
|
-- redraw the pattern textures as low-resolution pixel
|
||||||
-- art and use that instead.
|
-- art and use that instead.
|
||||||
|
|
||||||
local layer = "([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24^[colorize:" .. color .. ":" .. layer_ratio .. ")"
|
local layer = "(([combine:20x40:-2,-2="..pattern.."^[resize:16x24^[colorize:"..color..":"..layer_ratio.."))"
|
||||||
local mask = "([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24" .. ")"
|
|
||||||
|
|
||||||
function escape(text)
|
function escape(text)
|
||||||
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
|
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local layer_masked = layer .. "^[mask:" .. escape(mask)
|
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer)
|
||||||
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer_masked)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
inv = finished_banner
|
inv = finished_banner
|
||||||
|
|
|
@ -81,7 +81,7 @@ function mcl_beds.register_bed(name, def)
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = {handy=1, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1},
|
groups = {handy=1, flammable = 3, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1},
|
||||||
_mcl_hardness = 0.2,
|
_mcl_hardness = 0.2,
|
||||||
_mcl_blast_resistance = 1,
|
_mcl_blast_resistance = 1,
|
||||||
sounds = def.sounds or default_sounds,
|
sounds = def.sounds or default_sounds,
|
||||||
|
@ -204,7 +204,7 @@ function mcl_beds.register_bed(name, def)
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
-- FIXME: Should be bouncy=66, but this would be a higher bounciness than slime blocks!
|
-- FIXME: Should be bouncy=66, but this would be a higher bounciness than slime blocks!
|
||||||
groups = {handy = 1, flammable = -1, bed = 2, dig_by_piston=1, bouncy=33, fall_damage_add_percent=-50, not_in_creative_inventory = 1},
|
groups = {handy = 1, flammable = 3, bed = 2, dig_by_piston=1, bouncy=33, fall_damage_add_percent=-50, not_in_creative_inventory = 1},
|
||||||
_mcl_hardness = 0.2,
|
_mcl_hardness = 0.2,
|
||||||
_mcl_blast_resistance = 1,
|
_mcl_blast_resistance = 1,
|
||||||
sounds = def.sounds or default_sounds,
|
sounds = def.sounds or default_sounds,
|
||||||
|
|
|
@ -1,41 +1,6 @@
|
||||||
local S = minetest.get_translator("mcl_chests")
|
local S = minetest.get_translator("mcl_chests")
|
||||||
local mod_doc = minetest.get_modpath("doc")
|
local mod_doc = minetest.get_modpath("doc")
|
||||||
|
|
||||||
-- Christmas chest setup
|
|
||||||
local it_is_christmas = false
|
|
||||||
local date = os.date("*t")
|
|
||||||
if (
|
|
||||||
date.month == 12 and (
|
|
||||||
date.day == 24 or
|
|
||||||
date.day == 25 or
|
|
||||||
date.day == 26
|
|
||||||
)
|
|
||||||
) then
|
|
||||||
it_is_christmas = true
|
|
||||||
end
|
|
||||||
|
|
||||||
local tiles_chest_normal_small = {"mcl_chests_normal.png"}
|
|
||||||
local tiles_chest_normal_double = {"mcl_chests_normal_double.png"}
|
|
||||||
|
|
||||||
if it_is_christmas then
|
|
||||||
tiles_chest_normal_small = {"mcl_chests_normal_present.png^mcl_chests_noise.png"}
|
|
||||||
tiles_chest_normal_double = {"mcl_chests_normal_double_present.png^mcl_chests_noise_double.png"}
|
|
||||||
end
|
|
||||||
|
|
||||||
local tiles_chest_trapped_small = {"mcl_chests_trapped.png"}
|
|
||||||
local tiles_chest_trapped_double = {"mcl_chests_trapped_double.png"}
|
|
||||||
|
|
||||||
if it_is_christmas then
|
|
||||||
tiles_chest_trapped_small = {"mcl_chests_trapped_present.png^mcl_chests_noise.png"}
|
|
||||||
tiles_chest_trapped_double = {"mcl_chests_trapped_double_present.png^mcl_chests_noise_double.png"}
|
|
||||||
end
|
|
||||||
|
|
||||||
local tiles_chest_ender_small = {"mcl_chests_ender.png"}
|
|
||||||
|
|
||||||
if it_is_christmas then
|
|
||||||
tiles_chest_ender_small = {"mcl_chests_ender_present.png^mcl_chests_noise.png"}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Chest Entity
|
-- Chest Entity
|
||||||
local animate_chests = (minetest.settings:get_bool("animated_chests") ~= false)
|
local animate_chests = (minetest.settings:get_bool("animated_chests") ~= false)
|
||||||
local entity_animations = {
|
local entity_animations = {
|
||||||
|
@ -187,10 +152,7 @@ if minetest.get_modpath("screwdriver") then
|
||||||
local nodename = node.name
|
local nodename = node.name
|
||||||
local nodedef = minetest.registered_nodes[nodename]
|
local nodedef = minetest.registered_nodes[nodename]
|
||||||
local dir = minetest.facedir_to_dir(new_param2)
|
local dir = minetest.facedir_to_dir(new_param2)
|
||||||
|
find_or_create_entity(pos, nodename, nodedef._chest_entity_textures, new_param2, false, nodedef._chest_entity_sound, nodedef._chest_entity_mesh, nodedef._chest_entity_animation_type, dir):set_yaw(dir)
|
||||||
if animate_chests then
|
|
||||||
find_or_create_entity(pos, nodename, nodedef._chest_entity_textures, new_param2, false, nodedef._chest_entity_sound, nodedef._chest_entity_mesh, nodedef._chest_entity_animation_type, dir):set_yaw(dir)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -219,10 +181,6 @@ local player_chest_open = function(player, pos, node_name, textures, param2, dou
|
||||||
local dir = minetest.facedir_to_dir(param2)
|
local dir = minetest.facedir_to_dir(param2)
|
||||||
local blocked = not shulker and (back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
|
local blocked = not shulker and (back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
|
||||||
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name, blocked)
|
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name, blocked)
|
||||||
else
|
|
||||||
minetest.sound_play(sound .. "_open", {
|
|
||||||
pos = pos,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -254,14 +212,11 @@ local chest_update_after_close = function(pos)
|
||||||
|
|
||||||
if node.name == "mcl_chests:trapped_chest_on_small" then
|
if node.name == "mcl_chests:trapped_chest_on_small" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
||||||
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
||||||
if animate_chests then
|
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
|
||||||
end
|
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -273,7 +228,7 @@ local chest_update_after_close = function(pos)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -287,10 +242,6 @@ local player_chest_close = function(player)
|
||||||
end
|
end
|
||||||
if animate_chests then
|
if animate_chests then
|
||||||
find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh, open_chest.shulker and "shulker" or "chest"):close(name)
|
find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh, open_chest.shulker and "shulker" or "chest"):close(name)
|
||||||
else
|
|
||||||
minetest.sound_play(open_chest.sound .. "_close", {
|
|
||||||
pos = open_chest.pos,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
chest_update_after_close(open_chest.pos)
|
chest_update_after_close(open_chest.pos)
|
||||||
|
|
||||||
|
@ -429,21 +380,12 @@ minetest.register_node(small_name, {
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
_doc_items_hidden = hidden,
|
_doc_items_hidden = hidden,
|
||||||
drawtype = animate_chests and "nodebox" or "mesh",
|
drawtype = "nodebox",
|
||||||
mesh = not animate_chests and "mcl_chests_chest.obj" or nil,
|
node_box = {
|
||||||
node_box = animate_chests and {
|
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
} or nil,
|
|
||||||
collision_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
|
||||||
},
|
},
|
||||||
selection_box = {
|
tiles = {"mcl_chests_blank.png"},
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
|
||||||
},
|
|
||||||
tiles = animate_chests and {"mcl_chests_blank.png"} or small_textures,
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
_chest_entity_textures = small_textures,
|
_chest_entity_textures = small_textures,
|
||||||
_chest_entity_sound = "default_chest",
|
_chest_entity_sound = "default_chest",
|
||||||
|
@ -493,10 +435,7 @@ minetest.register_node(small_name, {
|
||||||
minetest.swap_node(p, { name = "mcl_chests:"..canonical_basename.."_right", param2 = param2 })
|
minetest.swap_node(p, { name = "mcl_chests:"..canonical_basename.."_right", param2 = param2 })
|
||||||
else
|
else
|
||||||
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename.."_small", param2 = param2 })
|
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename.."_small", param2 = param2 })
|
||||||
|
create_entity(pos, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
|
||||||
if animate_chests then
|
|
||||||
create_entity(pos, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
@ -884,8 +823,8 @@ register_chest("chest",
|
||||||
chestusage,
|
chestusage,
|
||||||
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest"),
|
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest"),
|
||||||
{
|
{
|
||||||
small = tiles_chest_normal_small,
|
small = {"mcl_chests_normal.png"},
|
||||||
double = tiles_chest_normal_double,
|
double = {"mcl_chests_normal_double.png"},
|
||||||
inv = {"default_chest_top.png", "mcl_chests_chest_bottom.png",
|
inv = {"default_chest_top.png", "mcl_chests_chest_bottom.png",
|
||||||
"mcl_chests_chest_right.png", "mcl_chests_chest_left.png",
|
"mcl_chests_chest_right.png", "mcl_chests_chest_left.png",
|
||||||
"mcl_chests_chest_back.png", "default_chest_front.png"},
|
"mcl_chests_chest_back.png", "default_chest_front.png"},
|
||||||
|
@ -900,8 +839,8 @@ register_chest("chest",
|
||||||
)
|
)
|
||||||
|
|
||||||
local traptiles = {
|
local traptiles = {
|
||||||
small = tiles_chest_trapped_small,
|
small = {"mcl_chests_trapped.png"},
|
||||||
double = tiles_chest_trapped_double,
|
double = {"mcl_chests_trapped_double.png"},
|
||||||
inv = {"mcl_chests_chest_trapped_top.png", "mcl_chests_chest_trapped_bottom.png",
|
inv = {"mcl_chests_chest_trapped_top.png", "mcl_chests_chest_trapped_bottom.png",
|
||||||
"mcl_chests_chest_trapped_right.png", "mcl_chests_chest_trapped_left.png",
|
"mcl_chests_chest_trapped_right.png", "mcl_chests_chest_trapped_left.png",
|
||||||
"mcl_chests_chest_trapped_back.png", "mcl_chests_chest_trapped_front.png"},
|
"mcl_chests_chest_trapped_back.png", "mcl_chests_chest_trapped_front.png"},
|
||||||
|
@ -926,9 +865,7 @@ register_chest("trapped_chest",
|
||||||
}},
|
}},
|
||||||
function(pos, node, clicker)
|
function(pos, node, clicker)
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
||||||
if animate_chests then
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
|
||||||
end
|
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
end,
|
end,
|
||||||
function(pos, node, clicker)
|
function(pos, node, clicker)
|
||||||
|
@ -936,7 +873,7 @@ register_chest("trapped_chest",
|
||||||
meta:set_int("players", 1)
|
meta:set_int("players", 1)
|
||||||
|
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -950,7 +887,7 @@ register_chest("trapped_chest",
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_on_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_on_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
||||||
mesecon.receptor_on(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos_other, trapped_chest_mesecons_rules)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
@ -971,15 +908,13 @@ local function close_if_trapped_chest(pos, player)
|
||||||
|
|
||||||
if node.name == "mcl_chests:trapped_chest_on_small" then
|
if node.name == "mcl_chests:trapped_chest_on_small" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
||||||
if animate_chests then
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
|
||||||
end
|
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
player_chest_close(player)
|
player_chest_close(player)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -993,7 +928,7 @@ local function close_if_trapped_chest(pos, player)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
player_chest_close(player)
|
player_chest_close(player)
|
||||||
|
@ -1041,7 +976,7 @@ minetest.register_node("mcl_chests:ender_chest", {
|
||||||
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "mcl_chests_chest.obj",
|
mesh = "mcl_chests_chest.obj",
|
||||||
tiles = tiles_chest_ender_small,
|
tiles = {"mcl_chests_ender.png"},
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -1067,38 +1002,22 @@ local formspec_ender_chest = "size[9,8.75]"..
|
||||||
"listring[current_player;enderchest]"..
|
"listring[current_player;enderchest]"..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
|
|
||||||
minetest.register_chatcommand("enderchest", {
|
|
||||||
description = S("Show ender chest inventory formspec."),
|
|
||||||
privs = { debug = true },
|
|
||||||
func = function(name, params)
|
|
||||||
minetest.show_formspec(name, "enderchest:enderchest", formspec_ender_chest)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("mcl_chests:ender_chest_small", {
|
minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
description = S("Ender Chest"),
|
description = S("Ender Chest"),
|
||||||
_tt_help = S("27 interdimensional inventory slots") .. "\n" .. S("Put items inside, retrieve them from any ender chest"),
|
_tt_help = S("27 interdimensional inventory slots") .. "\n" .. S("Put items inside, retrieve them from any ender chest"),
|
||||||
_doc_items_longdesc = S("Ender chests grant you access to a single personal interdimensional inventory with 27 slots. This inventory is the same no matter from which ender chest you access it from. If you put one item into one ender chest, you will find it in all other ender chests. Each player will only see their own items, but not the items of other players."),
|
_doc_items_longdesc = S("Ender chests grant you access to a single personal interdimensional inventory with 27 slots. This inventory is the same no matter from which ender chest you access it from. If you put one item into one ender chest, you will find it in all other ender chests. Each player will only see their own items, but not the items of other players."),
|
||||||
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
||||||
drawtype = animate_chests and "nodebox" or "mesh",
|
drawtype = "nodebox",
|
||||||
mesh = not animate_chests and "mcl_chests_chest.obj" or nil,
|
node_box = {
|
||||||
node_box = animate_chests and {
|
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
fixed = {-0.4375, -0.5, -0.4375, 0.5, 0.375, 0.4375},
|
||||||
} or nil,
|
|
||||||
collision_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
|
||||||
},
|
},
|
||||||
selection_box = {
|
_chest_entity_textures = {"mcl_chests_ender.png"},
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
|
||||||
},
|
|
||||||
tiles = animate_chests and {"mcl_chests_blank.png"} or tiles_chest_ender_small,
|
|
||||||
_chest_entity_textures = tiles_chest_ender_small,
|
|
||||||
_chest_entity_sound = "mcl_chests_enderchest",
|
_chest_entity_sound = "mcl_chests_enderchest",
|
||||||
_chest_entity_mesh = "mcl_chests_chest",
|
_chest_entity_mesh = "mcl_chests_chest",
|
||||||
_chest_entity_animation_type = "chest",
|
_chest_entity_animation_type = "chest",
|
||||||
|
tiles = {"mcl_chests_blank.png"},
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
--[[{"mcl_chests_ender_chest_top.png", "mcl_chests_ender_chest_bottom.png",
|
--[[{"mcl_chests_ender_chest_top.png", "mcl_chests_ender_chest_bottom.png",
|
||||||
"mcl_chests_ender_chest_right.png", "mcl_chests_ender_chest_left.png",
|
"mcl_chests_ender_chest_right.png", "mcl_chests_ender_chest_left.png",
|
||||||
|
@ -1115,13 +1034,10 @@ minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec_ender_chest)
|
meta:set_string("formspec", formspec_ender_chest)
|
||||||
|
create_entity(pos, "mcl_chests:ender_chest_small", {"mcl_chests_ender.png"}, minetest.get_node(pos).param2, false, "mcl_chests_enderchest", "mcl_chests_chest", "chest")
|
||||||
if animate_chests then
|
|
||||||
create_entity(pos, "mcl_chests:ender_chest_small", tiles_chest_ender_small, minetest.get_node(pos).param2, false, "mcl_chests_enderchest", "mcl_chests_chest", "chest")
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
player_chest_open(clicker, pos, "mcl_chests:ender_chest_small", tiles_chest_ender_small, node.param2, false, "mcl_chests_enderchest", "mcl_chests_chest")
|
player_chest_open(clicker, pos, "mcl_chests:ender_chest_small", {"mcl_chests_ender.png"}, node.param2, false, "mcl_chests_enderchest", "mcl_chests_chest")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if fields.quit then
|
if fields.quit then
|
||||||
|
@ -1139,20 +1055,6 @@ minetest.register_on_joinplayer(function(player)
|
||||||
inv:set_size("enderchest", 9*3)
|
inv:set_size("enderchest", 9*3)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_allow_player_inventory_action(function(player, action, inv, info)
|
|
||||||
if inv:get_location().type == "player" and (
|
|
||||||
action == "move" and (info.from_list == "enderchest" or info.to_list == "enderchest")
|
|
||||||
or action == "put" and info.listname == "enderchest"
|
|
||||||
or action == "take" and info.listname == "enderchest"
|
|
||||||
) then
|
|
||||||
local def = player:get_wielded_item():get_definition()
|
|
||||||
|
|
||||||
if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'mcl_chests:ender_chest',
|
output = 'mcl_chests:ender_chest',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -1313,9 +1215,8 @@ for color, desc in pairs(boxtypes) do
|
||||||
_doc_items_entry_name = entry_name,
|
_doc_items_entry_name = entry_name,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
drawtype = animate_chests and "nodebox" or "mesh",
|
drawtype = "nodebox",
|
||||||
mesh = not animate_chests and "mcl_chests_shulker.obj" or nil,
|
tiles = {"mcl_chests_blank.png"},
|
||||||
tiles = animate_chests and {"mcl_chests_blank.png"} or {mob_texture},
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
_chest_entity_textures = {mob_texture},
|
_chest_entity_textures = {mob_texture},
|
||||||
_chest_entity_sound = "mcl_chests_shulker",
|
_chest_entity_sound = "mcl_chests_shulker",
|
||||||
|
@ -1336,10 +1237,7 @@ for color, desc in pairs(boxtypes) do
|
||||||
meta:set_string("formspec", formspec_shulker_box(nil))
|
meta:set_string("formspec", formspec_shulker_box(nil))
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 9*3)
|
inv:set_size("main", 9*3)
|
||||||
|
create_entity(pos, small_name, {mob_texture}, minetest.get_node(pos).param2, false, "mcl_chests_shulker", "mcl_chests_shulker", "shulker")
|
||||||
if animate_chests then
|
|
||||||
create_entity(pos, small_name, {mob_texture}, minetest.get_node(pos).param2, false, "mcl_chests_shulker", "mcl_chests_shulker", "shulker")
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local nmeta = minetest.get_meta(pos)
|
local nmeta = minetest.get_meta(pos)
|
||||||
|
@ -1458,11 +1356,6 @@ local function select_and_spawn_entity(pos, node)
|
||||||
local node_name = node.name
|
local node_name = node.name
|
||||||
local node_def = minetest.registered_nodes[node_name]
|
local node_def = minetest.registered_nodes[node_name]
|
||||||
local double_chest = minetest.get_item_group(node_name, "double_chest") > 0
|
local double_chest = minetest.get_item_group(node_name, "double_chest") > 0
|
||||||
|
|
||||||
if not animate_chests and not double_chest then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
find_or_create_entity(pos, node_name, node_def._chest_entity_textures, node.param2, double_chest, node_def._chest_entity_sound, node_def._chest_entity_mesh, node_def._chest_entity_animation_type)
|
find_or_create_entity(pos, node_name, node_def._chest_entity_textures, node.param2, double_chest, node_def._chest_entity_sound, node_def._chest_entity_mesh, node_def._chest_entity_animation_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 286 B |
|
@ -382,14 +382,8 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
-- TODO: Add crafting recipe: 9 ice → 1 packed ice
|
||||||
output = 'mcl_core:packed_ice 1',
|
-- Add it when silk touch tools work.
|
||||||
recipe = {
|
|
||||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
|
||||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
|
||||||
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Crafting (tool repair)
|
-- Crafting (tool repair)
|
||||||
|
|
|
@ -165,7 +165,7 @@ local function eat_gapple(itemstack, placer, pointed_thing)
|
||||||
mcl_potions.fire_resistance_func(placer, 1, 300)
|
mcl_potions.fire_resistance_func(placer, 1, 300)
|
||||||
mcl_potions.leaping_func(placer, 1, 300)
|
mcl_potions.leaping_func(placer, 1, 300)
|
||||||
end
|
end
|
||||||
-- TODO: Absorbtion
|
mcl_potions.swiftness_func(placer, absorbtion_factor, 120) -- TODO: Absorbtion
|
||||||
mcl_potions.regeneration_func(placer, 2, regen_duration)
|
mcl_potions.regeneration_func(placer, 2, regen_duration)
|
||||||
return gapple_hunger_restore(itemstack, placer, pointed_thing)
|
return gapple_hunger_restore(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,21 +18,19 @@ minetest.register_node("mcl_farming:beetroot_0", {
|
||||||
_doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."),
|
_doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."),
|
||||||
_doc_items_entry_name = S("Premature Beetroot Plant"),
|
_doc_items_entry_name = S("Premature Beetroot Plant"),
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:beetroot_seeds",
|
drop = "mcl_farming:beetroot_seeds",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_0.png") },
|
tiles = {"mcl_farming_beetroot_0.png"},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_beetroot_0.png",
|
inventory_image = "mcl_farming_beetroot_0.png",
|
||||||
wield_image = "mcl_farming_beetroot_0.png",
|
wield_image = "mcl_farming_beetroot_0.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, -6/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
@ -44,21 +42,19 @@ minetest.register_node("mcl_farming:beetroot_1", {
|
||||||
description = S("Premature Beetroot Plant (Stage 2)"),
|
description = S("Premature Beetroot Plant (Stage 2)"),
|
||||||
_doc_items_create_entry = false,
|
_doc_items_create_entry = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:beetroot_seeds",
|
drop = "mcl_farming:beetroot_seeds",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_1.png") },
|
tiles = {"mcl_farming_beetroot_1.png"},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_beetroot_1.png",
|
inventory_image = "mcl_farming_beetroot_1.png",
|
||||||
wield_image = "mcl_farming_beetroot_1.png",
|
wield_image = "mcl_farming_beetroot_1.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, -4/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, -3/16, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
@ -70,21 +66,19 @@ minetest.register_node("mcl_farming:beetroot_2", {
|
||||||
description = S("Premature Beetroot Plant (Stage 3)"),
|
description = S("Premature Beetroot Plant (Stage 3)"),
|
||||||
_doc_items_create_entry = false,
|
_doc_items_create_entry = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:beetroot_seeds",
|
drop = "mcl_farming:beetroot_seeds",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_2.png") },
|
tiles = {"mcl_farming_beetroot_2.png"},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_beetroot_2.png",
|
inventory_image = "mcl_farming_beetroot_2.png",
|
||||||
wield_image = "mcl_farming_beetroot_2.png",
|
wield_image = "mcl_farming_beetroot_2.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, 1/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, 2/16, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
@ -97,12 +91,11 @@ minetest.register_node("mcl_farming:beetroot", {
|
||||||
_doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."),
|
_doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."),
|
||||||
_doc_items_create_entry = true,
|
_doc_items_create_entry = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = {
|
drop = {
|
||||||
--[[ drops 1 beetroot guaranteed.
|
--[[ drops 1 beetroot guaranteed.
|
||||||
drops 1-4 beetroot seeds:
|
drops 1-4 beetroot seeds:
|
||||||
|
@ -119,14 +112,13 @@ minetest.register_node("mcl_farming:beetroot", {
|
||||||
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
|
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_3.png") },
|
tiles = {"mcl_farming_beetroot_3.png"},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_beetroot_3.png",
|
inventory_image = "mcl_farming_beetroot_3.png",
|
||||||
wield_image = "mcl_farming_beetroot_3.png",
|
wield_image = "mcl_farming_beetroot_3.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, 2/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, 3/16, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4},
|
||||||
|
|
|
@ -28,20 +28,18 @@ for i=1, 7 do
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
paramtype2 = "meshoptions",
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:carrot_item",
|
drop = "mcl_farming:carrot_item",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
tiles = {texture},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, sel_height - 1/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, sel_height, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
@ -55,13 +53,11 @@ minetest.register_node("mcl_farming:carrot", {
|
||||||
_doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."),
|
_doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."),
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
paramtype2 = "meshoptions",
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
tiles = {"farming_carrot_4.png"},
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("farming_carrot_4.png") },
|
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "farming_carrot_4.png",
|
inventory_image = "farming_carrot_4.png",
|
||||||
wield_image = "farming_carrot_4.png",
|
wield_image = "farming_carrot_4.png",
|
||||||
drop = {
|
drop = {
|
||||||
|
@ -76,7 +72,7 @@ minetest.register_node("mcl_farming:carrot", {
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, 3/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, 4/16, 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
|
|
@ -27,73 +27,3 @@ dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua")
|
||||||
|
|
||||||
-- ========= BEETROOT =========
|
-- ========= BEETROOT =========
|
||||||
dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua")
|
dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua")
|
||||||
|
|
||||||
-- This function generates a row of plantlike and nodebox nodes whose
|
|
||||||
-- name starts with a given string, starting at a given position. It
|
|
||||||
-- places a given node below so that the rendering can be examined.
|
|
||||||
local function generate_plant_row(prefix, pos, below_node)
|
|
||||||
local i = 1
|
|
||||||
for node_name, node in pairs(minetest.registered_nodes) do
|
|
||||||
if (
|
|
||||||
1 == node_name:find(prefix) and
|
|
||||||
(
|
|
||||||
"plantlike" == node.drawtype or
|
|
||||||
"nodebox" == node.drawtype
|
|
||||||
)
|
|
||||||
) then
|
|
||||||
local node_pos = {
|
|
||||||
x = pos.x + i,
|
|
||||||
y = pos.y,
|
|
||||||
z = pos.z,
|
|
||||||
}
|
|
||||||
minetest.set_node(
|
|
||||||
node_pos,
|
|
||||||
{
|
|
||||||
name = node_name,
|
|
||||||
param2 = node.place_param2 or 0
|
|
||||||
}
|
|
||||||
)
|
|
||||||
local below_pos = {
|
|
||||||
x = node_pos.x,
|
|
||||||
y = node_pos.y - 1,
|
|
||||||
z = node_pos.z
|
|
||||||
}
|
|
||||||
minetest.set_node(
|
|
||||||
below_pos,
|
|
||||||
below_node
|
|
||||||
)
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_chatcommand("generate_farming_plant_rows",{
|
|
||||||
description = "Generates rows of mcl_farming plant nodes on farming soil and glass",
|
|
||||||
privs = { debug = true },
|
|
||||||
func = function(name, param)
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local pos = player:get_pos()
|
|
||||||
local node_prefixes = {
|
|
||||||
"mcl_farming:beetroot",
|
|
||||||
"mcl_farming:carrot",
|
|
||||||
"mcl_farming:melon",
|
|
||||||
"mcl_farming:potato",
|
|
||||||
"mcl_farming:pumpkin",
|
|
||||||
"mcl_farming:wheat",
|
|
||||||
}
|
|
||||||
for i,node_prefix in ipairs(node_prefixes) do
|
|
||||||
generate_plant_row(
|
|
||||||
node_prefix,
|
|
||||||
pos,
|
|
||||||
{ name = "mcl_farming:soil" }
|
|
||||||
)
|
|
||||||
pos.z = pos.z + 2
|
|
||||||
generate_plant_row(
|
|
||||||
node_prefix,
|
|
||||||
pos,
|
|
||||||
{ name = "mcl_core:glass" }
|
|
||||||
)
|
|
||||||
pos.z = pos.z + 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
|
@ -91,18 +91,16 @@ for s=1,7 do
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drop = stem_drop,
|
drop = stem_drop,
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
tiles = {texture},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},
|
||||||
|
|
|
@ -6,13 +6,13 @@ for i=1, 7 do
|
||||||
local texture, selbox
|
local texture, selbox
|
||||||
if i < 3 then
|
if i < 3 then
|
||||||
texture = "mcl_farming_potatoes_stage_0.png"
|
texture = "mcl_farming_potatoes_stage_0.png"
|
||||||
selbox = { -0.5, -9/16, -0.5, 0.5, -6/16, 0.5 }
|
selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
|
||||||
elseif i < 5 then
|
elseif i < 5 then
|
||||||
texture = "mcl_farming_potatoes_stage_1.png"
|
texture = "mcl_farming_potatoes_stage_1.png"
|
||||||
selbox = { -0.5, -9/16, -0.5, 0.5, -3/16, 0.5 }
|
selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
|
||||||
else
|
else
|
||||||
texture = "mcl_farming_potatoes_stage_2.png"
|
texture = "mcl_farming_potatoes_stage_2.png"
|
||||||
selbox = { -0.5, -9/16, -0.5, 0.5, 1/16, 0.5 }
|
selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
|
||||||
end
|
end
|
||||||
|
|
||||||
local create, name, longdesc
|
local create, name, longdesc
|
||||||
|
@ -33,15 +33,13 @@ for i=1, 7 do
|
||||||
_doc_items_entry_name = name,
|
_doc_items_entry_name = name,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:potato_item",
|
drop = "mcl_farming:potato_item",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
tiles = { texture },
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
|
@ -59,14 +57,12 @@ minetest.register_node("mcl_farming:potato", {
|
||||||
description = S("Mature Potato Plant"),
|
description = S("Mature Potato Plant"),
|
||||||
_doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."),
|
_doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."),
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "meshoptions",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
tiles = {"mcl_farming_potatoes_stage_3.png"},
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_potatoes_stage_3.png") },
|
|
||||||
use_texture_alpha = "clip",
|
|
||||||
wield_image = "mcl_farming_potatoes_stage_3.png",
|
wield_image = "mcl_farming_potatoes_stage_3.png",
|
||||||
inventory_image = "mcl_farming_potatoes_stage_3.png",
|
inventory_image = "mcl_farming_potatoes_stage_3.png",
|
||||||
drop = {
|
drop = {
|
||||||
|
@ -81,7 +77,7 @@ minetest.register_node("mcl_farming:potato", {
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{ -0.5, -9/16, -0.5, 0.5, 0, 0.5 }
|
{ -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||||
|
|
|
@ -63,18 +63,16 @@ for s=1,7 do
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drop = stem_drop,
|
drop = stem_drop,
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
tiles = {texture},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
||||||
|
@ -106,6 +104,7 @@ local pumpkin_base_def = {
|
||||||
_mcl_blast_resistance = 1,
|
_mcl_blast_resistance = 1,
|
||||||
_mcl_hardness = 1,
|
_mcl_hardness = 1,
|
||||||
}
|
}
|
||||||
|
minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def)
|
||||||
|
|
||||||
local pumpkin_face_base_def = table.copy(pumpkin_base_def)
|
local pumpkin_face_base_def = table.copy(pumpkin_base_def)
|
||||||
pumpkin_face_base_def.description = S("Pumpkin")
|
pumpkin_face_base_def.description = S("Pumpkin")
|
||||||
|
@ -116,11 +115,6 @@ pumpkin_face_base_def.groups.armor_head=1
|
||||||
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
|
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
|
||||||
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
|
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
|
||||||
pumpkin_face_base_def.groups.non_combat_armor=1
|
pumpkin_face_base_def.groups.non_combat_armor=1
|
||||||
pumpkin_face_base_def.on_construct = function(pos)
|
|
||||||
-- Attempt to spawn iron golem or snow golem
|
|
||||||
mobs_mc.tools.check_iron_golem_summon(pos)
|
|
||||||
mobs_mc.tools.check_snow_golem_summon(pos)
|
|
||||||
end
|
|
||||||
if minetest.get_modpath("mcl_armor") then
|
if minetest.get_modpath("mcl_armor") then
|
||||||
pumpkin_face_base_def.on_secondary_use = armor.on_armor_use
|
pumpkin_face_base_def.on_secondary_use = armor.on_armor_use
|
||||||
end
|
end
|
||||||
|
@ -129,11 +123,12 @@ end
|
||||||
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
|
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
|
||||||
|
|
||||||
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
|
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
|
||||||
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127")
|
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_face_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127",
|
||||||
|
function(pos)
|
||||||
-- Steal function to properly disconnect a carved pumpkin
|
-- Attempt to spawn iron golem or snow golem
|
||||||
pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct
|
mobs_mc.tools.check_iron_golem_summon(pos)
|
||||||
minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def)
|
mobs_mc.tools.check_snow_golem_summon(pos)
|
||||||
|
end)
|
||||||
|
|
||||||
-- Jack o'Lantern
|
-- Jack o'Lantern
|
||||||
minetest.register_node("mcl_farming:pumpkin_face_light", {
|
minetest.register_node("mcl_farming:pumpkin_face_light", {
|
||||||
|
@ -170,6 +165,11 @@ minetest.register_craft({
|
||||||
recipe = {{"mcl_farming:pumpkin"}}
|
recipe = {{"mcl_farming:pumpkin"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_farming:pumpkin_seeds 4",
|
||||||
|
recipe = {{"mcl_farming:pumpkin_face"}}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_farming:pumpkin_pie", {
|
minetest.register_craftitem("mcl_farming:pumpkin_pie", {
|
||||||
description = S("Pumpkin Pie"),
|
description = S("Pumpkin Pie"),
|
||||||
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
|
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
|
||||||
|
@ -187,6 +187,11 @@ minetest.register_craft({
|
||||||
output = "mcl_farming:pumpkin_pie",
|
output = "mcl_farming:pumpkin_pie",
|
||||||
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"},
|
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"},
|
||||||
})
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "mcl_farming:pumpkin_pie",
|
||||||
|
recipe = {"mcl_farming:pumpkin_face", "mcl_core:sugar", "mcl_throwing:egg"},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
|
|
|
@ -178,7 +178,7 @@ end
|
||||||
- stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason
|
- stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason
|
||||||
- stem_drop: Drop probability table for all stem
|
- stem_drop: Drop probability table for all stem
|
||||||
- gourd_itemstring: Desired itemstring of the full gourd node
|
- gourd_itemstring: Desired itemstring of the full gourd node
|
||||||
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_destruct to the definition for unconnecting any connected stems
|
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_dig_node to the definition for unconnecting any connected stems
|
||||||
- grow_interval: Will attempt to grow a gourd periodically at this interval in seconds
|
- grow_interval: Will attempt to grow a gourd periodically at this interval in seconds
|
||||||
- grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number
|
- grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number
|
||||||
- connected_stem_texture: Texture of the connected stem
|
- connected_stem_texture: Texture of the connected stem
|
||||||
|
@ -228,8 +228,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register gourd
|
-- Register gourd
|
||||||
if not gourd_def.after_destruct then
|
if not gourd_def.after_dig_node then
|
||||||
gourd_def.after_destruct = function(blockpos, oldnode)
|
gourd_def.after_dig_node = function(blockpos, oldnode, oldmetadata, user)
|
||||||
-- Disconnect any connected stems, turning them back to normal stems
|
-- Disconnect any connected stems, turning them back to normal stems
|
||||||
for n=1, #neighbors do
|
for n=1, #neighbors do
|
||||||
local offset = neighbors[n]
|
local offset = neighbors[n]
|
||||||
|
@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
stem_def.selection_box = {
|
stem_def.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -9/16, -0.15, 0.15, 7/16, 0.15}
|
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -273,20 +273,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
stem_def.paramtype = "light"
|
stem_def.paramtype = "light"
|
||||||
end
|
end
|
||||||
if not stem_def.drawtype then
|
if not stem_def.drawtype then
|
||||||
stem_def.drawtype = "nodebox"
|
stem_def.drawtype = "plantlike"
|
||||||
end
|
|
||||||
if not stem_def.node_box then
|
|
||||||
stem_def.node_box = mcl_farming:get_plantlike_plus_nodebox()
|
|
||||||
end
|
|
||||||
if stem_def.tiles then
|
|
||||||
for i=1,#stem_def.tiles do
|
|
||||||
stem_def.tiles[i] = mcl_farming:align_plantlike_nodebox_texture(
|
|
||||||
stem_def.tiles[i]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not stem_def.use_texture_alpha then
|
|
||||||
stem_def.use_texture_alpha = "clip"
|
|
||||||
end
|
end
|
||||||
if stem_def.walkable == nil then
|
if stem_def.walkable == nil then
|
||||||
stem_def.walkable = false
|
stem_def.walkable = false
|
||||||
|
@ -313,9 +300,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
minetest.register_node(stem_itemstring, stem_def)
|
minetest.register_node(stem_itemstring, stem_def)
|
||||||
|
|
||||||
-- Register connected stems
|
-- Register connected stems
|
||||||
local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture(
|
|
||||||
connected_stem_texture
|
|
||||||
)
|
|
||||||
local connected_stem_tiles = {
|
local connected_stem_tiles = {
|
||||||
{ "blank.png", --top
|
{ "blank.png", --top
|
||||||
"blank.png", -- bottom
|
"blank.png", -- bottom
|
||||||
|
@ -347,16 +332,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local connected_stem_nodebox = {
|
local connected_stem_nodebox = {
|
||||||
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
||||||
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
||||||
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
||||||
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
||||||
}
|
}
|
||||||
local connected_stem_selectionbox = {
|
local connected_stem_selectionbox = {
|
||||||
{-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1},
|
{-0.1, -0.5, -0.1, 0.5, 0.2, 0.1},
|
||||||
{-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1},
|
{-0.5, -0.5, -0.1, 0.1, 0.2, 0.1},
|
||||||
{-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5},
|
{-0.1, -0.5, -0.1, 0.1, 0.2, 0.5},
|
||||||
{-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1},
|
{-0.1, -0.5, -0.5, 0.1, 0.2, 0.1},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i=1, 4 do
|
for i=1, 4 do
|
||||||
|
@ -403,11 +388,12 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
{ x=0, y=0, z=-1 },
|
{ x=0, y=0, z=-1 },
|
||||||
{ x=0, y=0, z=1 },
|
{ x=0, y=0, z=1 },
|
||||||
}
|
}
|
||||||
|
local floorpos, floor
|
||||||
for n=#neighbors, 1, -1 do
|
for n=#neighbors, 1, -1 do
|
||||||
local offset = neighbors[n]
|
local offset = neighbors[n]
|
||||||
local blockpos = vector.add(stempos, offset)
|
local blockpos = vector.add(stempos, offset)
|
||||||
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
||||||
local floor = minetest.get_node(floorpos)
|
floor = minetest.get_node(floorpos)
|
||||||
local block = minetest.get_node(blockpos)
|
local block = minetest.get_node(blockpos)
|
||||||
local soilgroup = minetest.get_item_group(floor.name, "soil")
|
local soilgroup = minetest.get_item_group(floor.name, "soil")
|
||||||
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
|
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
|
||||||
|
@ -421,8 +407,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
local r = math.random(1, #neighbors)
|
local r = math.random(1, #neighbors)
|
||||||
local offset = neighbors[r]
|
local offset = neighbors[r]
|
||||||
local blockpos = vector.add(stempos, offset)
|
local blockpos = vector.add(stempos, offset)
|
||||||
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
|
||||||
local floor = minetest.get_node(floorpos)
|
|
||||||
local p2
|
local p2
|
||||||
if offset.x == 1 then
|
if offset.x == 1 then
|
||||||
minetest.set_node(stempos, {name=connected_stem_names[1]})
|
minetest.set_node(stempos, {name=connected_stem_names[1]})
|
||||||
|
@ -484,40 +468,3 @@ minetest.register_lbm({
|
||||||
mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed)
|
mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- This function returns a nodebox that imitates a plantlike plus (+)
|
|
||||||
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
|
||||||
-- farming soil. The regular plantlike drawtype can not do this.
|
|
||||||
function mcl_farming:get_plantlike_plus_nodebox()
|
|
||||||
return {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ 0, -9/16, -0.15, 0, 7/16, 0.15 },
|
|
||||||
{ -0.15, -9/16, 0, 0.15, 7/16, 0 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This function returns a nodebox that imitates a plantlike grid (#)
|
|
||||||
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
|
||||||
-- farming soil. The regular plantlike drawtype can not do this.
|
|
||||||
function mcl_farming:get_plantlike_grid_nodebox()
|
|
||||||
return {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ 4/16, -9/16, -8/16, 4/16, 7/16, 8/16},
|
|
||||||
{-4/16, -9/16, -8/16, -4/16, 7/16, 8/16},
|
|
||||||
{-8/16, -9/16, -4/16, 8/16, 7/16, -4/16},
|
|
||||||
{-8/16, -9/16, 4/16, 8/16, 7/16, 4/16},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This function takes a texture and returns a modified texture where
|
|
||||||
-- the bottom row is at the top, assuming 16px × 16px textures. This
|
|
||||||
-- is used to align textures to a “plantlike” nodebox shifted 1/16
|
|
||||||
-- below its own node – into the empty space above farming soil.
|
|
||||||
function mcl_farming:align_plantlike_nodebox_texture(texture)
|
|
||||||
local texture = texture:gsub("%^", "\\%^"):gsub(":", "\\:")
|
|
||||||
return "[combine:16x16:0,-15=" .. texture .. ":0,1=" .. texture
|
|
||||||
end
|
|
||||||
|
|
|
@ -39,21 +39,19 @@ for i=1,7 do
|
||||||
_doc_items_entry_name = name,
|
_doc_items_entry_name = name,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
paramtype2 = "meshoptions",
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
|
||||||
drop = "mcl_farming:wheat_seeds",
|
drop = "mcl_farming:wheat_seeds",
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_"..(i-1)..".png") },
|
tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"},
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
||||||
wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -9/16, -0.5, 0.5, sel_heights[i] - 1/16, 0.5}
|
{-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
||||||
|
@ -67,21 +65,13 @@ minetest.register_node("mcl_farming:wheat", {
|
||||||
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
|
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
-- keep place_param2 for plantlike drawtype compatiblity
|
paramtype2 = "meshoptions",
|
||||||
place_param2 = 3,
|
place_param2 = 3,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "plantlike",
|
||||||
node_box = mcl_farming:get_plantlike_grid_nodebox(),
|
tiles = {"mcl_farming_wheat_stage_7.png"},
|
||||||
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_7.png") },
|
|
||||||
use_texture_alpha = "clip",
|
|
||||||
inventory_image = "mcl_farming_wheat_stage_7.png",
|
inventory_image = "mcl_farming_wheat_stage_7.png",
|
||||||
wield_image = "mcl_farming_wheat_stage_7.png",
|
wield_image = "mcl_farming_wheat_stage_7.png",
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -9/16, -0.5, 0.5, 7/16, 0.5 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 4,
|
max_items = 4,
|
||||||
items = {
|
items = {
|
||||||
|
|
|
@ -5,6 +5,29 @@ mcl_fire = {}
|
||||||
local S = minetest.get_translator("mcl_fire")
|
local S = minetest.get_translator("mcl_fire")
|
||||||
local N = function(s) return s end
|
local N = function(s) return s end
|
||||||
|
|
||||||
|
-- inverse pyramid pattern above lava source, floor 1 of 2:
|
||||||
|
local lava_fire=
|
||||||
|
{
|
||||||
|
{ x =-1, y = 1, z =-1},
|
||||||
|
{ x =-1, y = 1, z = 0},
|
||||||
|
{ x =-1, y = 1, z = 1},
|
||||||
|
{ x = 0, y = 1, z =-1},
|
||||||
|
{ x = 0, y = 1, z = 0},
|
||||||
|
{ x = 0, y = 1, z = 1},
|
||||||
|
{ x = 1, y = 1, z =-1},
|
||||||
|
{ x = 1, y = 1, z = 0},
|
||||||
|
{ x = 1, y = 1, z = 1}
|
||||||
|
}
|
||||||
|
local alldirs=
|
||||||
|
{
|
||||||
|
{ x =-1, y = 0, z = 0},
|
||||||
|
{ x = 1, y = 0, z = 0},
|
||||||
|
{ x = 0, y =-1, z = 0},
|
||||||
|
{ x = 0, y = 1, z = 0},
|
||||||
|
{ x = 0, y = 0, z =-1},
|
||||||
|
{ x = 0, y = 0, z = 1}
|
||||||
|
}
|
||||||
|
|
||||||
local spawn_smoke = function(pos)
|
local spawn_smoke = function(pos)
|
||||||
mcl_particles.add_node_particlespawner(pos, {
|
mcl_particles.add_node_particlespawner(pos, {
|
||||||
amount = 0.1,
|
amount = 0.1,
|
||||||
|
@ -27,34 +50,6 @@ local spawn_smoke = function(pos)
|
||||||
}, "high")
|
}, "high")
|
||||||
end
|
end
|
||||||
|
|
||||||
local adjacents = {
|
|
||||||
{ x =-1, y = 0, z = 0 },
|
|
||||||
{ x = 1, y = 0, z = 0 },
|
|
||||||
{ x = 0, y = 1, z = 0 },
|
|
||||||
{ x = 0, y =-1, z = 0 },
|
|
||||||
{ x = 0, y = 0, z =-1 },
|
|
||||||
{ x = 0, y = 0, z = 1 },
|
|
||||||
}
|
|
||||||
|
|
||||||
math.randomseed(os.time())
|
|
||||||
local function shuffle_table(t)
|
|
||||||
for i = #t, 1, -1 do
|
|
||||||
local r = math.random(i)
|
|
||||||
t[i], t[r] = t[r], t[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
shuffle_table(adjacents)
|
|
||||||
|
|
||||||
local function has_flammable(pos)
|
|
||||||
for k,v in pairs(adjacents) do
|
|
||||||
local p=vector.add(pos,v)
|
|
||||||
local n=minetest.get_node_or_nil(p)
|
|
||||||
if n and minetest.get_item_group(n.name, "flammable") ~= 0 then
|
|
||||||
return p
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Items
|
-- Items
|
||||||
--
|
--
|
||||||
|
@ -90,6 +85,10 @@ local fire_death_messages = {
|
||||||
N("@1 died in a fire."),
|
N("@1 died in a fire."),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local fire_timer = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(math.random(3, 7))
|
||||||
|
end
|
||||||
|
|
||||||
local spawn_fire = function(pos, age)
|
local spawn_fire = function(pos, age)
|
||||||
minetest.set_node(pos, {name="mcl_fire:fire", param2 = age})
|
minetest.set_node(pos, {name="mcl_fire:fire", param2 = age})
|
||||||
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
|
@ -125,6 +124,82 @@ minetest.register_node("mcl_fire:fire", {
|
||||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_timer = function(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
-- Age is a number from 0 to 15 and is increased every timer step.
|
||||||
|
-- "old" fire is more likely to be extinguished
|
||||||
|
local age = node.param2
|
||||||
|
local flammables = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"group:flammable"})
|
||||||
|
local below = minetest.get_node({x=pos.x, y=pos.z-1, z=pos.z})
|
||||||
|
local below_is_flammable = minetest.get_item_group(below.name, "flammable") > 0
|
||||||
|
-- Extinguish fire
|
||||||
|
if (not fire_enabled) and (math.random(1,3) == 1) then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if age == 15 and not below_is_flammable then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
elseif age > 3 and #flammables == 0 and not below_is_flammable and math.random(1,4) == 1 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local age_add = 1
|
||||||
|
-- If fire spread is disabled, we have to skip the "destructive" code
|
||||||
|
if (not fire_enabled) then
|
||||||
|
if age + age_add <= 15 then
|
||||||
|
node.param2 = age + age_add
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
-- Restart timer
|
||||||
|
fire_timer(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Spawn fire to nearby flammable nodes
|
||||||
|
local is_next_to_flammable = minetest.find_node_near(pos, 2, {"group:flammable"}) ~= nil
|
||||||
|
if is_next_to_flammable and math.random(1,2) == 1 then
|
||||||
|
-- The fire we spawn copies the age of this fire.
|
||||||
|
-- This prevents fire from spreading infinitely far as the fire fire dies off
|
||||||
|
-- quicker the further it has spreaded.
|
||||||
|
local age_next = math.min(15, age + math.random(0, 1))
|
||||||
|
-- Select random type of fire spread
|
||||||
|
local burntype = math.random(1,2)
|
||||||
|
if burntype == 1 then
|
||||||
|
-- Spawn fire in air
|
||||||
|
local nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
||||||
|
while #nodes > 0 do
|
||||||
|
local r = math.random(1, #nodes)
|
||||||
|
if minetest.find_node_near(nodes[r], 1, {"group:flammable"}) then
|
||||||
|
spawn_fire(nodes[r], age_next)
|
||||||
|
break
|
||||||
|
else
|
||||||
|
table.remove(nodes, r)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Burn flammable block
|
||||||
|
local nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"group:flammable"})
|
||||||
|
if #nodes > 0 then
|
||||||
|
local r = math.random(1, #nodes)
|
||||||
|
local nn = minetest.get_node(nodes[r]).name
|
||||||
|
local ndef = minetest.registered_nodes[nn]
|
||||||
|
local fgroup = minetest.get_item_group(nn, "flammable")
|
||||||
|
if ndef and ndef._on_burn then
|
||||||
|
ndef._on_burn(nodes[r])
|
||||||
|
elseif fgroup ~= -1 then
|
||||||
|
spawn_fire(nodes[r], age_next)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Regular age increase
|
||||||
|
if age + age_add <= 15 then
|
||||||
|
node.param2 = age + age_add
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
-- Restart timer
|
||||||
|
fire_timer(pos)
|
||||||
|
end,
|
||||||
drop = "",
|
drop = "",
|
||||||
sounds = {},
|
sounds = {},
|
||||||
-- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer
|
-- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer
|
||||||
|
@ -134,12 +209,14 @@ minetest.register_node("mcl_fire:fire", {
|
||||||
|
|
||||||
local dim = mcl_worlds.pos_to_dimension(bpos)
|
local dim = mcl_worlds.pos_to_dimension(bpos)
|
||||||
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" or (under == "mcl_core:bedrock" and dim == "end") then
|
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" or (under == "mcl_core:bedrock" and dim == "end") then
|
||||||
minetest.set_node(pos, {name="mcl_fire:eternal_fire"})
|
minetest.swap_node(pos, {name = "mcl_fire:eternal_fire"})
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_portals") then
|
if minetest.get_modpath("mcl_portals") then
|
||||||
mcl_portals.light_nether_portal(pos)
|
mcl_portals.light_nether_portal(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fire_timer(pos)
|
||||||
spawn_smoke(pos)
|
spawn_smoke(pos)
|
||||||
end,
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
|
@ -178,7 +255,29 @@ minetest.register_node("mcl_fire:eternal_fire", {
|
||||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_timer = function(pos)
|
||||||
|
if fire_enabled then
|
||||||
|
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
||||||
|
while #airs > 0 do
|
||||||
|
local r = math.random(1, #airs)
|
||||||
|
if minetest.find_node_near(airs[r], 1, {"group:flammable"}) then
|
||||||
|
local node = minetest.get_node(airs[r])
|
||||||
|
local age = node.param2
|
||||||
|
local age_next = math.min(15, age + math.random(0, 1))
|
||||||
|
spawn_fire(airs[r], age_next)
|
||||||
|
break
|
||||||
|
else
|
||||||
|
table.remove(airs, r)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Restart timer
|
||||||
|
fire_timer(pos)
|
||||||
|
end,
|
||||||
|
-- Start burning timer and light Nether portal (if possible)
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
fire_timer(pos)
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_portals") then
|
if minetest.get_modpath("mcl_portals") then
|
||||||
mcl_portals.light_nether_portal(pos)
|
mcl_portals.light_nether_portal(pos)
|
||||||
end
|
end
|
||||||
|
@ -303,6 +402,114 @@ if flame_sound then
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- ABMs
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Extinguish all flames quickly with water and such
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Extinguish fire",
|
||||||
|
nodenames = {"mcl_fire:fire", "mcl_fire:eternal_fire"},
|
||||||
|
neighbors = {"group:puts_out_fire"},
|
||||||
|
interval = 3,
|
||||||
|
chance = 1,
|
||||||
|
catch_up = false,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
minetest.sound_play("fire_extinguish_flame",
|
||||||
|
{pos = pos, max_hear_distance = 16, gain = 0.15}, true)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Enable the following ABMs according to 'enable fire' setting
|
||||||
|
|
||||||
|
local function has_flammable(pos)
|
||||||
|
local npos, node
|
||||||
|
for n, v in ipairs(alldirs) do
|
||||||
|
npos = vector.add(pos, v)
|
||||||
|
node = minetest.get_node_or_nil(npos)
|
||||||
|
if node and node.name and minetest.get_item_group(node.name, "flammable") ~= 0 then
|
||||||
|
return npos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if not fire_enabled then
|
||||||
|
|
||||||
|
-- Occasionally remove fire if fire disabled
|
||||||
|
-- NOTE: Fire is normally extinguished in timer function
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Remove disabled fire",
|
||||||
|
nodenames = {"mcl_fire:fire"},
|
||||||
|
interval = 10,
|
||||||
|
chance = 10,
|
||||||
|
catch_up = false,
|
||||||
|
action = minetest.remove_node,
|
||||||
|
})
|
||||||
|
|
||||||
|
else -- Fire enabled
|
||||||
|
|
||||||
|
-- Set fire to air nodes
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Ignite fire by lava",
|
||||||
|
nodenames = {"group:lava"},
|
||||||
|
neighbors = {"air"},
|
||||||
|
interval = 7,
|
||||||
|
chance = 3,
|
||||||
|
catch_up = false,
|
||||||
|
action = function(pos)
|
||||||
|
local i, dir, target, node, i2, f
|
||||||
|
i = math.random(1,9)
|
||||||
|
dir = lava_fire[i]
|
||||||
|
target = {x=pos.x+dir.x, y=pos.y+dir.y, z=pos.z+dir.z}
|
||||||
|
node = minetest.get_node(target)
|
||||||
|
if not node or node.name ~= "air" then
|
||||||
|
i = ((i + math.random(0,7)) % 9) + 1
|
||||||
|
dir = lava_fire[i]
|
||||||
|
target = {x=pos.x+dir.x, y=pos.y+dir.y, z=pos.z+dir.z}
|
||||||
|
node = minetest.get_node(target)
|
||||||
|
if not node or node.name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
i2 = math.random(1,15)
|
||||||
|
if i2 < 10 then
|
||||||
|
local dir2, target2, node2
|
||||||
|
dir2 = lava_fire[i2]
|
||||||
|
target2 = {x=target.x+dir2.x, y=target.y+dir2.y, z=target.z+dir2.z}
|
||||||
|
node2 = minetest.get_node(target2)
|
||||||
|
if node2 and node2.name == "air" then
|
||||||
|
f = has_flammable(target2)
|
||||||
|
if f then
|
||||||
|
minetest.after(1, spawn_fire, {x=target2.x, y=target2.y, z=target2.z})
|
||||||
|
minetest.add_particle({
|
||||||
|
pos = vector.new({x=pos.x, y=pos.y+0.5, z=pos.z}),
|
||||||
|
velocity={x=f.x-pos.x, y=math.max(f.y-pos.y,0.7), z=f.z-pos.z},
|
||||||
|
expirationtime=1, size=1.5, collisiondetection=false,
|
||||||
|
glow=minetest.LIGHT_MAX, texture="mcl_particles_flame.png"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
f = has_flammable(target)
|
||||||
|
if f then
|
||||||
|
minetest.after(1, spawn_fire, {x=target.x, y=target.y, z=target.z})
|
||||||
|
minetest.add_particle({
|
||||||
|
pos = vector.new({x=pos.x, y=pos.y+0.5, z=pos.z}),
|
||||||
|
velocity={x=f.x-pos.x, y=math.max(f.y-pos.y,0.25), z=f.z-pos.z},
|
||||||
|
expirationtime=1, size=1, collisiondetection=false,
|
||||||
|
glow=minetest.LIGHT_MAX, texture="mcl_particles_flame.png"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Set pointed_thing on (normal) fire.
|
-- Set pointed_thing on (normal) fire.
|
||||||
-- * pointed_thing: Pointed thing to ignite
|
-- * pointed_thing: Pointed thing to ignite
|
||||||
-- * player: Player who sets fire or nil if nobody
|
-- * player: Player who sets fire or nil if nobody
|
||||||
|
@ -328,144 +535,6 @@ mcl_fire.set_fire = function(pointed_thing, player, allow_on_fire)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
|
||||||
-- ABMs
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Extinguish all flames quickly with water and such
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Extinguish fire",
|
|
||||||
nodenames = {"mcl_fire:fire", "mcl_fire:eternal_fire"},
|
|
||||||
neighbors = {"group:puts_out_fire"},
|
|
||||||
interval = 3,
|
|
||||||
chance = 1,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
minetest.sound_play("fire_extinguish_flame",
|
|
||||||
{pos = pos, max_hear_distance = 16, gain = 0.15}, true)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- Enable the following ABMs according to 'enable fire' setting
|
|
||||||
|
|
||||||
-- [...]a fire that is not adjacent to any flammable block does not spread, even to another flammable block within the normal range.
|
|
||||||
-- https://minecraft.fandom.com/wiki/Fire#Spread
|
|
||||||
|
|
||||||
local function check_aircube(p1,p2)
|
|
||||||
local nds=minetest.find_nodes_in_area(p1,p2,{"air"})
|
|
||||||
shuffle_table(nds)
|
|
||||||
for k,v in pairs(nds) do
|
|
||||||
if has_flammable(v) then return v end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- [...] a fire block can turn any air block that is adjacent to a flammable block into a fire block. This can happen at a distance of up to one block downward, one block sideways (including diagonals), and four blocks upward of the original fire block (not the block the fire is on/next to).
|
|
||||||
local function get_ignitable(pos)
|
|
||||||
return check_aircube(vector.add(pos,vector.new(-1,-1,-1)),vector.add(pos,vector.new(1,4,1)))
|
|
||||||
end
|
|
||||||
-- Fire spreads from a still lava block similarly: any air block one above and up to one block sideways (including diagonals) or two above and two blocks sideways (including diagonals) that is adjacent to a flammable block may be turned into a fire block.
|
|
||||||
local function get_ignitable_by_lava(pos)
|
|
||||||
return check_aircube(vector.add(pos,vector.new(-1,1,-1)),vector.add(pos,vector.new(1,1,1))) or check_aircube(vector.add(pos,vector.new(-2,2,-2)),vector.add(pos,vector.new(2,2,2))) or nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if not fire_enabled then
|
|
||||||
|
|
||||||
-- Occasionally remove fire if fire disabled
|
|
||||||
-- NOTE: Fire is normally extinguished in timer function
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Remove disabled fire",
|
|
||||||
nodenames = {"mcl_fire:fire"},
|
|
||||||
interval = 10,
|
|
||||||
chance = 10,
|
|
||||||
catch_up = false,
|
|
||||||
action = minetest.remove_node,
|
|
||||||
})
|
|
||||||
|
|
||||||
else -- Fire enabled
|
|
||||||
|
|
||||||
-- Fire Spread
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Ignite flame",
|
|
||||||
nodenames ={"mcl_fire:fire","mcl_fire:eternal_fire"},
|
|
||||||
interval = 7,
|
|
||||||
chance = 12,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos)
|
|
||||||
local p = get_ignitable(pos)
|
|
||||||
if p then
|
|
||||||
spawn_fire(p)
|
|
||||||
shuffle_table(adjacents)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
--lava fire spread
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Ignite fire by lava",
|
|
||||||
nodenames = {"mcl_core:lava_source","mcl_nether:nether_lava_source"},
|
|
||||||
neighbors = {"air","group:flammable"},
|
|
||||||
interval = 7,
|
|
||||||
chance = 3,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos)
|
|
||||||
local p=get_ignitable_by_lava(pos)
|
|
||||||
if p then
|
|
||||||
spawn_fire(p)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Remove fires",
|
|
||||||
nodenames = {"mcl_fire:fire"},
|
|
||||||
interval = 7,
|
|
||||||
chance = 3,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos)
|
|
||||||
local p=has_flammable(pos)
|
|
||||||
if p then
|
|
||||||
local n=minetest.get_node_or_nil(p)
|
|
||||||
if n and minetest.get_item_group(n.name, "flammable") < 1 then
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Remove flammable nodes around basic flame
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "Remove flammable nodes",
|
|
||||||
nodenames = {"mcl_fire:fire","mcl_fire:eternal_fire"},
|
|
||||||
neighbors = {"group:flammable"},
|
|
||||||
interval = 5,
|
|
||||||
chance = 18,
|
|
||||||
catch_up = false,
|
|
||||||
action = function(pos)
|
|
||||||
local p = has_flammable(pos)
|
|
||||||
if not p then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local nn = minetest.get_node(p).name
|
|
||||||
local def = minetest.registered_nodes[nn]
|
|
||||||
local fgroup = minetest.get_item_group(nn, "flammable")
|
|
||||||
|
|
||||||
if def and def._on_burn then
|
|
||||||
def._on_burn(p)
|
|
||||||
elseif fgroup ~= -1 then
|
|
||||||
spawn_fire(p)
|
|
||||||
minetest.check_for_falling(p)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
label = "Smoke particles from fire",
|
label = "Smoke particles from fire",
|
||||||
name = "mcl_fire:smoke",
|
name = "mcl_fire:smoke",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local S = minetest.get_translator("mcl_tnt")
|
local S = minetest.get_translator("mcl_tnt")
|
||||||
local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 1.0)
|
|
||||||
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
|
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
|
||||||
|
|
||||||
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
@ -181,7 +180,7 @@ function TNT:on_step(dtime)
|
||||||
self.blinkstatus = not self.blinkstatus
|
self.blinkstatus = not self.blinkstatus
|
||||||
end
|
end
|
||||||
if self.timer > tnt.BOOMTIMER then
|
if self.timer > tnt.BOOMTIMER then
|
||||||
mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = tnt_drop_rate }, self.object)
|
mcl_explosions.explode(self.object:get_pos(), 4, {}, self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -232,10 +232,10 @@ if minetest.get_modpath("mcl_farming") then
|
||||||
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
|
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
|
||||||
itemstack:add_wear(wear)
|
itemstack:add_wear(wear)
|
||||||
end
|
end
|
||||||
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
|
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
|
||||||
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
|
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
|
||||||
local param2 = minetest.dir_to_facedir(dir)
|
local param2 = minetest.dir_to_facedir(dir)
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
|
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
|
||||||
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
|
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
name = screwdriver
|
|
|
@ -3532,7 +3532,7 @@ local function register_decorations()
|
||||||
-- Pumpkin
|
-- Pumpkin
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
decoration = "mcl_farming:pumpkin",
|
decoration = "mcl_farming:pumpkin_face",
|
||||||
param2 = 0,
|
param2 = 0,
|
||||||
param2_max = 3,
|
param2_max = 3,
|
||||||
place_on = {"group:grass_block_no_snow"},
|
place_on = {"group:grass_block_no_snow"},
|
||||||
|
|
|
@ -868,7 +868,7 @@ local function register_mgv6_decorations()
|
||||||
-- Pumpkin
|
-- Pumpkin
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
decoration = "mcl_farming:pumpkin",
|
decoration = "mcl_farming:pumpkin_face",
|
||||||
param2 = 0,
|
param2 = 0,
|
||||||
param2_max = 3,
|
param2_max = 3,
|
||||||
place_on = {"group:grass_block_no_snow"},
|
place_on = {"group:grass_block_no_snow"},
|
||||||
|
|
|
@ -532,24 +532,9 @@ local function dir_to_rotation(dir)
|
||||||
return "0"
|
return "0"
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_test_structure_comparator = function(pos, rotation, pr)
|
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_comparator.mts"
|
|
||||||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr)
|
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_fireproof.mts"
|
|
||||||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_structures.generate_test_structure_tnt = function(pos, rotation, pr)
|
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_tnt.mts"
|
|
||||||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug command
|
-- Debug command
|
||||||
minetest.register_chatcommand("spawnstruct", {
|
minetest.register_chatcommand("spawnstruct", {
|
||||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof | test_structure_tnt",
|
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine",
|
||||||
description = S("Generate a pre-defined structure near your position."),
|
description = S("Generate a pre-defined structure near your position."),
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
@ -583,12 +568,6 @@ minetest.register_chatcommand("spawnstruct", {
|
||||||
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
||||||
elseif param == "end_portal_shrine" then
|
elseif param == "end_portal_shrine" then
|
||||||
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
||||||
elseif param == "test_structure_comparator" then
|
|
||||||
mcl_structures.generate_test_structure_comparator(pos, rot, pr)
|
|
||||||
elseif param == "test_structure_fireproof" then
|
|
||||||
mcl_structures.generate_test_structure_fireproof(pos, rot, pr)
|
|
||||||
elseif param == "test_structure_tnt" then
|
|
||||||
mcl_structures.generate_test_structure_tnt(pos, rot, pr)
|
|
||||||
elseif param == "" then
|
elseif param == "" then
|
||||||
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
|
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
|
||||||
errord = true
|
errord = true
|
||||||
|
|
|
@ -1,206 +0,0 @@
|
||||||
local clamp = function(value, min, max)
|
|
||||||
assert( min < max )
|
|
||||||
if value < min then
|
|
||||||
return min
|
|
||||||
end
|
|
||||||
if value > max then
|
|
||||||
return max
|
|
||||||
end
|
|
||||||
return value
|
|
||||||
end
|
|
||||||
|
|
||||||
assert( clamp(000, -100, 100) == 000 )
|
|
||||||
assert( clamp(999, -100, 100) == 100 )
|
|
||||||
assert( clamp(999, -999, 999) == 999 )
|
|
||||||
assert( clamp(998, 999, 1999) == 999 )
|
|
||||||
assert( clamp(999, 999, 1999) == 999 )
|
|
||||||
|
|
||||||
local clamp_s16 = function(value)
|
|
||||||
-- seems minetest hangs on -32768 and 32767
|
|
||||||
return clamp(value, -32767, 32766)
|
|
||||||
end
|
|
||||||
|
|
||||||
assert( clamp_s16(000000) == 000000 )
|
|
||||||
assert( clamp_s16(000001) == 000001 )
|
|
||||||
assert( clamp_s16(000010) == 000010 )
|
|
||||||
assert( clamp_s16(000100) == 000100 )
|
|
||||||
assert( clamp_s16(001000) == 001000 )
|
|
||||||
assert( clamp_s16(010000) == 010000 )
|
|
||||||
assert( clamp_s16(100000) == 032766 )
|
|
||||||
|
|
||||||
assert( clamp_s16(-00000) == -00000 )
|
|
||||||
assert( clamp_s16(-00009) == -00009 )
|
|
||||||
assert( clamp_s16(-00099) == -00099 )
|
|
||||||
assert( clamp_s16(-00999) == -00999 )
|
|
||||||
assert( clamp_s16(-09999) == -09999 )
|
|
||||||
assert( clamp_s16(-99999) == -32767 )
|
|
||||||
|
|
||||||
local minetest_find_nodes_in_area = minetest.find_nodes_in_area
|
|
||||||
minetest.find_nodes_in_area = function(minp, maxp, ...)
|
|
||||||
if
|
|
||||||
minp.x >= 32767 or minp.x <= -32768 or
|
|
||||||
minp.y >= 32767 or minp.y <= -32768 or
|
|
||||||
minp.z >= 32767 or minp.z <= -32768 or
|
|
||||||
maxp.x >= 32767 or maxp.x <= -32768 or
|
|
||||||
maxp.y >= 32767 or maxp.y <= -32768 or
|
|
||||||
maxp.z >= 32767 or maxp.z <= -32768
|
|
||||||
then
|
|
||||||
minetest.log(
|
|
||||||
"warning",
|
|
||||||
"find_nodes_in_area() called with coords outside interval (-32768, 32767), clamping arguments: " ..
|
|
||||||
"minp { x=" .. minp.x .. ", y=" .. minp.y .. " z=" .. minp.z .. " } " ..
|
|
||||||
"maxp { x=" .. maxp.x .. ", y=" .. maxp.y .. " z=" .. maxp.z .. " } "
|
|
||||||
)
|
|
||||||
return minetest_find_nodes_in_area(
|
|
||||||
{ x=clamp_s16(minp.x), y=clamp_s16(minp.y), z=clamp_s16(minp.z) },
|
|
||||||
{ x=clamp_s16(maxp.x), y=clamp_s16(maxp.y), z=clamp_s16(maxp.z) },
|
|
||||||
...
|
|
||||||
)
|
|
||||||
else
|
|
||||||
return minetest_find_nodes_in_area(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
deep_compare = function(a, b)
|
|
||||||
local type_a = type(a)
|
|
||||||
local type_b = type(b)
|
|
||||||
if type_a ~= type_b then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
if type_a ~= "table" and type_b ~= "table" then
|
|
||||||
return a == b
|
|
||||||
end
|
|
||||||
for key_a, value_a in pairs(a) do
|
|
||||||
local value_b = b[key_a]
|
|
||||||
if not deep_compare(value_a, value_b) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for key_b, value_b in pairs(b) do
|
|
||||||
local value_a = a[key_b]
|
|
||||||
if not deep_compare(value_b, value_a) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
1,
|
|
||||||
1.0
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
true,
|
|
||||||
"true"
|
|
||||||
) == false
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
{ a=1, b=-2, c=3.4 },
|
|
||||||
{ a=1, b=-2, c=3.4 }
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
{ a={ 1, 2, 3 }, b="foo", c=false },
|
|
||||||
{ a={ 1, 2, 3 }, b="foo", c=false }
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
{ a={ 1, 2, 3 }, b="foo", c=false },
|
|
||||||
{ a={ 4, 5, 6 }, b="foo", c=false }
|
|
||||||
) == false
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
{ a={ 1, 2, 3 }, b={ c=false } },
|
|
||||||
{ a={ 1, 2, 3 }, b={ c=false } }
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
{ a={ 1, 2, 3 }, b={ } },
|
|
||||||
{ a={ 1, 2, 3 }, b={ c=false } }
|
|
||||||
) == false
|
|
||||||
)
|
|
||||||
|
|
||||||
local test_minetest_find_nodes_in_area_implementation_equivalence = function()
|
|
||||||
-- If any assertion in this test function fails, the wrapper
|
|
||||||
-- for minetest.find_nodes_in_area() does not behave like the
|
|
||||||
-- original function. If you are reading the code because your
|
|
||||||
-- server crashed, please inform the Mineclonia developers.
|
|
||||||
local fun_1 = minetest_find_nodes_in_area
|
|
||||||
local fun_2 = minetest.find_nodes_in_area
|
|
||||||
for x = -31000, 31000, 15500 do
|
|
||||||
for y = -31000, 31000, 15500 do
|
|
||||||
for z = -31000, 31000, 15500 do
|
|
||||||
for d = 1, 9, 3 do
|
|
||||||
local minp = { x=x, y=y, z=z }
|
|
||||||
local maxp = { x=x+d, y=y+d, z=z+d }
|
|
||||||
minetest.emerge_area(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
function(blockpos, action, calls_remaining)
|
|
||||||
local npos_1, nnum_1 = fun_1(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ "air", "ignore" }
|
|
||||||
)
|
|
||||||
local npos_2, nnum_2 = fun_2(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ "air", "ignore" }
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
npos_1,
|
|
||||||
npos_2
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
nnum_1,
|
|
||||||
nnum_2
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
local ntab_1 = fun_1(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ "air", "ignore" },
|
|
||||||
true
|
|
||||||
)
|
|
||||||
local ntab_2 = fun_2(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ "air", "ignore" },
|
|
||||||
true
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
deep_compare(
|
|
||||||
ntab_1,
|
|
||||||
ntab_2
|
|
||||||
) == true
|
|
||||||
)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.after( 0, test_minetest_find_nodes_in_area_implementation_equivalence )
|
|
|
@ -1 +0,0 @@
|
||||||
name = mcl_engine_workarounds
|
|
|
@ -1,121 +0,0 @@
|
||||||
local test_minetest_find_nodes_in_area_can_count = function(dtime)
|
|
||||||
-- This function tests that minetest.find_nodes_in_area() can
|
|
||||||
-- count nodes correctly. If it fails, the engine can not be
|
|
||||||
-- trusted to actually count how many nodes of a given type
|
|
||||||
-- are in a given volume. Yes, *it* is bad if that happens.
|
|
||||||
--
|
|
||||||
-- If you are looking at this function because it executes at
|
|
||||||
-- startup and crashes the game, by far the most stupid thing
|
|
||||||
-- you could do is disabling it. Only an absolute moron would
|
|
||||||
-- disable tests that ensure basic functionality still works.
|
|
||||||
--
|
|
||||||
-- Experience has taught me that such warnings are mostly not
|
|
||||||
-- taken seriously by both Minetest mod & core developers. As
|
|
||||||
-- there are very few situations in which someone would read
|
|
||||||
-- the code of the function without a crash, you are probably
|
|
||||||
-- asking yourself how bad it can be. Surely you will want an
|
|
||||||
-- example of what will break if this test breaks. The answer
|
|
||||||
-- to this simple question is equally simple and consists of a
|
|
||||||
-- heartfelt “What the fuck did you say, you stupid fuckwad?”.
|
|
||||||
--
|
|
||||||
-- Alrighty then, let's get it on …
|
|
||||||
|
|
||||||
local pos = { x=30999, y=30999, z=30999 }
|
|
||||||
-- You think there is nothing there? Well, here is the thing:
|
|
||||||
-- With standard settings you can only see map until x=30927,
|
|
||||||
-- although the renderer can actually render up to x=31007 if
|
|
||||||
-- you configure it to. Any statements given by minetest core
|
|
||||||
-- devs that contradict the above assertion are probably lies.
|
|
||||||
--
|
|
||||||
-- In any way, this area should be so far out that no one has
|
|
||||||
-- built here … yet. Now that you know it is possible, I know
|
|
||||||
-- you want to. How though? I suggest to figure the technique
|
|
||||||
-- out yourself, then go on and build invisible lag machines.
|
|
||||||
|
|
||||||
local radius = 3
|
|
||||||
local minp = vector.subtract(pos, radius)
|
|
||||||
local maxp = vector.add(pos, radius)
|
|
||||||
local nodename = "air"
|
|
||||||
local c_nodename = minetest.get_content_id(nodename)
|
|
||||||
|
|
||||||
-- Why not use minetest.set_node() here? Well, some mods do
|
|
||||||
-- trigger on every placement of a node in the entire map …
|
|
||||||
-- and we do not want to crash those mods in this test case.
|
|
||||||
-- (Voxelmanip does not trigger callbacks – so all is well.)
|
|
||||||
--
|
|
||||||
-- And now for a funny story: I initially copied the following
|
|
||||||
-- code from the Minetest developer wiki. Can you spot a typo?
|
|
||||||
-- <https://dev.minetest.net/index.php?title=minetest.get_content_id&action=edit>
|
|
||||||
local vm = minetest.get_voxel_manip()
|
|
||||||
local emin, emax = vm:read_from_map(
|
|
||||||
minp,
|
|
||||||
maxp
|
|
||||||
)
|
|
||||||
local area = VoxelArea:new({
|
|
||||||
MinEdge=emin,
|
|
||||||
MaxEdge=emax
|
|
||||||
})
|
|
||||||
local data = vm:get_data()
|
|
||||||
for z = minp.z, maxp.z do
|
|
||||||
for y = minp.y, maxp.y do
|
|
||||||
local vi = area:index(minp.x, y, z)
|
|
||||||
for x = minp.x, maxp.y do
|
|
||||||
data[vi] = c_nodename
|
|
||||||
vi = vi + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vm:set_data(data)
|
|
||||||
vm:write_to_map()
|
|
||||||
local npos, nnum = minetest.find_nodes_in_area(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ nodename }
|
|
||||||
)
|
|
||||||
local nodes_expected = math.pow( 1 + (2 * radius), 3 )
|
|
||||||
local nodes_counted = nnum[nodename]
|
|
||||||
local nodes_difference = nodes_expected - nodes_counted
|
|
||||||
-- Originally, there was an assertion here that made the game
|
|
||||||
-- crash at startup if Minetest forgot how to count. This was
|
|
||||||
-- originally intended to avoid buggy engine releases, but it
|
|
||||||
-- mostly made people upset and hindered debugging. Also, the
|
|
||||||
-- assertion contained no error message hinting at the reason
|
|
||||||
-- for the crash, making it exceptionally user-unfriendly. It
|
|
||||||
-- follows that a game or mod should only assert on behaviour
|
|
||||||
-- of the Lua code, not the underlying implementation, unless
|
|
||||||
-- engine bugs are bad enough to permanently corrupt a world.
|
|
||||||
if ( 0 ~= nodes_difference ) then
|
|
||||||
minetest.debug(
|
|
||||||
"minetest.find_nodes_in_area() failed to find " ..
|
|
||||||
nodes_difference .. " nodes that were placed. " ..
|
|
||||||
"Downgrading to Minetest 5.4.1 might fix this."
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.after( 0, test_minetest_find_nodes_in_area_can_count )
|
|
||||||
|
|
||||||
local test_minetest_find_nodes_in_area_crash = function(dtime)
|
|
||||||
-- And now for our feature presentation, where we call the
|
|
||||||
-- function “minetest.find_nodes_in_area()” with a position
|
|
||||||
-- out of bounds! Will it crash? Who knows‽ If it does, the
|
|
||||||
-- workaround is not working though, so it should be patched.
|
|
||||||
|
|
||||||
local pos = { x=32767, y=32767, z=32767 }
|
|
||||||
-- Note that not all out of bounds values actually crash the
|
|
||||||
-- function minetest.find_nodes_in_area()“. In fact, the vast
|
|
||||||
-- majority of out of bounds values do not crash the function.
|
|
||||||
|
|
||||||
local radius = 3
|
|
||||||
local minp = vector.subtract(pos, radius)
|
|
||||||
local maxp = vector.add(pos, radius)
|
|
||||||
local nodename = "air"
|
|
||||||
local npos, nnum = minetest.find_nodes_in_area(
|
|
||||||
minp,
|
|
||||||
maxp,
|
|
||||||
{ nodename }
|
|
||||||
)
|
|
||||||
-- That's all, folks!
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.after( 0, test_minetest_find_nodes_in_area_crash )
|
|
|
@ -1 +0,0 @@
|
||||||
name = mcl_selftests
|
|
|
@ -1 +0,0 @@
|
||||||
name = mcl_player
|
|
|
@ -19,114 +19,8 @@ end
|
||||||
|
|
||||||
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
||||||
|
|
||||||
local function roundN(n, d)
|
|
||||||
if type(n) ~= "number" then return n end
|
|
||||||
local m = 10^d
|
|
||||||
return math.floor(n * m + 0.5) / m
|
|
||||||
end
|
|
||||||
|
|
||||||
local function close_enough(a,b)
|
|
||||||
local rt=true
|
|
||||||
if type(a) == "table" and type(b) == "table" then
|
|
||||||
for k,v in pairs(a) do
|
|
||||||
if roundN(v,2) ~= roundN(b[k],2) then
|
|
||||||
rt=false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
rt = roundN(a,2) == roundN(b,2)
|
|
||||||
end
|
|
||||||
return rt
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function props_changed(props,oldprops)
|
|
||||||
local changed=false
|
|
||||||
local p={}
|
|
||||||
for k,v in pairs(props) do
|
|
||||||
if not close_enough(v,oldprops[k]) then
|
|
||||||
p[k]=v
|
|
||||||
changed=true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return changed,p
|
|
||||||
end
|
|
||||||
|
|
||||||
--test if assert works
|
|
||||||
assert(true)
|
|
||||||
assert(not false)
|
|
||||||
|
|
||||||
--test data for == and ~=
|
|
||||||
local test_equal1=42
|
|
||||||
local test_equal2=42.0
|
|
||||||
local test_equal3=42.1
|
|
||||||
|
|
||||||
assert(test_equal1==test_equal1)
|
|
||||||
assert(test_equal1==test_equal2)
|
|
||||||
assert(test_equal1~=test_equal3)
|
|
||||||
|
|
||||||
--testdata for roundN
|
|
||||||
local test_round1=15
|
|
||||||
local test_round2=15.00199999999
|
|
||||||
local test_round3=15.00111111
|
|
||||||
local test_round4=15.00999999
|
|
||||||
|
|
||||||
assert(roundN(test_round1,2)==roundN(test_round1,2)) --test again if basic equality works because wth not
|
|
||||||
assert(roundN(test_round1,2)==roundN(test_round2,2))
|
|
||||||
assert(roundN(test_round1,2)==roundN(test_round3,2))
|
|
||||||
assert(roundN(test_round1,2)~=roundN(test_round4,2))
|
|
||||||
|
|
||||||
|
|
||||||
-- tests for close_enough
|
|
||||||
local test_cb = {-0.35,0,-0.35,0.35,0.8,0.35} --collisionboxes
|
|
||||||
local test_cb_close = {-0.351213,0,-0.35,0.35,0.8,0.351212}
|
|
||||||
local test_cb_diff = {-0.35,0,-1.35,0.35,0.8,0.35}
|
|
||||||
|
|
||||||
local test_eh = 1.65 --eye height
|
|
||||||
local test_eh_close = 1.65123123
|
|
||||||
local test_eh_diff = 1.35
|
|
||||||
|
|
||||||
local test_nt = { r = 225, b = 225, a = 225, g = 225 } --nametag
|
|
||||||
local test_nt_diff = { r = 225, b = 225, a = 0, g = 225 }
|
|
||||||
|
|
||||||
assert(close_enough(test_cb,test_cb_close))
|
|
||||||
assert(not close_enough(test_cb,test_cb_diff))
|
|
||||||
|
|
||||||
assert(close_enough(test_eh,test_eh_close))
|
|
||||||
assert(not close_enough(test_eh,test_eh_diff))
|
|
||||||
|
|
||||||
assert(not close_enough(test_nt,test_nt_diff)) --no floats involved here
|
|
||||||
|
|
||||||
--tests for props_changed
|
|
||||||
local test_properties_set1={collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}
|
|
||||||
local test_properties_set2={collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}
|
|
||||||
|
|
||||||
local test_p1,p=props_changed(test_properties_set1,test_properties_set1)
|
|
||||||
local test_p2,p=props_changed(test_properties_set1,test_properties_set2)
|
|
||||||
|
|
||||||
assert(not test_p1)
|
|
||||||
assert(test_p2)
|
|
||||||
|
|
||||||
-- we still don't really know if lua is lying to us! but at least everything *seems* to be ok
|
|
||||||
|
|
||||||
local function set_properties_conditional(player,props)
|
|
||||||
local changed,p=props_changed(props,player:get_properties())
|
|
||||||
if changed then
|
|
||||||
player:set_properties(p)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_bone_position_conditional(player,b,p,r) --bone,position,rotation
|
|
||||||
local oldp,oldr=player:get_bone_position(b)
|
|
||||||
if vector.equals(vector.round(oldp),vector.round(p)) and vector.equals(vector.round(oldr),vector.round(r)) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
player:set_bone_position(b,p,r)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
time = time + dtime
|
time = time + dtime
|
||||||
|
|
||||||
-- Update jump status immediately since we need this info in real time.
|
-- Update jump status immediately since we need this info in real time.
|
||||||
|
@ -151,55 +45,55 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
-- controls right and left arms pitch when shooting a bow or punching
|
-- controls right and left arms pitch when shooting a bow or punching
|
||||||
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
||||||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
||||||
elseif controls.LMB and player:get_attach() == nil then
|
elseif controls.LMB and player:get_attach() == nil then
|
||||||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
|
||||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
||||||
else
|
else
|
||||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
||||||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if controls.sneak and player:get_attach() == nil then
|
if controls.sneak and player:get_attach() == nil then
|
||||||
-- controls head pitch when sneaking
|
-- controls head pitch when sneaking
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
||||||
-- sneaking body conrols
|
-- sneaking body conrols
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
||||||
-- set head pitch and yaw when swimming
|
-- set head pitch and yaw when swimming
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
-- control body bone when swimming
|
-- control body bone when swimming
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
|
||||||
|
|
||||||
elseif player:get_attach() == nil then
|
elseif player:get_attach() == nil then
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
|
|
||||||
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
|
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
|
||||||
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
||||||
-- controls head and Body_Control bones while moving backwards
|
-- controls head and Body_Control bones while moving backwards
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
||||||
else
|
else
|
||||||
-- controls head and Body_Control bones while moving forwards
|
-- controls head and Body_Control bones while moving forwards
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local attached = player:get_attach(parent)
|
local attached = player:get_attach(parent)
|
||||||
local attached_yaw = degrees(attached:get_yaw())
|
local attached_yaw = degrees(attached:get_yaw())
|
||||||
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
|
|
|
@ -24,9 +24,6 @@ mcl_doWeatherCycle (Change weather) bool true
|
||||||
# Note that blocks never have drops when in Creative Mode.
|
# Note that blocks never have drops when in Creative Mode.
|
||||||
mcl_doTileDrops (Blocks have drops) bool true
|
mcl_doTileDrops (Blocks have drops) bool true
|
||||||
|
|
||||||
# Chance of a node destroyed by a TNT explosion to be dropped as an item
|
|
||||||
mcl_tnt_drop_rate (TNT drop rate) float 1.0 0.0 1.0
|
|
||||||
|
|
||||||
# If enabled, TNT explosions destroy blocks.
|
# If enabled, TNT explosions destroy blocks.
|
||||||
mcl_tnt_griefing (TNT destroys blocks) bool true
|
mcl_tnt_griefing (TNT destroys blocks) bool true
|
||||||
|
|
||||||
|
@ -94,20 +91,12 @@ flame_sound (Flame sound) bool true
|
||||||
# Form: Image height / Image width
|
# Form: Image height / Image width
|
||||||
fire_animation_frames (Fire Animation Frames) int 8
|
fire_animation_frames (Fire Animation Frames) int 8
|
||||||
|
|
||||||
# How long to wait between frames of the fire animation in frames per second.
|
|
||||||
# A higher number means it looks better but also results in a lot of additional network traffic. A low single digit value is recommended for multiplayer.
|
|
||||||
#(default: 30)
|
|
||||||
fire_animation_fps (Fire Animation FPS) int 30 0 60
|
|
||||||
|
|
||||||
# Whether to animate chests when open / close
|
# Whether to animate chests when open / close
|
||||||
animated_chests (Animated chests) bool true
|
animated_chests (Animated chests) bool true
|
||||||
|
|
||||||
# Whether to preview the player in inventory in 3D (requires Minetest 5.4)
|
# Whether to preview the player in inventory in 3D (requires Minetest 5.4)
|
||||||
3d_player_preview (3D Player preview) bool true
|
3d_player_preview (3D Player preview) bool true
|
||||||
|
|
||||||
# How long a temporary message will be shown in the HUD
|
|
||||||
mcl_tmp_message_hud_hide_timeout (Temporary message display duration) int 10 0 60
|
|
||||||
|
|
||||||
[Experimental]
|
[Experimental]
|
||||||
# Whether ice is translucent. If disabled, ice is fully opaque.
|
# Whether ice is translucent. If disabled, ice is fully opaque.
|
||||||
#
|
#
|
||||||
|
|