5 Commits 5d223192e8 ... 18c3ef5536

Autore SHA1 Messaggio Data
  alauer 18c3ef5536 Merge https://notabug.org/BlueBird51/musttest_game into onion 4 anni fa
  alauer 310fd12a0d add onions to mapgen 4 anni fa
  BluebirdGreycoat 98f9087755 Allow to put onions in the flowerpot 4 anni fa
  BlueBird51 5102a7dc52 Merge branch 'onion' of alauer/musttest_game into master 4 anni fa
  alauer 0feb3f452c onions 4 anni fa

+ 5 - 0
mods/flowerpot/init.lua

@@ -351,6 +351,11 @@ if not flowerpot.loaded then
 		"potatoes:potato_2",
 		"potatoes:potato_3",
 		"potatoes:potato_4",
+
+		"onions:allium_sprouts_1",
+		"onions:allium_sprouts_2",
+		"onions:allium_sprouts_3",
+		"onions:allium_sprouts_4",
 	}) do
 		flowerpot.register_node(node)
 	end

+ 8 - 7
mods/mapgen/grass.lua

@@ -18,16 +18,17 @@ local find_surface = function(xz, b, t)
 end
 
 local plants = {
-  "default:junglegrass",
+	"default:junglegrass",
 	"default:coarsegrass",
 	"default:dry_grass_5",
-  "default:grass_5",
-  "pumpkin:plant_8",
-  "tomato:plant_7",
-  "carrot:plant_8",
-  "blueberries:plant_4",
-  "raspberries:plant_4",
+	"default:grass_5",
+	"pumpkin:plant_8",
+	"tomato:plant_7",
+	"carrot:plant_8",
+	"blueberries:plant_4",
+	"raspberries:plant_4",
 	"potatoes:potato_4",
+	"onions:allium_sprouts_4",
 	"cucumber:cucumber_4",
 }
 

+ 5 - 0
mods/onions/depends.txt

@@ -0,0 +1,5 @@
+default
+farming
+craft_register
+coresounds
+utility

+ 114 - 0
mods/onions/init.lua

@@ -0,0 +1,114 @@
+
+--[[
+	Original textures from DocFarming mod
+	https://forum.minetest.net/viewtopic.php?id=3948
+]]
+
+local S = function(s)
+	return s
+end
+
+minetest.register_node("onions:seed", {
+  description = "Allium Seeds",
+  tiles = {"allium_seeds.png"},
+  wield_image = "allium_seeds.png",
+  inventory_image = "allium_seeds.png",
+  drawtype = "signlike",
+  paramtype = "light",
+  paramtype2 = "wallmounted",
+  walkable = false,
+  sunlight_propagates = true,
+  selection_box = {
+    type = "fixed",
+    fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
+  },
+  groups = utility.dig_groups("seeds", {seed = 1, attached_node = 1, flammable = 2, notify_destruct = 1}),
+  on_place = function(itemstack, placer, pointed_thing)
+    return farming.place_seed(itemstack, placer, pointed_thing, "onions:seed")
+  end,
+  on_timer = farming.grow_plant,
+  minlight = 13,
+  maxlight = 15,
+  next_plant = "onions:allium_sprouts_1",
+  fertility = {"grassland"},
+  sounds = default.node_sound_dirt_defaults({
+    dug = {name = "default_grass_footstep", gain = 0.2},
+    place = {name = "default_place_node", gain = 0.25},
+  }),
+})
+
+
+
+-- onion 
+minetest.register_craftitem("onions:onion", {
+	description = S("Wild Onion"),
+	inventory_image = "wild_onion.png",
+	on_use = minetest.item_eat(1),
+	groups = {foodrot=1},
+	flowerpot_insert = {
+		"onions:allium_sprouts_1",
+		"onions:allium_sprouts_2",
+		"onions:allium_sprouts_3",
+		"onions:allium_sprouts_4",
+	},
+})
+
+-- onion definition
+local crop_def = {
+	drawtype = "plantlike",
+	tiles = {"allium_sprouts1.png"},
+	paramtype = "light",
+	sunlight_propagates = true,
+	waving = 1,
+	walkable = false,
+	buildable_to = true,
+	drop = "",
+	selection_box = {
+		type = "fixed",
+		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
+	},
+	groups = utility.dig_groups("crop", {
+		flammable = 2, plant = 1, attached_node = 1,
+		not_in_creative_inventory = 1, growing = 1, notify_destruct = 1,
+	}),
+	sounds = default.node_sound_leaves_defaults(),
+  on_timer = farming.grow_plant,
+  minlight = 13,
+  maxlight = default.LIGHT_MAX,
+	movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
+	flowerpot_drop = "onions:onion",
+}
+
+-- stage 1
+crop_def.next_plant = "onions:allium_sprouts_2"
+minetest.register_node("onions:allium_sprouts_1", table.copy(crop_def))
+
+-- stage 2
+crop_def.next_plant = "onions:allium_sprouts_3"
+crop_def.tiles = {"allium_sprouts2.png"}
+minetest.register_node("onions:allium_sprouts_2", table.copy(crop_def))
+
+-- stage 3
+crop_def.next_plant = "onions:allium_sprouts_4"
+crop_def.tiles = {"allium_sprouts3.png"}
+crop_def.drop = {
+	items = {
+		{items = {'onions:onion'}, rarity = 1},
+		{items = {'onions:onion'}, rarity = 3},
+	}
+}
+minetest.register_node("onions:allium_sprouts_3", table.copy(crop_def))
+
+-- stage 4
+crop_def.next_plant = nil
+crop_def.tiles = {"allium_sprouts4.png"}
+crop_def.groups.growing = 0
+crop_def.drop = {
+	items = {
+		{items = {'onions:onion'}, rarity = 1},
+		{items = {'onions:onion 3'}, rarity = 3},
+		{items = {'onions:seed'}, rarity = 1},
+		{items = {'onions:seed'}, rarity = 2},
+	}
+}
+minetest.register_node("onions:allium_sprouts_4", table.copy(crop_def))

BIN
mods/onions/textures/allium_seeds.png


BIN
mods/onions/textures/allium_sprouts1.png


BIN
mods/onions/textures/allium_sprouts2.png


BIN
mods/onions/textures/allium_sprouts3.png


BIN
mods/onions/textures/allium_sprouts4.png


+ 0 - 0
mods/onions/textures/wild_onion.png


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