mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-24 02:12:25 +01:00
Add bone meal support for dispenser
This commit is contained in:
parent
06847c38d2
commit
eb9c2efb82
@ -14,6 +14,7 @@
|
||||
-- })
|
||||
|
||||
-- Other mods can use these for looping through available colors
|
||||
mcl_dye = {}
|
||||
local dye = {}
|
||||
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
|
||||
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
|
||||
@ -98,7 +99,7 @@ end
|
||||
|
||||
-- Bone Meal
|
||||
|
||||
local apply_bone_meal = function(pointed_thing)
|
||||
mcl_dye.apply_bone_meal = function(pointed_thing)
|
||||
local plant_tab = {
|
||||
"air",
|
||||
"mcl_core:tallgrass",
|
||||
@ -210,7 +211,7 @@ minetest.register_craftitem("mcl_dye:white", {
|
||||
stack_max = 64,
|
||||
groups = {dye=1, craftitem=1, basecolor_white=1, excolor_white=1, unicolor_white=1},
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if(apply_bone_meal(pointed_thing) and not minetest.setting_getbool("creative_mode")) then
|
||||
if(mcl_dye.apply_bone_meal(pointed_thing) and not minetest.setting_getbool("creative_mode")) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
@ -163,6 +163,19 @@ local dispenserdef = {
|
||||
inv:set_stack("main", stack_id, stack)
|
||||
end
|
||||
|
||||
elseif iname == "mcl_dye:white" then
|
||||
-- Apply bone meal, if possible
|
||||
if dropnode.name == "air" then
|
||||
pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } }
|
||||
else
|
||||
pointed_thing = { above = pos, under = droppos }
|
||||
end
|
||||
local success = mcl_dye.apply_bone_meal(pointed_thing)
|
||||
if success then
|
||||
stack:take_item()
|
||||
inv:set_stack("main", stack_id, stack)
|
||||
end
|
||||
|
||||
elseif iname == "mcl_minecarts:minecart" then
|
||||
-- Place minecart as entity on rail
|
||||
if dropnodedef.groups.rail then
|
||||
|
Loading…
Reference in New Issue
Block a user