bring baseline minetest_game code up-to-date

master
Vanessa Ezekowitz 2015-08-25 19:00:55 -04:00
parent 7acbbc3b0c
commit 1460d56852
96 changed files with 2328 additions and 11641 deletions

View File

@ -1,4 +1,3 @@
--
-- Helper functions
--
@ -8,6 +7,7 @@ local function is_water(pos)
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
@ -16,12 +16,14 @@ local function get_sign(i)
end
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
@ -32,7 +34,7 @@ end
local boat = {
physical = true,
collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5},
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "boat.obj",
textures = {"default_wood.png"},
@ -43,6 +45,7 @@ local boat = {
removed = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
@ -53,9 +56,15 @@ function boat.on_rightclick(self, clicker)
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
local pos = clicker:getpos()
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
minetest.after(0.1, function()
clicker:setpos(pos)
end)
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
clicker:set_attach(self.object, "",
{x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
@ -64,6 +73,7 @@ function boat.on_rightclick(self, clicker)
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
@ -72,11 +82,14 @@ function boat.on_activate(self, staticdata, dtime_s)
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
function boat.on_punch(self, puncher, time_from_last_punch,
tool_capabilities, direction)
if not puncher or not puncher:is_player() or self.removed then
return
end
@ -97,6 +110,7 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
if self.driver then
@ -149,7 +163,8 @@ function boat.on_step(self, dtime)
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
else
p.y = p.y + 1
@ -172,7 +187,8 @@ function boat.on_step(self, dtime)
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
end
end
@ -181,8 +197,10 @@ function boat.on_step(self, dtime)
self.object:setacceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boat_inventory.png",
@ -206,6 +224,7 @@ minetest.register_craftitem("boats:boat", {
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
@ -214,4 +233,3 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"},
},
})

17
mods/bones/README.txt Normal file
View File

@ -0,0 +1,17 @@
Minetest 0.4 mod: bones
=======================
License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
WTFPL
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
----------------------
Bad_Command_

1
mods/bones/depends.txt Normal file
View File

@ -0,0 +1 @@
default

219
mods/bones/init.lua Normal file
View File

@ -0,0 +1,219 @@
-- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information.
bones = {}
local function is_owner(pos, name)
local owner = minetest.get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end
bones.bones_formspec =
"size[8,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85)
local share_bones_time = tonumber(minetest.setting_get("share_bones_time") or 1200)
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early") or (share_bones_time/4))
minetest.register_node("bones:bones", {
description = "Bones",
tiles = {
"bones_top.png",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {dig_immediate=2},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.5},
dug = {name="default_gravel_footstep", gain=1.0},
}),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then
return stack:get_count()
end
return 0
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then
minetest.remove_node(pos)
end
end,
on_punch = function(pos, node, player)
if(not is_owner(pos, player:get_player_name())) then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
local has_space = true
for i=1,inv:get_size("main") do
local stk = inv:get_stack("main", i)
if player_inv:room_for_item("main", stk) then
inv:set_stack("main", i, nil)
player_inv:add_item("main", stk)
else
has_space = false
break
end
end
-- remove bones if player emptied them
if has_space then
minetest.remove_node(pos)
end
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local time = meta:get_int("time") + elapsed
if time >= share_bones_time then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("owner", "")
else
meta:set_int("time", time)
return true
end
end,
})
local function may_replace(pos, player)
local node_name = minetest.get_node(pos).name
local node_definition = minetest.registered_nodes[node_name]
-- if the node is unknown, we let the protection mod decide
-- this is consistent with when a player could dig or not dig it
-- unknown decoration would often be removed
-- while unknown building materials in use would usually be left
if not node_definition then
-- only replace nodes that are not protected
return not minetest.is_protected(pos, player:get_player_name())
end
-- allow replacing air and liquids
if node_name == "air" or node_definition.liquidtype ~= "none" then
return true
end
-- don't replace filled chests and other nodes that don't allow it
local can_dig_func = node_definition.can_dig
if can_dig_func and not can_dig_func(pos, player) then
return false
end
-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones?
-- flowers being squished by bones are more realistical than a squished stone, too
-- exception are of course any protected buildable_to
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
end
minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") then
return
end
local player_inv = player:get_inventory()
if player_inv:is_empty("main") and
player_inv:is_empty("craft") then
return
end
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5)
pos.z = math.floor(pos.z+0.5)
local param2 = minetest.dir_to_facedir(player:get_look_dir())
local player_name = player:get_player_name()
local player_inv = player:get_inventory()
if (not may_replace(pos, player)) then
if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then
-- drop one node above if there's space
-- this should solve most cases of protection related deaths in which players dig straight down
-- yet keeps the bones reachable
pos.y = pos.y+1
else
-- drop items instead of delete
for i=1,player_inv:get_size("main") do
minetest.add_item(pos, player_inv:get_stack("main", i))
end
for i=1,player_inv:get_size("craft") do
minetest.add_item(pos, player_inv:get_stack("craft", i))
end
-- empty lists main and craft
player_inv:set_list("main", {})
player_inv:set_list("craft", {})
return
end
end
minetest.set_node(pos, {name="bones:bones", param2=param2})
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
inv:set_list("main", player_inv:get_list("main"))
for i=1,player_inv:get_size("craft") do
local stack = player_inv:get_stack("craft", i)
if inv:room_for_item("main", stack) then
inv:add_item("main", stack)
else
--drop if no space left
minetest.add_item(pos, stack)
end
end
player_inv:set_list("main", {})
player_inv:set_list("craft", {})
meta:set_string("formspec", bones.bones_formspec)
meta:set_string("owner", player_name)
if share_bones_time ~= 0 then
meta:set_string("infotext", player_name.."'s fresh bones")
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
meta:set_int("time", 0)
else
meta:set_int("time", (share_bones_time - share_bones_time_early))
end
minetest.get_node_timer(pos):start(10)
else
meta:set_string("infotext", player_name.."'s bones")
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

22
mods/creative/README.txt Normal file
View File

@ -0,0 +1,22 @@
Minetest 0.4 mod: creative
==========================
Implements creative mode.
Switch on by using the "creative_mode" setting.
Registered items that
- have a description, and
- do not have the group not_in_creative_inventory
are added to the creative inventory.
License of source code and media files:
---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,177 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:creative;main]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if start_i < 0 then
start_i = start_i + 4*6
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)
if minetest.setting_getbool("creative_mode") then
local digtime = 0.5
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
},
damage_groups = {fleshy = 10},
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end
end

View File

@ -24,7 +24,6 @@ Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
Cisoun's WTFPL texture pack:
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_sapling.png
@ -59,8 +58,8 @@ VanessaE (WTFPL):
default_nc_side.png
default_desert_sand.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA):
default_brick.png
@ -77,7 +76,6 @@ Jordach (CC BY-SA 3.0):
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mineral_gold.png
@ -119,12 +117,16 @@ paramat (CC BY-SA 3.0):
default_dry_grass.png
default_dry_grass_side.png
default_dry_grass_*.png
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0)
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_grass_side.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_stone_brick.png, derived from a texture by Cisoun (WTFPL)
default_desert_stone_brick.png, derived from a texture by VanessaE (WTFPL)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_clay_brick.png
default_iron_ingot.png
@ -153,10 +155,6 @@ Neuromancer (CC BY-SA 3.0):
default_dirt.png
default_furnace_*.png
Philipbenr (CC BY-SA 3.0):
default_grass.png
default_grass_side.png
Gambit (WTFPL):
default_bronze_ingot.png
default_copper_ingot.png

View File

@ -68,5 +68,9 @@ minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick")
minetest.register_alias("snow", "default:snow")
-- Mese now comes in the form of blocks, ore, crystal and fragments
minetest.register_alias("default:mese", "default:mese_block")
-- 'mese_block' was used for a while for the block form of mese
minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")

View File

@ -1,15 +0,0 @@
minetest.register_chatcommand("hotbar", {
params = "[size]",
description = "Sets the size of your hotbar",
func = function(name, slots)
if slots == "" then slots = 16 end
if type(tonumber(slots)) ~= "number" or tonumber(slots) < 1 or tonumber(slots) > 23 then
minetest.chat_send_player(name, "[_] Hotbar size must be between 1 and 23.")
return
end
local player = minetest.get_player_by_name(name)
player:hud_set_hotbar_itemcount(tonumber(slots))
minetest.chat_send_player(name, "[_] Hotbar size set to " .. tonumber(slots) .. ".")
end,
})

View File

@ -15,9 +15,9 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:pinewood 4',
output = 'default:pine_wood 4',
recipe = {
{'default:pinetree'},
{'default:pine_tree'},
}
})

View File

@ -89,16 +89,22 @@ end
--
default.cool_lava_source = function(pos)
minetest.set_node(pos, {name = "default:obsidian"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
default.cool_lava_flowing = function(pos)
minetest.set_node(pos, {name = "default:stone"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"group:water"},
interval = 5,
chance = 15,
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_flowing(...)
end,
@ -107,8 +113,8 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 5,
chance = 15,
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_source(...)
end,

View File

@ -9,7 +9,7 @@ default = {}
default.LIGHT_MAX = 14
-- GUI related stuff
default.gui_bg = "bgcolor[#08080899;false]"
default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
@ -44,15 +44,5 @@ dofile(minetest.get_modpath("default").."/crafting.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/trees.lua")
dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/aliases.lua")
dofile(minetest.get_modpath("default").."/legacy.lua")
hotbar_size = minetest.setting_get("hotbar_size") or 16
minetest.register_on_joinplayer(function(player)
player:hud_set_hotbar_itemcount(hotbar_size)
minetest.after(0.5,function()
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
end)
end)

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,393 +0,0 @@
# Blender v2.69 (sub 0) OBJ File: 'apple.blend'
# www.blender.org
o Icosphere_Icosphere.002
v 0.000000 -0.400842 0.000000
v 0.144721 -0.339444 0.105145
v -0.055278 -0.339444 0.170130
v -0.178885 -0.339443 0.000000
v -0.055278 -0.339444 -0.170130
v 0.144721 -0.339444 -0.105145
v 0.055278 -0.160556 0.170130
v -0.144721 -0.160556 0.105145
v -0.144721 -0.160556 -0.105145
v 0.055278 -0.160556 -0.170130
v 0.178885 -0.160557 0.000000
v -0.032491 -0.418319 0.099999
v 0.085065 -0.418319 0.061802
v 0.052574 -0.355148 0.161802
v 0.170130 -0.355147 0.000000
v 0.085065 -0.418319 -0.061802
v -0.105146 -0.418318 0.000000
v -0.137638 -0.355147 0.099999
v -0.032491 -0.418319 -0.099999
v -0.137638 -0.355147 -0.099999
v 0.052574 -0.355148 -0.161802
v 0.190212 -0.250000 0.061803
v 0.190212 -0.250000 -0.061803
v 0.000000 -0.250000 0.200000
v 0.117557 -0.250000 0.161803
v -0.190212 -0.250000 0.061803
v -0.117557 -0.250000 0.161803
v -0.117557 -0.250000 -0.161803
v -0.190212 -0.250000 -0.061803
v 0.117557 -0.250000 -0.161803
v 0.000000 -0.250000 -0.200000
v 0.137638 -0.144853 0.099999
v -0.052574 -0.144852 0.161802
v -0.170130 -0.144853 0.000000
v -0.052574 -0.144852 -0.161802
v 0.137638 -0.144853 -0.099999
v 0.009687 -0.099347 0.044790
v 0.048737 -0.099347 0.000000
v -0.038857 -0.099347 0.028197
v -0.042458 -0.099347 -0.023996
v 0.012688 -0.099347 -0.040590
v -0.016246 -0.425452 0.050000
v -0.052573 -0.425452 0.000000
v -0.016246 -0.425452 -0.050000
v 0.042532 -0.425452 0.030901
v 0.042532 -0.425452 -0.030901
v 0.015091 -0.107438 -0.003228
v 0.002701 -0.107438 0.010984
v -0.012702 -0.107438 0.005719
v -0.013845 -0.107438 -0.010842
v 0.003653 -0.107438 -0.016107
v 0.029212 -0.099347 0.022395
v -0.014585 -0.099347 0.036494
v -0.040657 -0.099347 0.002100
v -0.014885 -0.099347 -0.032293
v 0.030712 -0.099347 -0.020295
v 0.015092 -0.077511 -0.003228
v 0.002701 -0.077510 0.010984
v -0.012702 -0.077510 0.005719
v -0.013844 -0.077510 -0.010842
v 0.003653 -0.077510 -0.016107
v 0.015092 -0.058676 -0.015508
v 0.002701 -0.058676 -0.001296
v -0.012702 -0.058676 -0.006561
v -0.013844 -0.058676 -0.023122
v 0.003653 -0.058676 -0.028387
v 0.007173 -0.048549 -0.021201
v 0.000872 -0.048549 -0.013974
v -0.006961 -0.048549 -0.016651
v -0.007542 -0.048549 -0.025073
v 0.001356 -0.048549 -0.027750
v -0.108675 -0.054386 -0.056250
v -0.206943 -0.056320 -0.003236
v -0.109310 -0.075273 0.051569
v 0.004258 -0.111407 -0.002341
v 0.032483 -0.120213 0.107460
v -0.091789 -0.120213 0.066671
v -0.093590 -0.120213 -0.064571
v 0.033983 -0.120213 -0.105360
v 0.113811 -0.120213 0.000000
v 0.073663 -0.112361 0.072395
v 0.093187 -0.112361 0.050000
v -0.045715 -0.112361 0.095000
v -0.021443 -0.112361 0.103296
v -0.106294 -0.112361 -0.011998
v -0.104493 -0.112361 0.014098
v -0.019943 -0.112361 -0.101196
v -0.047516 -0.112361 -0.092899
v 0.093187 -0.112361 -0.050000
v 0.075163 -0.112361 -0.070294
v 0.021085 -0.100041 0.076125
v -0.065323 -0.100041 0.047434
v -0.068024 -0.100041 -0.044283
v 0.023335 -0.100041 -0.072975
v 0.081274 -0.100041 0.000000
v 0.041675 -0.096115 0.058593
v 0.070962 -0.096115 0.025000
v -0.042286 -0.096115 0.061598
v -0.005878 -0.096115 0.074043
v -0.074376 -0.096115 -0.017997
v -0.071675 -0.096115 0.021148
v -0.003627 -0.096115 -0.070893
v -0.044987 -0.096115 -0.058448
v 0.070962 -0.096115 -0.025000
v 0.043925 -0.096115 -0.055442
v -0.008123 -0.409577 0.025000
v -0.026286 -0.409577 0.000000
v -0.008123 -0.409577 -0.025000
v 0.021266 -0.409577 0.015451
v 0.021266 -0.409577 -0.015451
v -0.108675 -0.054808 -0.056250
v -0.206943 -0.056742 -0.003236
v -0.109310 -0.075694 0.051569
v 0.004258 -0.111829 -0.002341
vt 0.289705 0.228174
vt 0.289705 0.302602
vt 0.144853 0.302602
vt 0.144853 0.228174
vt 0.289705 0.455440
vt 0.362131 0.430395
vt 0.000000 0.302604
vt 0.000000 0.228174
vt 0.724262 0.228174
vt 0.724262 0.302604
vt 0.579409 0.302602
vt 0.579409 0.228173
vt 0.434556 0.302602
vt 0.434556 0.228174
vt 0.325918 0.584572
vt 0.144853 0.455440
vt 0.217279 0.430395
vt 0.181065 0.584572
vt 0.000000 0.455441
vt 0.072426 0.430395
vt 0.036213 0.584572
vt 0.579409 0.455440
vt 0.651836 0.430395
vt 0.615622 0.584572
vt 0.434556 0.455440
vt 0.506983 0.430394
vt 0.470770 0.584572
vt 0.253492 0.584572
vt 0.108639 0.584572
vt 0.724262 0.455441
vt 0.760474 0.584572
vt 0.688049 0.584572
vt 0.543196 0.584572
vt 0.398343 0.584572
vt 0.033072 0.896143
vt 0.072396 0.884511
vt 0.111719 0.896164
vt 0.072359 0.936130
vt 0.618812 0.897573
vt 0.657742 0.883879
vt 0.696895 0.893530
vt 0.664964 0.934857
vt 0.465964 0.902055
vt 0.507521 0.890502
vt 0.549089 0.901679
vt 0.508273 0.945427
vt 0.323087 0.895401
vt 0.362131 0.883726
vt 0.401175 0.895401
vt 0.362131 0.934911
vt 0.289705 0.192561
vt 0.127621 0.147092
vt 0.434556 0.192561
vt 0.362131 0.713702
vt 0.217278 0.713703
vt 0.072425 0.713703
vt 0.651836 0.713703
vt 0.506984 0.713703
vt 0.289705 0.738748
vt 0.144852 0.738748
vt 0.724262 0.738748
vt 0.000000 0.738748
vt 0.579410 0.738748
vt 0.434557 0.738748
vt 0.137239 0.950981
vt 0.208861 1.000000
vt 0.048762 0.994923
vt 0.272599 0.842762
vt 0.305365 0.839590
vt 0.730211 0.948544
vt 0.773024 0.994923
vt 0.647679 0.987870
vt 0.129366 0.840006
vt 0.157472 0.839915
vt 0.592982 0.957496
vt 0.517488 0.989927
vt 0.711305 0.838051
vt 0.739721 0.839989
vt 0.429440 0.955305
vt 0.386423 0.992018
vt 0.565625 0.842943
vt 0.597694 0.841390
vt 0.286737 0.955311
vt 0.205618 0.939811
vt 0.418896 0.839590
vt 0.448807 0.843243
vt 0.144853 0.192561
vt 0.000000 0.192562
vt 0.724262 0.192562
vt 0.579409 0.192561
vt 0.005949 0.948544
vt 0.767451 0.404977
vt 0.872589 0.209706
vt 0.985565 0.404823
vt 0.853830 0.682518
vt 0.903146 0.685113
vt 0.896929 0.770357
vt 0.850527 0.762064
vt 0.890812 0.826286
vt 0.860909 0.811163
vt 0.954056 0.688302
vt 0.950898 0.776662
vt 1.000000 0.689191
vt 0.999543 0.774642
vt 0.755093 0.687754
vt 0.800762 0.682518
vt 0.806209 0.759291
vt 0.764716 0.771747
vt 0.889296 0.850213
vt 0.865584 0.843783
vt 0.928044 0.828413
vt 0.968027 0.830186
vt 0.820614 0.807692
vt 0.786350 0.832977
vt 0.876499 0.886345
vt 0.897919 0.899823
vt 0.888199 0.920805
vt 0.863675 0.920805
vt 0.858739 0.899072
vt 0.914231 0.854536
vt 0.937825 0.860954
vt 0.838067 0.846931
vt 0.819828 0.862512
vt 0.171934 0.896808
vt 0.212212 0.887025
vt 0.252331 0.900314
vt 0.214902 0.823441
vt 0.072412 0.821993
vt 0.654646 0.821682
vt 0.507231 0.825364
vt 0.362131 0.821550
vt 0.757334 0.896143
vt 0.015459 0.839989
vt 0.796621 0.936130
vt 0.851883 0.147092
vt 0.892905 0.647492
s 1
f 45/1 13/2 12/3 42/4
f 2/5 13/2 15/6
f 42/4 12/3 17/7 43/8
f 43/9 17/10 19/11 44/12
f 44/12 19/11 16/13 46/14
f 2/5 15/6 22/15
f 3/16 14/17 24/18
f 4/19 18/20 26/21
f 5/22 20/23 28/24
f 6/25 21/26 30/27
f 2/5 22/15 25/28
f 3/16 24/18 27/29
f 4/30 26/31 29/32
f 5/22 28/24 31/33
f 6/25 30/27 23/34
f 101/35 92/36 98/37 39/38
f 103/39 93/40 100/41 40/42
f 105/43 94/44 102/45 41/46
f 97/47 95/48 104/49 38/50
f 12/3 14/17 3/16
f 12/3 13/2 14/17
f 13/2 2/5 14/17
f 15/6 16/13 6/25
f 15/6 13/2 16/13
f 109/51 1/52 110/53
f 17/7 18/20 4/19
f 17/7 12/3 18/20
f 12/3 3/16 18/20
f 19/11 20/23 5/22
f 19/11 17/10 20/23
f 17/10 4/30 20/23
f 16/13 21/26 6/25
f 16/13 19/11 21/26
f 19/11 5/22 21/26
f 22/15 23/34 11/54
f 22/15 15/6 23/34
f 15/6 6/25 23/34
f 24/18 25/28 7/55
f 24/18 14/17 25/28
f 14/17 2/5 25/28
f 26/21 27/29 8/56
f 26/21 18/20 27/29
f 18/20 3/16 27/29
f 28/24 29/32 9/57
f 28/24 20/23 29/32
f 20/23 4/30 29/32
f 30/27 31/33 10/58
f 30/27 21/26 31/33
f 21/26 5/22 31/33
f 25/28 32/59 7/55
f 25/28 22/15 32/59
f 22/15 11/54 32/59
f 27/29 33/60 8/56
f 27/29 24/18 33/60
f 24/18 7/55 33/60
f 29/32 34/61 9/57
f 29/32 26/31 34/61
f 26/21 8/56 34/62
f 31/33 35/63 10/58
f 31/33 28/24 35/63
f 28/24 9/57 35/63
f 23/34 36/64 11/54
f 23/34 30/27 36/64
f 30/27 10/58 36/64
f 53/65 48/66 49/67 39/38
f 81/68 32/59 82/69
f 54/70 49/71 50/72 40/42
f 83/73 33/60 84/74
f 55/75 50/72 51/76 41/46
f 85/77 34/61 86/78
f 56/79 41/46 51/76 47/80
f 87/81 35/63 88/82
f 52/83 47/80 48/66 37/84
f 89/85 36/64 90/86
f 109/51 45/1 42/4 106/87
f 106/87 42/4 43/8 107/88
f 107/89 43/9 44/12 108/90
f 108/90 44/12 46/14 110/53
f 13/2 45/1 46/14 16/13
f 53/65 37/84 48/66
f 54/91 39/38 49/67
f 55/75 40/42 50/72
f 72/92 73/93 74/94
f 47/95 51/96 61/97 57/98
f 57/98 61/97 66/99 62/100
f 51/96 50/101 60/102 61/97
f 50/101 49/103 59/104 60/102
f 49/105 48/106 58/107 59/108
f 48/106 47/95 57/98 58/107
f 62/100 66/99 71/109 67/110
f 61/97 60/102 65/111 66/99
f 60/102 59/104 64/112 65/111
f 59/108 58/107 63/113 64/114
f 58/107 57/98 62/100 63/113
f 68/115 67/116 71/117 70/118 69/119
f 66/99 65/111 70/120 71/109
f 65/111 64/112 69/121 70/120
f 64/114 63/113 68/122 69/123
f 63/113 62/100 67/110 68/122
f 99/124 91/125 96/126 37/84
f 7/55 32/59 81/68 76/127
f 8/56 33/60 83/73 77/128
f 9/57 34/61 85/77 78/129
f 10/58 35/63 87/81 79/130
f 11/54 36/64 89/85 80/131
f 96/126 81/68 82/69 97/47
f 32/59 11/54 80/131 82/69
f 98/37 83/73 84/74 99/124
f 33/60 7/55 76/127 84/74
f 100/41 85/77 86/78 101/132
f 34/62 8/56 77/128 86/133
f 102/45 87/81 88/82 103/39
f 35/63 9/57 78/129 88/82
f 104/49 89/85 90/86 105/43
f 36/64 10/58 79/130 90/86
f 76/127 81/68 96/126 91/125
f 77/128 83/73 98/37 92/36
f 78/129 85/77 100/41 93/40
f 79/130 87/81 102/45 94/44
f 80/131 89/85 104/49 95/48
f 82/69 80/131 95/48 97/47
f 84/74 76/127 91/125 99/124
f 86/133 77/128 92/36 101/35
f 88/82 78/129 93/40 103/39
f 90/86 79/130 94/44 105/43
f 37/84 96/126 97/47 38/50 52/83
f 39/38 98/37 99/124 37/84 53/65
f 40/42 100/41 101/132 39/134 54/70
f 41/46 102/45 103/39 40/42 55/75
f 38/50 104/49 105/43 41/46 56/79
f 45/1 109/51 110/53 46/14
f 1/52 109/51 106/87
f 1/52 106/87 107/88
f 1/135 107/89 108/90
f 1/135 108/90 110/53
f 52/83 38/50 56/79 47/80
f 75/136 72/92 74/94
f 111/92 113/94 112/93
f 114/136 113/94 111/92

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ function default.player_register_model(name, def)
end
-- Default player appearance
default.player_register_model("character.x", {
default.player_register_model("character.b3d", {
animation_speed = 30,
textures = {"character.png", },
animations = {
@ -93,7 +93,7 @@ end
-- Update appearance when the player joins
minetest.register_on_joinplayer(function(player)
default.player_attached[player:get_player_name()] = false
default.player_set_model(player, "character.x")
default.player_set_model(player, "character.b3d")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 574 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,7 +1,9 @@
--
-- Grow trees
-- Grow trees from saplings
--
-- 'Can grow' function
local random = math.random
local function can_grow(pos)
@ -17,10 +19,12 @@ local function can_grow(pos)
return true
end
-- Sapling ABMs
-- Sapling ABM
minetest.register_abm({
nodenames = {"default:sapling"},
nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
@ -28,76 +32,52 @@ minetest.register_abm({
return
end
minetest.log("action", "A sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_tree(pos, random(1, 4) == 1)
else
default.grow_new_apple_tree(pos)
local mapgen = minetest.get_mapgen_params().mgname
if node.name == "default:sapling" then
minetest.log("action", "A sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_tree(pos, random(1, 4) == 1)
else
default.grow_new_apple_tree(pos)
end
elseif node.name == "default:junglesapling" then
minetest.log("action", "A jungle sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_jungle_tree(pos)
else
default.grow_new_jungle_tree(pos)
end
elseif node.name == "default:pine_sapling" then
minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_pine_tree(pos)
else
default.grow_new_pine_tree(pos)
end
elseif node.name == "default:acacia_sapling" then
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos)
end
end
})
minetest.register_abm({
nodenames = {"default:junglesapling"},
interval = 11,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "A jungle sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_jungle_tree(pos)
else
default.grow_new_jungle_tree(pos)
end
end
})
--
-- Tree generation
--
minetest.register_abm({
nodenames = {"default:pine_sapling"},
interval = 12,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_pine_tree(pos)
else
default.grow_new_pine_tree(pos)
end
end
})
minetest.register_abm({
nodenames = {"default:acacia_sapling"},
interval = 13,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos)
end
})
-- Default, jungletree function
-- Apple tree and jungle tree trunk and leaves function
local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
height, size, iters)
height, size, iters, is_apple_tree)
local x, y, z = pos.x, pos.y, pos.z
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_apple = minetest.get_content_id("default:apple")
-- Trunk
data[a:index(x, y, z)] = tree_cid -- Force-place lowest trunk node to replace sapling
@ -115,7 +95,11 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
local vi = a:index(x - 1, y + height + y_dist, z + z_dist)
for x_dist = -1, 1 do
if data[vi] == c_air or data[vi] == c_ignore then
data[vi] = leaves_cid
if is_apple_tree and random(1, 8) == 1 then
data[vi] = c_apple
else
data[vi] = leaves_cid
end
end
vi = vi + 1
end
@ -133,7 +117,11 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
for zi = 0, 1 do
local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi)
if data[vi] == c_air or data[vi] == c_ignore then
data[vi] = leaves_cid
if is_apple_tree and random(1, 8) == 1 then
data[vi] = c_apple
else
data[vi] = leaves_cid
end
end
end
end
@ -141,9 +129,10 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
end
end
-- Default tree
function default.grow_tree(pos, is_apple_tree, bad) -- is_apple_tree is ignored now.
-- Apple tree
function default.grow_tree(pos, is_apple_tree, bad)
--[[
NOTE: Tree-placing code is currently duplicated in the engine
and in games that have saplings; both are deprecated but not
@ -166,14 +155,15 @@ function default.grow_tree(pos, is_apple_tree, bad) -- is_apple_tree is ignored
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8)
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end
-- Jungletree
-- Jungle tree
function default.grow_jungle_tree(pos, bad)
--[[
@ -224,7 +214,8 @@ function default.grow_jungle_tree(pos, bad)
vm:update_map()
end
-- Pinetree from mg mapgen mod, design by sfan5, pointy top added by paramat
-- Pine tree from mg mapgen mod, design by sfan5, pointy top added by paramat
local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles)
local node_id = data[vi]
@ -246,7 +237,7 @@ function default.grow_pine_tree(pos)
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_pinetree = minetest.get_content_id("default:pinetree")
local c_pine_tree = minetest.get_content_id("default:pine_tree")
local c_pine_needles = minetest.get_content_id("default:pine_needles")
local c_snow = minetest.get_content_id("default:snow")
local c_snowblock = minetest.get_content_id("default:snowblock")
@ -350,12 +341,13 @@ function default.grow_pine_tree(pos)
end
-- Trunk
data[a:index(x, y, z)] = c_pinetree -- Force-place lowest trunk node to replace sapling
data[a:index(x, y, z)] = c_pine_tree -- Force-place lowest trunk node to replace sapling
for yy = y + 1, maxy do
local vi = a:index(x, yy, z)
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore or node_id == c_pine_needles then
data[vi] = c_pinetree
if node_id == c_air or node_id == c_ignore or
node_id == c_pine_needles or node_id == c_snow then
data[vi] = c_pine_tree
end
end
@ -364,7 +356,8 @@ function default.grow_pine_tree(pos)
vm:update_map()
end
-- New tree
-- New apple tree
function default.grow_new_apple_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/apple_tree.mts"
@ -372,6 +365,7 @@ function default.grow_new_apple_tree(pos)
path, 0, nil, false)
end
-- New jungle tree
function default.grow_new_jungle_tree(pos)
@ -380,6 +374,7 @@ function default.grow_new_jungle_tree(pos)
path, 0, nil, false)
end
-- New pine tree
function default.grow_new_pine_tree(pos)
@ -388,6 +383,7 @@ function default.grow_new_pine_tree(pos)
path, 0, nil, false)
end
-- New acacia tree
function default.grow_new_acacia_tree(pos)

View File

@ -129,7 +129,7 @@ function doors.register_door(name, def)
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir
if not minetest.get_node(pos).name == check_name then
if minetest.get_node(pos).name ~= check_name then
return
end
local p2 = minetest.get_node(pos).param2

View File

@ -1,17 +1,23 @@
-- minetest/fire/init.lua
-- Global namespace for functions
fire = {}
-- Register flame node
minetest.register_node("fire:basic_flame", {
description = "Fire",
drawtype = "firelike",
tiles = {{
name="fire_basic_flame_animated.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
name = "fire_basic_flame_animated.png",
animation = {type = "vertical_frames",
aspect_w = 16, aspect_h = 16, length = 1},
}},
inventory_image = "fire_basic_flame.png",
light_source = 14,
groups = {igniter=2,dig_immediate=3},
groups = {igniter = 2, dig_immediate = 3},
drop = '',
walkable = false,
buildable_to = true,
@ -29,44 +35,55 @@ minetest.register_node("fire:basic_flame", {
on_blast = function() end,
})
fire.D = 6
-- Fire sounds table
-- key: position hash of low corner of area
-- value: {handle=sound handle, name=sound name}
fire.sounds = {}
-- Get sound area of position
-- size of sound areas
fire.D = 6
function fire.get_area_p0p1(pos)
local p0 = {
x=math.floor(pos.x/fire.D)*fire.D,
y=math.floor(pos.y/fire.D)*fire.D,
z=math.floor(pos.z/fire.D)*fire.D,
x = math.floor(pos.x / fire.D) * fire.D,
y = math.floor(pos.y / fire.D) * fire.D,
z = math.floor(pos.z / fire.D) * fire.D,
}
local p1 = {
x=p0.x+fire.D-1,
y=p0.y+fire.D-1,
z=p0.z+fire.D-1
x = p0.x + fire.D - 1,
y = p0.y + fire.D - 1,
z = p0.z + fire.D - 1
}
return p0, p1
end
-- Update fire sounds in sound area of position
function fire.update_sounds_around(pos)
local p0, p1 = fire.get_area_p0p1(pos)
local cp = {x=(p0.x+p1.x)/2, y=(p0.y+p1.y)/2, z=(p0.z+p1.z)/2}
local cp = {x = (p0.x + p1.x) / 2, y = (p0.y + p1.y) / 2, z = (p0.z + p1.z) / 2}
local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"})
--print("number of flames at "..minetest.pos_to_string(p0).."/"
-- ..minetest.pos_to_string(p1)..": "..#flames_p)
local should_have_sound = (#flames_p > 0)
local wanted_sound = nil
if #flames_p >= 9 then
wanted_sound = {name="fire_large", gain=1.5}
wanted_sound = {name = "fire_large", gain = 1.5}
elseif #flames_p > 0 then
wanted_sound = {name="fire_small", gain=1.5}
wanted_sound = {name = "fire_small", gain = 1.5}
end
local p0_hash = minetest.hash_node_position(p0)
local sound = fire.sounds[p0_hash]
if not sound then
if should_have_sound then
fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
handle = minetest.sound_play(wanted_sound,
{pos = cp, max_hear_distance = 16, loop = true}),
name = wanted_sound.name,
}
end
@ -77,40 +94,53 @@ function fire.update_sounds_around(pos)
elseif sound.name ~= wanted_sound.name then
minetest.sound_stop(sound.handle)
fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
handle = minetest.sound_play(wanted_sound,
{pos = cp, max_hear_distance = 16, loop = true}),
name = wanted_sound.name,
}
end
end
end
-- Update fire sounds on flame node construct or destruct
function fire.on_flame_add_at(pos)
fire.update_sounds_around(pos)
end
function fire.on_flame_remove_at(pos)
fire.update_sounds_around(pos)
end
-- Return positions for flames around a burning node
function fire.find_pos_for_flame_around(pos)
return minetest.find_node_near(pos, 1, {"air"})
end
-- Detect nearby extinguishing nodes
function fire.flame_should_extinguish(pos)
if minetest.setting_getbool("disable_fire") then return true end
--return minetest.find_node_near(pos, 1, {"group:puts_out_fire"})
local p0 = {x=pos.x-2, y=pos.y, z=pos.z-2}
local p1 = {x=pos.x+2, y=pos.y, z=pos.z+2}
local p0 = {x = pos.x - 1, y = pos.y, z = pos.z - 1}
local p1 = {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}
local ps = minetest.find_nodes_in_area(p0, p1, {"group:puts_out_fire"})
return (#ps ~= 0)
end
-- Ignite neighboring nodes
minetest.register_abm({
nodenames = {"group:flammable"},
neighbors = {"group:igniter"},
interval = 5,
chance = 2,
interval = 7,
chance = 32,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, don't ignite
if fire.flame_should_extinguish(p0) then
@ -118,12 +148,17 @@ minetest.register_abm({
end
local p = fire.find_pos_for_flame_around(p0)
if p then
minetest.set_node(p, {name="fire:basic_flame"})
minetest.set_node(p, {name = "fire:basic_flame"})
end
end,
})
-- Rarely ignite things from far
--[[ Currently disabled to reduce the chance of uncontrollable spreading
fires that disrupt servers. Also for less lua processing load.
minetest.register_abm({
nodenames = {"group:igniter"},
neighbors = {"air"},
@ -143,17 +178,20 @@ minetest.register_abm({
end
local p2 = fire.find_pos_for_flame_around(p)
if p2 then
minetest.set_node(p2, {name="fire:basic_flame"})
minetest.set_node(p2, {name = "fire:basic_flame"})
end
end
end,
})
--]]
-- Remove flammable nodes and flame
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 3,
chance = 2,
interval = 5,
chance = 16,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, remove flame
if fire.flame_should_extinguish(p0) then
@ -161,7 +199,7 @@ minetest.register_abm({
return
end
-- Make the following things rarer
if math.random(1,3) == 1 then
if math.random(1, 3) == 1 then
return
end
-- If there are no flammable nodes around flame, remove flame
@ -169,7 +207,7 @@ minetest.register_abm({
minetest.remove_node(p0)
return
end
if math.random(1,4) == 1 then
if math.random(1, 4) == 1 then
-- remove a flammable node around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then

View File

@ -17,3 +17,6 @@ WTFPL
Gambit (WTFPL):
flowers_mushroom_*.png
DanDuncombe (WTFPL):
flowers_spores_*.png

View File

@ -1,21 +1,33 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- Namespace for functions
flowers = {}
-- Map Generation
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
dofile(minetest.get_modpath("flowers") .. "/mapgen.lua")
--
-- Flowers
--
-- Aliases for original flowers mod
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
minetest.register_alias("flowers:flower_rose", "flowers:rose")
minetest.register_alias("flowers:flower_tulip", "flowers:tulip")
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
minetest.register_alias("flowers:flower_viola", "flowers:viola")
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
-- Flower registration
-- Flower registration function
local function add_simple_flower(name, desc, box, f_groups)
-- Common flowers' groups
f_groups.snappy = 3
@ -24,10 +36,10 @@ local function add_simple_flower(name, desc, box, f_groups)
f_groups.flora = 1
f_groups.attached_node = 1
minetest.register_node("flowers:"..name.."", {
minetest.register_node("flowers:" .. name, {
description = desc,
drawtype = "plantlike",
tiles = { "flowers_" .. name .. ".png" },
tiles = {"flowers_" .. name .. ".png"},
inventory_image = "flowers_" .. name .. ".png",
wield_image = "flowers_" .. name .. ".png",
sunlight_propagates = true,
@ -43,46 +55,21 @@ local function add_simple_flower(name, desc, box, f_groups)
})
end
-- Registrations using the function above
flowers.datas = {
{"dandelion_yellow", "Yellow Dandelion", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_yellow=1}},
{"geranium", "Blue Geranium", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_blue=1}},
{"rose", "Rose", { -0.15, -0.5, -0.15, 0.15, 0.3, 0.15 }, {color_red=1}},
{"tulip", "Orange Tulip", { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, {color_orange=1}},
{"dandelion_white", "White dandelion", { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, {color_white=1}},
{"viola", "Viola", { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, {color_violet=1}}
{"rose", "Rose", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_red = 1}},
{"tulip", "Orange Tulip", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_orange = 1}},
{"dandelion_yellow", "Yellow Dandelion", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_yellow = 1}},
{"geranium", "Blue Geranium", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_blue = 1}},
{"viola", "Viola", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_violet = 1}},
{"dandelion_white", "White dandelion", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_white = 1}}
}
for _,item in pairs(flowers.datas) do
add_simple_flower(unpack(item))
end
local mushrooms_datas = {
{"brown", 2}, {"red", -6}
}
for _, m in pairs(mushrooms_datas) do
local name, nut = m[1], m[2]
minetest.register_node("flowers:mushroom_"..name, {
description = string.sub(string.upper(name), 0, 1)..
string.sub(name, 2).." Mushroom",
tiles = {"flowers_mushroom_"..name..".png"},
inventory_image = "flowers_mushroom_"..name..".png",
wield_image = "flowers_mushroom_"..name..".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=3,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
end
-- Flower spread
minetest.register_abm({
nodenames = {"group:flora"},
@ -94,27 +81,27 @@ minetest.register_abm({
local under = minetest.get_node(pos)
pos.y = pos.y + 1
if under.name == "default:desert_sand" then
minetest.set_node(pos, {name="default:dry_shrub"})
minetest.set_node(pos, {name = "default:dry_shrub"})
elseif under.name ~= "default:dirt_with_grass" then
return
end
local light = minetest.get_node_light(pos)
if not light or light < 13 then
return
end
local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
local pos0 = {x = pos.x - 4, y = pos.y - 4, z = pos.z - 4}
local pos1 = {x = pos.x + 4, y = pos.y + 4, z = pos.z + 4}
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
return
end
local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
if #flowers > 3 then
return
end
local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
if #seedling > 0 then
seedling = seedling[math.random(#seedling)]
@ -124,8 +111,127 @@ minetest.register_abm({
return
end
if minetest.get_node(seedling).name == "air" then
minetest.set_node(seedling, {name=node.name})
minetest.set_node(seedling, {name = node.name})
end
end
end,
})
--
-- Mushrooms
--
local mushrooms_datas = {
{"brown", 2},
{"red", -6}
}
for _, m in pairs(mushrooms_datas) do
local name, nut = m[1], m[2]
-- Register fertile mushrooms
-- These are placed by mapgen and the growing ABM.
-- These drop an infertile mushroom, and 0 to 3 spore
-- nodes with an average of 1.25 per mushroom, for
-- a slow multiplication of mushrooms when farming.
minetest.register_node("flowers:mushroom_fertile_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Fertile Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1,
not_in_creative_inventory = 1},
drop = {
items = {
{items = {"flowers:mushroom_" .. name}},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 4},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2}
}
},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register infertile mushrooms
-- These do not drop spores, to avoid the use of repeated digging
-- and placing of a single mushroom to generate unlimited spores.
minetest.register_node("flowers:mushroom_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register mushroom spores
minetest.register_node("flowers:mushroom_spores_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom Spores",
drawtype = "signlike",
tiles = {"flowers_mushroom_spores_" .. name .. ".png"},
inventory_image = "flowers_mushroom_spores_" .. name .. ".png",
wield_image = "flowers_mushroom_spores_" .. name .. ".png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
selection_box = {
type = "wallmounted",
},
groups = {dig_immediate = 3, attached_node = 1},
})
end
-- Register growing ABM
minetest.register_abm({
nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"},
interval = 11,
chance = 50,
action = function(pos, node)
local node_under = minetest.get_node_or_nil({x = pos.x,
y = pos.y - 1, z = pos.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then
if node.name == "flowers:mushroom_spores_brown" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_brown"})
elseif node.name == "flowers:mushroom_spores_red" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"})
end
end
end
})

View File

@ -1,4 +1,8 @@
local function register_flower(name)
--
-- Mgv6
--
local function register_mgv6_flower(name)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
@ -17,19 +21,112 @@ local function register_flower(name)
})
end
function flowers.register_mgv6_decorations()
register_flower("rose")
register_flower("tulip")
register_flower("dandelion_yellow")
register_flower("geranium")
register_flower("viola")
register_flower("dandelion_white")
local function register_mgv6_mushroom(name)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.04,
spread = {x=100, y=100, z=100},
seed = 7133,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = 30,
decoration = "flowers:"..name,
spawn_by = "default:tree",
num_spawn_by = 1,
})
end
-- Enable in mapgen v6 only
function flowers.register_mgv6_decorations()
register_mgv6_flower("rose")
register_mgv6_flower("tulip")
register_mgv6_flower("dandelion_yellow")
register_mgv6_flower("geranium")
register_mgv6_flower("viola")
register_mgv6_flower("dandelion_white")
register_mgv6_mushroom("mushroom_fertile_brown")
register_mgv6_mushroom("mushroom_fertile_red")
end
--
-- All other biome API mapgens
--
local function register_flower(seed, name)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = -0.02,
scale = 0.03,
spread = {x=200, y=200, z=200},
seed = seed,
octaves = 3,
persist = 0.6
},
biomes = {
"stone_grassland",
"sandstone_grassland",
"deciduous_forest",
"coniferous_forest",
},
y_min = 6,
y_max = 31000,
decoration = "flowers:"..name,
})
end
local function register_mushroom(name)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=200, y=200, z=200},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest", "coniferous_forest"},
y_min = 6,
y_max = 31000,
decoration = "flowers:"..name,
})
end
function flowers.register_decorations()
register_flower(436, "rose")
register_flower(19822, "tulip")
register_flower(1220999, "dandelion_yellow")
register_flower(36662, "geranium")
register_flower(1133, "viola")
register_flower(73133, "dandelion_white")
register_mushroom("mushroom_fertile_brown")
register_mushroom("mushroom_fertile_red")
end
--
-- Detect mapgen to select functions
--
-- Mods using singlenode mapgen can call these functions to enable
-- the use of minetest.generate_ores or minetest.generate_decorations
local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then
flowers.register_mgv6_decorations()
elseif mg_params.mgname ~= "singlenode" then
flowers.register_decorations()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

View File

@ -1 +1,2 @@
default
farming

View File

@ -1,9 +1,26 @@
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.
-- Global namespace for functions
stairs = {}
-- Register aliases for new pine node names
minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
-- Get setting for replace ABM
local replace = minetest.setting_getbool("enable_stairs_replace_abm")
-- Register stairs.
-- Node will be called stairs:stair_<subname>
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
minetest.register_node(":stairs:stair_" .. subname, {
description = description,
@ -48,7 +65,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
param2 = minetest.dir_to_facedir(dir)
end
if p0.y-1 == p1.y then
if p0.y - 1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
@ -62,10 +79,12 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
-- for replace ABM
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
replace_name = "stairs:stair_" .. subname,
groups = {slabs_replace=1},
})
if replace then
minetest.register_node(":stairs:stair_" .. subname .. "upside_down", {
replace_name = "stairs:stair_" .. subname,
groups = {slabs_replace = 1},
})
end
minetest.register_craft({
output = 'stairs:stair_' .. subname .. ' 6',
@ -87,7 +106,10 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
end
-- Register slabs.
-- Node will be called stairs:slab_<subname>
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
minetest.register_node(":stairs:slab_" .. subname, {
description = description,
@ -120,7 +142,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and
n0.param2 >= 20)
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and
p0.y + 1 == p1.y then
slabpos = p0
slabnode = n0
elseif n1.name == "stairs:slab_" .. subname then
@ -136,7 +159,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
pointed_thing.above = slabpos
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
fakestack, success = minetest.item_place(fakestack, placer,
pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
@ -148,7 +172,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- Upside down slabs
if p0.y-1 == p1.y then
if p0.y - 1 == p1.y then
-- Turn into full block if pointing at a existing slab
if n0_is_upside_down then
-- Remove the slab at the position of the slab
@ -159,7 +183,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
pointed_thing.above = p0
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
fakestack, success = minetest.item_place(fakestack, placer,
pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
@ -175,7 +200,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- If pointing at the side of a upside down slab
if n0_is_upside_down and p0.y+1 ~= p1.y then
if n0_is_upside_down and p0.y + 1 ~= p1.y then
param2 = 20
end
@ -184,10 +209,12 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
})
-- for replace ABM
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
replace_name = "stairs:slab_"..subname,
groups = {slabs_replace=1},
})
if replace then
minetest.register_node(":stairs:slab_" .. subname .. "upside_down", {
replace_name = "stairs:slab_".. subname,
groups = {slabs_replace = 1},
})
end
minetest.register_craft({
output = 'stairs:slab_' .. subname .. ' 6',
@ -197,123 +224,177 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
})
end
-- Replace old "upside_down" nodes with new param2 versions
minetest.register_abm({
nodenames = {"group:slabs_replace"},
interval = 1,
chance = 1,
action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name
node.param2 = node.param2 + 20
if node.param2 == 21 then
node.param2 = 23
elseif node.param2 == 23 then
node.param2 = 21
end
minetest.set_node(pos, node)
end,
})
-- Optionally replace old "upside_down" nodes with new param2 versions.
-- Disabled by default.
if replace then
minetest.register_abm({
nodenames = {"group:slabs_replace"},
interval = 8,
chance = 1,
action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name
node.param2 = node.param2 + 20
if node.param2 == 21 then
node.param2 = 23
elseif node.param2 == 23 then
node.param2 = 21
end
minetest.set_node(pos, node)
end,
})
end
-- Stair/slab registration function.
-- Nodes will be called stairs:{stair,slab}_<subname>
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
function stairs.register_stair_and_slab(subname, recipeitem, groups, images,
desc_stair, desc_slab, sounds)
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
end
-- Register default stairs and slabs
stairs.register_stair_and_slab("wood", "default:wood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_wood.png"},
"Wooden Stair",
"Wooden Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("junglewood", "default:junglewood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_junglewood.png"},
"Junglewood Stair",
"Junglewood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("pine_wood", "default:pine_wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_pine_wood.png"},
"Pine Wood Stair",
"Pine Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_acacia_wood.png"},
"Acacia Wood Stair",
"Acacia Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("stone", "default:stone",
{cracky=3},
{cracky = 3},
{"default_stone.png"},
"Stone Stair",
"Stone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("cobble", "default:cobble",
{cracky=3},
{cracky = 3},
{"default_cobble.png"},
"Cobblestone Stair",
"Cobblestone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("stonebrick", "default:stonebrick",
{cracky = 3},
{"default_stone_brick.png"},
"Stone Brick Stair",
"Stone Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("desert_stone", "default:desert_stone",
{cracky=3},
{cracky = 3},
{"default_desert_stone.png"},
"Desertstone Stair",
"Desertstone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("desert_cobble", "default:desert_cobble",
{cracky=3},
{cracky = 3},
{"default_desert_cobble.png"},
"Desert Cobblestone Stair",
"Desert Cobblestone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("desert_stonebrick", "default:desert_stonebrick",
{cracky=3},
{cracky = 3},
{"default_desert_stone_brick.png"},
"Desert Stone Brick Stair",
"Desert Stone Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("brick", "default:brick",
{cracky=3},
{"default_brick.png"},
"Brick Stair",
"Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstone", "default:sandstone",
{crumbly=2,cracky=2},
{crumbly = 2, cracky = 2},
{"default_sandstone.png"},
"Sandstone Stair",
"Sandstone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
{crumbly=2,cracky=2},
{crumbly = 2, cracky = 2},
{"default_sandstone_brick.png"},
"Sandstone Brick Stair",
"Sandstone Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("junglewood", "default:junglewood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_junglewood.png"},
"Junglewood Stair",
"Junglewood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("stonebrick", "default:stonebrick",
{cracky=3},
{"default_stone_brick.png"},
"Stone Brick Stair",
"Stone Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("pinewood", "default:pinewood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_pinewood.png"},
"Pinewood Stair",
"Pinewood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("obsidian", "default:obsidian",
{cracky=1,level=2},
{cracky = 1, level = 2},
{"default_obsidian.png"},
"Obsidian Stair",
"Obsidian Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("obsidianbrick", "default:obsidianbrick",
{cracky=1,level=2},
{cracky = 1, level = 2},
{"default_obsidian_brick.png"},
"Obsidian Brick Stair",
"Obsidian Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("brick", "default:brick",
{cracky = 3},
{"default_brick.png"},
"Brick Stair",
"Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
default.node_sound_leaves_defaults())
stairs.register_stair_and_slab("steelblock", "default:steelblock",
{cracky = 1, level = 2},
{"default_steel_block.png"},
"Steel Block Stair",
"Steel Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("copperblock", "default:copperblock",
{cracky = 1, level = 2},
{"default_copper_block.png"},
"Copper Block Stair",
"Copper Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("bronzeblock", "default:bronzeblock",
{cracky = 1, level = 2},
{"default_bronze_block.png"},
"Bronze Block Stair",
"Bronze Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("goldblock", "default:goldblock",
{cracky = 1},
{"default_gold_block.png"},
"Gold Block Stair",
"Gold Block Slab",
default.node_sound_stone_defaults())

36
mods/tnt/README.txt Normal file
View File

@ -0,0 +1,36 @@
=== TNT mod for Minetest ===
by PilzAdam and ShadowNinja
Introduction:
This mod adds TNT to Minetest. TNT is a tool to help the player
in mining.
How to use the mod:
Craft gunpowder by placing coal and gravel in the crafting area. The
gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT
surround gunpowder with 4 wood in a + shape.
There are different ways to blow up TNT:
1. Hit it with a torch.
2. Hit a gunpowder fuze that leads to a TNT block with a torch.
3. Activate it with mesecons (fastest way)
Be aware of the damage radius of 7 blocks!
License:
WTFPL (see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

3
mods/tnt/depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
fire

390
mods/tnt/init.lua Normal file
View File

@ -0,0 +1,390 @@
-- Default to enabled in singleplayer and disabled in multiplayer
local singleplayer = minetest.is_singleplayer()
local setting = minetest.setting_getbool("enable_tnt")
if (not singleplayer and setting ~= true) or
(singleplayer and setting == false) then
return
end
-- loss probabilities array (one in X will be lost)
local loss_prob = {}
loss_prob["default:cobble"] = 3
loss_prob["default:dirt"] = 4
local radius = tonumber(minetest.setting_get("tnt_radius") or 3)
-- Fill a list with data for content IDs, after all nodes are registered
local cid_data = {}
minetest.after(0, function()
for name, def in pairs(minetest.registered_nodes) do
cid_data[minetest.get_content_id(name)] = {
name = name,
drops = def.drops,
flammable = def.groups.flammable,
on_blast = def.on_blast,
}
end
end)
local function rand_pos(center, pos, radius)
pos.x = center.x + math.random(-radius, radius)
pos.z = center.z + math.random(-radius, radius)
end
local function eject_drops(drops, pos, radius)
local drop_pos = vector.new(pos)
for _, item in pairs(drops) do
local count = item:get_count()
local max = item:get_stack_max()
if count > max then
item:set_count(max)
end
while count > 0 do
if count < max then
item:set_count(count)
end
rand_pos(pos, drop_pos, radius)
local obj = minetest.add_item(drop_pos, item)
if obj then
obj:get_luaentity().collect = true
obj:setacceleration({x=0, y=-10, z=0})
obj:setvelocity({x=math.random(-3, 3), y=10,
z=math.random(-3, 3)})
end
count = count - max
end
end
end
local function add_drop(drops, item)
item = ItemStack(item)
local name = item:get_name()
if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then
return
end
local drop = drops[name]
if drop == nil then
drops[name] = item
else
drop:set_count(drop:get_count() + item:get_count())
end
end
local fire_node = {name="fire:basic_flame"}
local function destroy(drops, pos, cid)
if minetest.is_protected(pos, "") then
return
end
local def = cid_data[cid]
if def and def.on_blast then
def.on_blast(vector.new(pos), 1)
return
end
if def and def.flammable then
minetest.set_node(pos, fire_node)
else
minetest.remove_node(pos)
if def then
local node_drops = minetest.get_node_drops(def.name, "")
for _, item in ipairs(node_drops) do
add_drop(drops, item)
end
end
end
end
local function calc_velocity(pos1, pos2, old_vel, power)
local vel = vector.direction(pos1, pos2)
vel = vector.normalize(vel)
vel = vector.multiply(vel, power)
-- Divide by distance
local dist = vector.distance(pos1, pos2)
dist = math.max(dist, 1)
vel = vector.divide(vel, dist)
-- Add old velocity
vel = vector.add(vel, old_vel)
return vel
end
local function entity_physics(pos, radius)
-- Make the damage radius larger than the destruction radius
radius = radius * 2
local objs = minetest.get_objects_inside_radius(pos, radius)
for _, obj in pairs(objs) do
local obj_pos = obj:getpos()
local obj_vel = obj:getvelocity()
local dist = math.max(1, vector.distance(pos, obj_pos))
if obj_vel ~= nil then
obj:setvelocity(calc_velocity(pos, obj_pos,
obj_vel, radius * 10))
end
local damage = (4 / dist) * radius
obj:set_hp(obj:get_hp() - damage)
end
end
local function add_effects(pos, radius)
minetest.add_particlespawner({
amount = 128,
time = 1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-20, y=-20, z=-20},
maxvel = {x=20, y=20, z=20},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 1,
maxexptime = 3,
minsize = 8,
maxsize = 16,
texture = "tnt_smoke.png",
})
end
local function burn(pos)
local name = minetest.get_node(pos).name
if name == "tnt:tnt" then
minetest.sound_play("tnt_ignite", {pos=pos})
minetest.set_node(pos, {name="tnt:tnt_burning"})
minetest.get_node_timer(pos):start(1)
elseif name == "tnt:gunpowder" then
minetest.sound_play("tnt_gunpowder_burning", {pos=pos, gain=2})
minetest.set_node(pos, {name="tnt:gunpowder_burning"})
minetest.get_node_timer(pos):start(1)
end
end
local function explode(pos, radius)
local pos = vector.round(pos)
local vm = VoxelManip()
local pr = PseudoRandom(os.time())
local p1 = vector.subtract(pos, radius)
local p2 = vector.add(pos, radius)
local minp, maxp = vm:read_from_map(p1, p2)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
local drops = {}
local p = {}
local c_air = minetest.get_content_id("air")
for z = -radius, radius do
for y = -radius, radius do
local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z)
for x = -radius, radius do
if (x * x) + (y * y) + (z * z) <=
(radius * radius) + pr:next(-radius, radius) then
local cid = data[vi]
p.x = pos.x + x
p.y = pos.y + y
p.z = pos.z + z
if cid ~= c_air then
destroy(drops, p, cid)
end
end
vi = vi + 1
end
end
end
return drops
end
local function boom(pos)
minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64})
minetest.set_node(pos, {name="tnt:boom"})
minetest.get_node_timer(pos):start(0.5)
local drops = explode(pos, radius)
entity_physics(pos, radius)
eject_drops(drops, pos, radius)
add_effects(pos, radius)
end
minetest.register_node("tnt:tnt", {
description = "TNT",
tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"},
is_ground_content = false,
groups = {dig_immediate=2, mesecon=2},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.sound_play("tnt_ignite", {pos=pos})
minetest.set_node(pos, {name="tnt:tnt_burning"})
minetest.get_node_timer(pos):start(4)
end
end,
on_blast = function(pos, intensity)
burn(pos)
end,
mesecons = {effector = {action_on = boom}},
})
minetest.register_node("tnt:tnt_burning", {
tiles = {
{
name = "tnt_top_burning_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
}
},
"tnt_bottom.png", "tnt_side.png"},
light_source = 5,
drop = "",
sounds = default.node_sound_wood_defaults(),
on_timer = boom,
-- unaffected by explosions
on_blast = function() end,
})
minetest.register_node("tnt:boom", {
drawtype = "plantlike",
tiles = {"tnt_boom.png"},
light_source = default.LIGHT_MAX,
walkable = false,
drop = "",
groups = {dig_immediate=3},
on_timer = function(pos, elapsed)
minetest.remove_node(pos)
end,
-- unaffected by explosions
on_blast = function() end,
})
minetest.register_node("tnt:gunpowder", {
description = "Gun Powder",
drawtype = "raillike",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
tiles = {"tnt_gunpowder_straight.png", "tnt_gunpowder_curved.png", "tnt_gunpowder_t_junction.png", "tnt_gunpowder_crossing.png"},
inventory_image = "tnt_gunpowder_inventory.png",
wield_image = "tnt_gunpowder_inventory.png",
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
groups = {dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")},
sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
burn(pos)
end
end,
on_blast = function(pos, intensity)
burn(pos)
end,
})
minetest.register_node("tnt:gunpowder_burning", {
drawtype = "raillike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
light_source = 5,
tiles = {{
name = "tnt_gunpowder_burning_straight_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
}
},
{
name = "tnt_gunpowder_burning_curved_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
}
},
{
name = "tnt_gunpowder_burning_t_junction_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
}
},
{
name = "tnt_gunpowder_burning_crossing_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
}
}},
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
drop = "",
groups = {dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
for dx = -1, 1 do
for dz = -1, 1 do
for dy = -1, 1 do
if not (dx == 0 and dz == 0) then
burn({
x = pos.x + dx,
y = pos.y + dy,
z = pos.z + dz,
})
end
end
end
end
minetest.remove_node(pos)
end,
-- unaffected by explosions
on_blast = function() end,
})
minetest.register_abm({
nodenames = {"tnt:tnt", "tnt:gunpowder"},
neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"},
interval = 1,
chance = 1,
action = burn,
})
minetest.register_craft({
output = "tnt:gunpowder",
type = "shapeless",
recipe = {"default:coal_lump", "default:gravel"}
})
minetest.register_craft({
output = "tnt:tnt",
recipe = {
{"", "group:wood", ""},
{"group:wood", "tnt:gunpowder", "group:wood"},
{"", "group:wood", ""}
}
})
if minetest.setting_get("log_mods") then
minetest.debug("[TNT] Loaded!")
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B