api.lua 474 B

1234567891011121314151617181920
  1. farming.add_soil=function(soil2add)
  2. table.insert(farming.change_soil,soil2add)
  3. end
  4. function farming.register_on_harvest(spec)
  5. -- Add function
  6. if #farming.registered_on_harvest == 0 then
  7. farming.registered_on_harvest=spec
  8. else
  9. table.insert(farming.registered_on_harvest,1,spec)
  10. end
  11. end
  12. function farming.on_harvest(pos,node,digger)
  13. for _, func in ipairs(farming.registered_on_harvest) do
  14. itemstack = func(pos,node,digger) or itemstack
  15. end
  16. return itemstack
  17. end