Tweaked code slightly

This commit is contained in:
TenPlus1 2016-06-04 15:00:53 +01:00
parent cbf7bee93a
commit 38b4111878
2 changed files with 37 additions and 34 deletions

View File

@ -114,3 +114,10 @@ crop_def.drop = {
} }
} }
minetest.register_node("farming:cotton_8", table.copy(crop_def)) minetest.register_node("farming:cotton_8", table.copy(crop_def))
--[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
})]]

View File

@ -1,5 +1,5 @@
--[[ --[[
Minetest Farming Redo Mod 1.22 (30th May 2016) Minetest Farming Redo Mod 1.22 (4th June 2016)
by TenPlus1 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
auto-refill by crabman77 auto-refill by crabman77
@ -50,6 +50,7 @@ end
local statistics = dofile(farming.path.."/statistics.lua") local statistics = dofile(farming.path.."/statistics.lua")
-- Intllib -- Intllib
local S local S
if minetest.get_modpath("intllib") then if minetest.get_modpath("intllib") then
S = intllib.Getter() S = intllib.Getter()
@ -58,31 +59,6 @@ else
end end
farming.intllib = S farming.intllib = S
dofile(farming.path.."/soil.lua")
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/wheat.lua")
dofile(farming.path.."/cotton.lua")
dofile(farming.path.."/carrot.lua")
dofile(farming.path.."/potato.lua")
dofile(farming.path.."/tomato.lua")
dofile(farming.path.."/cucumber.lua")
dofile(farming.path.."/corn.lua")
dofile(farming.path.."/coffee.lua")
dofile(farming.path.."/melon.lua")
dofile(farming.path.."/sugar.lua")
dofile(farming.path.."/pumpkin.lua")
dofile(farming.path.."/cocoa.lua")
dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")
dofile(farming.path.."/grapes.lua")
dofile(farming.path.."/barley.lua")
dofile(farming.path.."/donut.lua")
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
-- Utility Functions -- Utility Functions
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 local time_speed = tonumber(minetest.setting_get("time_speed")) or 72
@ -673,7 +649,7 @@ farming.register_plant = function(name, def)
-- Last step doesn't need growing=1 so Abm never has to check these -- Last step doesn't need growing=1 so Abm never has to check these
if i == def.steps then if i == def.steps then
g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} g.growing = 0
end end
local node_name = mname .. ":" .. pname .. "_" .. i local node_name = mname .. ":" .. pname .. "_" .. i
@ -691,7 +667,7 @@ farming.register_plant = function(name, def)
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
register_plant_node(node_name) -- register_plant_node(node_name)
end end
-- Return info -- Return info
@ -699,9 +675,29 @@ farming.register_plant = function(name, def)
return r return r
end end
--[[ Cotton (example, is already registered in cotton.lua) -- load crops
farming.register_plant("farming:cotton", {
description = "Cotton2 seed", dofile(farming.path.."/soil.lua")
inventory_image = "farming_cotton_seed.png", dofile(farming.path.."/hoes.lua")
steps = 8, dofile(farming.path.."/grass.lua")
})]] dofile(farming.path.."/wheat.lua")
dofile(farming.path.."/cotton.lua")
dofile(farming.path.."/carrot.lua")
dofile(farming.path.."/potato.lua")
dofile(farming.path.."/tomato.lua")
dofile(farming.path.."/cucumber.lua")
dofile(farming.path.."/corn.lua")
dofile(farming.path.."/coffee.lua")
dofile(farming.path.."/melon.lua")
dofile(farming.path.."/sugar.lua")
dofile(farming.path.."/pumpkin.lua")
dofile(farming.path.."/cocoa.lua")
dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")
dofile(farming.path.."/grapes.lua")
dofile(farming.path.."/barley.lua")
dofile(farming.path.."/donut.lua")
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility