Initial commit (imported game)

This commit is contained in:
Wuzzy 2020-03-30 22:41:58 +02:00
commit 1face3940a
1376 changed files with 58650 additions and 0 deletions

6
README.md Normal file
View File

@ -0,0 +1,6 @@
The RealTest Game
========
Realistic game for Minetest 0.4.5+
For developers: https://github.com/sda97ghb/realtest/issues/12

1
game.conf Normal file
View File

@ -0,0 +1 @@
name = The RealTest Game

BIN
menu/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

BIN
menu/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
menu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

4
mods/anvil/depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
metals
instruments
hatches

501
mods/anvil/init.lua Normal file
View File

@ -0,0 +1,501 @@
anvil = {}
realtest.registered_anvil_recipes = {}
function realtest.register_anvil_recipe(RecipeDef)
local recipe = {
type = RecipeDef.type or "forge",
item1 = RecipeDef.item1 or "",
item2 = RecipeDef.item2 or "",
rmitem1 = RecipeDef.rmitem1,
rmitem2 = RecipeDef.rmitem2,
output = RecipeDef.output or "",
level = RecipeDef.level or 0,
instrument = RecipeDef.instrument or "hammer",
material = RecipeDef.material, -- just to make the craft guide more manageable
}
if recipe.rmitem1 == nil then
recipe.rmitem1 = true
end
if recipe.rmitem2 == nil then
recipe.rmitem2 = true
end
if recipe.level < 0 then
recipe.level = 0
end
if recipe.output ~= "" and recipe.item1 ~= "" and (recipe.type == "forge" or recipe.type == "weld") then
table.insert(realtest.registered_anvil_recipes, recipe)
end
end
--Unshaped metals, buckets, double ingots, sheets, hammers, locks and hatches
for i, metal in ipairs(metals.list) do
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_unshaped",
output = "metals:"..metal.."_ingot",
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_sheet",
item2 = "scribing_table:plan_bucket",
rmitem2 = false,
output = "instruments:bucket_"..metal,
level = metals.levels[i],
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doubleingot",
output = "metals:"..metal.."_sheet",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doubleingot",
output = "metals:"..metal.."_ingot 2",
level = metals.levels[i] - 1,
instrument = "chisel",
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doublesheet",
output = "metals:"..metal.."_sheet 2",
level = metals.levels[i] - 1,
instrument = "chisel",
material = metal,
})
realtest.register_anvil_recipe({
type = "weld",
item1 = "metals:"..metal.."_ingot",
item2 = "metals:"..metal.."_ingot",
output = "metals:"..metal.."_doubleingot",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
type = "weld",
item1 = "metals:"..metal.."_sheet",
item2 = "metals:"..metal.."_sheet",
output = "metals:"..metal.."_doublesheet",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_ingot",
item2 = "scribing_table:plan_lock",
rmitem2 = false,
output = "metals:"..metal.."_lock",
level = metals.levels[i],
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_ingot",
item2 = "scribing_table:plan_hatch",
rmitem2 = false,
output = "hatches:"..metal.."_hatch_closed",
level = metals.levels[i],
material = metal,
})
end
-- general receipes (for flux production; used for welding)
realtest.register_anvil_recipe({
item1 = "minerals:borax",
output = "minerals:flux 8"
})
realtest.register_anvil_recipe({
item1 = "minerals:sylvite",
output = "minerals:flux 4"
})
-- receipe for coin production
realtest.register_anvil_recipe({
item1 = "metals:gold_sheet",
output = "money:coin 15",
level = metals.levels[i],
instrument = "chisel",
material = "gold",
})
--Pig iron --> Wrought iron
realtest.register_anvil_recipe({
item1 = "metals:pig_iron_ingot",
output = "metals:wrought_iron_ingot",
level = 2,
material = "wrought_iron",
})
--Instruments
local anvil_instruments =
{{"axe", "_ingot"},
{"pick", "_ingot"},
{"shovel", "_ingot"},
{"spear", "_ingot"},
{"chisel", "_ingot"},
{"sword", "_doubleingot"},
{"hammer", "_doubleingot"},
{"saw", "_sheet"}
}
for _, instrument in ipairs(anvil_instruments) do
for i, metal in ipairs(metals.list) do
-- the proper way to do that is to check whether we have metal in instruments.metals list or not
-- but who cares?
local output_name = "instruments:"..instrument[1].."_"..metal.."_head"
if minetest.registered_items[output_name] then
realtest.register_anvil_recipe({
item1 = "metals:"..metal..instrument[2],
item2 = "scribing_table:plan_"..instrument[1],
rmitem2 = false,
output = output_name,
level = metals.levels[i],
material = metal,
})
end
end
end
local anvils = {
{'stone', 'Stone', 0, 61*2.3},
{'desert_stone', 'Desert Stone', 0, 61*2.3},
{'copper', 'Copper', 1, 411*2.3},
{'rose_gold', 'Rose Gold', 2, 521*2.3},
{'bismuth_bronze', 'Bismuth Bronze', 2, 581*2.3},
{'black_bronze', 'Black Bronze', 2, 531*2.3},
{'bronze', 'Bronze', 2, 601*2.3},
{'wrought_iron', 'Wrought Iron', 3, 801*2.3},
{'steel', 'Steel', 4, 1101*2.3},
{'black_steel', 'Black Steel', 5, 1501*2.3}
}
minetest.register_craft({
output = 'anvil:anvil_stone',
recipe = {
{'default:stone','default:stone','default:stone'},
{'','default:stone',''},
{'default:stone','default:stone','default:stone'},
}
})
minetest.register_craft({
output = 'anvil:anvil_desert_stone',
recipe = {
{'default:desert_stone','default:desert_stone','default:desert_stone'},
{'','default:desert_stone',''},
{'default:desert_stone','default:desert_stone','default:desert_stone'},
}
})
for _, anvil in ipairs(anvils) do
if anvil[1] ~= "stone" then
minetest.register_craft({
output = "anvil:anvil_"..anvil[1],
recipe = {
{"metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot"},
{"","metals:"..anvil[1].."_doubleingot",""},
{"metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot"},
}
})
end
end
for _, anvil in ipairs(anvils) do
minetest.register_node("anvil:anvil_"..anvil[1], {
description = anvil[2] .. " Anvil",
tiles = {"anvil_"..anvil[1].."_top.png","anvil_"..anvil[1].."_top.png","anvil_"..anvil[1].."_side.png"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
},
},
groups = {oddly_breakable_by_hand=2, falling_node=1, dig_immediate=1},
sounds = default.node_sound_stone_defaults(),
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if inv:is_empty("src1") and inv:is_empty("src2") and inv:is_empty("hammer")
and inv:is_empty("output") and inv:is_empty("flux") then
return true
end
return false
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[8,7]"..
-- some (hopefully) helpful buttons
"button[2.0,1.75;1,0.5;guide;Guide]"..
"button_exit[5,1.75;1,0.5;quit;Exit]"..
"label[2.9,-0.2;Input 1:]"..
"label[4.1,-0.2;Input 2:]"..
"label[1.0,1.1;Instrument:]"..
"label[6.0,1.1;Flux:]"..
"label[3.5,2.35;Output]"..
-- the rest of the formspec
"button[0.5,0.25;1.35,1;buttonForge;Forge]"..
"button[1.6,0.25;0.9,1;buttonForge10;x10]"..
"list[current_name;src1;2.9,0.25;1,1;]"..
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
"list[current_name;src2;4.1,0.25;1,1;]"..
"button[5.5,0.25;1.35,1;buttonWeld;Weld]"..
"button[6.6,0.25;0.9,1;buttonWeld10;x10]"..
"list[current_name;hammer;1,1.5;1,1;]"..
"list[current_name;output;3.5,1.5;1,1;]"..
"list[current_name;flux;6,1.5;1,1;]"..
"list[current_player;main;0,3;8,4;]")
meta:set_string("infotext", anvil[2].." Anvil")
local inv = meta:get_inventory()
inv:set_size("src1", 1)
inv:set_size("src2", 1)
inv:set_size("hammer", 1)
inv:set_size("output", 1)
inv:set_size("flux", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
if( fields and fields.guide and sender ) then
-- anvils made from diffrent materials have diffrent capabilities
fields.anvil_typ = anvil[1];
realtest.show_craft_guide_anvil( sender, "realtest:craft_guide_anvil", fields);
return;
end
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local src1, src2 = inv:get_stack("src1", 1), inv:get_stack("src2", 1)
local instrument, flux = inv:get_stack("hammer", 1), inv:get_stack("flux", 1)
local output = inv:get_stack("output", 1)
local forge = function()
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
if recipe.type == "forge" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() and
anvil[3] >= recipe.level and
minetest.get_item_group(instrument:get_name(), recipe.instrument) == 1 and
minetest.get_item_group(instrument:get_name(), "material_level") >= recipe.level - 1 then
if inv:room_for_item("output", recipe.output) then
if recipe.rmitem1 then
src1:take_item()
inv:set_stack("src1", 1, src1)
end
if recipe.item2 ~= "" and recipe.rmitem2 then
src2:take_item()
inv:set_stack("src2", 1, src2)
end
output:add_item(recipe.output)
inv:set_stack("output", 1, output)
instrument:add_wear(65535/minetest.get_item_group(instrument:get_name(), "durability"))
inv:set_stack("hammer", 1, instrument)
end
return
end
end
end
local weld = function()
if flux:get_name() == "minerals:flux" then
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
if recipe.type == "weld" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() and
anvil[3] >= recipe.level and
minetest.get_item_group(instrument:get_name(), recipe.instrument) == 1 and
minetest.get_item_group(instrument:get_name(), "material_level") >= recipe.level then
if inv:room_for_item("output", recipe.output) then
if recipe.rmitem1 then
src1:take_item()
inv:set_stack("src1", 1, src1)
end
if recipe.item2 ~= "" and recipe.rmitem2 then
src2:take_item()
inv:set_stack("src2", 1, src2)
end
output:add_item(recipe.output)
inv:set_stack("output", 1, output)
flux:take_item()
inv:set_stack("flux", 1, flux)
instrument:add_wear(65535/minetest.get_item_group(instrument:get_name(), "durability")/2)
inv:set_stack("hammer", 1, instrument)
end
return
end
end
end
end
if fields["buttonForge"] then
forge()
elseif fields["buttonForge10"] then
for i = 0, 9 do
forge()
end
elseif fields["buttonWeld"] then
weld()
elseif fields["buttonWeld10"] then
for i = 0, 9 do
weld()
end
end
end,
})
end
realtest.show_craft_guide_anvil = function( player, formname, fields)
if( formname ~= "realtest:craft_guide_anvil" or not( player ) or fields.quit) then
return;
end
if( not( fields.material )) then
if( fields.old_material ) then
fields.material = fields.old_material;
else
fields.material = metals.list[1];
end
end
-- select the plan that is to be shown
local nr = 1;
for i, v in ipairs(realtest.registered_anvil_recipes ) do
if( v and v.output and fields[ v.output ]) then
nr = i;
end
end
local plan = realtest.registered_anvil_recipes[ nr ];
-- abort if no plan can be found
if( not( plan )) then
return;
end
local stack = ItemStack( plan.output );
local def = stack:get_definition();
local name = "";
if( def ) then
name = def.description;
end
if( not( name )) then
name = plan.output;
end
local how_to = "Forge";
if( plan.type and plan.type=="weld" ) then
how_to = "Weld";
end
local formspec =
"size[12,8]"..
"label[1.5,-0.2;"..how_to.." "..tostring(stack:get_count()).."x "..name.." this way (click on "..how_to.."):]"..
-- extra exit button for those tablet users
"button_exit[5,2.25;1,0.5;quit;Exit]"..
-- labels that describe the general usage of a slot
"label[2.9,0.3;Input 1:]"..
"label[4.1,0.3;Input 2:]"..
"label[1.0,1.6;Instrument:]"..
"label[6.0,1.6;Flux:]"..
"label[3.5,2.85;Output]"..
"label[8,-0.4;Select metal type to work with:]"..
-- buttons that do nothing; they exist just so that the interface looks similar
"button[0.5,0.75;1.35,1;nothing;Forge]"..
"button[1.6,0.75;0.9,1;nothing;x10]"..
"button[5.5,0.75;1.35,1;buttonWeld;Weld]"..
"button[6.6,0.75;0.9,1;buttonWeld10;x10]"..
"image[3.69,0.72;0.54,1.5;anvil_arrow.png]"..
-- background for the inventory slots
"box[2.9,0.75;0.8,0.9;#BBBBBB]"..
"box[4.1,0.75;0.8,0.9;#BBBBBB]"..
"box[3.5,1.99;0.8,0.9;#BBBBBB]"..
"item_image[3.5,2.0;1,1;"..plan.output.."]"..
-- the 4 simulated slots for the instruments
"box[1.0,1.99;0.8,0.9;#BBBBBB]"..
"box[6.0,1.99;0.8,0.9;#BBBBBB]"..
-- hide the material (=selected metal) somewhere
"field[-10,-10;0.1,0.1;old_material;"..fields.material..";"..fields.material.."]"..
-- some receipes output more of the same item than just one
"label[3.0,2.5;"..tostring(stack:get_count()).."x]"..
"label[0,3.5;Select receipe to show:]";
-- show the indigrents
if( plan.item1 and plan.item1 ~= "" and minetest.registered_items[ plan.item1 ]) then
local button = "item_image[2.9,0.75;1,1;"..plan.item1.."]";
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v.output == plan.item1 ) then
button = "item_image_button[2.9,0.75;1,1;"..v.output..";"..v.output..";]";
end
end
formspec = formspec..button;
end
-- the second slot usually takes a plan
if( plan.item2 and plan.item2 ~= "" and minetest.registered_items[ plan.item2 ]) then
local button = "item_image[4.1,0.75;1,1;"..plan.item2.."]";
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v.output == plan.item2 ) then
button = "item_image_button[4.1,0.75;1,1;"..v.output..";"..v.output..";]";
end
end
formspec = formspec..button;
end
-- show the instrument needed
if( plan.instrument and plan.instrument ~= "" and minetest.registered_items[ "instruments:"..plan.instrument.."_copper" ]) then
-- find a suitable instrument that can be used to work on this
local found = -1;
for i,v in ipairs( instruments.levels ) do
if( found<1 and plan.level <= v ) then
found = i;
end
end
local instrument_material = "copper"; -- fallback
if( found ) then
instrument_material = instruments.materials[ found ];
end
-- the instrument may need to be made out of a diffrent material
formspec = formspec.."item_image_button[1.0,2.0;1,1;instruments:"..plan.instrument.."_"..instrument_material..";material;"..instrument_material.."]";
-- show error message for unkown tools
elseif( plan.instrument and plan.instrument ~= "" ) then
formspec = formspec.."label[0.5,2.5;ERROR]";
end
-- welding requires flux
if( plan.type and plan.type=="weld") then
formspec = formspec.."item_image[6.0,2.0;1,1;minerals:flux]";
end
-- show a list of all receipes to select from
local i = 1;
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v and not( v.material ) or v.material == fields.material) then
formspec = formspec..
"item_image_button["..tostring((i-1)%8)..","..
tostring(4+math.floor((i-1)/8))..";1,1;"..
v.output..";"..v.output..";]";
-- minetest.formspec_escape(v.output).."]";
i = i+1;
end
end
-- show the metals to select from
for i, v in ipairs( metals.list ) do
formspec = formspec..
"image_button["..tostring(8+(i-1)%4)..","..
tostring(math.floor((i-1)/4))..";1,1;"..
"metals_"..v.."_block.png;material;"..
v.."]";
end
-- show the anvils that can do this task
formspec = formspec.."label[0,6.9;The following anvils are strong enough for this task ";
if( plan.type=="weld") then
formspec = formspec.."(welding can be done on all anvils):]";
else
formspec = formspec.." (at least strength "..tostring(plan.level).."):]";
end
for i,anvil in ipairs( anvils ) do
if( anvil[3] >= plan.level or plan.type=="weld") then
formspec = formspec.."item_image_button["..tostring(i-1)..",7.3;1,1;anvil:anvil_"..anvil[1]..";material;"..anvil[1].."]";
end
end
minetest.show_formspec( player:get_player_name(), "realtest:craft_guide_anvil", formspec );
end
-- make sure we receive player input; needed for showing formspecs directly
minetest.register_on_player_receive_fields( realtest.show_craft_guide_anvil );

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

218
mods/awards/api.lua Normal file
View File

@ -0,0 +1,218 @@
-- AWARDS
-- by Rubenwardy, CC-BY-SA
-------------------------------------------------------
-- this is api function file
-------------------------------------------------------
-- The global award namespace
awards = {}
-- Table Save Load Functions
function awards.save()
local file = io.open(minetest.get_worldpath().."/awards.txt", "w")
if file then
file:write(minetest.serialize(awards.players))
file:close()
end
end
function awards.load()
local file = io.open(minetest.get_worldpath().."/awards.txt", "r")
if file then
local table = minetest.deserialize(file:read("*all"))
if type(table) == "table" then
return table
end
end
return {}
end
awards.players = awards.load()
function awards.player(name)
return awards.players[player]
end
-- A table of award definitions
awards.def = {}
function awards.tbv(tb,value,default)
if not default then
default = {}
end
if not tb or type(tb) ~= "table" then
if not value then
value = "[NULL]"
end
print("[ERROR] awards.tbv - table '"..value.."' is null, or not a table! Dump: "..dump(tb))
return
end
if not value then
print("[ERROR] awards.tbv was not used correctly!")
print("Value: '"..dump(value).."'")
print("Dump:"..dump(tb))
return
end
if not tb[value] then
tb[value] = default
end
end
function awards.assertPlayer(playern)
awards.tbv(awards.players, playern)
awards.tbv(awards.players[playern], "name", playern)
awards.tbv(awards.players[playern], "unlocked")
awards.tbv(awards.players[playern], "place")
awards.tbv(awards.players[playern], "count")
awards.tbv(awards.players[playern], "deaths", 0)
end
-- Load files
dofile(minetest.get_modpath("awards").."/triggers.lua")
dofile(minetest.get_modpath("awards").."/config.txt")
-- API Functions
function awards.register_achievement(name,data_table)
-- see if a trigger is defined in the achievement definition
if data_table.trigger and data_table.trigger.type then
if data_table.trigger.type=="dig" then
local tmp={
award=name,
node=data_table.trigger.node,
target=data_table.trigger.target,
}
table.insert(awards.onDig,tmp)
elseif data_table.trigger.type=="place" then
local tmp={
award=name,
node=data_table.trigger.node,
target=data_table.trigger.target,
}
table.insert(awards.onPlace,tmp)
elseif data_table.trigger.type=="death" then
local tmp={
award=name,
target=data_table.trigger.target,
}
table.insert(awards.onDeath,tmp)
end
end
-- check icon, background and custom_announce data
if data_table.icon == nil or data_table.icon == "" then
data_table.icon = "unknown.png"
end
if data_table.background == nil or data_table.background == "" then
data_table.background = "bg_default.png"
end
if data_table.custom_announce == nil or data_table.custom_announce == "" then
data_table.custom_announce = "Achievement Unlocked:"
end
-- add the achievement to the definition table
awards.def[name] = data_table
end
-- this function adds a trigger function or table to the ondig table
function awards.register_onDig(func)
table.insert(awards.onDig,func);
end
-- this function adds a trigger function or table to the ondig table
function awards.register_onPlace(func)
table.insert(awards.onPlace,func);
end
-- this function adds a trigger function or table to the ondeath table
function awards.register_onDeath(func)
table.insert(awards.onDeath,func);
end
-- This function is called whenever a target condition is met.
-- It checks if a player already has that achievement, and if they do not,
-- it gives it to them
----------------------------------------------
--awards.give_achievement(name,award)
-- name - the name of the player
-- award - the name of the award to give
function awards.give_achievement(name,award)
-- Access Player Data
local data=awards.players[name]
-- Perform checks
if not data then
return
end
if not awards.def[award] then
return
end
awards.tbv(data,"unlocked")
-- check to see if the player does not already have that achievement
if not data.unlocked[award] or data.unlocked[award]~=award then
-- Set award flag
data.unlocked[award]=award
-- Get data from definition tables
local title = award
local desc = ""
local background = ""
local icon = ""
local custom_announce = ""
if awards.def[award].title then
title = awards.def[award].title
end
if awards.def[award].custom_announce then
custom_announce = awards.def[award].custom_announce
end
if awards.def[award].background then
background = awards.def[award].background
end
if awards.def[award].icon then
icon = awards.def[award].icon
end
if awards.def[award] and awards.def[award].description then
desc = awards.def[award].description
end
-- send the won award message to the player
if Use_Formspec == true then
-- use a formspec to send it
minetest.show_formspec(name, "achievements:unlocked", "size[4,2]"..
"image_button_exit[0,0;4,2;"..background..";close1; ]"..
"image_button_exit[0.2,0.8;1,1;"..icon..";close2; ]"..
"label[1.1,1;"..title.."]"..
"label[0.3,0.1;"..custom_announce.."]")
else
-- use the chat console to send it
minetest.chat_send_player(name, "Achievement Unlocked: "..title)
if desc~="" then
minetest.chat_send_player(name, desc)
end
end
-- record this in the log
print(name.." Has unlocked"..title..".")
-- save playertable
awards.save()
end
end
-- List a player's achievements
minetest.register_chatcommand("list_awards", {
params = "",
description = "list_awards: list your awards",
func = function(name, param)
if not awards.players[name] or not awards.players[name].unlocked then
minetest.chat_send_player(name, "You do not have any awards")
return
end
minetest.chat_send_player(name, name.."'s awards:")
for _, str in pairs(awards.players[name].unlocked) do
minetest.chat_send_player(name, str);
end
end,
})

8
mods/awards/config.txt Normal file
View File

@ -0,0 +1,8 @@
-- AWARDS
-- by Rubenwardy, CC-BY-SA
-------------------------------------------------------
-- this is the configuration file for the awards mod
-------------------------------------------------------
Use_Formspec = true
--Use a graphical display for unlocking achievements. (Possible values: true | false)

292
mods/awards/init.lua Normal file
View File

@ -0,0 +1,292 @@
-- AWARDS
-- by Rubenwardy, CC-BY-SA
-------------------------------------------------------
-- this is the init file for the award mod
-------------------------------------------------------
dofile(minetest.get_modpath("awards").."/api.lua")
-- Light it up
awards.register_achievement("award_firstlight",{
title = "First Light",
description = "You have placed a torch",
icon = "novicebuilder.png",
trigger={
type="place",
node="default:torch",
target=1,
},
})
awards.register_achievement("award_lightitup",{
title = "Light It Up",
description = "You have placed 100 torches",
icon = "novicebuilder.png",
trigger={
type="place",
node="default:torch",
target=100,
},
})
awards.register_achievement("award_betterthantorch",{
title = "Better Than Torch",
description = "You have placed a streetlight",
icon = "novicebuilder.png",
trigger={
type="place",
node="light:streetlight",
target=1,
},
})
-- Lumber Jack
awards.register_achievement("award_lumberjack_ash",{
title = "Ash Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:ash_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_aspen",{
title = "Aspen Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:aspen_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_birch",{
title = "Birch Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:birch_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_maple",{
title = "Maple Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:maple_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_chestnut",{
title = "Chestnut Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:chestnut_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_pine",{
title = "Pine Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:pine_log",
target=1,
},
})
awards.register_achievement("award_lumberjack_spruce",{
title = "Spruce Lumber Jack",
description = "You have mined a log!",
trigger={
type="dig",
node="trees:spruce_log",
target=1,
},
})
-- Placed a stone anvil
awards.register_achievement("award_anvil_stone",{
title = "Smithery",
description = "Place a Stone Anvil",
icon = "anvil.png",
background = "bg_default.png",
trigger={
type="place",
node="anvil:anvil_stone",
target=1,
},
})
awards.register_achievement("award_anvil_dstone",{
title = "Smithery",
description = "Place a Desert Stone Anvil",
icon = "anvil.png",
background = "bg_default.png",
trigger={
type="place",
node="anvil:anvil_desert_stone",
target=1,
},
})
-- Just entered the mine
awards.register_achievement("award_mine1",{
title = "Entering the mine",
description = "You have dug 10 stone blocks",
icon = "miniminer.png",
background = "bg_mining.png",
trigger={
type="dig",
node="default:stone",
target=10,
},
})
-- Mini Miner
awards.register_achievement("award_mine2",{
title = "Mini Miner",
description = "You have dug 100 stone blocks",
icon = "miniminer.png",
background = "bg_mining.png",
trigger={
type="dig",
node="default:stone",
target=100,
},
})
-- Hardened Miner
awards.register_achievement("award_mine3",{
title = "Hardened Miner",
description = "You have dug 1000 stone blocks",
icon = "miniminer.png",
background = "bg_mining.png",
trigger={
type="dig",
node="default:stone",
target=1000,
},
})
-- Master Miner
awards.register_achievement("award_mine4",{
title = "Master Miner",
description = "You have dug 10000 stone blocks",
icon = "miniminer.png",
background = "bg_mining.png",
trigger={
type="dig",
node="default:stone",
target=10000,
},
})
-- First Death
awards.register_achievement("award_death1",{
title = "First Death",
description = "Oh well, it does not matter you have more lives than a cat",
trigger={
type="death",
target=1,
},
})
-- Burned to death
awards.register_achievement("award_burn",{
title = "you're a witch!",
description = "Burn to death in a fire",
})
awards.register_onDeath(function(player,data)
print ("running on death function")
local pos=player:getpos()
if pos and minetest.env:find_node_near(pos, 1, "fire:basic_flame")~=nil then
return "award_burn"
end
return nil
end)
-- Spike Placement
awards.register_achievement("award_spike_ash",{
title = "Spiky Ash!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_ash",
target=1,
},
})
awards.register_achievement("award_spike_aspen",{
title = "Spiky Aspen",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_aspen",
target=1,
},
})
awards.register_achievement("award_spike_birch",{
title = "Spiky Birch!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_birch",
target=1,
},
})
awards.register_achievement("award_spike_maple",{
title = "Spiky Maple!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_maple",
target=1,
},
})
awards.register_achievement("award_spike_chestnut",{
title = "Spiky Chestnut!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_chestnut",
target=1,
},
})
awards.register_achievement("award_spike_pine",{
title = "Spiky Pine!!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_pine",
target=1,
},
})
awards.register_achievement("award_spike_spruce",{
title = "Spiky Spruce!",
description = "You placed spikes!",
trigger={
type="place",
node="spikes:spike_spruce",
target=1,
},
})
--Ants
awards.register_achievement("award_ants_old",{
title = "ANTS!",
description = "You dug an anthill",
trigger={
type="dig",
node="farming:anthill",
target=1,
},
})
awards.register_achievement("award_ants",{
title = "ANTS!",
description = "You dug an anthill",
trigger={
type="dig",
node="farming:ant_hill",
target=1,
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

175
mods/awards/triggers.lua Normal file
View File

@ -0,0 +1,175 @@
-- AWARDS
-- by Rubenwardy, CC-BY-SA
-------------------------------------------------------
-- this is the trigger handler file for the awards mod
-------------------------------------------------------
-- Function and table holders for Triggers
awards.onDig={}
awards.onPlace={}
awards.onTick={}
awards.onDeath={}
-- Trigger Handles
minetest.register_on_dignode(function(pos, oldnode, digger)
if not digger or not pos or not oldnode then
return
end
local nodedug = string.split(oldnode.name, ":")
if #nodedug ~= 2 then
print(oldnode.name.." is in wrong format!")
return
end
local mod=nodedug[1]
local item=nodedug[2]
local playern = digger:get_player_name()
if (not playern or not nodedug or not mod or not item) then
return
end
awards.assertPlayer(playern)
awards.tbv(awards.players[playern].count, mod)
awards.tbv(awards.players[playern].count[mod], item, 0 )
-- Increment counder
awards.players[playern].count[mod][item]=awards.players[playern].count[mod][item]+1
print(" - "..mod..":"..item.." 's count is now "..(awards.players[playern].count[mod][item]))
-- Run callbacks and triggers
local player=digger
local data=awards.players[playern]
for i=1,# awards.onDig do
local res = nil
if type(awards.onDig[i]) == "function" then
-- Run trigger callback
res = awards.onDig[i](player,data)
elseif type(awards.onDig[i]) == "table" then
-- Handle table trigger
if not awards.onDig[i].node or not awards.onDig[i].target or not awards.onDig[i].award then
-- table running failed!
print("[ERROR] awards - onDig trigger "..i.." is invalid!")
else
-- run the table
local tnodedug = string.split(awards.onDig[i].node, ":")
local tmod=tnodedug[1]
local titem=tnodedug[2]
if tmod==nil or titem==nil or not data.count[tmod] or not data.count[tmod][titem] then
-- table running failed!
elseif data.count[tmod][titem] > awards.onDig[i].target-1 then
res=awards.onDig[i].award
end
end
end
if res then
awards.give_achievement(playern,res)
end
end
end)
minetest.register_on_placenode(function(pos,node,digger)
if not digger or not pos or not node or not digger:get_player_name() or digger:get_player_name()=="" then
return
end
local nodedug = string.split(node.name, ":")
if #nodedug ~= 2 then
print(oldnode.name.." is in wrong format!")
return
end
local mod=nodedug[1]
local item=nodedug[2]
local playern = digger:get_player_name()
-- Run checks
if (not playern or not nodedug or not mod or not item) then
return
end
awards.assertPlayer(playern)
awards.tbv(awards.players[playern].place, mod)
awards.tbv(awards.players[playern].place[mod], item, 0 )
-- Increment counder
awards.players[playern].place[mod][item] = awards.players[playern].place[mod][item]+1
print(" - "..mod..":"..item.." 's place count is now "..(awards.players[playern].place[mod][item]))
-- Run callbacks and triggers
local player = digger
local data = awards.players[playern]
for i=1,# awards.onPlace do
local res = nil
if type(awards.onPlace[i]) == "function" then
-- Run trigger callback
res = awards.onPlace[i](player,data)
elseif type(awards.onPlace[i]) == "table" then
-- Handle table trigger
if not awards.onPlace[i].node or not awards.onPlace[i].target or not awards.onPlace[i].award then
-- table running failed!
print("[ERROR] awards - onPlace trigger "..i.." is invalid!")
else
-- run the table
local tnodedug = string.split(awards.onPlace[i].node, ":")
local tmod = tnodedug[1]
local titem = tnodedug[2]
if tmod==nil or titem==nil or not data.place[tmod] or not data.place[tmod][titem] then
-- table running failed!
elseif data.place[tmod][titem] > awards.onPlace[i].target-1 then
res = awards.onPlace[i].award
end
end
end
if res then
awards.give_achievement(playern,res)
end
end
end)
minetest.register_on_dieplayer(function(player)
-- Run checks
if not player or not player:get_player_name() or player:get_player_name()=="" then
return
end
local playern = player:get_player_name()
awards.assertPlayer(playern)
-- Increment counter
awards.players[player:get_player_name()].deaths = awards.players[player:get_player_name()].deaths + 1
-- Run callbacks and triggers
local data=awards.players[playern]
for i=1,# awards.onDeath do
local res=nil
if type(awards.onDeath[i]) == "function" then
-- Run trigger callback
res=awards.onDeath[i](player,data)
elseif type(awards.onDeath[i]) == "table" then
-- handle table here
if not awards.onDeath[i].target or not awards.onDeath[i].award then
-- table running failed!
print("[ERROR] awards - onDeath trigger "..i.." is invalid!")
else
-- run the table
if not data.deaths then
-- table running failed!
elseif data.deaths > awards.onDeath[i].target-1 then
res=awards.onDeath[i].award
end
end
end
if res~=nil then
awards.give_achievement(playern,res)
end
end
end)
minetest.register_on_newplayer(function(player)
local playern = player:get_player_name()
awards.assertPlayer(playern)
end)
minetest.register_on_shutdown(function()
awards.save()
end)

16
mods/boats/README.txt Normal file
View File

@ -0,0 +1,16 @@
Minetest 0.4 mod: boats
=======================
by PilzAdam
License of source code:
-----------------------
WTFPL
License of media (textures and sounds):
---------------------------------------
WTFPL
Authors of media files:
-----------------------
textures: Zeg9
model: thetoon and Zeg9

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

@ -0,0 +1 @@
default

170
mods/boats/init.lua Normal file
View File

@ -0,0 +1,170 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.env:get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i/math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = math.cos(yaw)*v
local z = math.sin(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
--
-- Cart entity
--
local boat = {
physical = true,
collisionbox = {-0.6,-0.4,-0.6, 0.6,0.3,0.6},
visual = "mesh",
mesh = "boat.x",
textures = {"trees_birch_planks.png"},
driver = nil,
v = 0,
}
function boat:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:setyaw(clicker:get_look_yaw())
end
end
function boat:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
end
end
function boat:get_staticdata()
return tostring(v)
end
function boat:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
function boat:on_step(dtime)
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v+0.1
end
if ctrl.down then
self.v = self.v-0.08
end
if ctrl.left then
self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120)
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:setvelocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y-0.5
if not is_water(p) then
if minetest.registered_nodes[minetest.env:get_node(p).name].walkable then
self.v = 0
end
self.object:setacceleration({x=0, y=-10, z=0})
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
else
p.y = p.y+1
if is_water(p) then
self.object:setacceleration({x=0, y=3, z=0})
local y = self.object:getvelocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:setacceleration({x=0, y=10, z=0})
end
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), y))
else
self.object:setacceleration({x=0, y=0, z=0})
if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y)+0.5
self.object:setpos(pos)
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
else
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
end
end
end
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Raft",
inventory_image = "boat_inventory.png",
wield_image = "boat_wield.png",
wield_scale = {x=2, y=2, z=1},
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
if not is_water(pointed_thing.under) then
return
end
pointed_thing.under.y = pointed_thing.under.y+0.5
minetest.env:add_entity(pointed_thing.under, "boats:boat")
itemstack:take_item()
return itemstack
end,
})
for _, tree in pairs(realtest.registered_trees) do
minetest.register_craft({
output = "boats:boat",
recipe = {
{tree.name.."_plank", "", tree.name.."_plank"},
{tree.name.."_plank", tree.name.."_plank", tree.name.."_plank"},
}
})
end

11110
mods/boats/models/boat.x Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

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

@ -0,0 +1 @@
default

218
mods/bonfire/init.lua Normal file
View File

@ -0,0 +1,218 @@
bonfire = {}
bonfire.formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,1;]"..
"list[current_player;main;0,5;8,4;]"
realtest.bonfire_fuels = {}
function realtest.add_bonfire_fuel(fuel)
if fuel then
table.insert(realtest.bonfire_fuels, fuel)
end
end
realtest.add_bonfire_fuel("default:cactus")
realtest.add_bonfire_fuel("default:papyrus")
realtest.add_bonfire_fuel("default:torch")
realtest.add_bonfire_fuel("default:sign_wall")
realtest.add_bonfire_fuel("ores:peat")
realtest.add_bonfire_fuel("minerals:charcoal")
minetest.register_node("bonfire:self", {
description = "Bonfire",
tiles = {"bonfire_top.png", "bonfire_bottom.png", "bonfire_side.png"},
particle_image = {"bonfire_bottom.png"},
drawtype = "nodebox",
paramtype = "light",
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.45,0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.45,0.5},
},
},
drop = "",
groups = {crumbly=3, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", bonfire.formspec)
meta:set_string("infotext", "Bonfire")
meta:set_int("active", 0)
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 2)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("fuel") and inv:is_empty("src") and inv:is_empty("dst") then
return true
end
return false
end,
})
minetest.register_node("bonfire:self_active", {
description = "Bonfire",
tiles = {"bonfire_top_active.png",
"bonfire_bottom.png",
{name="bonfire_flame.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.8}},
},
particle_image = {"bonfire_bottom.png"},
drawtype = "nodebox",
paramtype = "light",
damage_per_second = 6,
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.45001,-0.5,0.5,-0.45,0.5},--Base
{-5/16, -8/16, -3/16, 5/16, 8/16, -3/16},--Fire
{-5/16, -8/16, 3/16, 5/16, 8/16, 3/16},--Fire
{-3/16, -8/16, -5/16, -3/16, 8/16, 5/16},--Fire
{3/16, -8/16, -5/16, 3/16, 8/16, 5/16},--Fire
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.45,0.5},
},
},
light_source = 12,
drop = "",
groups = {igniter=1,crumbly=3, not_in_creative_inventory=1,fires=1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", bonfire.formspec)
meta:set_string("infotext", "Bonfire")
meta:set_int("active", 0)
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 2)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("fuel") and inv:is_empty("src") and inv:is_empty("dst") then
return true
end
return false
end,
})
minetest.register_abm({
nodenames = {"bonfire:self","bonfire:self_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
if meta:get_int("active") == 1 then
if meta:get_int("sound_play") ~= 1 then
meta:set_int("sound_handle", minetest.sound_play("bonfire_burning", {pos=pos, max_hear_distance = 4,loop=true,gain=0.8}))
meta:set_int("sound_play", 1)
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
srcstack = inv:get_stack("src", 1)
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
--else
--print("Could not insert '"..cooked.item.."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Bonfire active: "..percent.."%")
hacky_swap_node(pos,"bonfire:self_active")
meta:set_string("formspec",
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,1;]"..
"list[current_player;main;0,5;8,4;]")
return
end
local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel and not table.contains(realtest.bonfire_fuels, inv:get_stack("fuel", 1):get_name()) then
fuel.time = 0
end
end
if fuel.time <= 0 then
meta:set_string("infotext","Bonfire out of fuel")
hacky_swap_node(pos,"bonfire:self")
meta:set_string("formspec", bonfire.formspec)
meta:set_int("active", 0)
meta:set_int("sound_play", 0)
minetest.sound_stop(meta:get_int("sound_handle"))
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
end
end,
})

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

View File

@ -0,0 +1,38 @@
=== BUILTIN_ITEM MOD for MINETEST-C55 ===
by PilzAdam
Features:
This mod adds some new features to the builtin items:
- The items are pushed by flowing water
- The items are destroyed by lava
- The items are removed after 300 seconds or the time that is specified by
remove_items in minetest.conf (0 disables it)
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
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.

186
mods/builtin_item/init.lua Normal file
View File

@ -0,0 +1,186 @@
minetest.register_entity(":__builtin:item", {
initial_properties = {
hp_max = 1,
physical = true,
collisionbox = {-0.17,-0.17,-0.17, 0.17,0.17,0.17},
visual = "sprite",
visual_size = {x=0.5, y=0.5},
textures = {""},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = false,
timer = 0,
},
itemstring = '',
physical_state = true,
set_item = function(self, itemstring)
self.itemstring = itemstring
local stack = ItemStack(itemstring)
local itemtable = stack:to_table()
local itemname = nil
if itemtable then
itemname = stack:to_table().name
end
local item_texture = nil
local item_type = ""
if minetest.registered_items[itemname] then
item_texture = minetest.registered_items[itemname].inventory_image
item_type = minetest.registered_items[itemname].type
end
prop = {
is_visible = true,
visual = "sprite",
textures = {"unknown_item.png"}
}
if item_texture and item_texture ~= "" then
prop.visual = "sprite"
prop.textures = {item_texture}
prop.visual_size = {x=0.50, y=0.50}
else
prop.visual = "wielditem"
prop.textures = {itemname}
prop.visual_size = {x=0.20, y=0.20}
prop.automatic_rotate = math.pi * 0.25
end
self.object:set_properties(prop)
end,
get_staticdata = function(self)
--return self.itemstring
return minetest.serialize({
itemstring = self.itemstring,
always_collect = self.always_collect,
timer = self.timer,
})
end,
on_activate = function(self, staticdata, dtime_s)
if string.sub(staticdata, 1, string.len("return")) == "return" then
local data = minetest.deserialize(staticdata)
if data and type(data) == "table" then
self.itemstring = data.itemstring
self.always_collect = data.always_collect
self.timer = data.timer
if not self.timer then
self.timer = 0
end
self.timer = self.timer+dtime_s
end
else
self.itemstring = staticdata
end
self.object:set_armor_groups({immortal=1})
self.object:setvelocity({x=0, y=2, z=0})
self.object:setacceleration({x=0, y=-10, z=0})
self:set_item(self.itemstring)
end,
on_step = function(self, dtime)
local time = tonumber(minetest.setting_get("remove_items"))
if not time then
time = 300
end
if not self.timer then
self.timer = 0
end
self.timer = self.timer + dtime
if time ~= 0 and (self.timer > time) then
self.object:remove()
end
local p = self.object:getpos()
local name = minetest.env:get_node(p).name
if name == "default:lava_flowing" or name == "default:lava_source" then
minetest.sound_play("builtin_item_lava", {pos=self.object:getpos()})
self.object:remove()
return
end
if minetest.registered_nodes[name].liquidtype == "flowing" then
get_flowing_dir = function(self)
local pos = self.object:getpos()
local param2 = minetest.env:get_node(pos).param2
for i,d in ipairs({-1, 1, -1, 1}) do
if i<3 then
pos.x = pos.x+d
else
pos.z = pos.z+d
end
local name = minetest.env:get_node(pos).name
local par2 = minetest.env:get_node(pos).param2
if name == "default:water_flowing" and par2 < param2 then
return pos
end
if i<3 then
pos.x = pos.x-d
else
pos.z = pos.z-d
end
end
end
local vec = get_flowing_dir(self)
if vec then
local v = self.object:getvelocity()
if vec and vec.x-p.x > 0 then
self.object:setvelocity({x=0.5,y=v.y,z=0})
elseif vec and vec.x-p.x < 0 then
self.object:setvelocity({x=-0.5,y=v.y,z=0})
elseif vec and vec.z-p.z > 0 then
self.object:setvelocity({x=0,y=v.y,z=0.5})
elseif vec and vec.z-p.z < 0 then
self.object:setvelocity({x=0,y=v.y,z=-0.5})
end
self.object:setacceleration({x=0, y=-10, z=0})
self.physical_state = true
self.object:set_properties({
physical = true
})
return
end
end
p.y = p.y - 0.3
local nn = minetest.env:get_node(p).name
-- If node is not registered or node is walkably solid
if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then
if self.physical_state then
self.object:setvelocity({x=0,y=0,z=0})
self.object:setacceleration({x=0, y=0, z=0})
self.physical_state = false
self.object:set_properties({
physical = false
})
end
else
if not self.physical_state then
self.object:setvelocity({x=0,y=0,z=0})
self.object:setacceleration({x=0, y=-10, z=0})
self.physical_state = true
self.object:set_properties({
physical = true
})
end
end
end,
on_punch = function(self, hitter)
if self.itemstring ~= '' then
local left = hitter:get_inventory():add_item("main", self.itemstring)
if not left:is_empty() then
self.itemstring = left:to_string()
return
end
end
self.object:remove()
end,
})
if minetest.setting_get("log_mods") then
minetest.log("action", "builtin_item loaded")
end

Binary file not shown.

View File

@ -0,0 +1,118 @@
local S = plantslib.intllib
-- Basket
minetest.register_craft({
output = "bushes:basket_empty",
recipe = {
{ "default:stick", "default:stick", "default:stick" },
{ "", "default:stick", "" },
},
})
-- Sugar
minetest.register_craftitem(":bushes:sugar", {
description = S("Sugar"),
inventory_image = "bushes_sugar.png",
on_use = minetest.item_eat(1),
groups = {food_sugar=1}
})
minetest.register_craft({
output = "bushes:sugar 1",
recipe = {
{ "default:papyrus", "default:papyrus" },
},
})
for i, berry in ipairs(bushes_classic.bushes) do
local desc = bushes_classic.bushes_descriptions[i]
minetest.register_craftitem(":bushes:"..berry.."_pie_raw", {
description = S("Raw "..desc.." pie"),
inventory_image = "bushes_"..berry.."_pie_raw.png",
on_use = minetest.item_eat(4),
})
if berry ~= "mixed_berry" then
if berry == "strawberry" and minetest.registered_nodes["farming_plus:strawberry"] then
-- Special case for strawberries, when farming_plus is in use. Use
-- the item from that mod, but redefine it so it has the right
-- groups and does't look so ugly!
minetest.register_craftitem(":farming_plus:strawberry_item", {
description = S("Strawberry"),
inventory_image = "bushes_"..berry..".png",
on_use = minetest.item_eat(2),
groups = {berry=1, strawberry=1}
})
minetest.register_alias("bushes:strawberry", "farming_plus:strawberry_item")
else
minetest.register_craftitem(":bushes:"..berry, {
description = desc,
inventory_image = "bushes_"..berry..".png",
groups = {berry = 1, [berry] = 1},
on_use = minetest.item_eat(1),
})
end
minetest.register_craft({
output = "bushes:"..berry.."_pie_raw 1",
recipe = {
{ "group:food_sugar", "farming:flour", "group:food_sugar" },
{ "group:"..berry, "group:"..berry, "group:"..berry },
},
})
end
-- Cooked pie
minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", {
description = S("Cooked "..desc.." pie"),
inventory_image = "bushes_"..berry.."_pie_cooked.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
type = "cooking",
output = "bushes:"..berry.."_pie_cooked",
recipe = "bushes:"..berry.."_pie_raw",
cooktime = 30,
})
-- slice of pie
minetest.register_craftitem(":bushes:"..berry.."_pie_slice", {
description = S("Slice of "..desc.." pie"),
inventory_image = "bushes_"..berry.."_pie_slice.png",
on_use = minetest.item_eat(1),
})
minetest.register_craft({
output = "bushes:"..berry.."_pie_slice 6",
recipe = {
{ "bushes:"..berry.."_pie_cooked" },
},
})
-- Basket with pies
minetest.register_craft({
output = "bushes:basket_"..berry.." 1",
recipe = {
{ "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked" },
{ "", "bushes:basket_empty", "" },
},
})
end
minetest.register_craft({
output = "bushes:mixed_berry_pie_raw 2",
recipe = {
{ "group:food_sugar", "farming:flour", "group:food_sugar" },
{ "group:berry", "group:berry", "group:berry" },
{ "group:berry", "group:berry", "group:berry" },
},
})

View File

@ -0,0 +1,3 @@
plants_lib
farming?
farming_plus?

View File

@ -0,0 +1,5 @@
strawberry: http://www.clker.com/clipart-4060.html
blueberry: http://www.clker.com/clipart-cerezafiro12.html
blackberry: http://www.clker.com/clipart-blackberry-2.html
raspberry: http://www.clker.com/clipart-simple-raspberry.html
gooseberry: http://www.clker.com/clipart-26281.html

View File

@ -0,0 +1,58 @@
-- Bushes classic mod originally by unknown
-- now maintained by VanessaE
--
-- License: WTFPL
local S = plantslib.intllib
bushes_classic = {}
bushes_classic.bushes = {
"strawberry",
"blackberry",
"blueberry",
"raspberry",
"gooseberry",
"mixed_berry"
}
bushes_classic.bushes_descriptions = {
"Strawberry",
"Blackberry",
"Blueberry",
"Raspberry",
"Gooseberry",
"Mixed Berry"
}
bushes_classic.spawn_list = {}
dofile(minetest.get_modpath('bushes_classic') .. '/cooking.lua')
dofile(minetest.get_modpath('bushes_classic') .. '/nodes.lua')
plantslib:spawn_on_surfaces({
spawn_delay = 3600,
spawn_plants = bushes_classic.spawn_list,
avoid_radius = 10,
spawn_chance = 100,
spawn_surfaces = {
"default:dirt_with_grass",
"woodsoils:dirt_with_leaves_1",
"woodsoils:grass_with_leaves_1",
"woodsoils:grass_with_leaves_2",
"farming:soil",
"farming:soil_wet"
},
avoid_nodes = {"group:bush"},
seed_diff = 545342534, -- chosen by a fair mashing of the keyboard - guaranteed to be random :P
plantlife_limit = -0.1,
light_min = 10,
temp_min = 0.15, -- approx 20C
temp_max = -0.15, -- approx 35C
humidity_min = 0, -- 50% RH
humidity_max = -1, -- 100% RH
})
minetest.register_alias("bushes:basket_pies", "bushes:basket_strawberry")
print(S("[Bushes] Loaded."))

View File

@ -0,0 +1,43 @@
# Translation by Xanthin
Strawberry = Erdbeere
Blackberry = Brombeere
Blueberry = Blaubeere
Raspberry = Himbeere
Gooseberry = Stachelbeere
Mixed Berry = Beerenmix
Basket with Strawberry Pies = Korb mit Erdbeertorten
Basket with Blackberry Pies = Korb mit Brombeertorten
Basket with Blueberry Pies = Korb mit Blaubeertorten
Basket with Raspberry Pies = Korb mit Himbeertorten
Basket with Gooseberry Pies = Korb mit Stachelbeertorten
Basket with Mixed Berry Pies = Korb mit Beerenmixtorten
currently fruitless = zur Zeit fruechteloser
Strawberry Bush = Erdbeerbusch
Blackberry Bush = Brombeerbusch
Blueberry Bush = Blaubeerbusch
Raspberry Bush = Himbeerbusch
Gooseberry Bush = Stachelbeerbusch
Mixed Berry Bush = Beerenmixbusch
Basket = Korb
Sugar = Zucker
Raw Strawberry pie = Rohe Erdbeertorte
Raw Blackberry pie = Rohe Brombeertorte
Raw Blueberry pie = Rohe Blaubeertorte
Raw Raspberry pie = Rohe Himbeertorte
Raw Gooseberry pie = Rohe Stachelbeertorte
Raw Mixed Berry pie = Rohe Beerenmixtorte
Cooked Strawberry pie = Erdbeertorte
Cooked Blackberry pie = Brombeertorte
Cooked Blueberry pie = Blaubeertorte
Cooked Raspberry pie = Himbeertorte
Cooked Gooseberry pie = Stachelbeertorte
Cooked Mixed Berry pie = Beerenmixtorte
Slice of Strawberry pie = Erdbeertortenstueck
Slice of Blackberry pie = Brombeertortenstueck
Slice of Blueberry pie = Blaubeertortenstueck
Slice of Raspberry pie = Himbeertortenstueck
Slice of Gooseberry pie = Stachelbeertortenstueck
Slice of Mixed Berry pie = Beerenmixtortenstueck
[Bushes] Loaded. = [Bushes] Geladen.

View File

@ -0,0 +1,43 @@
# Template
Strawberry = Fraise
Blackberry = Mûre
Blueberry = Myrtille
Raspberry = Framboise
Gooseberry = Groseille
Mixed Berry = Mélange de baies
Basket with Strawberry Pies = Panier de tartes aux fraises
Basket with Blackberry Pies = Panier de tartes aux mûres
Basket with Blueberry Pies = Panier de tartes aux myrtilles
Basket with Raspberry Pies = Panier de tartes aux framboises
Basket with Gooseberry Pies = Panier de tartes aux groseilles
Basket with Mixed Berry Pies = Panier de tartes au mélange de baies
currently fruitless = actuellement sans fruit
Strawberry Bush = Buisson à fraise
Blackberry Bush = Buisson à mûre
Blueberry Bush = Buisson à myrtille
Raspberry Bush = Buisson à framboise
Gooseberry Bush = Buisson à groseille
Mixed Berry Bush = Buisson de baies mélangées
Basket = Panier
Sugar = Sucre
Raw Strawberry pie = Tarte crue aux fraises
Raw Blackberry pie = Tarte crue aux mûres
Raw Blueberry pie = Tarte crue aux myrtilles
Raw Raspberry pie = Tarte crue aux framboises
Raw Gooseberry pie = Tarte crue aux groseilles
Raw Mixed Berry pie = Tarte crue au mélange de baies
Cooked Strawberry pie = Tarte cuite aux fraises
Cooked Blackberry pie = Tarte cuite aux mûres
Cooked Blueberry pie = Tarte cuite aux myrtilles
Cooked Raspberry pie = Tarte cuite aux framboises
Cooked Gooseberry pie = Tarte cuite aux groseilles
Cooked Mixed Berry pie = Tarte cuite au mélange de baies
Slice of Strawberry pie = Part de tarte aux fraises
Slice of Blackberry pie = Part de tarte aux mûres
Slice of Blueberry pie = Part de tarte aux myrtilles
Slice of Raspberry pie = Part de tarts aux framboises
Slice of Gooseberry pie = Part de tarte aux groseilles
Slice of Mixed Berry pie = Part de tarte au mélange de baies
[Bushes] Loaded. = [Buissons] Chargés.

View File

@ -0,0 +1,43 @@
# Template
Strawberry =
Blackberry =
Blueberry =
Raspberry =
Gooseberry =
Mixed Berry =
Basket with Strawberry Pies =
Basket with Blackberry Pies =
Basket with Blueberry Pies =
Basket with Raspberry Pies =
Basket with Gooseberry Pies =
Basket with Mixed Berry Pies =
currently fruitless =
Strawberry Bush =
Blackberry Bush =
Blueberry Bush =
Raspberry Bush =
Gooseberry Bush =
Mixed Berry Bush =
Basket =
Sugar =
Raw Strawberry pie =
Raw Blackberry pie =
Raw Blueberry pie =
Raw Raspberry pie =
Raw Gooseberry pie =
Raw Mixed Berry pie =
Cooked Strawberry pie =
Cooked Blackberry pie =
Cooked Blueberry pie =
Cooked Raspberry pie =
Cooked Gooseberry pie =
Cooked Mixed Berry pie =
Slice of Strawberry pie =
Slice of Blackberry pie =
Slice of Blueberry pie =
Slice of Raspberry pie =
Slice of Gooseberry pie =
Slice of Mixed Berry pie =
[Bushes] Loaded. =

View File

@ -0,0 +1,44 @@
# Turkish translation
# mahmutelmas06@hotmail.com
Strawberry = Çilek
Blackberry = Böğürtlen
Blueberry = Yaban mersini
Raspberry = Ahududu
Gooseberry = Bektaşi üzümü
Mixed Berry = Dut
Basket with Strawberry Pies = Çilekli pasta sepeti
Basket with Blackberry Pies = Böğürtlenli pasta sepeti
Basket with Blueberry Pies = Yaban mersini pastalı sepet
Basket with Raspberry Pies = Ahududulu pasta sepeti
Basket with Gooseberry Pies = Bektaşi üzümlü pasta sepeti
Basket with Mixed Berry Pies = Dutlu pasta sepeti
currently fruitless = şu anda meyvesiz
Strawberry Bush = Çilek fidanı
Blackberry Bush = Böğürtlen fidanı
Blueberry Bush = Yaban mersini fidanı
Raspberry Bush = Ahududu fidanı
Gooseberry Bush = Bektaşi üzümü fidanı
Mixed Berry Bush = Dut fidanı
Basket = Sepet
Sugar = Şeker
Raw Strawberry pie = Çilekli çiğ pasta
Raw Blackberry pie = Böğürtlenli çiğ pasta
Raw Blueberry pie = Yaban mersinli çiğ pasta
Raw Raspberry pie = Ahududulu çiğ pasta
Raw Gooseberry pie = Bektaşi üzümlü çiğ pasta
Raw Mixed Berry pie = Dutlu çiğ pasta
Cooked Strawberry pie = Pişmiş çilekli pasta
Cooked Blackberry pie = Pişmiş böğürtlenli pasta
Cooked Blueberry pie = Pişmiş yaban mersinli pasta
Cooked Raspberry pie = Pişmiş ahududulu pasta
Cooked Gooseberry pie = Pişmiş bektaşi üzümlü pasta
Cooked Mixed Berry pie = Pişmiş dutlu pasta
Slice of Strawberry pie = Çilekli pasta dilimi
Slice of Blackberry pie = Böğürtlenli pasta dilimi
Slice of Blueberry pie = Yaban mersinli pasta dilimi
Slice of Raspberry pie = Ahududulu pasta dilimi
Slice of Gooseberry pie = Bektaşi üzümlü pasta dilimi
Slice of Mixed Berry pie = Dutlu pasta dilimi
[Bushes] Loaded. = [Bushes] yüklendi.

View File

@ -0,0 +1,46 @@
# Blender v2.73 (sub 0) OBJ File: 'basket-of-pies.blend'
# www.blender.org
o basket_Cube.001
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 0.500000 0.500000
v -0.437500 0.500000 0.437500
v -0.437500 0.500000 -0.437500
v 0.437500 0.500000 -0.437500
v 0.437500 0.500000 0.437500
v -0.437500 -0.437500 0.437500
v -0.437500 -0.437500 -0.437500
v 0.437500 -0.437500 -0.437500
v 0.437500 -0.437500 0.437500
vt 0.484848 0.984848
vt 0.015152 0.984848
vt 0.015152 0.515152
vt 0.484848 0.515152
vt 0.515152 0.984848
vt 0.515152 0.515152
vt 0.984848 0.515152
vt 0.984848 0.984848
vt 0.954545 0.545455
vt 0.545455 0.545455
vt 0.954545 0.954545
vt 0.545455 0.954545
s off
f 5/1 6/2 2/3 1/4
f 6/1 7/2 3/3 2/4
f 7/1 8/2 4/3 3/4
f 8/1 5/2 1/3 4/4
f 1/5 2/6 3/7 4/8
f 5/6 8/7 12/9 9/10
f 8/7 7/8 11/11 12/9
f 7/8 6/5 10/12 11/11
f 6/5 5/6 9/10 10/12
f 9/1 12/2 16/3 13/4
f 12/1 11/2 15/3 16/4
f 11/1 10/2 14/3 15/4
f 10/1 9/2 13/3 14/4
f 13/10 16/9 15/11 14/12

View File

@ -0,0 +1,330 @@
# Blender v2.73 (sub 0) OBJ File: 'basket-of-pies.blend'
# www.blender.org
o pies_Cylinder
v -0.089468 -0.116804 -0.438000
v -0.116691 -0.091480 -0.438000
v 0.024696 0.005921 -0.404659
v -0.002527 0.031245 -0.404659
v 0.121480 0.109962 -0.309713
v 0.094258 0.135286 -0.309713
v 0.186149 0.179480 -0.167615
v 0.158927 0.204804 -0.167615
v 0.208858 0.203891 0.000000
v 0.181635 0.229215 0.000000
v 0.186149 0.179480 0.167615
v 0.158927 0.204804 0.167615
v 0.121480 0.109962 0.309713
v 0.094258 0.135286 0.309713
v 0.024696 0.005921 0.404659
v -0.002527 0.031245 0.404659
v -0.089468 -0.116804 0.438000
v -0.116691 -0.091480 0.438000
v -0.230856 -0.214204 0.404659
v -0.327640 -0.318245 0.309713
v -0.392309 -0.387763 0.167615
v -0.415018 -0.412175 -0.000000
v -0.392309 -0.387763 -0.167615
v -0.327640 -0.318245 -0.309713
v -0.230856 -0.214204 -0.404659
v -0.135230 -0.074234 -0.383250
v -0.035336 0.033150 -0.354077
v 0.049350 0.124186 -0.270999
v 0.105936 0.185014 -0.146663
v 0.125806 0.206374 0.000000
v 0.105936 0.185014 0.146663
v 0.049350 0.124186 0.270999
v -0.035336 0.033150 0.354077
v -0.135230 -0.074234 0.383250
v -0.235124 -0.181618 0.354077
v -0.319810 -0.272654 0.270999
v -0.376395 -0.333482 0.146663
v -0.396266 -0.354842 -0.000000
v -0.376395 -0.333482 -0.146664
v -0.319810 -0.272654 -0.270999
v -0.235124 -0.181618 -0.354077
v 0.071215 -0.085999 -0.438000
v 0.041377 -0.063816 -0.438000
v 0.171221 0.048513 -0.404659
v 0.141384 0.070697 -0.404659
v 0.256002 0.162547 -0.309713
v 0.226165 0.184731 -0.309713
v 0.312652 0.238743 -0.167615
v 0.282814 0.260926 -0.167615
v 0.332544 0.265499 0.000000
v 0.302707 0.287682 0.000000
v 0.312652 0.238743 0.167615
v 0.282814 0.260926 0.167615
v 0.256002 0.162547 0.309713
v 0.226165 0.184731 0.309713
v 0.171221 0.048513 0.404659
v 0.141383 0.070697 0.404659
v 0.071215 -0.085999 0.438000
v 0.041377 -0.063816 0.438000
v -0.058629 -0.198328 0.404659
v -0.058629 -0.198328 -0.404659
v 0.021058 -0.048709 -0.383250
v 0.108564 0.068989 -0.354077
v 0.182747 0.168769 -0.270999
v 0.232315 0.235440 -0.146663
v 0.249721 0.258852 0.000000
v 0.232315 0.235440 0.146663
v 0.182747 0.168769 0.270999
v 0.108564 0.068989 0.354077
v 0.021058 -0.048709 0.383250
v -0.066448 -0.166408 0.354077
v -0.140632 -0.266188 0.270999
v -0.190200 -0.332858 0.146663
v -0.207605 -0.356270 -0.000000
v -0.190199 -0.332858 -0.146664
v -0.140631 -0.266188 -0.270999
v -0.066448 -0.166408 -0.354077
v 0.220377 -0.057101 -0.438000
v 0.188086 -0.038671 -0.438000
v 0.303465 0.088470 -0.404659
v 0.271175 0.106901 -0.404659
v 0.373905 0.211880 -0.309713
v 0.341614 0.230311 -0.309713
v 0.420971 0.294340 -0.167615
v 0.388680 0.312771 -0.167615
v 0.437498 0.323296 0.000000
v 0.405208 0.341727 0.000000
v 0.420971 0.294340 0.167615
v 0.388680 0.312771 0.167615
v 0.373905 0.211880 0.309713
v 0.341614 0.230311 0.309713
v 0.303465 0.088470 0.404659
v 0.271175 0.106901 0.404659
v 0.220377 -0.057101 0.438000
v 0.188086 -0.038671 0.438000
v 0.104997 -0.184242 0.404659
v 0.104997 -0.184242 -0.404659
v 0.166096 -0.026119 -0.383250
v 0.238799 0.101256 -0.354077
v 0.300433 0.209240 -0.270999
v 0.341616 0.281392 -0.146663
v 0.356078 0.306728 0.000000
v 0.341616 0.281392 0.146664
v 0.300433 0.209240 0.270999
v 0.238799 0.101256 0.354077
v 0.166096 -0.026119 0.383250
v 0.093393 -0.153495 0.354077
v 0.031759 -0.261478 0.270999
v -0.009424 -0.333631 0.146663
v -0.023885 -0.358967 -0.000000
v -0.009424 -0.333631 -0.146664
v 0.031759 -0.261478 -0.270999
v 0.093394 -0.153495 -0.354077
vt 0.000000 0.054054
vt 0.000000 0.000000
vt 0.062500 0.000000
vt 0.062500 0.054054
vt 0.125000 0.000000
vt 0.125000 0.054054
vt 0.187500 0.000000
vt 0.187500 0.054054
vt 0.250000 0.000000
vt 0.250000 0.054054
vt 0.312500 0.000000
vt 0.312500 0.054054
vt 0.375000 0.000000
vt 0.375000 0.054054
vt 0.437500 0.000000
vt 0.437500 0.054054
vt 0.500000 0.000000
vt 0.500000 0.054054
vt 0.055610 0.293778
vt 0.110171 0.184656
vt 0.123905 0.225763
vt 0.076165 0.321244
vt 0.316174 0.801264
vt 0.253798 0.852938
vt 0.186282 0.852938
vt 0.123905 0.801264
vt 0.076165 0.705782
vt 0.050327 0.581029
vt 0.050327 0.445997
vt 0.186282 0.174088
vt 0.253798 0.174089
vt 0.316174 0.225763
vt 0.363915 0.321245
vt 0.389752 0.445997
vt 0.389752 0.581029
vt 0.363915 0.705782
vt 0.384468 0.733249
vt 0.329907 0.842371
vt 0.055610 0.733249
vt 0.026082 0.590674
vt 0.384468 0.293778
vt 0.413996 0.436353
vt 0.258619 0.901428
vt 0.181458 0.901428
vt 0.181458 0.125599
vt 0.258619 0.125599
vt 0.026082 0.436353
vt 0.413996 0.590674
vt 0.110171 0.842371
vt 0.329907 0.184656
vt 0.076566 0.705251
vt 0.050729 0.580498
vt 0.050729 0.445466
vt 0.076566 0.320713
vt 0.124307 0.225232
vt 0.186684 0.173557
vt 0.254199 0.173557
vt 0.316576 0.225232
vt 0.364317 0.320713
vt 0.390154 0.445466
vt 0.390154 0.580498
vt 0.364317 0.705251
vt 0.316576 0.800732
vt 0.254199 0.852407
vt 0.186684 0.852407
vt 0.124307 0.800732
vt 0.110573 0.841838
vt 0.056012 0.732716
vt 0.330309 0.841838
vt 0.259022 0.900894
vt 0.026484 0.590141
vt 0.026484 0.435819
vt 0.414398 0.435819
vt 0.414398 0.590141
vt 0.181861 0.900894
vt 0.384870 0.732716
vt 0.384870 0.293245
vt 0.389637 0.582094
vt 0.363799 0.706847
vt 0.316059 0.802329
vt 0.253682 0.854003
vt 0.186166 0.854003
vt 0.123790 0.802329
vt 0.076049 0.706847
vt 0.050212 0.582094
vt 0.050212 0.447062
vt 0.076049 0.322309
vt 0.123790 0.226828
vt 0.186166 0.175153
vt 0.253682 0.175153
vt 0.316058 0.226828
vt 0.363799 0.322310
vt 0.389637 0.447062
vt 0.413881 0.437419
vt 0.413881 0.591741
vt 0.258504 0.126666
vt 0.329792 0.185722
vt 0.384353 0.734315
vt 0.329792 0.843437
vt 0.055495 0.294844
vt 0.110056 0.185722
vt 0.384353 0.294844
vt 0.181343 0.126666
vt 0.025967 0.437419
g pies_Cylinder_pie
s off
f 1/1 2/2 4/3 3/4
f 3/4 4/3 6/5 5/6
f 5/6 6/5 8/7 7/8
f 7/8 8/7 10/9 9/10
f 9/10 10/9 12/11 11/12
f 11/12 12/11 14/13 13/14
f 13/14 14/13 16/15 15/16
f 15/16 16/15 18/17 17/18
f 20/19 19/20 35/21 36/22
f 27/23 26/24 41/25 40/26 39/27 38/28 37/29 36/22 35/21 34/30 33/31 32/32 31/33 30/34 29/35 28/36
f 6/37 4/38 27/23 28/36
f 23/39 22/40 38/28 39/27
f 12/41 10/42 30/34 31/33
f 2/43 25/44 41/25 26/24
f 4/38 2/43 26/24 27/23
f 18/45 16/46 33/31 34/30
f 21/47 20/19 36/22 37/29
f 8/48 6/37 28/36 29/35
f 24/49 23/39 39/27 40/26
f 14/50 12/41 31/33 32/32
f 19/20 18/45 34/30 35/21
f 22/40 21/47 37/29 38/28
f 10/42 8/48 29/35 30/34
f 25/44 24/49 40/26 41/25
f 16/46 14/50 32/32 33/31
f 42/1 43/2 45/3 44/4
f 44/4 45/3 47/5 46/6
f 46/6 47/5 49/7 48/8
f 48/8 49/7 51/9 50/10
f 50/10 51/9 53/11 52/12
f 52/12 53/11 55/13 54/14
f 54/14 55/13 57/15 56/16
f 56/16 57/15 59/17 58/18
f 63/51 62/52 77/53 76/54 75/55 74/56 73/57 72/58 71/59 70/60 69/61 68/62 67/63 66/64 65/65 64/66
f 47/67 45/68 63/51 64/66
f 53/69 51/70 66/64 67/63
f 43/71 61/72 77/53 62/52
f 45/68 43/71 62/52 63/51
f 59/73 57/74 69/61 70/60
f 49/75 47/67 64/66 65/65
f 55/76 53/69 67/63 68/62
f 60/77 59/73 70/60 71/59
f 51/70 49/75 65/65 66/64
f 57/74 55/76 68/62 69/61
f 78/1 79/2 81/3 80/4
f 80/4 81/3 83/5 82/6
f 82/6 83/5 85/7 84/8
f 84/8 85/7 87/9 86/10
f 86/10 87/9 89/11 88/12
f 88/12 89/11 91/13 90/14
f 90/14 91/13 93/15 92/16
f 92/16 93/15 95/17 94/18
f 99/78 98/79 113/80 112/81 111/82 110/83 109/84 108/85 107/86 106/87 105/88 104/89 103/90 102/91 101/92 100/93
f 83/94 81/95 99/78 100/93
f 89/96 87/97 102/91 103/90
f 79/98 97/99 113/80 98/79
f 81/95 79/98 98/79 99/78
f 95/100 93/101 105/88 106/87
f 85/102 83/94 100/93 101/92
f 91/103 89/96 103/90 104/89
f 96/104 95/100 106/87 107/86
f 87/97 85/102 101/92 102/91
f 93/101 91/103 104/89 105/88
o basket_Cube.001
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 0.500000 0.500000
v -0.437500 0.500000 0.437500
v -0.437500 0.500000 -0.437500
v 0.437500 0.500000 -0.437500
v 0.437500 0.500000 0.437500
v -0.437500 -0.437500 0.437500
v -0.437500 -0.437500 -0.437500
v 0.437500 -0.437500 -0.437500
v 0.437500 -0.437500 0.437500
vt 0.484848 0.984848
vt 0.015152 0.984848
vt 0.015152 0.515152
vt 0.484848 0.515152
vt 0.515152 0.984848
vt 0.515152 0.515152
vt 0.984848 0.515152
vt 0.984848 0.984848
vt 0.954545 0.545455
vt 0.545455 0.545455
vt 0.954545 0.954545
vt 0.545455 0.954545
g basket_Cube.001_basket
s off
f 118/105 119/106 115/107 114/108
f 119/105 120/106 116/107 115/108
f 120/105 121/106 117/107 116/108
f 121/105 118/106 114/107 117/108
f 114/109 115/110 116/111 117/112
f 118/110 121/111 125/113 122/114
f 121/111 120/112 124/115 125/113
f 120/112 119/109 123/116 124/115
f 119/109 118/110 122/114 123/116
f 122/105 125/106 129/107 126/108
f 125/105 124/106 128/107 129/108
f 124/105 123/106 127/107 128/108
f 123/105 122/106 126/107 127/108
f 126/114 129/113 128/115 127/116

View File

@ -0,0 +1,329 @@
# Blender v2.73 (sub 0) OBJ File: 'bush.blend'
# www.blender.org
o nodebox-4
v 0.467076 -0.122686 -0.190481
v -0.453590 -0.119789 -0.192145
v 0.420865 -0.181680 -0.171396
v -0.429008 -0.188000 -0.182314
v -0.450977 0.041977 -0.191409
v -0.271687 -0.294075 -0.114977
v -0.096925 -0.495759 -0.044091
v -0.070286 -0.344209 -0.030750
v -0.163971 -0.173437 -0.403793
v -0.188139 -0.116431 0.446425
v 0.069865 0.462329 0.170043
v -0.175980 -0.180649 0.417932
v -0.184276 0.039248 0.437271
v -0.121692 -0.319322 0.290049
v -0.039557 -0.495759 0.097032
v -0.029307 -0.346230 0.070496
v -0.440307 0.205163 -0.203598
v -0.440281 0.206327 0.191785
v -0.339366 0.327086 -0.144329
v -0.267923 0.418413 0.108270
v -0.264994 0.405691 -0.113216
v 0.173823 0.186657 0.424935
v -0.172109 0.470396 -0.073638
v -0.090743 0.491063 -0.039539
v -0.173625 0.180559 0.412022
v 0.108534 0.404586 0.263698
v -0.137870 0.317286 0.327397
v 0.149454 0.342906 0.361857
v -0.115069 0.426252 0.274637
v 0.116858 -0.311812 0.284557
v -0.074459 0.465500 0.178311
v -0.036397 0.486640 0.094150
v 0.044199 -0.495759 -0.101459
v 0.034559 -0.377127 -0.079219
v 0.116886 -0.299764 -0.276145
v -0.172864 0.462259 0.069984
v 0.173974 -0.178414 -0.411782
v 0.191827 0.042411 -0.453422
v 0.190055 -0.117435 -0.449613
v -0.136929 0.321997 -0.339476
v 0.101567 -0.495759 0.039664
v 0.076778 -0.365788 0.030191
v 0.292232 -0.320027 0.121743
v -0.067752 0.451498 -0.167691
v 0.433751 -0.189348 0.181586
v 0.457624 0.044950 0.184732
v 0.473778 -0.128221 0.198329
v -0.113891 -0.307852 -0.282552
v 0.081961 0.458662 -0.191580
v 0.042947 0.491063 -0.093885
v 0.109202 0.397842 -0.257691
v 0.145450 0.328672 -0.343352
v 0.191241 0.038411 0.444768
v -0.184306 0.045052 -0.456452
v -0.289997 -0.318897 0.117161
v 0.182461 0.185982 -0.431178
v 0.180190 0.469152 0.074510
v 0.097292 0.491063 0.039804
v 0.264954 0.412421 0.110505
v 0.355939 0.336100 0.148277
v -0.474575 0.042725 0.191924
v -0.169486 0.185035 -0.418844
v -0.445009 -0.118527 0.180804
v 0.427054 0.187979 0.172057
v 0.350926 0.339079 -0.143384
v 0.189060 -0.125023 0.462241
v 0.269270 -0.290650 -0.109472
v 0.175816 -0.186803 0.429367
v 0.259570 0.406980 -0.105942
v -0.103158 0.398344 -0.255462
v -0.339105 0.330270 0.137302
v -0.186029 -0.123369 -0.460126
v -0.418539 -0.180131 0.169838
v 0.041492 0.491063 0.094145
v 0.487251 0.041118 -0.191308
v 0.173059 0.459504 -0.070716
v 0.460259 0.206607 -0.196213
v 0.108065 0.487446 -0.045199
v -0.103423 0.491173 0.040772
v -0.040665 0.496765 -0.107957
v -0.070153 -0.343292 0.028053
v -0.028215 -0.347521 -0.072596
v 0.028031 -0.329368 0.067986
v 0.075170 -0.358957 -0.031186
v -0.037332 -0.495759 -0.099759
v 0.099867 -0.495759 -0.041867
v -0.095225 -0.495759 0.037440
v 0.041974 -0.495759 0.095332
v 0.001777 0.503796 -0.003546
v 0.002321 -0.495758 -0.002214
vt 0.875000 0.281250
vt 1.000000 0.281250
vt 1.000000 0.421875
vt 0.875000 0.421875
vt 0.375000 0.125000
vt 0.500000 0.125000
vt 0.500000 0.234375
vt 0.375000 0.234375
vt 0.625000 0.234375
vt 0.625000 0.281250
vt 0.500000 0.281250
vt 0.500000 0.609375
vt 0.500000 0.656250
vt 0.375000 0.656250
vt 0.375000 0.609375
vt 0.625000 0.421875
vt 0.500000 0.421875
vt 0.375000 0.281250
vt 0.375000 0.421875
vt 0.125000 0.609375
vt 0.125000 0.656250
vt 0.000000 0.656250
vt 0.000000 0.609375
vt 0.846670 0.983596
vt 0.823789 0.862038
vt 0.861831 0.862038
vt 0.500000 0.531250
vt 0.375000 0.531250
vt 0.234375 0.609375
vt 0.234375 0.531250
vt 0.875000 0.234375
vt 0.750000 0.234375
vt 0.750000 0.125000
vt 0.875000 0.125000
vt 0.125000 0.234375
vt 0.125000 0.125000
vt 0.234375 0.125000
vt 0.234375 0.234375
vt 0.125000 0.281250
vt 0.234375 0.281250
vt 0.234375 0.421875
vt 0.125000 0.421875
vt 0.125000 0.703125
vt 0.000000 0.703125
vt 0.875000 0.656250
vt 0.750000 0.656250
vt 0.750000 0.609375
vt 0.875000 0.609375
vt 0.625000 0.656250
vt 0.625000 0.609375
vt 0.234375 0.656250
vt 0.375000 0.703125
vt 0.234375 0.703125
vt 0.125000 0.531250
vt 0.875000 0.531250
vt 1.000000 0.531250
vt 1.000000 0.609375
vt 0.500000 0.703125
vt 0.000000 0.421875
vt 0.000000 0.531250
vt 0.875000 0.703125
vt 0.750000 0.703125
vt 0.328125 0.812500
vt 0.328125 0.875000
vt 0.265625 0.890625
vt 0.265625 0.781250
vt 0.750000 0.531250
vt 1.000000 0.234375
vt -0.000000 0.281250
vt 0.000000 0.234375
vt 0.375000 0.921875
vt 0.328125 0.984375
vt 0.562500 0.812500
vt 0.500000 0.828125
vt 0.625000 0.125000
vt 0.625000 0.531250
vt 0.970570 0.983596
vt 0.918853 0.862038
vt 0.983390 0.862038
vt 1.000000 0.703125
vt 1.000000 0.656250
vt 0.694849 0.983596
vt 0.653099 0.862038
vt 0.703461 0.862038
vt 0.453125 1.000000
vt 0.437500 0.937500
vt 0.546875 0.937500
vt 0.375000 0.765625
vt 0.625000 0.703125
vt 0.750000 0.281250
vt 0.000000 0.125000
vt 0.781059 0.974219
vt 0.740272 0.862038
vt 0.773590 0.862038
vt 0.823762 0.862067
vt 0.773656 0.862066
vt 0.800723 0.801332
vt 0.750000 0.421875
vt 1.000000 0.125000
vt 0.881508 0.980225
vt 0.923791 0.982865
vt 0.819499 0.959318
vt 0.634200 0.973424
vt 0.659430 0.971277
vt 0.724959 0.956989
vt 0.755822 0.968617
vt 0.125000 0.000000
vt 0.234375 0.000000
vt 0.375000 0.000000
vt 0.500000 0.000000
vt 0.750000 0.000000
vt 0.875000 0.000000
vt 1.000000 0.000000
vt 0.625000 0.000000
vt 0.000000 0.000000
vt 0.618713 0.862038
vt 0.453125 0.781250
vt 0.484375 0.890625
vt 0.406250 0.859375
vt 0.738525 0.828462
vt 0.741806 0.778103
vt 0.777683 0.740596
vt 0.827789 0.740597
vt 0.862920 0.774201
vt 0.859639 0.824560
s off
f 63/1 10/2 13/3 61/4
f 67/5 35/6 37/7 3/8
f 9/9 72/10 39/11 37/7
f 52/12 51/13 69/14 65/15
f 72/10 54/16 38/17 39/11
f 1/18 39/11 38/17 75/19
f 28/20 26/21 29/22 27/23
f 82/24 33/25 85/26
f 75/19 38/17 56/27 77/28
f 77/28 65/15 60/29 64/30
f 73/31 4/32 6/33 55/34
f 68/35 30/36 43/37 45/38
f 66/39 47/40 46/41 53/42
f 11/43 31/44 29/22 26/21
f 20/45 21/46 19/47 71/48
f 70/49 40/50 19/47 21/46
f 59/51 69/14 76/52 57/53
f 3/8 37/7 39/11 1/18
f 28/20 22/54 64/30 60/29
f 71/48 18/55 25/56 27/57
f 69/14 51/13 49/58 76/52
f 13/59 53/42 22/54 25/60
f 36/61 23/62 21/46 20/45
f 58/63 74/64 11/65 57/66
f 57/53 11/43 26/21 59/51
f 19/47 17/67 18/55 71/48
f 73/31 12/68 10/2 63/1
f 68/35 66/39 10/69 12/70
f 74/64 32/71 31/72 11/65
f 53/42 46/41 64/30 22/54
f 25/56 18/55 61/4 13/3
f 49/58 44/73 80/74
f 45/38 3/8 1/18 47/40
f 9/9 48/75 6/33 4/32
f 62/76 40/50 52/12 56/27
f 81/77 7/78 87/79
f 31/80 36/61 20/45 29/81
f 83/82 15/83 88/84
f 36/85 79/86 23/87
f 78/88 58/63 57/66
f 17/67 19/47 40/50 62/76
f 45/38 47/40 66/39 68/35
f 51/13 70/49 44/89 49/58
f 4/32 73/31 63/1 2/90
f 12/70 14/91 30/36 68/35
f 84/92 41/93 86/94
f 33/95 86/96 90/97
f 70/49 21/46 23/62 44/89
f 54/16 62/76 56/27 38/17
f 29/81 20/45 71/48 27/57
f 37/7 35/6 48/75 9/9
f 5/98 17/67 62/76 54/16
f 18/55 17/67 5/98 61/4
f 10/69 66/39 53/42 13/59
f 12/68 73/31 55/34 14/99
f 51/13 52/12 40/50 70/49
f 27/23 25/60 22/54 28/20
f 65/15 69/14 59/51 60/29
f 56/27 52/12 65/15 77/28
f 46/41 75/19 77/28 64/30
f 60/29 59/51 26/21 28/20
f 47/40 1/18 75/19 46/41
f 2/90 5/98 54/16 72/10
f 4/32 2/90 72/10 9/9
f 43/37 67/5 3/8 45/38
f 2/90 63/1 61/4 5/98
f 82/100 7/78 8/101
f 82/24 34/102 33/25
f 81/103 15/83 16/104
f 81/77 8/101 7/78
f 83/82 41/93 42/105
f 83/82 16/104 15/83
f 84/92 33/25 34/102
f 84/92 42/106 41/93
f 30/36 83/107 42/108 43/37
f 42/108 84/109 67/5 43/37
f 67/5 84/109 34/110 35/6
f 55/34 6/33 8/111 81/112
f 55/34 81/112 16/113 14/99
f 34/110 82/114 48/75 35/6
f 48/75 82/114 8/111 6/33
f 30/36 14/91 16/115 83/107
f 7/78 82/100 85/26
f 15/83 81/103 87/116
f 41/93 83/82 88/84
f 33/25 84/92 86/94
f 80/74 50/117 49/58
f 23/87 24/118 80/74
f 80/74 44/73 23/87
f 79/86 36/85 31/72
f 79/86 24/118 23/87
f 31/72 32/71 79/86
f 78/88 49/58 50/117
f 78/88 57/66 76/52
f 76/52 49/58 78/88
f 24/118 79/86 89/119
f 79/86 32/71 89/119
f 32/71 74/64 89/119
f 74/64 58/63 89/119
f 58/63 78/88 89/119
f 78/88 50/117 89/119
f 50/117 80/74 89/119
f 80/74 24/118 89/119
f 86/96 41/120 90/97
f 41/120 88/121 90/97
f 88/121 15/122 90/97
f 15/122 87/123 90/97
f 87/123 7/124 90/97
f 7/124 85/125 90/97
f 85/125 33/95 90/97

View File

@ -0,0 +1,214 @@
local S = plantslib.intllib
plantlife_bushes = {}
-- TODO: add support for nodebreakers? those dig like mese picks
plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not (digger and pos and oldnode) then
return
end
-- find out which bush type we are dealing with
local bush_name = ""
local can_harvest = false
if oldnode.name == "bushes:fruitless_bush" then
-- this bush has not grown fruits yet (but will eventually)
bush_name = oldmetadata.fields.bush_type
-- no fruits to be found, so can_harvest stays false
else
local name_parts = oldnode.name:split(":")
if #name_parts >= 2 and name_parts[2] ~= nil then
name_parts = name_parts[2]:split("_")
if #name_parts >= 2 and name_parts[1] ~= nil then
bush_name = name_parts[1]
-- this bush really carries fruits
can_harvest = true
end
end
end
-- find out which tool the digger was wielding (if any)
local toolstack = digger:get_wielded_item()
local capabilities = toolstack:get_tool_capabilities()
-- what the player will get
local harvested
-- failure to find out what the tool can do: destroy the bush and return nothing
local groupcaps = capabilities.groupcaps
if not groupcaps then
return
-- digging with the hand or something like that
elseif groupcaps.snappy then
-- plant a new bush without fruits
minetest.set_node(pos, {type = "node", name = "bushes:fruitless_bush"})
local meta = minetest.get_meta(pos)
meta:set_string('bush_type', bush_name)
-- construct the stack of fruits the player will get
-- only bushes that have grown fruits can actually give fruits
if can_harvest then
local amount = "4"
harvested = "bushes:" .. bush_name .. " " .. amount
end
-- something like a shovel
elseif groupcaps.crumbly then
-- with a chance of 1/3, return 2 bushes
local amount
if math.random(1,3) == 1 then
amount = "2"
else
amount = "1"
end
-- return the bush itself
harvested = "bushes:" .. bush_name .. "_bush "..amount
-- something like an axe
elseif groupcaps.choppy then
-- the amount of sticks may vary
local amount = math.random(4, 20)
-- return some sticks
harvested = "default:stick " .. amount
-- nothing known - destroy the plant
else
return
end
-- give the harvested result to the player
if harvested then
--minetest.chat_send_player("singleplayer","you would now get "..tostring( harvested ) );
local itemstack = ItemStack(harvested)
local inventory = digger:get_inventory()
if inventory:room_for_item("main", itemstack) then
inventory:add_item("main", itemstack)
else
minetest.item_drop(itemstack, digger, pos)
end
end
end
plantlife_bushes.after_place_node = function(pos, placer, itemstack)
if not (itemstack and pos) then
return
end
local name_parts = itemstack:get_name():split(":")
if #name_parts < 2 or name_parts[2] == nil then
return
end
name_parts = name_parts[2]:split("_")
if #name_parts < 2 or name_parts[1] == nil then
return
end
minetest.set_node(pos, {name = "bushes:fruitless_bush"})
local meta = minetest.get_meta(pos)
meta:set_string("bush_type", name_parts[1])
end
-- regrow berries (uses a base abm instead of plants_lib because of the use of metadata).
minetest.register_abm({
nodenames = {"bushes:fruitless_bush"},
neighbors = {"group:soil", "group:potting_soil"},
interval = 500,
chance = 5,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
local bush_name = meta:get_string("bush_type")
if bush_name and bush_name ~= "" then
local dirtpos = {x = pos.x, y = pos.y-1, z = pos.z}
local dirt = minetest.get_node(dirtpos)
local is_soil = minetest.get_item_group(dirt.name, "soil") or minetest.get_item_group(dirt.name, "potting_soil")
if is_soil and (dirt.name == "farming:soil_wet" or math.random(1,3) == 1) then
minetest.set_node( pos, {name = "bushes:" .. bush_name .. "_bush"})
end
end
end
})
-- Define the basket and bush nodes
for i, bush_name in ipairs(bushes_classic.bushes) do
local desc = bushes_classic.bushes_descriptions[i]
minetest.register_node(":bushes:basket_"..bush_name, {
description = S("Basket with "..desc.." Pies"),
drawtype = "mesh",
mesh = "bushes_basket_full.obj",
tiles = {
"bushes_basket_pie_"..bush_name..".png",
"bushes_basket.png"
},
paramtype = "light",
paramtype2 = "facedir",
on_use = minetest.item_eat(18),
groups = { dig_immediate = 3 },
})
local texture_top, texture_bottom
local groups = {snappy = 3, bush = 1, flammable = 2, attached_node=1}
if bush_name == "mixed_berry" then
bush_name = "fruitless";
desc = S("currently fruitless");
texture_top = "bushes_fruitless_bush_top.png"
texture_bottom = "bushes_fruitless_bush_bottom.png"
groups.not_in_creative_inventory = 1
else
texture_top = "bushes_bush_top.png"
texture_bottom = "bushes_bush_bottom.png"
end
minetest.register_node(":bushes:" .. bush_name .. "_bush", {
description = S(desc.." Bush"),
drawtype = "mesh",
mesh = "bushes_bush.obj",
tiles = {"bushes_bush_"..bush_name..".png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = groups,
sounds = default.node_sound_leaves_defaults(),
drop = "",
after_dig_node = function( pos, oldnode, oldmetadata, digger )
return plantlife_bushes.after_dig_node(pos, oldnode, oldmetadata, digger);
end,
after_place_node = function( pos, placer, itemstack )
return plantlife_bushes.after_place_node(pos, placer, itemstack);
end,
})
-- do not spawn fruitless bushes
if bush_name ~= "fruitless" then
table.insert(bushes_classic.spawn_list, "bushes:"..bush_name.."_bush")
end
end
minetest.register_node(":bushes:basket_empty", {
description = S("Basket"),
drawtype = "mesh",
mesh = "bushes_basket_empty.obj",
tiles = { "bushes_basket.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = { dig_immediate = 3 },
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Some files were not shown because too many files have changed in this diff Show More