added grass.

master
NathanSalapat 2019-05-03 09:07:21 -05:00
parent a9d1cab629
commit 40f17d3679
17 changed files with 188 additions and 14 deletions

View File

@ -1,3 +1,6 @@
2019-05-03:
Added grass.
2017-05-29:
Added a chest and did some updates to the players inventory and formspecs.

View File

@ -1 +1 @@
name = new subgame
name = new-subgame

View File

@ -1,11 +1,11 @@
common.colbox_stair = {
common.colbox_stair = { --Stairs nodebox
type = 'fixed',
fixed = {
{-.5, -.5, -.5, .5, 0, .5},
{-.5, 0, 0, .5, .5, .5},
}}
common.colbox_1_5_slab = {
common.colbox_1_5_slab = { --1/5th height slab
type = 'fixed',
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.3, 0.5},

View File

@ -56,9 +56,9 @@ minetest.register_biome({
minetest.register_biome({
name = "grassland_dunes",
--node_dust = "",
node_top = "ground:sand",
node_top = "ground:dirt_with_grass",
depth_top = 1,
node_filler = "ground:sand",
node_filler = "ground:dirt_with_grass",
depth_filler = 2,
--node_stone = "",
--node_water_top = "",
@ -99,11 +99,11 @@ minetest.register_biome({
depth_top = 1,
node_filler = 'ground:dirt',
depth_filler = 4,
node_stone = 'ground:desert_stone',
node_stone = 'ground:stone',
node_riverbed = 'ground:sand',
depth_riverbed = 1,
y_min = 12,
y_max = 60,
y_max = 20,
heat_point = 10,
humidity_point = 47,
})
@ -116,8 +116,24 @@ minetest.register_biome({
depth_filler = 10,
node_riverbed = 'ground:dirt',
depth_riverbed = 2,
vertical_blend = 3,
y_min = -5,
y_max = 15,
y_max = 5,
heat_point = 65,
humidity_point = 70,
})
minetest.register_biome({
name = 'stone',
node_top = 'ground:stone',
depth_top = 1,
node_filler = 'ground:stone',
depth_filler = 4,
node_stone = 'ground:stone',
node_riverbed = 'ground:stone',
depth_riverbed = 1,
y_min = 20,
y_max = 80,
heat_point = 10,
humidity_point = 47,
})

View File

@ -19,3 +19,28 @@ minetest.register_ore({
y_min = -31000,
y_max = -50,
})
minetest.register_ore({
ore_type = 'stratum',
ore = 'ground:dirt',
wherein = 'ground:stone',
clust_scarcity = 1,
y_min = 25,
y_max = 30,
noise_params = {
offset = 27,
scale = 4,
spread = {x = 100, y = 100, z = 100},
seed = 90122,
octaves = 3,
persist = 0.7
},
np_stratum_thickness = {
offset = 8,
scale = 4,
spread = {x = 100, y = 100, z = 100},
seed = 17,
octaves = 3,
persist = 0.7
},
})

62
mods/plants/grasses.lua Normal file
View File

@ -0,0 +1,62 @@
minetest.register_node('plants:grass_1', {
description = 'grass',
tiles = {'plants_grass_1.png'},
drawtype = 'plantlike',
inventory_image = "plants_grass_4.png",
wield_image = "plants_grass_4.png",
groups = {flora=1, grass=1, oddly_breakable_by_hand=1, attached_node=1},
drop = 'plants:grass_1',
waving = 1,
walkable = false,
sunlight_propagates = true,
buildable_to = true,
paramtype = 'light',
selection_box = plants.grass_sel,
on_place = function(itemstack, placer, pointed_thing)
local stack = ItemStack('plants:grass_' .. math.random(1,4))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack('plants:grass_1 '.. itemstack:get_count() - (1 - ret:get_count()))
end
})
minetest.register_node('plants:grass_2', {
description = 'grass',
tiles = {'plants_grass_2.png'},
drawtype = 'plantlike',
groups = {flora=1, grass=1, oddly_breakable_by_hand=1, attached_node=1},
drop = 'plants:grass_1',
waving = 1,
walkable = false,
sunlight_propagates = true,
buildable_to = true,
paramtype = 'light',
selection_box = plants.grass_sel,
})
minetest.register_node('plants:grass_3', {
description = 'grass',
tiles = {'plants_grass_3.png'},
drawtype = 'plantlike',
groups = {flora=1, grass=1, oddly_breakable_by_hand=1, attached_node=1},
drop = 'plants:grass_1',
waving = 1,
walkable = false,
sunlight_propagates = true,
buildable_to = true,
paramtype = 'light',
selection_box = plants.grass_sel,
})
minetest.register_node('plants:grass_4', {
description = 'grass',
tiles = {'plants_grass_4.png'},
drawtype = 'plantlike',
groups = {flora=1, grass=1, oddly_breakable_by_hand=1, attached_node=1},
drop = 'plants:grass_1',
waving = 1,
walkable = false,
sunlight_propagates = true,
buildable_to = true,
paramtype = 'light',
selection_box = plants.grass_sel,
})

5
mods/plants/init.lua Normal file
View File

@ -0,0 +1,5 @@
plants = {}
plants.grass_sel = {type = 'fixed',
fixed = {{-0.4, -0.5, -0.4, 0.4, -0.3, 0.4},}}
dofile(minetest.get_modpath('plants')..'/grasses.lua')

4
mods/plants/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = plants
depends = common
description = All sorts of plants.
author = Nathan

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

View File

@ -14,7 +14,7 @@ minetest.register_node('storage:wooden_chest', {
meta:set_string('formspec', wooden_chest_formspec)
meta:set_string('upgrade', 0)
local inv = meta:get_inventory()
inv:set_size('main', 6*3)
inv:set_size('main', 18)
inv:set_size('sort_upgrade', 1)
inv:set_size('label_upgrade', 1)
end,
@ -25,13 +25,14 @@ minetest.register_node('storage:wooden_chest', {
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == 'sort_upgrade' then
if stack:get_name() == ('ground:dirt') then
if inv:is_empty('sort_upgrade') and stack:get_name() == 'ground:dirt' then
return 1
else return 0
end
elseif listname == 'label_upgrade' then
if stack:get_name() == ('items:label') then
if inv:is_empty('label_upgrade') and stack:get_name() == 'items:label' then
return 1
else return 0
end
@ -45,6 +46,7 @@ minetest.register_node('storage:wooden_chest', {
if stack:get_name() == ('ground:dirt') then --Needs changing to something more suitable
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val + 1
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
@ -53,6 +55,7 @@ minetest.register_node('storage:wooden_chest', {
if stack:get_name() == ('items:label') then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val + 2
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
@ -64,20 +67,75 @@ minetest.register_node('storage:wooden_chest', {
if stack:get_name() == ('ground:dirt') then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val - 1
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
end
if listname == 'label_upgrade' then
elseif listname == 'label_upgrade' then
if stack:get_name() == ('items:label') then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val - 2
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('infotext', '')
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
end
end,
allow_metadata_inventory_move = function (pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == 'sort_upgrade' then
if inv:is_empty('sort_upgrade') and stack:get_name() == ('ground:dirt') then
return 1
else return 0
end
elseif to_list == 'label_upgrade' then
if inv:is_empty('label_upgrade') and stack:get_name() == ('items:label') then
return 1
else return 0
end
else
return 99
end
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if from_list == 'sort_upgrade' then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val - 1
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
elseif from_list == 'label_upgrade' then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val - 2
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
if to_list == 'sort_upgrade' then
local stack = inv:get_stack(to_list, to_index)
if stack:get_name() == ('ground:dirt') then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val + 1
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
elseif to_list == 'label_upgrade' then
local stack = inv:get_stack(to_list, to_index)
if stack:get_name() == ('items:label') then
local upgrade_val = tonumber(meta:get_string('upgrade'))
local upgrade_new = upgrade_val + 2
print ('upgrade value '..upgrade_new)
meta:set_string('upgrade', upgrade_new)
meta:set_string('formspec', storage.wooden_chest_formspec(pos))
end
end
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
if fields ['save'] then

View File

@ -4,6 +4,7 @@ wooden_chest_formspec =
common.gui_bg_img..
common.gui_slots..
'label[.5,.25;Upgrades]'..
'image[2,0;1,1;storage_label_outline.png]'..
'list[current_name;label_upgrade;2,0;1,1]'..
'list[current_name;sort_upgrade;3,0;1,1]'..
'list[current_name;main;1,1;6,3;]'..

View File

@ -15,13 +15,13 @@ function storage.wooden_chest_formspec(pos, name)
common.gui_bg_img..
common.gui_slots..
'label[.5,.25;Upgrades]'..
'image[2,0;1,1;storage_label_outline.png]'..
'list[current_name;label_upgrade;2,0;1,1]'..
'list[current_name;sort_upgrade;3,0;1,1]'..
'list[current_name;main;1,1;6,3;]'..
'list[current_player;main;0,5;8,3;]'..
'listring[]'
local meta = minetest.get_meta(pos)
local upgrade_tier = tonumber(meta:get_string('upgrade'))
if upgrade_tier == 0 then
local formspec =

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B