1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 06:11:47 +02:00

initial commit

subgame + mods
This commit is contained in:
Ombridride
2014-10-28 18:01:32 +01:00
parent baab1b3f7c
commit 232b274c55
6451 changed files with 226156 additions and 0 deletions

View File

@ -0,0 +1,126 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
-- 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,64 @@
-- Bushes classic mod originally by unknown
-- now maintained by VanessaE
--
-- License: WTFPL
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
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 =
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,228 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
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 ) or not( pos ) or not (oldnode )) then
return nil;
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 = "";
local amount = "";
-- failure to find out what the tool can do: destroy the bush and return nothing
if( not( capabilities["groupcaps"] )) then
return nil;
-- digging with the hand or something like that
elseif( capabilities["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 == true ) then
amount = "4";
harvested = "bushes:"..bush_name.." "..amount;
end
-- something like a shovel
elseif( capabilities["groupcaps"]["crumbly"] ) then
-- with a chance of 1/3, return 2 bushes
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( capabilities["groupcaps"]["choppy"] ) then
-- the amount of sticks may vary
amount = math.random( 4, 20 );
-- return some sticks
harvested = "default:stick "..amount;
-- nothing known - destroy the plant
else
return nil;
end
-- give the harvested result to the player
if( harvested ~= "" ) then
--minetest.chat_send_player("singleplayer","you would now get "..tostring( harvested ) );
digger:get_inventory():add_item( "main", harvested );
end
end
plantlife_bushes.after_place_node = function(pos, placer, itemstack)
if( not( itemstack ) or not( pos )) then
return nil;
end
local name_parts = itemstack:get_name():split( ":" );
if( #name_parts <2 or name_parts[2]==nil ) then
return nil;
end
name_parts = name_parts[2]:split( "_" );
if( #name_parts <2 or name_parts[1]==nil ) then
return nil;
end
minetest.set_node( pos, {type='node',name='bushes:fruitless_bush'});
local meta = minetest.get_meta( pos );
meta:set_string( 'bush_type', name_parts[1] );
return nil;
end
-- regrow berries (uses a base abm instead of plants_lib because of the use of metadata).
minetest.register_abm({
nodenames = { "bushes:fruitless_bush" },
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 ~= nil and bush_name ~= '' ) then
local dirtpos = { x = pos.x, y = pos.y-1, z = pos.z }
local dirt = minetest.get_node(dirtpos)
if dirt.name == "farming:soil_wet" or math.random(1,3) == 1 then
minetest.set_node( pos, {type='node',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"),
tiles = {
"bushes_basket_"..bush_name.."_top.png",
"bushes_basket_bottom.png",
"bushes_basket_side.png"
},
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 = "nodebox",
tiles = {texture_top, texture_bottom, "bushes_" .. bush_name .. "_bush.png"},
inventory_image = "bushes_" .. bush_name .. "_bush.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-1/16, -8/16, -1/16, 1/16, -6/16, 1/16},
{-4/16, -6/16, -4/16, 4/16, 5/16, 4/16},
{-5/16, -5/16, -5/16, 5/16, 3/16, 5/16},
{-6/16, -4/16, -6/16, 6/16, 2/16, 6/16},
{-6.5/16, -3/16, -6.5/16, 6.5/16, -2/16, 6.5/16},
{-3/16, 5/16, -3/16, 3/16, 6/16, 3/16},
{-2/16, 5/16, -2/16, 2/16, 7/16, 2/16}
}
},
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"),
tiles = {
"bushes_basket_empty_top.png",
"bushes_basket_bottom.png",
"bushes_basket_side.png"
},
groups = { dig_immediate = 3 },
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB