develop #24

Merged
milan merged 4 commits from develop into master 2020-12-30 10:35:09 +01:00
36 changed files with 196 additions and 158 deletions
Showing only changes of commit 877f03b698 - Show all commits

View file

@ -416,6 +416,12 @@ end
armor.damage = function(self, player, index, stack, use)
local old_stack = ItemStack(stack)
local worn_armor = armor:get_weared_armor_elements(player)
local armor_worn_cnt = 0
for k,v in pairs(worn_armor) do
armor_worn_cnt = armor_worn_cnt + 1
end
use = math.ceil(use/armor_worn_cnt)
stack:add_wear(use)
self:run_callbacks("on_damage", player, index, stack)
self:set_inventory_stack(player, index, stack)

View file

@ -389,14 +389,18 @@ if armor.config.drop == true or armor.config.destroy == true then
end)
end
end)
else -- reset un-dropped armor and it's effects
minetest.register_on_respawnplayer(function(player)
armor:set_player_armor(player)
end)
end
if armor.config.punch_damage == true then
minetest.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities)
local name = player:get_player_name()
local name2 = hitter:get_player_name()
if name and name2 and minetest.is_protected(player:get_pos(), "") then
local hit_ip = hitter:is_player()
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
return
elseif name then
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)

View file

@ -17,8 +17,6 @@ end
if minetest.global_exists("armor") and armor.elements then
table.insert(armor.elements, "shield")
local mult = armor.config.level_multiplier or 1
armor.config.level_multiplier = mult * 0.9
end
-- Regisiter Shields

View file

@ -129,11 +129,13 @@ local get_ambience = function(player, tod, name)
pos.y = pos.y + 1.4 -- head level
local nod_head = pplus and playerplus[name].nod_head or minetest.get_node(pos).name
local nod_head = pplus and name and playerplus[name].nod_head or
minetest.get_node(pos).name
pos.y = pos.y - 1.2 -- foot level
local nod_feet = pplus and playerplus[name].nod_feet or minetest.get_node(pos).name
local nod_feet = pplus and name and playerplus[name].nod_feet or
minetest.get_node(pos).name
pos.y = pos.y - 0.2 -- reset pos

View file

@ -1 +1 @@
This mod adds bees and beehives into minetest
This mod adds bees and hives to Minetest

View file

@ -14,7 +14,9 @@ else
end
--
-- FUNCTIONS
--
local floor = math.floor
local random = math.random
@ -55,15 +57,17 @@ local polinate_flower = function(pos, flower)
}
local floor_pos = {x = spawn_pos.x, y = spawn_pos.y - 1, z = spawn_pos.z}
local spawn = minetest.get_node(spawn_pos).name
local floor = minetest.get_node(floor_pos).name
local floorn = minetest.get_node(floor_pos).name
if floor == "group:soil" and spawn == "air" then
if floorn == "group:soil" and spawn == "air" then
minetest.set_node(spawn_pos, {name = flower})
end
end
--
-- NODES
--
minetest.register_node("bees:extractor", {
description = S("Honey Extractor"),
@ -77,11 +81,11 @@ minetest.register_node("bees:extractor", {
tubedevice_receiver = 1
},
on_construct = function(pos, node)
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos = pos.x .. "," .. pos.y .. "," .. pos.z
pos = pos.x .. "," .. pos.y .. "," .. pos.z
inv:set_size("frames_filled", 1)
inv:set_size("frames_emptied", 1)
@ -102,10 +106,11 @@ minetest.register_node("bees:extractor", {
)
end,
on_timer = function(pos, node)
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
if not inv:contains_item("frames_filled", "bees:frame_full")
or not inv:contains_item("bottles_empty", "vessels:glass_bottle") then
@ -125,39 +130,29 @@ minetest.register_node("bees:extractor", {
inv:remove_item("bottles_empty", "vessels:glass_bottle")
inv:remove_item("frames_filled", "bees:frame_full")
local p = {
x = pos.x + random() - 0.5,
y = pos.y + random() - 0.5,
z = pos.z + random() - 0.5
}
-- wax flying all over the place
minetest.add_particle({
pos = {x = pos.x, y = pos.y, z = pos.z},
vel = {
velocity = {
x = random(-1, 1),
y = random(4),
z = random(-1, 1)
},
acc = {x = 0, y = -6, z = 0},
acceleration = {x = 0, y = -6, z = 0},
expirationtime = 2,
size = random(1, 3),
collisiondetection = false,
texture = "bees_wax_particle.png",
})
local timer = minetest.get_node_timer(pos)
timer:start(5)
else
local timer = minetest.get_node_timer(pos)
timer:start(5) -- Try again in 5 seconds (was 1)
timer:start(5) -- try again in 5 seconds (was 1)
end
end,
tube = {
insert_object = function(pos, node, stack, direction)
insert_object = function(pos, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -183,7 +178,7 @@ minetest.register_node("bees:extractor", {
return stack
end,
can_insert = function(pos,node,stack,direction)
can_insert = function(pos, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -205,7 +200,7 @@ minetest.register_node("bees:extractor", {
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
},
on_metadata_inventory_put = function(pos, listname, index, stack, player)
on_metadata_inventory_put = function(pos, listname, _, stack)
local timer = minetest.get_node_timer(pos)
local meta = minetest.get_meta(pos)
@ -217,7 +212,7 @@ minetest.register_node("bees:extractor", {
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(_, listname, _, stack)
if (listname == "bottles_empty" and stack:get_name() == "vessels:glass_bottle")
or (listname == "frames_filled" and stack:get_name() == "bees:frame_full") then
@ -227,11 +222,11 @@ minetest.register_node("bees:extractor", {
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
allow_metadata_inventory_move = function()
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
allow_metadata_inventory_take = function(pos, _, _, stack, player)
if player and minetest.is_protected(pos, player:get_player_name()) then
return 0
@ -247,14 +242,12 @@ minetest.register_node("bees:bees", {
drawtype = "plantlike",
paramtype = "light",
groups = {not_in_creative_inventory = 1},
tiles = {
{
tiles = {{
name = "bees_strip.png",
animation = {
type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0
}
}
},
}},
damage_per_second = 1,
walkable = false,
buildable_to = true,
@ -265,8 +258,7 @@ minetest.register_node("bees:bees", {
}
},
on_punch = function(pos, node, puncher)
on_punch = function(_, _, puncher)
puncher:set_hp(puncher:get_hp() - 2)
end,
})
@ -274,7 +266,7 @@ minetest.register_node("bees:bees", {
minetest.register_node("bees:hive_wild", {
description = S("Wild Bee Hive"),
tiles = { --Neuromancer"s base texture
tiles = { -- Neuromancer's base texture
"bees_hive_wild.png", "bees_hive_wild.png", "bees_hive_wild.png",
"bees_hive_wild.png", "bees_hive_wild_bottom.png"
},
@ -291,10 +283,10 @@ minetest.register_node("bees:hive_wild", {
node_box = { -- VanessaE's wild hive nodebox contribution
type = "fixed",
fixed = {
{-0.250000,-0.500000,-0.250000,0.250000,0.375000,0.250000}, --NodeBox 2
{-0.312500,-0.375000,-0.312500,0.312500,0.250000,0.312500}, --NodeBox 4
{-0.375000,-0.250000,-0.375000,0.375000,0.125000,0.375000}, --NodeBox 5
{-0.062500,-0.500000,-0.062500,0.062500,0.500000,0.062500}, --NodeBox 6
{-0.25, -0.5, -0.25, 0.25, 0.375, 0.25},
{-0.3125, -0.375, -0.3125, 0.3125, 0.25, 0.3125},
{-0.375, -0.25, -0.375, 0.375, 0.125, 0.375},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
}
},
@ -328,7 +320,7 @@ minetest.register_node("bees:hive_wild", {
local stacks = inv:get_list("combs")
for k, v in pairs(stacks) do
for k, _ in pairs(stacks) do
if inv:get_stack("combs", k):is_empty() then
@ -363,7 +355,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
on_punch = function(pos, node, puncher)
on_punch = function(pos, _, puncher)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -374,7 +366,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
on_metadata_inventory_take = function(pos, listname, index, stack, taker)
on_metadata_inventory_take = function(pos, listname, _, _, taker)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -388,7 +380,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, taker)
on_metadata_inventory_put = function(pos)
local timer = minetest.get_node_timer(pos)
@ -397,7 +389,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(_, listname, _, stack)
-- restart the colony by adding a queen
if listname == "queen" and stack:get_name() == "bees:queen" then
@ -407,7 +399,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
on_rightclick = function(pos, _, clicker, itemstack)
minetest.show_formspec(clicker:get_player_name(),
"bees:hive_artificial",
@ -426,7 +418,7 @@ minetest.register_node("bees:hive_wild", {
end
end,
can_dig = function(pos,player)
can_dig = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -438,10 +430,9 @@ minetest.register_node("bees:hive_wild", {
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, user)
after_dig_node = function(_, _, _, user)
local wielded
if user:get_wielded_item() ~= nil then
wielded = user:get_wielded_item()
else
@ -488,7 +479,6 @@ minetest.register_node("bees:hive_artificial", {
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -500,13 +490,15 @@ minetest.register_node("bees:hive_artificial", {
meta:set_string("infotext", S("Requires Queen bee to function"))
end,
on_rightclick = function(pos, node, clicker, itemstack)
on_rightclick = function(pos, _, clicker)
if minetest.is_protected(pos, clicker:get_player_name()) then
local player_name = clicker:get_player_name()
if minetest.is_protected(pos, player_name) then
return
end
minetest.show_formspec(clicker:get_player_name(),
minetest.show_formspec(player_name,
"bees:hive_artificial",
hive_artificial(pos)
)
@ -523,7 +515,7 @@ minetest.register_node("bees:hive_artificial", {
end
end,
on_timer = function(pos,elapsed)
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -555,7 +547,7 @@ minetest.register_node("bees:hive_artificial", {
local stacks = inv:get_list("frames")
for k, v in pairs(stacks) do
for k, _ in pairs(stacks) do
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
@ -578,7 +570,7 @@ minetest.register_node("bees:hive_artificial", {
end
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
on_metadata_inventory_take = function(pos, listname)
if listname == "queen" then
@ -591,7 +583,7 @@ minetest.register_node("bees:hive_artificial", {
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
allow_metadata_inventory_move = function(pos, from_list, _, to_list, to_index)
local inv = minetest.get_meta(pos):get_inventory()
@ -607,7 +599,7 @@ minetest.register_node("bees:hive_artificial", {
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
on_metadata_inventory_put = function(pos, listname, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -627,7 +619,7 @@ minetest.register_node("bees:hive_artificial", {
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(pos, listname, index, stack)
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then return 0 end
@ -648,7 +640,10 @@ minetest.register_node("bees:hive_artificial", {
end,
})
-- ABMS
--
-- ABMs
--
minetest.register_abm({
nodenames = {"bees:hive_artificial", "bees:hive_wild", "bees:hive_industrial"},
@ -660,12 +655,12 @@ minetest.register_abm({
-- Bee particle
minetest.add_particle({
pos = {x = pos.x, y = pos.y, z = pos.z},
vel = {
velocity = {
x = (random() - 0.5) * 5,
y = (random() - 0.5) * 5,
z = (random() - 0.5) * 5
},
acc = {
acceleration = {
x = random() - 0.5,
y = random() - 0.5,
z = random() - 0.5
@ -692,14 +687,14 @@ minetest.register_abm({
})
-- spawn abm. This should be changed to a more realistic type of spawning
-- spawn ABM. This should be changed to a more realistic type of spawning
minetest.register_abm({
nodenames = {"group:leaves"},
neighbors = {"air"},
interval = 800,--1600,
chance = 10,--20,
interval = 800,
chance = 10,
action = function(pos, node)
action = function(pos)
if floor(pos.x / 40) ~= pos.x / 40
or floor(pos.z / 40) ~= pos.z / 40
@ -725,7 +720,7 @@ minetest.register_abm({
interval = 30,
chance = 4,
action = function(pos, node, _, _)
action = function(pos)
local p = {
x = pos.x + random(-5, 5),
@ -746,13 +741,15 @@ minetest.register_abm({
interval = 30,
chance = 5,
action = function(pos, node, _, _)
action = function(pos)
minetest.remove_node(pos)
end,
})
--
-- ITEMS
--
minetest.register_craftitem("bees:frame_empty", {
description = S("Empty hive frame"),
@ -794,7 +791,9 @@ minetest.register_craftitem("bees:queen", {
})
--
-- CRAFTS
--
minetest.register_craft({
output = "bees:extractor",
@ -852,7 +851,9 @@ if minetest.get_modpath("bushes_classic") then
end
--
-- TOOLS
--
minetest.register_tool("bees:smoker", {
description = S("smoker"),
@ -863,7 +864,7 @@ minetest.register_tool("bees:smoker", {
damage_groups = {fleshy = 2},
},
on_use = function(itemstack, user, pointed_thing)
on_use = function(itemstack, _, pointed_thing)
if pointed_thing.type ~= "node" then
return
@ -879,8 +880,8 @@ minetest.register_tool("bees:smoker", {
y = pos.y,
z = pos.z + random() - 0.5
},
vel = {x = 0, y = 0.5 + random(), z = 0},
acc = {x = 0, y = 0, z = 0},
velocity = {x = 0, y = 0.5 + random(), z = 0},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 2 + random(2.5),
size = random(3),
collisiondetection = false,
@ -909,7 +910,10 @@ minetest.register_tool("bees:grafting_tool", {
})
-- COMPATIBILTY --remove after all has been updated
--
-- COMPATIBILTY
-- remove after all has been updated
--
-- ALIASES
minetest.register_alias("bees:honey_extractor", "bees:extractor")
@ -952,7 +956,9 @@ minetest.register_lbm({
})
--
-- PIPEWORKS
--
if minetest.get_modpath("pipeworks") then
@ -967,7 +973,7 @@ if minetest.get_modpath("pipeworks") then
sounds = default.node_sound_wood_defaults(),
tube = {
insert_object = function(pos, node, stack, direction)
insert_object = function(pos, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -996,7 +1002,7 @@ if minetest.get_modpath("pipeworks") then
return stack
end,
can_insert = function(pos,node,stack,direction)
can_insert = function(pos, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -1016,7 +1022,7 @@ if minetest.get_modpath("pipeworks") then
return false
end,
can_remove = function(pos,node,stack,direction)
can_remove = function(_, _, stack)
if stack:get_name() == "bees:frame_full" then
return 1
@ -1032,7 +1038,6 @@ if minetest.get_modpath("pipeworks") then
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -1044,13 +1049,15 @@ if minetest.get_modpath("pipeworks") then
meta:set_string("infotext", S("Requires Queen bee to function"))
end,
on_rightclick = function(pos, node, clicker, itemstack)
on_rightclick = function(pos, _, clicker)
if minetest.is_protected(pos, clicker:get_player_name()) then
local player_name = clicker:get_player_name()
if minetest.is_protected(pos, player_name) then
return
end
minetest.show_formspec(clicker:get_player_name(),
minetest.show_formspec(player_name,
"bees:hive_artificial",
hive_artificial(pos)
)
@ -1067,7 +1074,7 @@ if minetest.get_modpath("pipeworks") then
end
end,
on_timer = function(pos,elapsed)
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -1097,7 +1104,7 @@ if minetest.get_modpath("pipeworks") then
local stacks = inv:get_list("frames")
for k, v in pairs(stacks) do
for k, _ in pairs(stacks) do
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
@ -1120,7 +1127,7 @@ if minetest.get_modpath("pipeworks") then
end
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
on_metadata_inventory_take = function(pos, listname)
if listname == "queen" then
@ -1133,7 +1140,7 @@ if minetest.get_modpath("pipeworks") then
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
allow_metadata_inventory_move = function(pos, from_list, _, to_list, to_index)
local inv = minetest.get_meta(pos):get_inventory()
@ -1149,7 +1156,7 @@ if minetest.get_modpath("pipeworks") then
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
on_metadata_inventory_put = function(pos, listname, _, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -1169,7 +1176,7 @@ if minetest.get_modpath("pipeworks") then
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
allow_metadata_inventory_put = function(pos, listname, index, stack)
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then
return 0
@ -1203,17 +1210,18 @@ if minetest.get_modpath("pipeworks") then
end
--
-- LUCKY BLOCKS
--
if minetest.get_modpath("lucky_block") then
local add_bees = function(pos, player)
local objs = minetest.get_objects_inside_radius(pos, 15)
local violet = minetest.get_color_escape_sequence("#ff00ff")
minetest.chat_send_player(player:get_player_name(),
violet .. S("Bees! Bees for all!"))
minetest.colorize("violet", S("Bees! Bees for all!")))
for n = 1, #objs do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 150 B

View file

@ -2,11 +2,15 @@
Minetest clay crafter mod.
Adds a way for players to obtain clay other than mining, out of a common material: dirt. It adds three new nodes:
Claycrafter: Used to convert compressed dirt into clay.
**Claycrafter:** Used to convert compressed dirt into clay.
Compressed dirt: Just 9 dirt, compressed, useful for saving storage space, too! (Not present if moreblocks is installed, use moreblocks:dirt_compressed instead)
**Compressed dirt:** Just 9 dirt, compressed, useful for saving storage space, too!
(Not present if moreblocks is installed, use moreblocks:dirt_compressed instead)
**Glass of water:** Used as fuel for the Claycrafter. Placeable.
For extra info look at the [Forum Thread](https://forum.minetest.net/viewtopic.php?f=11&t=13992)
Glass of water: Used as fuel for the Claycrafter. Placeable.
##### Dependencies:
Default
@ -15,18 +19,13 @@ Vessels
##### Optional dependencies:
moreblocks
Special thanks to everamzah
##### License for Code
Dragonop (LGPLv3)
##### License for Media
Textures created or modified by Dragonop (CC-BY-SA 4.0)
Glass of water derived from the Drinking Glass texture from the vessels mod made by Thomas-S which is distributed as (CC-BY-SA 3.0)
Compressed dirt derived from the minetest's game default dirt texture made by Neuromancer and later modified by random-geek which is distributed as (CC-BY-SA 3.0)
Arrow textures by Blockmen, from minetest game's default, distributed under (CC-BY-SA 3.0)
##### Special thanks to everamzah

BIN
mods/doors/screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -81,6 +81,9 @@ local is_member = function (meta, name)
else
-- is member if player and owner share at least one faction
local owner_factions = factions.get_player_factions(name)
local owner = meta:get_string("owner")
if owner_factions ~= nil and owner_factions ~= false then
for _, f in ipairs(owner_factions) do
@ -90,6 +93,7 @@ local is_member = function (meta, name)
end
end
end
end
for _, n in pairs(get_member_list(meta)) do
@ -173,11 +177,13 @@ local protector_formspec = function(meta)
checkbox_faction = true
end
else
if factions.get_player_factions(meta:get_string("owner")) ~= nil then
if next(factions.get_player_faction(meta:get_string("owner"))) then
checkbox_faction = true
end
end
end
end
if checkbox_faction then
formspec = formspec .. "checkbox[0,5;faction_members;"
@ -444,6 +450,19 @@ local check_overlap = function(itemstack, placer, pointed_thing)
end
-- remove protector display entities
local del_display = function(pos)
local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do
if v:get_luaentity().name == "protector:display" then
v:remove()
end
end
end
-- temporary pos store
local player_pos = {}
@ -521,17 +540,14 @@ minetest.register_node("protector:protect", {
on_blast = function() end,
after_destruct = function(pos, oldnode)
local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do
v:remove()
end
end,
after_destruct = del_display
})
-- default recipe and alternative for MineClone2
if protector_recipe then
if minetest.registered_items["default:stone"] then
minetest.register_craft({
output = "protector:protect",
recipe = {
@ -541,6 +557,7 @@ if protector_recipe then
}
})
else
minetest.register_craft({
output = "protector:protect",
recipe = {
@ -627,12 +644,7 @@ minetest.register_node("protector:protect2", {
on_blast = function() end,
after_destruct = function(pos, oldnode)
local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do
v:remove()
end
end,
after_destruct = del_display
})
-- recipes to switch between protectors

View file

@ -78,6 +78,8 @@ minetest.after(0.1, function()
regrow.add_fruit("ethereal:banana", "ethereal:bananaleaves")
regrow.add_fruit("ethereal:orange", "ethereal:orange_leaves")
regrow.add_fruit("ethereal:coconut", "ethereal:palmleaves")
regrow.add_fruit("ethereal:lemon", "ethereal:lemon_leaves")
regrow.add_fruit("ethereal:olive", "ethereal:olive_leaves")
-- regrow.add_fruit("ethereal:golden_apple", "ethereal:yellowleaves")
end)

View file

@ -24,3 +24,4 @@ Changelog
- 0.2 - Add checks for player placed fruit and tree's nearby.
- 0.3 - Make add_fruit a global function for other mods to use.
- 0.4 - Add check for fruit tree leaf type before re-growing.
- 0.5 - Ethereal Lemons and Olives can now regrow.

BIN
mods/regrow/screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View file

@ -0,0 +1,3 @@
Goebbels
Goebbels
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Thinky
Thinky
CC BY-SA 3.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B