Compare commits

..

56 Commits

Author SHA1 Message Date
kay27 cd4cd3f7c7 Merge pull request 'Release 1.9' (#252) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#252
2022-03-14 22:57:03 +00:00
kay27 b095966562 Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-15 02:06:05 +04:00
kay27 1f7aeeb977 Update compatibility for mcl_anticheat 2022-03-14 13:24:47 +04:00
kay27 d437029942 Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-14 13:23:26 +04:00
kay27 5589056bba Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-14 06:06:20 +04:00
kay27 af91d60200 Make safer get_staticdata 2022-03-14 06:05:17 +04:00
kay27 f5d3619d36 Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-14 04:16:48 +04:00
kay27 1b6af6af77 Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-14 04:07:32 +04:00
kay27 fe52c54f35 Merge remote-tracking branch 'origin/testing' into compatibility 2022-03-14 03:05:54 +04:00
kay27 230e3b0bc3 Merge testing into compatibility 2022-03-14 02:59:48 +04:00
kay27 6368cc195e Merge testing into compatibility 2022-03-13 18:56:31 +04:00
kay27 07c5fb7399 Merge testing into compatibility 2022-03-13 17:45:51 +04:00
kay27 e00becde00 Merge pull request 'Release 5.1.8' (#247) from compatibility into production-compatible
Basics checks done - releasing.
Reviewed-on: MineClone5/MineClone5#247
2022-03-11 00:14:03 +00:00
kay27 c8e92b8ff0 Merge testing into compatibility 2022-03-11 03:29:02 +04:00
kay27 421c0ce29f Merge pull request 'Release 5.1.7' (#225) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#225
2022-02-24 02:45:21 +00:00
kay27 a2974f2afe Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-24 06:05:39 +04:00
kay27 732d3aa8af Merge testing into compatibility 2022-02-24 06:04:09 +04:00
kay27 d634f2ad65 Fix mcl_time node time update 2022-02-19 00:13:00 +04:00
kay27 5ad0bd21e5 Merge pull request 'Release 5.1.6' (#196) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#196
2022-02-13 02:44:06 +00:00
kay27 44cb0e563c #123 Fix compatibility crash 2022-02-13 06:31:11 +04:00
kay27 7f70e2e613 #123 Merge testing into compatibility 2022-02-13 06:28:57 +04:00
kay27 b04c4610b5 #123 Add fake xor for missing bitop 2022-02-13 06:26:34 +04:00
cora bf5533799d fix another compatibility issue 2022-02-10 21:16:02 +01:00
kay27 148ecdf29f Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-09 16:52:01 +04:00
kay27 e8d26c9caf Merge remote-tracking branch 'origin/compatibility' into production-compatible 2022-02-06 05:35:04 +04:00
kay27 1a65812bea Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-06 05:34:23 +04:00
kay27 2ed90375dc Merge remote-tracking branch 'origin/compatibility' into production-compatible 2022-02-05 23:05:41 +04:00
kay27 4c59094ac5 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-05 23:05:22 +04:00
kay27 e4c90a95ef Merge pull request 'Release Amethyst' (#166) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#166
2022-02-05 17:18:06 +00:00
kay27 eebf756f16 Merge testing into compatibility 2022-02-05 21:13:12 +04:00
kay27 d17c103dfe Merge remote-tracking branch 'origin/compatibility' into production-compatible 2022-02-04 23:55:37 +04:00
kay27 7a5d632449 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-04 23:54:48 +04:00
kay27 697d8396dd Merge pull request 'Release 1.4' (#164) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#164
2022-02-04 19:50:01 +00:00
kay27 24dec437e5 #123 Make latest mapgen changes compatible with 5.4 2022-02-04 20:28:04 +04:00
kay27 8ee20a2d18 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-04 19:51:44 +04:00
kay27 a2f464c67f Merge remote-tracking branch 'origin/compatibility' into production-compatible 2022-02-02 04:18:13 +04:00
kay27 c917cd2e46 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-02 04:15:31 +04:00
kay27 d14cdceaa3 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-02 04:11:32 +04:00
kay27 61c87c7e1a Merge pull request 'Release 1.3 "Bugfix"' (#158) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#158
2022-02-02 00:02:37 +00:00
kay27 07603a8642 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-02 04:01:23 +04:00
kay27 f2898a0d1c Merge testing into compatibility 2022-02-02 03:51:25 +04:00
kay27 6dc05a2b69 Merge pull request 'Release MineClone 5 1.2 "Hell is Freezing Over Day"' (#154) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#154
2022-02-01 03:07:05 +00:00
kay27 6fe6885fdb #123 Fix a crash in mob api 2022-02-01 06:48:27 +04:00
kay27 fda5aa1395 Merge remote-tracking branch 'origin/testing' into compatibility 2022-02-01 06:45:10 +04:00
kay27 8e66734736 Merge pull request 'Release MineClone 5.1.1 Shields' (#135) from compatibility into production-compatible
Reviewed-on: MineClone5/MineClone5#135
2022-01-25 22:08:34 +00:00
kay27 2d43b359a3 Merge remote-tracking branch 'origin/testing' into compatibility 2022-01-25 20:07:56 +04:00
kay27 2ae4b31da2 Restore some old stuff in compatibility.lua 2022-01-25 20:02:40 +04:00
kay27 a8d94e35ce Add dummy strongholds to overwrite old mod for many players needed that 2022-01-25 19:48:46 +04:00
kay27 98ddf778cf Fix mob click in minetest 5.1.1 2022-01-25 19:18:49 +04:00
kay27 0096100228 Make it RUN under Minetest 5.1.1!!! :) 2022-01-24 03:07:55 +04:00
kay27 ce7a4fec3d Merge remote-tracking branch 'origin/testing' into compatibility 2022-01-24 02:51:48 +04:00
kay27 28f17b1004 Fix mcl_playerinfo 2022-01-24 02:51:19 +04:00
kay27 e291853c01 Run bossbars in minetest 5.1.1 2022-01-24 02:45:39 +04:00
kay27 da9fa916e8 Separate old and new sky apis 2022-01-24 02:37:43 +04:00
kay27 8079d3bc9d #123 Add vector.offset by cora 2022-01-23 03:38:32 +04:00
kay27 786fd43173 Start adding compatibility with minetest 5.1.1 2022-01-23 03:35:21 +04:00
65 changed files with 912 additions and 484 deletions

View File

@ -71,7 +71,6 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `coral_block=X`: Coral block (1 = alive, 2 = dead)
* `coral_species=X`: Specifies the species of a coral; equal X means equal species
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
* `compostability`: Amount from 1 to 100 that defines the percentage of likelyhood that the composter will advance a level.
#### Footnotes

View File

@ -0,0 +1,100 @@
mcl_compatibility = mcl_compatibility or {}
mcl_vars = mcl_vars or {}
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
if not bit then
bit = {}
function bit.bxor(a, b)
-- fake! mock! speedify for now! TODO: make proper xor bitwise
return math.ceil(math.abs(math.floor(a/0.14) * b * 1.001 + b))
end
end
function math.round(x)
if x >= 0 then
return math.floor(x + 0.5)
end
return math.ceil(x - 0.5)
end
dofile(modpath .. "/vector.lua")
local minetest_get_node = minetest.get_node
mcl_compatibility.sort_nodes = function(nodes)
if not nodes then return {} end
for _, pos in pairs(nodes) do
if not pos.x or not pos.y or not pos.z then
return nodes
end
end
local new_nodes = {}
for _, pos in pairs(nodes) do
local node = minetest_get_node(pos)
local name = node.name
if not new_nodes[name] then
new_nodes[name] = { pos }
else
table.insert(new_nodes[name], pos)
end
end
return new_nodes
end
local minetest_find_nodes_in_area = minetest.find_nodes_in_area
minetest.find_nodes_in_area = function(pos1, pos2, nodenames, grouped)
local nodes, num = minetest_find_nodes_in_area(pos1, pos2, nodenames, grouped)
if not grouped or not nodes or next(nodes) == nil then
return nodes, num
end
return mcl_compatibility.sort_nodes(nodes)
end
function mcl_vars.pos_to_block(pos)
return mcl_mapgen and mcl_mapgen.pos_to_block(pos)
end
function mcl_vars.pos_to_chunk(pos)
return mcl_mapgen and mcl_mapgen.pos_to_chunk(pos)
end
function mcl_vars.get_chunk_number(pos)
return mcl_mapgen and get_chunk_number(pos)
end
function mcl_vars.is_generated(pos)
local node = minetest.get_node(pos)
if not node then return false end
if node.name == "ignore" then return false end
return true
end
function mcl_vars.get_node(p, force, us_timeout)
if not p or not p.x or not p.y or not p.z then return {name="error"} end
local node = minetest.get_node(p)
if node.name ~= "ignore" then return node end
minetest.get_voxel_manip():read_from_map(p, p)
return minetest.get_node(pos)
end
mcl_vars.mg_overworld_min = -62
mcl_vars.mg_overworld_max_official = 198
mcl_vars.mg_bedrock_overworld_min = -62
mcl_vars.mg_bedrock_overworld_max = -58
mcl_vars.mg_lava_overworld_max = -52
mcl_vars.mg_lava = true
mcl_vars.mg_bedrock_is_rough = true
mcl_vars.mg_overworld_max = 30927
mcl_vars.mg_nether_min = -29067
mcl_vars.mg_nether_max = -28939
mcl_vars.mg_bedrock_nether_bottom_min = -29067
mcl_vars.mg_bedrock_nether_top_max = -29063
mcl_vars.mg_end_min = -27073
mcl_vars.mg_end_max_official = -26817
mcl_vars.mg_end_max = -2062
mcl_vars.mg_end_platform_pos = { x = 100, y = -26999, z = 0 }
mcl_vars.mg_realm_barrier_overworld_end_max = -2062
mcl_vars.mg_realm_barrier_overworld_end_min = -2073
mcl_vars.mg_dungeons = true

View File

@ -0,0 +1,3 @@
name = mcl_compatibility
author = kay27, minetest devs
description = Makes MineClone 5 run in old versions of Minetest and be compatible with mods using old MineClone APIs

View File

@ -0,0 +1,362 @@
--[[
Vector helpers
Note: The vector.*-functions must be able to accept old vectors that had no metatables
]]
-- localize functions
local setmetatable = setmetatable
vector = {}
local metatable = {}
vector.metatable = metatable
local xyz = {"x", "y", "z"}
-- only called when rawget(v, key) returns nil
function metatable.__index(v, key)
return rawget(v, xyz[key]) or vector[key]
end
-- only called when rawget(v, key) returns nil
function metatable.__newindex(v, key, value)
rawset(v, xyz[key] or key, value)
end
-- constructors
local function fast_new(x, y, z)
return setmetatable({x = x, y = y, z = z}, metatable)
end
function vector.new(a, b, c)
if a and b and c then
return fast_new(a, b, c)
end
-- deprecated, use vector.copy and vector.zero directly
if type(a) == "table" then
return vector.copy(a)
else
assert(not a, "Invalid arguments for vector.new()")
return vector.zero()
end
end
function vector.zero()
return fast_new(0, 0, 0)
end
function vector.copy(v)
assert(v.x and v.y and v.z, "Invalid vector passed to vector.copy()")
return fast_new(v.x, v.y, v.z)
end
function vector.from_string(s, init)
local x, y, z, np = string.match(s, "^%s*%(%s*([^%s,]+)%s*[,%s]%s*([^%s,]+)%s*[,%s]" ..
"%s*([^%s,]+)%s*[,%s]?%s*%)()", init)
x = tonumber(x)
y = tonumber(y)
z = tonumber(z)
if not (x and y and z) then
return nil
end
return fast_new(x, y, z), np
end
function vector.to_string(v)
return string.format("(%g, %g, %g)", v.x, v.y, v.z)
end
metatable.__tostring = vector.to_string
function vector.equals(a, b)
return a.x == b.x and
a.y == b.y and
a.z == b.z
end
metatable.__eq = vector.equals
-- unary operations
function vector.length(v)
return math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
end
-- Note: we can not use __len because it is already used for primitive table length
function vector.normalize(v)
local len = vector.length(v)
if len == 0 then
return fast_new(0, 0, 0)
else
return vector.divide(v, len)
end
end
function vector.floor(v)
return vector.apply(v, math.floor)
end
function vector.round(v)
return fast_new(
math.round(v.x),
math.round(v.y),
math.round(v.z)
)
end
function vector.apply(v, func)
return fast_new(
func(v.x),
func(v.y),
func(v.z)
)
end
function vector.distance(a, b)
local x = a.x - b.x
local y = a.y - b.y
local z = a.z - b.z
return math.sqrt(x * x + y * y + z * z)
end
function vector.direction(pos1, pos2)
return vector.subtract(pos2, pos1):normalize()
end
function vector.angle(a, b)
local dotp = vector.dot(a, b)
local cp = vector.cross(a, b)
local crossplen = vector.length(cp)
return math.atan2(crossplen, dotp)
end
function vector.dot(a, b)
return a.x * b.x + a.y * b.y + a.z * b.z
end
function vector.cross(a, b)
return fast_new(
a.y * b.z - a.z * b.y,
a.z * b.x - a.x * b.z,
a.x * b.y - a.y * b.x
)
end
function metatable.__unm(v)
return fast_new(-v.x, -v.y, -v.z)
end
-- add, sub, mul, div operations
function vector.add(a, b)
if type(b) == "table" then
return fast_new(
a.x + b.x,
a.y + b.y,
a.z + b.z
)
else
return fast_new(
a.x + b,
a.y + b,
a.z + b
)
end
end
function metatable.__add(a, b)
return fast_new(
a.x + b.x,
a.y + b.y,
a.z + b.z
)
end
function vector.subtract(a, b)
if type(b) == "table" then
return fast_new(
a.x - b.x,
a.y - b.y,
a.z - b.z
)
else
return fast_new(
a.x - b,
a.y - b,
a.z - b
)
end
end
function metatable.__sub(a, b)
return fast_new(
a.x - b.x,
a.y - b.y,
a.z - b.z
)
end
function vector.multiply(a, b)
if type(b) == "table" then
return fast_new(
a.x * b.x,
a.y * b.y,
a.z * b.z
)
else
return fast_new(
a.x * b,
a.y * b,
a.z * b
)
end
end
function metatable.__mul(a, b)
if type(a) == "table" then
return fast_new(
a.x * b,
a.y * b,
a.z * b
)
else
return fast_new(
a * b.x,
a * b.y,
a * b.z
)
end
end
function vector.divide(a, b)
if type(b) == "table" then
return fast_new(
a.x / b.x,
a.y / b.y,
a.z / b.z
)
else
return fast_new(
a.x / b,
a.y / b,
a.z / b
)
end
end
function metatable.__div(a, b)
-- scalar/vector makes no sense
return fast_new(
a.x / b,
a.y / b,
a.z / b
)
end
-- misc stuff
function vector.offset(v, x, y, z)
return fast_new(
v.x + x,
v.y + y,
v.z + z
)
end
function vector.sort(a, b)
return fast_new(math.min(a.x, b.x), math.min(a.y, b.y), math.min(a.z, b.z)),
fast_new(math.max(a.x, b.x), math.max(a.y, b.y), math.max(a.z, b.z))
end
function vector.check(v)
return getmetatable(v) == metatable
end
local function sin(x)
if x % math.pi == 0 then
return 0
else
return math.sin(x)
end
end
local function cos(x)
if x % math.pi == math.pi / 2 then
return 0
else
return math.cos(x)
end
end
function vector.rotate_around_axis(v, axis, angle)
local cosangle = cos(angle)
local sinangle = sin(angle)
axis = vector.normalize(axis)
-- https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula
local dot_axis = vector.multiply(axis, vector.dot(axis, v))
local cross = vector.cross(v, axis)
return vector.new(
cross.x * sinangle + (v.x - dot_axis.x) * cosangle + dot_axis.x,
cross.y * sinangle + (v.y - dot_axis.y) * cosangle + dot_axis.y,
cross.z * sinangle + (v.z - dot_axis.z) * cosangle + dot_axis.z
)
end
function vector.rotate(v, rot)
local sinpitch = sin(-rot.x)
local sinyaw = sin(-rot.y)
local sinroll = sin(-rot.z)
local cospitch = cos(rot.x)
local cosyaw = cos(rot.y)
local cosroll = math.cos(rot.z)
-- Rotation matrix that applies yaw, pitch and roll
local matrix = {
{
sinyaw * sinpitch * sinroll + cosyaw * cosroll,
sinyaw * sinpitch * cosroll - cosyaw * sinroll,
sinyaw * cospitch,
},
{
cospitch * sinroll,
cospitch * cosroll,
-sinpitch,
},
{
cosyaw * sinpitch * sinroll - sinyaw * cosroll,
cosyaw * sinpitch * cosroll + sinyaw * sinroll,
cosyaw * cospitch,
},
}
-- Compute matrix multiplication: `matrix` * `v`
return vector.new(
matrix[1][1] * v.x + matrix[1][2] * v.y + matrix[1][3] * v.z,
matrix[2][1] * v.x + matrix[2][2] * v.y + matrix[2][3] * v.z,
matrix[3][1] * v.x + matrix[3][2] * v.y + matrix[3][3] * v.z
)
end
function vector.dir_to_rotation(forward, up)
forward = vector.normalize(forward)
local rot = vector.new(math.asin(forward.y), -math.atan2(forward.x, forward.z), 0)
if not up then
return rot
end
assert(vector.dot(forward, up) < 0.000001,
"Invalid vectors passed to vector.dir_to_rotation().")
up = vector.normalize(up)
-- Calculate vector pointing up with roll = 0, just based on forward vector.
local forwup = vector.rotate(vector.new(0, 1, 0), rot)
-- 'forwup' and 'up' are now in a plane with 'forward' as normal.
-- The angle between them is the absolute of the roll value we're looking for.
rot.z = vector.angle(forwup, up)
-- Since vector.angle never returns a negative value or a value greater
-- than math.pi, rot.z has to be inverted sometimes.
-- To determine wether this is the case, we rotate the up vector back around
-- the forward vector and check if it worked out.
local back = vector.rotate_around_axis(up, forward, -rot.z)
-- We don't use vector.equals for this because of floating point imprecision.
if (back.x - forwup.x) * (back.x - forwup.x) +
(back.y - forwup.y) * (back.y - forwup.y) +
(back.z - forwup.z) * (back.z - forwup.z) > 0.0000001 then
rot.z = -rot.z
end
return rot
end

View File

@ -0,0 +1 @@
-- moved to mcl_compatibility

View File

@ -1,5 +1,5 @@
-- Some global variables (don't overwrite them!)
mcl_vars = {}
mcl_vars = mcl_vars or {}
mcl_vars.redstone_tick = 0.1

View File

@ -1,3 +1,4 @@
name = mcl_init
depends = mcl_compatibility
author = Wuzzy
description = Initialization mod of MineClone 2. Defines some common shared variables and sets up initial default settings which have to be set at the beginning.

View File

@ -148,6 +148,7 @@ function mcl_time.get_irl_seconds_passed_at_pos_or_nil(pos)
if last_time <= 0 then return end
local delta_time = seconds_irl_public - last_time
if delta_time <= 0 then return end
meta:set_int(meta_name, seconds_irl_public)
return delta_time
end

View File

@ -11,6 +11,7 @@ function mcl_burning.is_affected_by_rain(obj)
end
function mcl_burning.get_collisionbox(obj, smaller, storage)
if not storage then return end
local cache = storage.collisionbox_cache
if cache then
local box = cache[smaller and 2 or 1]
@ -29,6 +30,7 @@ end
function mcl_burning.get_touching_nodes(obj, nodenames, storage)
local pos = obj:get_pos()
local minp, maxp = mcl_burning.get_collisionbox(obj, true, storage)
if not minp or not maxp then return {} end
local nodes = minetest.find_nodes_in_area(vector.add(pos, minp), vector.add(pos, maxp), nodenames)
return nodes
end

View File

@ -113,7 +113,9 @@ minetest.register_globalstep(function(dtime)
local pos = player:get_pos()
if tick == true and pool[name] > 0 then
local pool_name = pool[name]
if tick == true and pool_name and pool_name > 0 then
minetest.sound_play("item_drop_pickup", {
pos = pos,
gain = 0.7,

View File

@ -173,9 +173,15 @@ mobs.punch_attack = function(self)
dir = vector_multiply(dir,3)
if self.attacking:get_velocity().y <= 1 then
dir.y = 5
end
local attacking = self.attacking
if attacking then
local attacking_velocity = attacking:get_velocity() or attacking:get_player_velocity()
if attacking_velocity then
if attacking_velocity.y <= 1 then
dir.y = 5
end
end
end
self.attacking:add_velocity(dir)
end

View File

@ -99,7 +99,8 @@ mobs.death_logic = function(self, dtime)
self.death_animation_timer = self.death_animation_timer + dtime
--get all attached entities and sort through them
local attached_entities = self.object:get_children()
-- TODO: support 5.1.1
local attached_entities = self.object.get_children and self.object:get_children() or {}
if #attached_entities > 0 then
for _,entity in pairs(attached_entities) do
--kick the player off

View File

@ -185,7 +185,8 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
--if player is falling multiply damage by 1.5
--critical hit
if hitter:get_velocity().y < 0 then
local hitter_velocity = hitter:get_velocity() or hitter:get_player_velocity() or vector.new(0, 0, 0)
if hitter_velocity.y < 0 then
damage = damage * 1.5
mobs.critical_effect(self)
end
@ -207,7 +208,9 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
self.pause_timer = 0.4
--don't do knockback from a rider
for _,obj in pairs(self.object:get_children()) do
local object_children = self.object.get_children and self.object:get_children()
-- TODO: support 5.1.1
for _,obj in pairs(object_children or {}) do
if obj == hitter then
return
end

View File

@ -53,10 +53,18 @@ minetest.register_globalstep(function(dtime)
local moon_arg = {texture = get_moon_texture()}
local players = minetest.get_connected_players()
for p=1, #players do
players[p]:set_moon(moon_arg)
if players[p].set_moon then
players[p]:set_moon(moon_arg)
else
-- TODO: use old sky api
end
end
end)
minetest.register_on_joinplayer(function(player)
player:set_moon({texture = get_moon_texture(), scale=3.75})
if player.set_moon then
player:set_moon({texture = get_moon_texture(), scale=3.75})
else
-- TODO: use old sky api
end
end)

View File

@ -1,6 +1,46 @@
local mods_loaded = false
local NIGHT_VISION_RATIO = 0.45
local function set_sky(player, def)
if player.set_sun then
-- new api
player:set_sky(def)
else
-- TODO
-- old api
end
end
local function set_sun(player, def)
if player.set_sun then
-- new api
player:set_sun(def)
else
-- TODO
-- old api
end
end
local function set_moon(player, def)
if player.set_sun then
-- new api
player:set_moon(def)
else
-- TODO
-- old api
end
end
local function set_stars(player, def)
if player.set_sun then
-- new api
player:set_stars(def)
else
-- TODO
-- old api
end
end
mcl_weather.skycolor = {
-- Should be activated before do any effect.
active = true,
@ -83,7 +123,7 @@ mcl_weather.skycolor = {
if dim == "overworld" then
if (mcl_weather.state == "none") then
-- Clear weather
player:set_sky({
set_sky(player, {
type = "regular",
sky_color = {
day_sky = "#92B9FF",
@ -95,16 +135,17 @@ mcl_weather.skycolor = {
},
clouds = true,
})
player:set_sun({visible = true, sunrise_visible = true})
player:set_moon({visible = true})
player:set_stars({visible = true})
set_sun(player, {visible = true, sunrise_visible = true})
set_moon(player, {visible = true})
set_stars(player, {visible = true})
mcl_weather.skycolor.override_day_night_ratio(player, nil)
else
-- Weather skies
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5)
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75)
local night_color = mcl_weather.skycolor.get_sky_layer_color(0)
player:set_sky({ type = "regular",
set_sky(player, {
type = "regular",
sky_color = {
day_sky = day_color,
day_horizon = day_color,
@ -115,9 +156,9 @@ mcl_weather.skycolor = {
},
clouds = true,
})
player:set_sun({visible = false, sunrise_visible = false})
player:set_moon({visible = false})
player:set_stars({visible = false})
set_sun(player, {visible = false, sunrise_visible = false})
set_moon(player, {visible = false})
set_stars(player, {visible = false})
local lf = mcl_weather.get_current_light_factor()
if mcl_weather.skycolor.current_layer_name() == "lightning" then
@ -136,32 +177,35 @@ mcl_weather.skycolor = {
end
elseif dim == "end" then
local t = "mcl_playerplus_end_sky.png"
player:set_sky({ type = "skybox",
set_sky(player, {
type = "skybox",
base_color = "#000000",
textures = {t,t,t,t,t,t},
clouds = false,
})
player:set_sun({visible = false , sunrise_visible = false})
player:set_moon({visible = false})
player:set_stars({visible = false})
set_sun(player, {visible = false , sunrise_visible = false})
set_moon(player, {visible = false})
set_stars(player, {visible = false})
mcl_weather.skycolor.override_day_night_ratio(player, 0.5)
elseif dim == "nether" then
player:set_sky({ type = "plain",
set_sky(player, {
type = "plain",
base_color = "#300808",
clouds = false,
})
player:set_sun({visible = false , sunrise_visible = false})
player:set_moon({visible = false})
player:set_stars({visible = false})
set_sun(player, {visible = false , sunrise_visible = false})
set_moon(player, {visible = false})
set_stars(player, {visible = false})
mcl_weather.skycolor.override_day_night_ratio(player, nil)
elseif dim == "void" then
player:set_sky({ type = "plain",
set_sky(player, {
type = "plain",
base_color = "#000000",
clouds = false,
})
player:set_sun({visible = false, sunrise_visible = false})
player:set_moon({visible = false})
player:set_stars({visible = false})
set_sun(player, {visible = false, sunrise_visible = false})
set_moon(player, {visible = false})
set_stars(player, {visible = false})
end
end
end,

View File

@ -1080,10 +1080,10 @@ if progressive_mode then
if not awaiting_connection_player_names[name] then
local data = player_data[name]
local inv_items = get_inv_items(player)
local diff = table_diff(inv_items, data.inv_items)
local diff = table_diff(inv_items, data.inv_items or {})
if #diff > 0 then
data.inv_items = table_merge(diff, data.inv_items)
data.inv_items = table_merge(diff, data.inv_items or {})
end
end
end

View File

@ -124,12 +124,12 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name()
local bars = mcl_bossbars.bars[name]
local huds = mcl_bossbars.huds[name]
table.sort(bars, function(a, b) return a.priority < b.priority end)
table.sort(bars or {}, function(a, b) return a.priority < b.priority end)
local huds_new = {}
local bars_new = {}
local i = 0
while #huds > 0 or #bars > 0 do
while huds and bars and (#huds > 0 or #bars > 0) do
local bar = table.remove(bars, 1)
local hud = table.remove(huds, 1)

View File

@ -10,4 +10,3 @@ local modpath = minetest.get_modpath("mcl_beds")
dofile(modpath .. "/functions.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/beds.lua")
dofile(modpath .. "/respawn_anchor.lua")

View File

@ -2,4 +2,4 @@ name = mcl_beds
author = BlockMen
description =
depends = playerphysics
optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mcl_nether
optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc

View File

@ -1,172 +0,0 @@
--TODO: Add sounds for the respawn anchor
--Nether ends at y -29077
--Nether roof at y -28933
minetest.register_node("mcl_beds:respawn_anchor",{
description="respawn anchor",
tiles = {
"respawn_anchor_top_off.png",
"respawn_anchor_bottom.png",
"respawn_anchor_side0.png"
},
drawtype = "nodebox",
node_box= { --Reused the composter nodebox, since it is basicly the same
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
{-0.5, -0.5, -0.5, 0.5, -0.47, 0.5}, -- Bottom level, -0.47 because -0.5 is so low that you can see the texture of the block below through
}
},
on_rightclick = function(pos, node, player, itemstack)
if itemstack.get_name(itemstack) == "mcl_nether:glowstone" then
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_1"})
itemstack:take_item()
else
if pos.y < -29077 or pos.y > -28933 then
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
end
end
end,
groups = {pickaxey=1, material_stone=1},
_mcl_hardness = 22.5
})
minetest.register_node("mcl_beds:respawn_anchor_charged_1",{
description="respawn anchor",
tiles = {
"portal.png",
"respawn_anchor_bottom.png",
"respawn_anchor_side1.png"
},
drawtype = "nodebox",
node_box= { --Reused the composter nodebox, since it is basicly the same
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Bottom level
}
},
on_rightclick = function(pos, node, player, itemstack)
if itemstack.get_name(itemstack) == "mcl_nether:glowstone" then
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_2"})
itemstack:take_item()
else
if pos.y < -29077 or pos.y > -28933 then
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
else
mcl_spawn.set_spawn_pos(player, pos, nil)
end
end
end,
groups = {pickaxey=1, material_stone=1, not_in_creative_inventory=1},
_mcl_hardness = 22.5
})
minetest.register_node("mcl_beds:respawn_anchor_charged_2",{
description="respawn anchor",
tiles = {
"portal.png",
"respawn_anchor_bottom.png",
"respawn_anchor_side2.png"
},
drawtype = "nodebox",
node_box= { --Reused the composter nodebox, since it is basicly the same
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Bottom level
}
},
on_rightclick = function(pos, node, player, itemstack)
if itemstack.get_name(itemstack) == "mcl_nether:glowstone" then
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_3"})
itemstack:take_item()
else
if pos.y < -29077 or pos.y > -28933 then
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
else
mcl_spawn.set_spawn_pos(player, pos, nil)
end
end
end,
groups = {pickaxey=1, material_stone=1, not_in_creative_inventory=1},
_mcl_hardness = 22.5
})
minetest.register_node("mcl_beds:respawn_anchor_charged_3",{
description="respawn anchor",
tiles = {
"portal.png",
"respawn_anchor_bottom.png",
"respawn_anchor_side3.png"
},
drawtype = "nodebox",
node_box= { --Reused the composter nodebox, since it is basicly the same
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Bottom level
}
},
on_rightclick = function(pos, node, player, itemstack)
if itemstack.get_name(itemstack) == "mcl_nether:glowstone" then
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_4"})
itemstack:take_item()
else
if pos.y < -29077 or pos.y > -28933 then
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
else
mcl_spawn.set_spawn_pos(player, pos, nil)
end
end
end,
groups = {pickaxey=1, material_stone=1, not_in_creative_inventory=1},
_mcl_hardness = 22.5
})
minetest.register_node("mcl_beds:respawn_anchor_charged_4",{
description="respawn anchor",
tiles = {
"portal.png",
"respawn_anchor_bottom.png",
"respawn_anchor_side4.png"
},
drawtype = "nodebox",
node_box= { --Reused the composter nodebox, since it is basicly the same
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- Left wall
{ 0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Right wall
{-0.375, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Back wall
{-0.375, -0.5, -0.5, 0.375, 0.5, -0.375}, -- Front wall
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Bottom level
}
},
on_rightclick = function(pos, node, player, itemstack)
if pos.y < -29077 or pos.y > -28933 then
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
else
mcl_spawn.set_spawn_pos(player, pos, nil)
end
end,
groups = {pickaxey=1, material_stone=1, not_in_creative_inventory=1},
_mcl_hardness = 22.5
})
minetest.register_craft({ output = "mcl_beds:respawn_anchor",
recipe = { {"mcl_core:crying_obsidian", "mcl_core:crying_obsidian", "mcl_core:crying_obsidian"},
{"mcl_nether:glowstone", "mcl_nether:glowstone", "mcl_nether:glowstone"},
{"mcl_core:crying_obsidian", "mcl_core:crying_obsidian", "mcl_core:crying_obsidian"} } })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -507,6 +507,7 @@ function ARROW_ENTITY.on_activate(self, staticdata, dtime_s)
end
minetest.register_on_respawnplayer(function(player)
if not player.get_children then return end
for _, obj in pairs(player:get_children()) do
local ent = obj:get_luaentity()
if ent and ent.name and string.find(ent.name, "mcl_bows:arrow_entity") then

View File

@ -1,149 +1,149 @@
--[[
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
]]--
local CAKE_HUNGER_POINTS = 2
local S = minetest.get_translator(minetest.get_current_modname())
local cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
local slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
local slice_2 = { -7/16, -8/16, -7/16, -3/16, 0/16, 7/16}
local slice_3 = { -7/16, -8/16, -7/16, -1/16, 0/16, 7/16}
local slice_4 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
local slice_5 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
local slice_6 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
local full_cake = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
minetest.register_craft({
output = "mcl_cake:cake",
recipe = {
{"mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket"},
{"mcl_core:sugar", "mcl_throwing:egg", "mcl_core:sugar"},
{"mcl_farming:wheat_item", "mcl_farming:wheat_item", "mcl_farming:wheat_item"},
},
replacements = {
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
},
})
minetest.register_node("mcl_cake:cake", {
description = S("Cake"),
_tt_help = S("With 7 tasty slices!").."\n"..S("Hunger points: +@1 per slice", CAKE_HUNGER_POINTS),
_doc_items_longdesc = S("Cakes can be placed and eaten to restore hunger points. A cake has 7 slices. Each slice restores 2 hunger points and 0.4 saturation points. Cakes will be destroyed when dug or when the block below them is broken."),
_doc_items_usagehelp = S("Place the cake anywhere, then rightclick it to eat a single slice. You can't eat from the cake when your hunger bar is full."),
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
inventory_image = "cake.png",
wield_image = "cake.png",
paramtype = "light",
is_ground_content = false,
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = full_cake
},
node_box = {
type = "fixed",
fixed = full_cake
},
stack_max = 1,
groups = {handy=1, cake=7, food=2, no_eat_delay=1, compostability=100, attached_node=1, dig_by_piston=1, comparator_signal=14},
drop = "",
on_rightclick = function(pos, node, clicker, itemstack)
-- Cake is subject to protection
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= "mcl_cake:cake" or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
end
end,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_food_particles = false,
_mcl_saturation = 0.4,
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
})
local register_slice = function(level, nodebox, desc)
local this = "mcl_cake:cake_"..level
local after_eat = "mcl_cake:cake_"..(level-1)
local on_rightclick
if level > 1 then
on_rightclick = function(pos, node, clicker, itemstack)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
end
end
else
-- Last slice
on_rightclick = function(pos, node, clicker, itemstack)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.remove_node(pos)
minetest.check_for_falling(pos)
end
end
end
minetest.register_node(this, {
description = desc,
_doc_items_create_entry = false,
tiles = cake_texture,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
paramtype = "light",
is_ground_content = false,
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = nodebox,
},
node_box = {
type = "fixed",
fixed = nodebox,
},
groups = {handy=1, cake=level, food=2, no_eat_delay=1, compostability=100, attached_node=1, not_in_creative_inventory=1, dig_by_piston=1, comparator_signal=level*2},
drop = "",
on_rightclick = on_rightclick,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_food_particles = false,
_mcl_saturation = 0.4,
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
})
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_cake:cake", "nodes", "mcl_cake:cake_"..level)
end
end
register_slice(6, slice_6, S("Cake (6 Slices Left)"))
register_slice(5, slice_5, S("Cake (5 Slices Left)"))
register_slice(4, slice_4, S("Cake (4 Slices Left)"))
register_slice(3, slice_3, S("Cake (3 Slices Left)"))
register_slice(2, slice_2, S("Cake (2 Slices Left)"))
register_slice(1, slice_1, S("Cake (1 Slice Left)"))
--[[
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
]]--
local CAKE_HUNGER_POINTS = 2
local S = minetest.get_translator(minetest.get_current_modname())
local cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
local slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
local slice_2 = { -7/16, -8/16, -7/16, -3/16, 0/16, 7/16}
local slice_3 = { -7/16, -8/16, -7/16, -1/16, 0/16, 7/16}
local slice_4 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
local slice_5 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
local slice_6 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
local full_cake = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
minetest.register_craft({
output = "mcl_cake:cake",
recipe = {
{"mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket", "mcl_mobitems:milk_bucket"},
{"mcl_core:sugar", "mcl_throwing:egg", "mcl_core:sugar"},
{"mcl_farming:wheat_item", "mcl_farming:wheat_item", "mcl_farming:wheat_item"},
},
replacements = {
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
},
})
minetest.register_node("mcl_cake:cake", {
description = S("Cake"),
_tt_help = S("With 7 tasty slices!").."\n"..S("Hunger points: +@1 per slice", CAKE_HUNGER_POINTS),
_doc_items_longdesc = S("Cakes can be placed and eaten to restore hunger points. A cake has 7 slices. Each slice restores 2 hunger points and 0.4 saturation points. Cakes will be destroyed when dug or when the block below them is broken."),
_doc_items_usagehelp = S("Place the cake anywhere, then rightclick it to eat a single slice. You can't eat from the cake when your hunger bar is full."),
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
inventory_image = "cake.png",
wield_image = "cake.png",
paramtype = "light",
is_ground_content = false,
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = full_cake
},
node_box = {
type = "fixed",
fixed = full_cake
},
stack_max = 1,
groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1, comparator_signal=14},
drop = "",
on_rightclick = function(pos, node, clicker, itemstack)
-- Cake is subject to protection
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= "mcl_cake:cake" or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
end
end,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_food_particles = false,
_mcl_saturation = 0.4,
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
})
local register_slice = function(level, nodebox, desc)
local this = "mcl_cake:cake_"..level
local after_eat = "mcl_cake:cake_"..(level-1)
local on_rightclick
if level > 1 then
on_rightclick = function(pos, node, clicker, itemstack)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
end
end
else
-- Last slice
on_rightclick = function(pos, node, clicker, itemstack)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
minetest.remove_node(pos)
minetest.check_for_falling(pos)
end
end
end
minetest.register_node(this, {
description = desc,
_doc_items_create_entry = false,
tiles = cake_texture,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
paramtype = "light",
is_ground_content = false,
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = nodebox,
},
node_box = {
type = "fixed",
fixed = nodebox,
},
groups = {handy=1, cake=level, food=2,no_eat_delay=1,attached_node=1,not_in_creative_inventory=1,dig_by_piston=1,comparator_signal=level*2},
drop = "",
on_rightclick = on_rightclick,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_food_particles = false,
_mcl_saturation = 0.4,
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
})
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_cake:cake", "nodes", "mcl_cake:cake_"..level)
end
end
register_slice(6, slice_6, S("Cake (6 Slices Left)"))
register_slice(5, slice_5, S("Cake (5 Slices Left)"))
register_slice(4, slice_4, S("Cake (4 Slices Left)"))
register_slice(3, slice_3, S("Cake (3 Slices Left)"))
register_slice(2, slice_2, S("Cake (2 Slices Left)"))
register_slice(1, slice_1, S("Cake (1 Slice Left)"))

View File

@ -32,6 +32,108 @@ minetest.register_craft({
}
})
local compostability = {
["mcl_cake:cake"] = 100,
["mcl_farming:pumpkin_pie"] = 100,
["mcl_farming:potato_item_baked"] = 85,
["mcl_farming:bread"] = 85,
["mcl_farming:cookie"] = 85,
["mcl_farming:hay_block"] = 85,
-- mushroom cap block have 64 variants, wtf!?
["mcl_mushrooms:brown_mushroom_block_cap_111111"] = 85,
["mcl_mushrooms:red_mushroom_block_cap_111111"] = 85,
["mcl_nether:nether_wart_block"] = 85,
["mcl_mushroom:warped_wart_block"] = 85,
["mcl_core:apple"] = 65,
-- missing: azalea
["mcl_farming:beetroot_item"] = 65,
-- missing: big dripleaf
["mcl_farming:carrot_item"] = 65,
-- what's up with cocoa beans?
["mcl_dye:brown"] = 65,
["mcl_flowers:fern"] = 65,
["mcl_flowers:double_fern"] = 65,
["mcl_flowers:allium"] = 65,
["mcl_flowers:azure_bluet"] = 65,
["mcl_flowers:blue_orchid"] = 65,
["mcl_flowers:dandelion"] = 65,
["mcl_flowers:lilac"] = 65,
["mcl_flowers:oxeye_daisy"] = 65,
["mcl_flowers:poppy"] = 65,
["mcl_flowers:tulip_orange"] = 65,
["mcl_flowers:tulip_pink"] = 65,
["mcl_flowers:tulip_red"] = 65,
["mcl_flowers:tulip_white"] = 65,
["mcl_flowers:peony"] = 65,
["mcl_flowers:rose_bush"] = 65,
["mcl_flowers:sunflower"] = 65,
["mcl_flowers:waterlily"] = 65,
["mcl_farming:melon"] = 65,
["mcl_core:moss"] = 65,
-- mushroom aliases below?
["mcl_farming:mushroom_brown"] = 65,
["mcl_mushrooms:mushroom_brown"] = 65,
["mcl_farming:mushroom_red"] = 65,
["mcl_mushrooms:mushroom_red"] = 65,
["mcl_mushrooms:brown_mushroom_block_stem_full"] = 65,
["mcl_mushrooms:red_mushroom_block_stem_full"] = 65,
-- nether wart
["mcl_farming:potato_item"] = 65,
["mcl_farming:pumpkin"] = 65,
["mcl_farming:pumpkin_face_light"] = 65,
["mcl_ocean:sea_pickle_"] = 65,
["mcl_mushroom:shroomlight"] = 65,
-- missing: spore blossom
["mcl_farming:wheat_item"] = 65,
["mcl_mushroom:crimson_fungus"] = 65,
["mcl_mushroom:warped_fungus"] = 65,
["mcl_mushroom:crimson_roots"] = 65,
["mcl_mushroom:warped_roots"] = 65,
["mcl_core:cactus"] = 50,
["mcl_ocean:dried_kelp_block"] = 50,
-- missing: flowering azalea leaves
-- missing: glow lichen
["mcl_farming:melon_item"] = 50,
["mcl_mushroom:nether_sprouts"] = 50,
["mcl_core:reeds"] = 50,
["mcl_flowers:double_grass"] = 50,
["mcl_core:vine"] = 50,
-- missing: weeping vines
["mcl_mushroom:twisting_vines"] = 50,
["mcl_flowers:tallgrass"] = 30,
["mcl_farming:beetroot_seeds"] = 30,
["mcl_core:dirt_with_grass"] = 30,
["mcl_core:tallgrass"] = 30,
["mcl_ocean:dried_kelp"] = 30,
["mcl_ocean:kelp"] = 30,
["mcl_core:leaves"] = 30,
["mcl_core:acacialeaves"] = 30,
["mcl_core:birchleaves"] = 30,
["mcl_core:darkleaves"] = 30,
["mcl_core:jungleleaves"] = 30,
["mcl_core:spruceleaves"] = 30,
--
["mcl_farming:melon_seeds"] = 30,
["mcl_core:moss_carpet"] = 30,
["mcl_farming:pumpkin_seeds"] = 30,
["mcl_core:sapling"] = 30,
["mcl_core:acaciasapling"] = 30,
["mcl_core:birchsapling"] = 30,
["mcl_core:darksapling"] = 30,
["mcl_core:junglesapling"] = 30,
["mcl_core:sprucesapling"] = 30,
["mcl_ocean:seagrass"] = 30,
-- missing: small dripleaf
["mcl_sweet_berry:sweet_berry"] = 30,
["mcl_farming:sweet_berry"] = 30,
["mcl_farming:wheat_seeds"] = 30,
}
local function composter_add_item(pos, node, player, itemstack, pointed_thing)
--
-- handler for filling the composter when rightclicked
@ -45,9 +147,8 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing)
return itemstack
end
local itemname = itemstack:get_name()
local chance = minetest.get_item_group(itemname, "compostability")
if chance > 0 then
local chance = compostability[itemname]
if chance then
if not minetest.is_creative_enabled(player:get_player_name()) then
itemstack:take_item()
end

View File

@ -139,7 +139,7 @@ minetest.register_craftitem("mcl_core:apple", {
stack_max = 64,
on_place = minetest.item_eat(4),
on_secondary_use = minetest.item_eat(4),
groups = { food = 2, eatable = 4, compostability=65 },
groups = { food = 2, eatable = 4 },
_mcl_saturation = 2.4,
})

View File

@ -369,7 +369,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
color = "#8EB971",
is_ground_content = true,
stack_max = 64,
groups = {handy=1,shovely=1,dirt=2,grass_block=1, grass_block_no_snow=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, spreading_dirt_type=1, enderman_takable=1, building_block=1, compostability=30},
groups = {handy=1,shovely=1,dirt=2,grass_block=1, grass_block_no_snow=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, spreading_dirt_type=1, enderman_takable=1, building_block=1},
drop = "mcl_core:dirt",
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.1},
@ -473,7 +473,7 @@ minetest.register_node("mcl_core:moss", {
tiles = {"mcl_core_moss_block.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, hoey=1, compostability=65},
groups = {handy=1, hoey=1},
--sounds = TODO: add sound
_mcl_blast_resistance = 0.1,
_mcl_hardness = 0.1,
@ -1096,7 +1096,7 @@ minetest.register_node("mcl_core:moss", {
tiles = {"mcl_core_moss_block.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, hoey=1, compostability=65},
groups = {handy=1, hoey=1},
--sounds = TODO: add sound
_mcl_blast_resistance = 0.1,
_mcl_hardness = 0.1,
@ -1153,7 +1153,7 @@ minetest.register_node("mcl_core:moss_carpet", {
{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
},
},
groups = {handy=1, hoey=1, compostability=30},
groups = {handy=1, hoey=1},
--sounds = TODO: add sound
_mcl_blast_resistance = 0.1,
_mcl_hardness = 0.1,

View File

@ -12,7 +12,7 @@ minetest.register_node("mcl_core:cactus", {
tiles = {"mcl_core_cactus_top.png", "mcl_core_cactus_bottom.png", "mcl_core_cactus_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, attached_node=1, plant=1, deco_block=1, dig_by_piston=1, enderman_takable=1, compostability=50},
groups = {handy=1, attached_node=1, plant=1, deco_block=1, dig_by_piston=1, enderman_takable=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
paramtype = "light",
sunlight_propagates = true,
@ -79,7 +79,7 @@ minetest.register_node("mcl_core:reeds", {
},
},
stack_max = 64,
groups = {dig_immediate=3, craftitem=1, deco_block=1, plant=1, non_mycelium_plant=1, dig_by_piston=1, compostability=50},
groups = {dig_immediate=3, craftitem=1, deco_block=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
drop = "mcl_core:reeds", -- to prevent color inheritation

View File

@ -104,7 +104,7 @@ minetest.register_node("mcl_core:vine", {
type = "wallmounted",
},
stack_max = 64,
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1, fire_encouragement=15, fire_flammability=100, compostability=50},
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1, fire_encouragement=15, fire_flammability=100},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = "",
_mcl_shears_drop = true,

View File

@ -162,8 +162,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
deco_block=1,
dig_by_piston=1,
fire_encouragement=30,
fire_flammability=60,
compostability=30
fire_flammability=60
},
drop = get_drops(0),
_mcl_shears_drop = true,
@ -195,7 +194,7 @@ local function register_sapling(subname, description, longdesc, tt_help, texture
fixed = selbox
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,dig_by_piston=1,destroy_by_lava_flow=1,deco_block=1, compostability=30},
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,dig_by_piston=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -276,4 +275,4 @@ register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from
-- Node aliases
minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")

View File

@ -78,7 +78,7 @@ dyelocal.dyes = {
{"dark_green", "dye_dark_green", S("Cactus Green"),{dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
{"green", "mcl_dye_lime", S("Lime Dye"), {dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
{"yellow", "dye_yellow", S("Dandelion Yellow"), {dye=1, craftitem=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
{"brown", "mcl_dye_brown", S("Cocoa Beans"), {dye=1, craftitem=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1, compostability=65}},
{"brown", "mcl_dye_brown", S("Cocoa Beans"), {dye=1, craftitem=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
{"orange", "dye_orange", S("Orange Dye"), {dye=1, craftitem=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
{"red", "dye_red", S("Rose Red"), {dye=1, craftitem=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
{"magenta", "dye_magenta", S("Magenta Dye"), {dye=1, craftitem=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},

View File

@ -5,7 +5,7 @@ minetest.register_craftitem("mcl_farming:beetroot_seeds", {
_tt_help = S("Grows on farmland"),
_doc_items_longdesc = S("Grows into a beetroot plant. Chickens like beetroot seeds."),
_doc_items_usagehelp = S("Place the beetroot seeds on farmland (which can be created with a hoe) to plant a beetroot plant. They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it beetroot seeds."),
groups = { craftitem=1, compostability=30 },
groups = { craftitem=1 },
inventory_image = "mcl_farming_beetroot_seeds.png",
wield_image = "mcl_farming_beetroot_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
@ -133,7 +133,7 @@ minetest.register_craftitem("mcl_farming:beetroot_item", {
wield_image = "mcl_farming_beetroot.png",
on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1, compostability=65 },
groups = { food = 2, eatable = 1 },
_mcl_saturation = 1.2,
})

View File

@ -86,7 +86,7 @@ minetest.register_craftitem("mcl_farming:carrot_item", {
_doc_items_longdesc = S("Carrots can be eaten and planted. Pigs and rabbits like carrots."),
_doc_items_usagehelp = S("Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant the carrot. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it."),
inventory_image = "farming_carrot.png",
groups = { food = 2, eatable = 3, compostability=65 },
groups = { food = 2, eatable = 3 },
_mcl_saturation = 3.6,
on_secondary_use = minetest.item_eat(3),
on_place = function(itemstack, placer, pointed_thing)

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("mcl_farming:melon_seeds", {
_doc_items_longdesc = S("Grows into a melon stem which in turn grows melons. Chickens like melon seeds."),
_doc_items_usagehelp = S("Place the melon seeds on farmland (which can be created with a hoe) to plant a melon stem. Melon stems grow in sunlight and grow faster on hydrated farmland. When mature, the stem will attempt to grow a melon at the side. Rightclick an animal to feed it melon seeds."),
stack_max = 64,
groups = { craftitem=1, compostability=30 },
groups = { craftitem=1 },
inventory_image = "mcl_farming_melon_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:melontige_1")
@ -21,7 +21,7 @@ local melon_base_def = {
_doc_items_longdesc = S("A melon is a block which can be grown from melon stems, which in turn are grown from melon seeds. It can be harvested for melon slices."),
stack_max = 64,
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png"},
groups = {handy=1,axey=1, plant=1,building_block=1,enderman_takable=1,dig_by_piston=1, compostability=65},
groups = {handy=1,axey=1, plant=1,building_block=1,enderman_takable=1,dig_by_piston=1},
drop = {
max_items = 1,
items = {
@ -134,7 +134,7 @@ minetest.register_craftitem("mcl_farming:melon_item", {
inventory_image = "farming_melon.png",
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2, compostability=50 },
groups = { food = 2, eatable = 2 },
_mcl_saturation = 1.2,
})

View File

@ -91,7 +91,7 @@ minetest.register_craftitem("mcl_farming:potato_item", {
_doc_items_longdesc = S("Potatoes are food items which can be eaten, cooked in the furnace and planted. Pigs like potatoes."),
_doc_items_usagehelp = S("Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant it. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it."),
inventory_image = "farming_potato.png",
groups = { food = 2, eatable = 1, compostability=65 },
groups = { food = 2, eatable = 1 },
_mcl_saturation = 0.6,
stack_max = 64,
on_secondary_use = minetest.item_eat(1),
@ -112,7 +112,7 @@ minetest.register_craftitem("mcl_farming:potato_item_baked", {
inventory_image = "farming_potato_baked.png",
on_place = minetest.item_eat(5),
on_secondary_use = minetest.item_eat(5),
groups = { food = 2, eatable = 5, compostability = 85 },
groups = { food = 2, eatable = 5 },
_mcl_saturation = 6.0,
})

View File

@ -15,7 +15,7 @@ minetest.register_craftitem("mcl_farming:pumpkin_seeds", {
_doc_items_usagehelp = S("Place the pumpkin seeds on farmland (which can be created with a hoe) to plant a pumpkin stem. Pumpkin stems grow in sunlight and grow faster on hydrated farmland. When mature, the stem attempts to grow a pumpkin next to it. Rightclick an animal to feed it pumpkin seeds."),
stack_max = 64,
inventory_image = "mcl_farming_pumpkin_seeds.png",
groups = { craftitem=1, compostability=30 },
groups = { craftitem=1 },
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:pumpkin_1")
end
@ -99,7 +99,7 @@ local pumpkin_base_def = {
stack_max = 64,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"},
groups = {handy=1,axey=1, plant=1,building_block=1, dig_by_piston=1, enderman_takable=1, compostability=65},
groups = {handy=1,axey=1, plant=1,building_block=1, dig_by_piston=1, enderman_takable=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 1,
@ -192,7 +192,7 @@ minetest.register_node("mcl_farming:pumpkin_face_light", {
paramtype2 = "facedir",
light_source = minetest.LIGHT_MAX,
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
groups = {handy=1,axey=1, building_block=1, dig_by_piston=1, compostability=65 },
groups = {handy=1,axey=1, building_block=1, dig_by_piston=1 },
sounds = mcl_sounds.node_sound_wood_defaults(),
on_construct = function(pos)
-- Attempt to spawn iron golem or snow golem
@ -230,7 +230,7 @@ minetest.register_craftitem("mcl_farming:pumpkin_pie", {
wield_image = "mcl_farming_pumpkin_pie.png",
on_place = minetest.item_eat(8),
on_secondary_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8, compostability=100 },
groups = { food = 2, eatable = 8 },
_mcl_saturation = 4.8,
})

View File

@ -31,7 +31,7 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
inventory_image = "mcl_farming_sweet_berry.png",
_mcl_saturation = 0.2,
stack_max = 64,
groups = { food = 2, eatable = 1, compostability=30 },
groups = { food = 2, eatable = 1 },
on_secondary_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_sweet_berry:sweet_berry_bush_0")

View File

@ -9,7 +9,7 @@ minetest.register_craftitem("mcl_farming:wheat_seeds", {
Place the wheat seeds on farmland (which can be created with a hoe) to plant a wheat plant.
They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it wheat seeds.
]]),
groups = { craftitem=1, compostability=30 },
groups = { craftitem=1 },
inventory_image = "mcl_farming_wheat_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:wheat_1")
@ -104,7 +104,7 @@ minetest.register_craftitem("mcl_farming:wheat_item", {
_doc_items_longdesc = S("Wheat is used in crafting. Some animals like wheat."),
_doc_items_usagehelp = S("Use the “Place” key on an animal to try to feed it wheat."),
inventory_image = "farming_wheat_harvested.png",
groups = { craftitem = 1, compostability=65 },
groups = { craftitem = 1 },
})
minetest.register_craft({
@ -125,7 +125,7 @@ minetest.register_craftitem("mcl_farming:cookie", {
description = S("Cookie"),
_doc_items_longdesc = S("This is a food item which can be eaten."),
inventory_image = "farming_cookie.png",
groups = {food=2, eatable=2, compostability=85},
groups = {food=2, eatable=2},
_mcl_saturation = 0.4,
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
@ -136,7 +136,7 @@ minetest.register_craftitem("mcl_farming:bread", {
description = S("Bread"),
_doc_items_longdesc = S("This is a food item which can be eaten."),
inventory_image = "farming_bread.png",
groups = {food=2, eatable=5, compostability=85},
groups = {food=2, eatable=5},
_mcl_saturation = 6.0,
on_place = minetest.item_eat(5),
on_secondary_use = minetest.item_eat(5),
@ -156,7 +156,8 @@ minetest.register_node("mcl_farming:hay_block", {
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1, hoey=1, compostability=85, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
groups = {handy=1, hoey=1, flammable=2, fire_encouragement=60,
fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 0.5,

View File

@ -80,7 +80,7 @@ function mcl_flowers.register_simple_flower(name, def)
walkable = false,
stack_max = 64,
drop = def.drop,
groups = {dig_immediate=3,flammable=2,fire_encouragement=60,fire_flammability=100,plant=1,flower=1,place_flowerlike=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1, compostability=65},
groups = {dig_immediate=3,flammable=2,fire_encouragement=60,fire_flammability=100,plant=1,flower=1,place_flowerlike=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = on_place_flower,
@ -143,7 +143,7 @@ local def_tallgrass = {
walkable = false,
buildable_to = true,
is_ground_content = true,
groups = {handy=1,shearsy=1, flammable=3,fire_encouragement=60,fire_flammability=100,attached_node=1,plant=1,place_flowerlike=2,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1, compostability=30},
groups = {handy=1,shearsy=1, flammable=3,fire_encouragement=60,fire_flammability=100,attached_node=1,plant=1,place_flowerlike=2,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = wheat_seed_drop,
_mcl_shears_drop = true,
@ -163,7 +163,6 @@ def_fern._doc_items_longdesc = S("Ferns are small plants which occur naturally i
def_fern.tiles = { "mcl_flowers_fern.png" }
def_fern.inventory_image = "mcl_flowers_fern_inv.png"
def_fern.wield_image = "mcl_flowers_fern_inv.png"
def_fern.groups.compostability=65
def_fern.selection_box = {
type = "fixed",
fixed = { -6/16, -0.5, -6/16, 6/16, 5/16, 6/16 },
@ -206,13 +205,6 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
bottom_groups.not_in_creative_inventory = 1
create_entry = false
end
-- some special cases for the composter group
if name == "double_fern" or "peony" or "rose_bush" or "lilac" or "sunflower" then
bottom_groups.compostability = 65
end
if name == "double_grass" then
bottom_groups.compostability = 50
end
-- Drop itself by default
local drop_bottom, drop_top
if not drop then
@ -418,7 +410,7 @@ minetest.register_node("mcl_flowers:waterlily", {
liquids_pointable = true,
walkable = true,
sunlight_propagates = true,
groups = {dig_immediate = 3, plant=1, dig_by_water = 1,destroy_by_lava_flow=1, dig_by_piston = 1, deco_block=1, dig_by_boat=1, compostability=65},
groups = {dig_immediate = 3, plant=1, dig_by_water = 1,destroy_by_lava_flow=1, dig_by_piston = 1, deco_block=1, dig_by_boat=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
node_box = {

View File

@ -32,7 +32,7 @@ minetest.register_node("mcl_mushroom:warped_fungus", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, compostability=65},
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1},
light_source = 1,
selection_box = {
@ -67,7 +67,7 @@ minetest.register_node("mcl_mushroom:twisting_vines", {
walkable = false,
climbable = true,
buildable_to = true,
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1, compostability=50},
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
selection_box = {
type = "fixed",
fixed = { -3/16, -0.5, -3/16, 3/16, 0.5, 3/16 },
@ -108,7 +108,7 @@ minetest.register_node("mcl_mushroom:nether_sprouts", {
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1, compostability=50},
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
selection_box = {
type = "fixed",
fixed = { -4/16, -0.5, -4/16, 4/16, 0, 4/16 },
@ -130,7 +130,7 @@ minetest.register_node("mcl_mushroom:warped_roots", {
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1, compostability=65},
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
selection_box = {
type = "fixed",
fixed = { -6/16, -0.5, -6/16, 6/16, -4/16, 6/16 },
@ -144,7 +144,7 @@ minetest.register_node("mcl_mushroom:warped_roots", {
minetest.register_node("mcl_mushroom:warped_wart_block", {
description = S("Warped Wart Block"),
tiles = {"warped_wart_block.png"},
groups = {handy=1,hoe=7,swordy=1, compostability=85, deco_block=1, },
groups = {handy=1,hoe=7,swordy=1, deco_block=1, },
stack_max = 64,
_mcl_hardness = 2,
})
@ -152,7 +152,7 @@ minetest.register_node("mcl_mushroom:warped_wart_block", {
minetest.register_node("mcl_mushroom:shroomlight", {
description = S("Shroomlight"),
tiles = {"shroomlight.png"},
groups = {handy=1,hoe=7,swordy=1, leaves=1, deco_block=1, compostability=65, },
groups = {handy=1,hoe=7,swordy=1, leaves=1, deco_block=1, },
stack_max = 64,
_mcl_hardness = 2,
-- this is 15 in Minecraft
@ -305,7 +305,7 @@ minetest.register_node("mcl_mushroom:crimson_fungus", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1, compostability=65},
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
light_source = 1,
selection_box = {
@ -339,7 +339,7 @@ minetest.register_node("mcl_mushroom:crimson_roots", {
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1, compostability=65},
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
selection_box = {
type = "fixed",
fixed = { -6/16, -0.5, -6/16, 6/16, -4/16, 6/16 },

View File

@ -3,7 +3,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
local vector = vector
local template = {
groups = {handy=1,axey=1, building_block = 1, material_wood = 1, flammable = -1, compostability=85 },
groups = {handy=1,axey=1, building_block = 1, material_wood = 1, flammable = -1 },
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = true,
_mcl_blast_resistance = 0.2,
@ -51,7 +51,6 @@ local function register_mushroom(color, species_id, template, d_cap, d_stem, d_s
stem_full.tiles = { "mcl_mushrooms_mushroom_block_skin_stem.png" }
stem_full.groups.huge_mushroom = species_id
stem_full.groups.huge_mushroom_stem = 2
stem_full.groups.compostability=65
minetest.register_node("mcl_mushrooms:"..color.."_mushroom_block_stem_full", stem_full)
-- Stem
@ -61,7 +60,6 @@ local function register_mushroom(color, species_id, template, d_cap, d_stem, d_s
stem.tiles = { "mcl_mushrooms_mushroom_block_inside.png", "mcl_mushrooms_mushroom_block_inside.png", "mcl_mushrooms_mushroom_block_skin_stem.png" }
stem.groups.huge_mushroom = species_id
stem.groups.huge_mushroom_stem = 1
stem.groups.compostability=65
minetest.register_node("mcl_mushrooms:"..color.."_mushroom_block_stem", stem)
-- Mushroom block (cap)

View File

@ -38,7 +38,7 @@ minetest.register_node("mcl_mushrooms:mushroom_brown", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1, compostability=65},
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
light_source = 1,
selection_box = {
@ -62,7 +62,7 @@ minetest.register_node("mcl_mushrooms:mushroom_red", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1, compostability=65},
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",

View File

@ -77,7 +77,8 @@ minetest.register_node("mcl_nether:netheriteblock", {
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 1200,
_mcl_hardness = 50,
_mcl_silk_touch_drop = true
_mcl_silk_touch_drop = true,
_mcl_fortune_drop = mcl_core.fortune_drop_ore
})
-- For eternal fire on top of netherrack and magma blocks
@ -201,7 +202,7 @@ minetest.register_node("mcl_nether:nether_wart_block", {
stack_max = 64,
tiles = {"mcl_nether_nether_wart_block.png"},
is_ground_content = false,
groups = {handy=1, hoey=1, building_block=1, compostability=85},
groups = {handy=1, hoey=1, building_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(
{
footstep={name="default_dirt_footstep", gain=0.7},

View File

@ -150,7 +150,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
end
end
end,
groups = { craftitem = 1, brewitem=1, compostability=30 },
groups = { craftitem = 1, brewitem=1 },
})
local names = {"mcl_nether:nether_wart_0", "mcl_nether:nether_wart_1", "mcl_nether:nether_wart_2"}

View File

@ -741,7 +741,7 @@ minetest.register_craftitem("mcl_ocean:kelp", {
inventory_image = "mcl_ocean_kelp_item.png",
wield_image = "mcl_ocean_kelp_item.png",
on_place = kelp.kelp_on_place,
groups = { deco_block = 1, compostability=30 },
groups = { deco_block = 1 },
})
if mod_doc then
@ -756,7 +756,7 @@ minetest.register_craftitem("mcl_ocean:dried_kelp", {
_doc_items_longdesc = S("Dried kelp is a food item."),
inventory_image = "mcl_ocean_dried_kelp.png",
wield_image = "mcl_ocean_dried_kelp.png",
groups = { food = 2, eatable = 1, compostability=30 },
groups = { food = 2, eatable = 1 },
on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1),
_mcl_saturation = 0.6,
@ -773,7 +773,7 @@ minetest.register_node("mcl_ocean:dried_kelp_block", {
description = S("Dried Kelp Block"),
_doc_items_longdesc = S("A decorative block that serves as a great furnace fuel."),
tiles = { "mcl_ocean_dried_kelp_top.png", "mcl_ocean_dried_kelp_bottom.png", "mcl_ocean_dried_kelp_side.png" },
groups = { handy = 1, hoey = 1, building_block = 1, flammable = 2, fire_encouragement = 30, fire_flammability = 60, compostability=50 },
groups = { handy = 1, hoey = 1, building_block = 1, flammable = 2, fire_encouragement = 30, fire_flammability = 60 },
sounds = mcl_sounds.node_sound_leaves_defaults(),
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,

View File

@ -106,7 +106,7 @@ for s=1,4 do
},
inventory_image = img,
wield_image = img,
groups = { dig_immediate = 3, deco_block = 1, sea_pickle=1, not_in_creative_inventory=nici, compostability=65 },
groups = { dig_immediate = 3, deco_block = 1, sea_pickle=1, not_in_creative_inventory=nici },
-- Light level: 6 at size 1, +3 for each additional stage
light_source = math.min(6 + (s-1)*3, minetest.LIGHT_MAX),
selection_box = {

View File

@ -85,7 +85,7 @@ minetest.register_craftitem("mcl_ocean:seagrass", {
inventory_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
wield_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
on_place = seagrass_on_place,
groups = { deco_block = 1, compostability=30 },
groups = { deco_block = 1 },
})
-- Seagrass nodes: seagrass on a surface node

View File

@ -1101,7 +1101,7 @@ local function register_mgv6_decorations()
end
local mg_flags = minetest.settings:get_flags("mg_flags")
local mg_flags = minetest.settings.get_flags and minetest.settings:get_flags("mg_flags") or {}
-- Inform other mods of dungeon setting for MCL2-style dungeons
mcl_vars.mg_dungeons = mcl_mapgen.dungeons

View File

@ -0,0 +1 @@
-- moved into mcl_structures

View File

@ -0,0 +1,3 @@
name = mcl_strongholds
author = Wuzzy
description = Mod has been moved into mcl_structures. This is a dummy thing to overwrite the old thing, kay27 01/25/22

View File

@ -107,6 +107,7 @@ end
function process_mapgen_block_lvm(vm_context)
local nodes = minetest.find_nodes_in_area(vm_context.minp, vm_context.maxp, {"group:struct"}, true)
nodes = mcl_compatibility.sort_nodes(nodes)
for node_name, pos_list in pairs(nodes) do
local lvm_callback = on_finished_block_callbacks[node_name]
if lvm_callback then
@ -117,6 +118,7 @@ end
function process_mapgen_chunk(minp, maxp, seed, vm_context)
local nodes = minetest.find_nodes_in_area(minp, maxp, {"group:struct"}, true)
nodes = mcl_compatibility.sort_nodes(nodes)
for node_name, pos_list in pairs(nodes) do
local chunk_callback = on_finished_chunk_callbacks[node_name]
if chunk_callback then

View File

@ -1,4 +1,4 @@
name = mcl_structures
author = Wuzzy, kay27, cora
description = Structures for MineClone 2/5
depends = mcl_loot, mcl_mapgen, mcl_worlds
depends = mcl_init, mcl_loot, mcl_mapgen, mcl_worlds

View File

@ -20,6 +20,7 @@ minetest.register_on_shutdown(function()
end)
local core_is_creative_enabled = minetest.is_creative_enabled
or function() return false end
minetest.is_creative_enabled = function(name)
local id = player_to_gamemode_id[name]

View File

@ -63,7 +63,7 @@ local function update_player(player_object)
local noclip = #find_nodes_in_area({x = x, y = head_y, z = z}, {x = x + 1, y = head_y + 1, z = z + 1}, "group:opaque") == 8
local velocity = player_object:get_velocity()
local velocity = player_object:get_velocity() or player_object:get_player_velocity()
if vector_length(velocity) < 0.00000001 then
player_doesnt_move[name] = (player_doesnt_move[name] or 0) + 1
else
@ -122,7 +122,7 @@ local function check_player(name)
if not obj_player then
return
end
local velocity = obj_player:get_velocity()
local velocity = obj_player:get_velocity() or obj_player:get_player_velocity()
local pos = obj_player:get_pos()
local x, y, z = floor(pos.x), floor(pos.y), floor(pos.z)
while #find_nodes_in_area({x = x, y = y, z = z}, {x = x + 1, y = y, z = z + 1}, "air") == 4 do

View File

@ -90,7 +90,11 @@ function mcl_player.player_set_model(player, model_name)
end
local function set_texture(player, index, texture)
local textures = player_textures[player:get_player_name()] or {}
local textures = player_textures[player:get_player_name()]
if not textures then
player_textures[player:get_player_name()] = {"blank.png", "blank.png", "blank.png"}
textures = player_textures[player:get_player_name()]
end
textures[index] = texture
player:set_properties({textures = textures})
end

View File

@ -1,3 +1,4 @@
name = mcl_player
author = celeron55
description = Adds the 3D player model, taken from Minetest Game 0.4.16.
depends = mcl_playerinfo

View File

@ -63,6 +63,10 @@ minetest.register_globalstep(function(dtime)
-- what is around me?
local node_stand, node_stand_below, node_head, node_feet = get_player_nodes(pos)
if not mcl_playerinfo[name] then
mcl_playerinfo[name] = {}
end
mcl_playerinfo[name].node_stand = node_stand
mcl_playerinfo[name].node_stand_below = node_stand_below
mcl_playerinfo[name].node_head = node_head

View File

@ -279,6 +279,11 @@ minetest.register_globalstep(function(dtime)
local fly_node = minetest.get_node({x = fly_pos.x, y = fly_pos.y - 0.5, z = fly_pos.z}).name
local elytra = mcl_playerplus.elytra[name]
if not elytra then
mcl_playerplus.elytra[player] = {}
elytra = mcl_playerplus.elytra[player]
end
elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra"
and not player:get_attach()
and (elytra.active or control.jump and player_velocity.y < -6)
@ -402,7 +407,8 @@ minetest.register_globalstep(function(dtime)
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
if mcl_playerplus_internal[name].jump_cooldown > 0 then
local mcl_playerplus_internal_name = mcl_playerplus_internal[name]
if mcl_playerplus_internal_name and mcl_playerplus_internal_name.jump_cooldown > 0 then
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
end
@ -726,6 +732,9 @@ minetest.register_globalstep(function(dtime)
end
-- Update internal values
if not mcl_playerplus_internal[name] then
mcl_playerplus_internal[name] = {}
end
mcl_playerplus_internal[name].lastPos = pos
end

View File

@ -452,60 +452,10 @@ function mcl_spawn.get_player_spawn_pos(player)
if bgroup ~= 1 and bgroup ~= 2 then
-- Bed is destroyed:
if player and player:is_player() then
local function split(s, delimiter) --this is just a common function to split strings, since it is way harder to do in lua like in python, java etc.
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
s = split(player:get_meta():get_string("mcl_beds:spawn"), ",")
x = nil
y = nil
z = nil
for key, value in pairs(s) do
if key == 1 then
value = value:sub(2)
x = tonumber(value)
else
if key == 2 then
y = tonumber(value)
else
if key == 3 then
value = value:sub(1, -2)
z = tonumber(value)
end
end
end
end
checkblock = {x = x, y = y, z = z}
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_1" then
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor"})
player:set_pos(checkblock)
else
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_2" then
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_1"})
player:set_pos(checkblock)
else
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_3" then
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_2"})
player:set_pos(checkblock)
else
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_4" then
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_3"})
player:set_pos(checkblock)
else
player:get_meta():set_string("mcl_beds:spawn", "")
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor"))
return mcl_spawn.get_world_spawn_pos(), false
end
end
end
end
player:get_meta():set_string("mcl_beds:spawn", "")
end
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked."))
return mcl_spawn.get_world_spawn_pos(), false
end
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
@ -581,4 +531,4 @@ minetest.after(respawn_search_initial_delay, function()
storage:set_int("mcl_spawn_dir_step", dir_step)
storage:set_int("mcl_spawn_dir_ind", dir_ind)
end)
end)
end)