add missing files
This commit is contained in:
parent
42173f648d
commit
302b04ff1b
117 changed files with 1649 additions and 1 deletions
87
mods/vipworld/moretrees/cocos_palm.lua
Normal file
87
mods/vipworld/moretrees/cocos_palm.lua
Normal file
|
@ -0,0 +1,87 @@
|
|||
local S = moretrees.intllib
|
||||
|
||||
-- © 2016, Rogier <rogier777@gmail.com>
|
||||
|
||||
-- Some constants
|
||||
|
||||
local coconut_drop_ichance = 8
|
||||
|
||||
-- Make the cocos palm fruit trunk a real trunk (it is generated as a fruit)
|
||||
local trunk = minetest.registered_nodes["moretrees:palm_trunk"]
|
||||
local ftrunk = {}
|
||||
local gftrunk = {}
|
||||
for k,v in pairs(trunk) do
|
||||
ftrunk[k] = v
|
||||
gftrunk[k] = v
|
||||
end
|
||||
ftrunk.tiles = {}
|
||||
gftrunk.tiles = {}
|
||||
for k,v in pairs(trunk.tiles) do
|
||||
ftrunk.tiles[k] = v
|
||||
gftrunk.tiles[k] = v
|
||||
end
|
||||
ftrunk.drop = "moretrees:palm_trunk"
|
||||
gftrunk.drop = "moretrees:palm_trunk"
|
||||
ftrunk.after_destruct = function(pos, oldnode)
|
||||
local coconuts = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, {"group:moretrees_coconut"})
|
||||
for _,coconutpos in pairs(coconuts) do
|
||||
-- minetest.dig_node(coconutpos) does not cause nearby coconuts to be dropped :-( ...
|
||||
--minetest.dig_node(coconutpos)
|
||||
local items = minetest.get_node_drops(minetest.get_node(coconutpos).name)
|
||||
minetest.swap_node(coconutpos, biome_lib.air)
|
||||
for _, itemname in pairs(items) do
|
||||
minetest.add_item(coconutpos, itemname)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Make the different trunk types distinguishable (but barely)
|
||||
ftrunk.tiles[1] = "moretrees_palm_trunk_top.png^[transformR90"
|
||||
gftrunk.tiles[1] = "moretrees_palm_trunk_top.png^[transformR180"
|
||||
gftrunk.description = gftrunk.description.." (gen)"
|
||||
minetest.register_node("moretrees:palm_fruit_trunk", ftrunk)
|
||||
minetest.register_node("moretrees:palm_fruit_trunk_gen", gftrunk)
|
||||
|
||||
for _,suffix in ipairs({"_0", "_1", "_2", "_3", ""}) do
|
||||
local name
|
||||
if suffix == "_0" then
|
||||
name = S("Coconut Flower")
|
||||
else
|
||||
name = S("Coconut")
|
||||
end
|
||||
local drop = ""
|
||||
local coco_group = 1
|
||||
local tile = "moretrees_coconut"..suffix..".png"
|
||||
local timerfn = coconut_growfn
|
||||
local constructfn = coconut_starttimer
|
||||
if suffix == "_3" then
|
||||
drop = "moretrees:coconut"
|
||||
tile = "moretrees_coconut.png"
|
||||
elseif suffix == "" then
|
||||
drop = nil
|
||||
coco_group = nil
|
||||
timerfn = nil
|
||||
constructfn = nil
|
||||
end
|
||||
local coconutdef = {
|
||||
description = name,
|
||||
tiles = {tile},
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = { fleshy=3, dig_immediate=3, flammable=2, moretrees_coconut=coco_group },
|
||||
inventory_image = tile.."^[transformR180",
|
||||
wield_image = tile.."^[transformR180",
|
||||
sounds = default.node_sound_defaults(),
|
||||
drop = drop,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3}
|
||||
},
|
||||
on_timer = timerfn,
|
||||
on_construct = constructfn,
|
||||
|
||||
}
|
||||
minetest.register_node("moretrees:coconut"..suffix, coconutdef)
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue